/* Layout: one reading column; on a plan, a sticky progress bar keeps the result count and Copy button in reach. The look follows Mandrel.js's game client: near-black gunmetal, monospace HUD text, hard edges, and a rust-orange accent from mid-90s shooters. */
:root {
  --bg: #e8e8ec;
  --surface: #f6f6f8;
  --surface-2: #dcdce2;
  --fg: #16161a;
  --muted: #52525c;
  --line: #c6c6ce;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --link: #a3360a;
  --pass: #1f7a3d;
  --pass-bg: #d8eedd;
  --fail: #b42318;
  --fail-bg: #f7dcd8;
  --blocked: #8a5a00;
  --blocked-bg: #f3e6c4;
  --skip: #52525c;
  --skip-bg: #dcdce2;
  --font-display: "Chakra Petch", "Segoe UI", Roboto, sans-serif;
  --font-body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 3px;
  color-scheme: light;
}
/* Dark values appear twice: once for "System" on a dark device (unless the
   viewer picked Light), once for an explicit Dark choice. Keep them identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101014;
    --surface: #18181e;
    --surface-2: #22222a;
    --fg: #e8e8ec;
    --muted: #9d9da8;
    --line: #2e2e38;
    --accent: #ff7a1a;
    --accent-ink: #160c02;
    --link: #ff9d57;
    --pass: #5fd38a;
    --pass-bg: #10261a;
    --fail: #ff6b5b;
    --fail-bg: #2e1210;
    --blocked: #f2b84b;
    --blocked-bg: #2b2110;
    --skip: #9d9da8;
    --skip-bg: #22222a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101014;
  --surface: #18181e;
  --surface-2: #22222a;
  --fg: #e8e8ec;
  --muted: #9d9da8;
  --line: #2e2e38;
  --accent: #ff7a1a;
  --accent-ink: #160c02;
  --link: #ff9d57;
  --pass: #5fd38a;
  --pass-bg: #10261a;
  --fail: #ff6b5b;
  --fail-bg: #2e1210;
  --blocked: #f2b84b;
  --blocked-bg: #2b2110;
  --skip: #9d9da8;
  --skip-bg: #22222a;
  color-scheme: dark;
}

.theme-row {
  max-width: 760px;
  margin: 0 auto;
  padding-inline: 16px;
  padding-block: 12px 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.theme-row select {
  font: inherit;
  text-transform: none;
  letter-spacing: 0;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 8px;
}
.theme-row select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  border-top: 3px solid var(--accent);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
[hidden] {
  display: none !important;
}
.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding-inline: 16px;
  padding-block: 28px 64px;
  display: grid;
  gap: 28px;
}
a {
  color: var(--link);
  text-underline-offset: 2px;
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.05em 0.35em;
  overflow-wrap: anywhere;
}
pre {
  margin: 0;
  overflow-x: auto;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 10px 12px;
}
pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 0.86em;
}
h1,
h2,
h3 {
  text-wrap: balance;
  margin: 0;
}
p {
  margin: 0;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Header */
header {
  display: grid;
  gap: 12px;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow a {
  color: inherit;
}
header h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(28px, 5.5vw, 40px);
  line-height: 1.1;
  letter-spacing: 0.01em;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}
.meta span {
  min-width: 0;
}
.summary {
  font-size: 16px;
  max-width: 65ch;
}
.intro {
  color: var(--muted);
  max-width: 65ch;
}

/* Sticky progress bar */
.bar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.bar-inner {
  max-width: 760px;
  margin: 0 auto;
  padding-inline: 16px;
  padding-block: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}
.progress {
  flex: 1 1 240px;
  min-width: 0;
  display: grid;
  gap: 6px;
}
.progress-label {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.progress-label strong {
  font-weight: 700;
}
.meter {
  display: flex;
  height: 8px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.meter span {
  display: block;
  height: 100%;
}
.meter .m-pass {
  background: var(--pass);
}
.meter .m-fail {
  background: var(--fail);
}
.meter .m-blocked {
  background: var(--blocked);
}
.meter .m-skip {
  background: var(--skip);
}
.bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.toast {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  flex-basis: 100%;
}
.toast:empty {
  display: none;
}

button {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: var(--radius);
  padding: 7px 14px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
}
button:hover {
  border-color: var(--muted);
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
button.primary:hover {
  filter: brightness(1.08);
}
button.danger[data-armed="true"] {
  background: var(--fail-bg);
  border-color: var(--fail);
  color: var(--fail);
}
.link-button {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--radius);
  padding: 9px 16px;
}

.notice {
  border: 1px solid var(--blocked);
  border-left-width: 4px;
  background: var(--blocked-bg);
  color: var(--fg);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
}
.problem {
  display: grid;
  gap: 12px;
}
.problem h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
}
.problem ul {
  margin: 0;
  padding-left: 1.2em;
  font-family: var(--font-mono);
  font-size: 13px;
}

details.history {
  font-size: 14px;
}
details.history summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
}
details.history ul {
  margin: 8px 0 0;
  padding-left: 1.2em;
  display: grid;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}

/* Sections */
section {
  display: grid;
  gap: 14px;
}
section > h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}
/* A small square marker, like a HUD bullet. */
section > h2::before {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  background: var(--accent);
}
ol.setup {
  margin: 0;
  padding-left: 1.4em;
  display: grid;
  gap: 14px;
}
ol.setup li {
  padding-left: 4px;
  min-width: 0;
}
ol.setup li::marker {
  font-family: var(--font-mono);
  color: var(--accent);
}
ol.setup li > * + * {
  margin-top: 6px;
}
.setup-title {
  font-weight: 600;
}
.section-setup {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  min-width: 0;
}
.section-setup ol.setup {
  gap: 10px;
}

.tester {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.field {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.field label {
  font-size: 13px;
  font-weight: 600;
}
.hint {
  font-weight: 400;
  color: var(--muted);
}
input[type="text"],
input[type="search"],
textarea {
  font: inherit;
  font-size: 14px;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  width: 100%;
  box-sizing: border-box;
}
textarea {
  resize: vertical;
  min-height: 3.2em;
  field-sizing: content;
}

/* Test cards. The left edge takes the color of the test's result. */
.test {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: grid;
  gap: 12px;
  scroll-margin-top: 110px;
  min-width: 0;
}
.test:has(.pill[data-status="pass"]) {
  border-left-color: var(--pass);
}
.test:has(.pill[data-status="fail"]) {
  border-left-color: var(--fail);
}
.test:has(.pill[data-status="blocked"]) {
  border-left-color: var(--blocked);
}
.test:has(.pill[data-status="skip"]) {
  border-left-color: var(--skip);
}
.test-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.test-id {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 2px;
  padding: 1px 6px;
  margin-top: 2px;
  flex: none;
}
.test-head h3 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  flex: 1;
  min-width: 0;
}
.pill {
  flex: none;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 2px;
  padding: 3px 8px;
  background: var(--surface-2);
  color: var(--muted);
}
.pill[data-status="pass"] {
  background: var(--pass-bg);
  color: var(--pass);
}
.pill[data-status="fail"] {
  background: var(--fail-bg);
  color: var(--fail);
}
.pill[data-status="blocked"] {
  background: var(--blocked-bg);
  color: var(--blocked);
}
.pill[data-status="skip"] {
  background: var(--skip-bg);
  color: var(--skip);
}
.why {
  color: var(--muted);
  font-size: 14px;
}
.label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.test ol,
.test ul {
  margin: 0;
  padding-left: 1.4em;
  display: grid;
  gap: 4px;
}
.test ol li::marker {
  font-family: var(--font-mono);
  color: var(--muted);
}
.before {
  font-size: 14px;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 8px 12px;
}

.status {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.status label {
  position: relative;
}
.status input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.status span {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 5px 14px;
  background: var(--surface);
  color: var(--fg);
}
.status label:hover span {
  border-color: var(--muted);
}
.status input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.status input[value="pass"]:checked + span {
  background: var(--pass-bg);
  border-color: var(--pass);
  color: var(--pass);
}
.status input[value="fail"]:checked + span {
  background: var(--fail-bg);
  border-color: var(--fail);
  color: var(--fail);
}
.status input[value="blocked"]:checked + span {
  background: var(--blocked-bg);
  border-color: var(--blocked);
  color: var(--blocked);
}
.status input[value="skip"]:checked + span {
  background: var(--skip-bg);
  border-color: var(--skip);
  color: var(--skip);
}

ul.plain {
  margin: 0;
  padding-left: 1.2em;
  display: grid;
  gap: 4px;
  color: var(--muted);
}

.finish-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
details.preview summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}
details.preview textarea {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  min-height: 14em;
}

/* Home page plan list */
.plan-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  border-top: 1px solid var(--line);
}
.plan-list li {
  border-bottom: 1px solid var(--line);
}
.plan-list a {
  display: grid;
  gap: 2px;
  padding: 12px 12px 12px 14px;
  border-left: 3px solid transparent;
  text-decoration: none;
  color: var(--fg);
}
.plan-list a:hover {
  background: var(--surface);
  border-left-color: var(--accent);
}
.plan-list a:hover .plan-title {
  text-decoration: underline;
}
.plan-title {
  font-weight: 600;
}
.plan-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}
