:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --ink: #121212;
  --muted: #5e5e5e;
  --faint: #8a8a8a;
  --line: #e6e6e3;
  --line-strong: #d4d4d0;
  --accent: #121212;
  --accent-ink: #ffffff;
  --good: #0c7a4b;
  --good-soft: #e7f6ee;
  --warn: #8a5a00;
  --warn-soft: #f8f1dc;
  --bad: #b42318;
  --bad-soft: #fdeceb;
  --gauge: #121212;
  --gauge-track: #ecece8;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --max: 920px;
  --radius: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #090909;
    --surface: #111111;
    --ink: #f3f3f1;
    --muted: #a3a3a3;
    --faint: #7a7a7a;
    --line: #242424;
    --line-strong: #333333;
    --accent: #f3f3f1;
    --accent-ink: #090909;
    --good: #3dd68c;
    --good-soft: #10281c;
    --warn: #e6b450;
    --warn-soft: #2a220f;
    --bad: #ff7a70;
    --bad-soft: #2c1412;
    --gauge: #f3f3f1;
    --gauge-track: #242424;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #090909;
  --surface: #111111;
  --ink: #f3f3f1;
  --muted: #a3a3a3;
  --faint: #7a7a7a;
  --line: #242424;
  --line-strong: #333333;
  --accent: #f3f3f1;
  --accent-ink: #090909;
  --good: #3dd68c;
  --good-soft: #10281c;
  --warn: #e6b450;
  --warn-soft: #2a220f;
  --bad: #ff7a70;
  --bad-soft: #2c1412;
  --gauge: #f3f3f1;
  --gauge-track: #242424;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}
body[data-test-state="running"] .ad-slot { display: none !important; }
img, svg { max-width: 100%; }
a { color: inherit; text-underline-offset: 0.18em; }
a:hover { color: var(--good); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
}
.skip:focus { top: 0.75rem; z-index: 5; }

.site-header, .site-footer, main {
  width: min(var(--max), calc(100% - 2.5rem));
  margin-inline: auto;
}
.site-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem 0 0.5rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 620;
  letter-spacing: -0.04em;
  font-size: 1.05rem;
}
.brand:hover { color: var(--ink); }
.mark {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 99px;
  background: var(--good);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 18%, transparent);
}
.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  margin-left: auto;
}
.site-header nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
}
.site-header nav a:hover { color: var(--ink); }
.site-header nav a[aria-current="page"] { color: var(--ink); font-weight: 620; }
.theme-toggle {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex: none;
}
.theme-toggle::before {
  content: "";
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 99px;
  box-shadow: inset -0.42rem 0 0 var(--ink);
}
:root[data-theme="dark"] .theme-toggle::before {
  box-shadow: inset 0.42rem 0 0 var(--ink);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle::before {
    box-shadow: inset 0.42rem 0 0 var(--ink);
  }
}

main { padding: 2.5rem 0 5rem; }
.kicker {
  margin: 0 0 0.7rem;
  color: var(--faint);
  font-size: 0.75rem;
  font-weight: 620;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
h1, h2, h3 { font-weight: 580; letter-spacing: -0.045em; line-height: 1.12; }
h1 { font-size: clamp(2rem, 4vw, 2.75rem); margin: 0 0 0.85rem; max-width: 22ch; }
.hero h1 { font-size: clamp(2.6rem, 6vw, 4.15rem); max-width: 13ch; }
h2 { font-size: 1.25rem; margin: 0 0 0.65rem; letter-spacing: -0.03em; }
h3 { font-size: 1.05rem; margin: 0 0 0.35rem; }
.lede { font-size: 1.125rem; max-width: 38rem; color: var(--muted); margin: 0; }
.muted { color: var(--muted); }
.crumbs { color: var(--faint); font-size: 0.88rem; margin-bottom: 1.5rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }

.hero { padding: 2.5rem 0 0.5rem; }
.choices { display: grid; gap: 0.75rem; margin: 2.75rem 0 1.5rem; }
.choice {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem;
  padding: 1.35rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
}
.choice:hover { border-color: var(--line-strong); color: inherit; }
.choice h2 { font-size: 1.55rem; margin: 0 0 0.3rem; }
.choice p { margin: 0; color: var(--muted); }
.choice-go { color: var(--ink); font-weight: 600; font-size: 0.92rem; white-space: nowrap; }
.trust { color: var(--muted); max-width: 40rem; margin: 0.5rem 0 2.5rem; }
.quiet { margin: 2.75rem 0; }
.quiet h2 { font-size: 0.95rem; letter-spacing: 0.02em; font-weight: 620; }

.panel, .prose {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel { margin: 1.5rem 0; padding: 1.5rem 1.4rem 1.4rem; }
.prose { padding: 0.25rem 0 0.5rem; background: transparent; border: 0; box-shadow: none; }
.prose h2 { margin-top: 2.25rem; }
.stage { padding: 1.5rem 0 0.5rem; text-align: center; }
.stage-copy { text-align: left; margin-bottom: 2rem; }
.stage h1 { max-width: 16ch; font-size: clamp(2.1rem, 4vw, 3rem); }

.gauge {
  position: relative;
  width: min(100%, 280px);
  margin: 0 auto 0.75rem;
}
.gauge svg { display: block; width: 100%; height: auto; }
.gauge-track, .gauge-value { fill: none; stroke-width: 8; }
.gauge-track { stroke: var(--gauge-track); }
.gauge-value {
  stroke: var(--gauge);
  stroke-linecap: round;
  stroke-dasharray: 527.79;
  stroke-dashoffset: 527.79;
}
.gauge-readout {
  position: absolute;
  inset: 18%;
  display: grid;
  align-content: center;
  justify-items: center;
}
.gauge-label {
  margin: 0;
  color: var(--faint);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.gauge-number {
  margin: 0.15rem 0 0;
  font-size: clamp(1.7rem, 5vw, 2.7rem);
  font-weight: 560;
  letter-spacing: -0.05em;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}
.gauge-unit { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.95rem; }

.controls { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.7rem; margin: 0.4rem 0 0.6rem; }
.stage .controls { margin-top: 0; }
.btn:not([hidden]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.8rem 1.25rem;
  border-radius: 999px;
  cursor: pointer;
  min-height: 2.75rem;
}
.btn:hover { filter: brightness(1.08); }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.btn-ghost:not([hidden]) {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn-ghost:hover { filter: none; background: var(--surface); }
.phase { margin: 0.35rem 0 1.25rem; color: var(--muted); min-height: 1.4em; }
.stage .phase { text-align: center; }
.error {
  color: var(--bad);
  background: var(--bad-soft);
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  text-align: left;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 0.5rem auto 0;
  max-width: 34rem;
  text-align: left;
}
.stat-row div {
  padding: 0.85rem 0.2rem 0.2rem;
  border-top: 1px solid var(--line);
}
.stat-row dt { color: var(--faint); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }
.stat-row dd { margin: 0.25rem 0 0; font-size: 1.45rem; font-variant-numeric: tabular-nums; letter-spacing: -0.04em; }
.stat-row .unit { color: var(--muted); font-size: 0.8rem; letter-spacing: 0; }

.grade-row { display: flex; gap: 1rem; align-items: flex-start; text-align: left; }
.grade-letter {
  flex: none;
  width: 3.4rem;
  height: 3.4rem;
  display: grid;
  place-items: center;
  margin: 0;
  border-radius: 12px;
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.04em;
  background: var(--surface);
  border: 1px solid var(--line);
}
.grade-ap, .grade-a { color: var(--good); background: var(--good-soft); border-color: transparent; }
.grade-b { color: var(--good); background: var(--good-soft); border-color: transparent; }
.grade-c, .grade-d { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.grade-f, .grade-none { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.grade-row .kicker { margin-bottom: 0.25rem; }
.grade-row p { margin: 0.15rem 0; }

.verdicts { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; text-align: left; }
.verdict {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.15rem 0.8rem;
  padding: 0.95rem 0;
  border-top: 1px solid var(--line);
}
.verdict p { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 0.95rem; }
.verdict-name { font-weight: 620; }
.verdict-badge { font-size: 0.78rem; font-weight: 650; border-radius: 999px; padding: 0.2rem 0.55rem; height: fit-content; }
.verdict-ready .verdict-badge { background: var(--good-soft); color: var(--good); }
.verdict-marginal .verdict-badge { background: var(--warn-soft); color: var(--warn); }
.verdict-not-ready .verdict-badge { background: var(--bad-soft); color: var(--bad); }
.report-verdict { font-size: 2rem; letter-spacing: -0.04em; margin: 0.15rem 0 0.35rem; font-weight: 580; }
.verdict-healthy, .verdict-good { color: var(--good); }
.verdict-aging { color: var(--warn); }
.verdict-replace { color: var(--bad); }
.verdict-unknown, .verdict-drain { color: var(--ink); }

.diagnosis, .notes, .prose ul, .prose ol { padding-left: 1.15rem; }
.diagnosis li, .notes li { margin: 0.35rem 0; }
.history { list-style: none; padding: 0; margin: 0; }
.history li { display: grid; gap: 0.1rem; padding: 0.85rem 0; border-top: 1px solid var(--line); }
.history time { color: var(--faint); font-size: 0.82rem; }
.empty { color: var(--muted); border-top: 0; }

label { display: grid; gap: 0.35rem; font-size: 0.88rem; color: var(--muted); }
input, textarea, select {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
}
textarea { width: 100%; min-height: 9rem; resize: vertical; }
.plan, .stack { display: grid; gap: 0.8rem; }
.split { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; }
.check { display: flex; gap: 0.6rem; align-items: flex-start; color: var(--ink); }
.check input { margin-top: 0.25rem; }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }
fieldset { border: 0; margin: 0; padding: 0; }
legend { padding: 0; }

.tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.4rem 0 1rem; }
.tab {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font: inherit;
  cursor: pointer;
}
.tab[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
pre.command {
  background: #161616;
  color: #f4f4f2;
  padding: 0.95rem 1rem;
  border-radius: 12px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.88rem;
}
:root[data-theme="dark"] pre.command,
:root:not([data-theme="light"]) pre.command { background: #000; }
.spec { display: grid; grid-template-columns: minmax(8rem, 14rem) 1fr; gap: 0.35rem 1rem; margin: 1rem 0; }
.spec dt { color: var(--muted); }
.spec dd { margin: 0; font-variant-numeric: tabular-nums; }
.spec-heading { grid-column: 1 / -1; margin-top: 0.8rem; font-size: 1.05rem; color: var(--ink); }
.hero-stat, .drain-score {
  font-size: clamp(3.5rem, 12vw, 5rem);
  letter-spacing: -0.06em;
  line-height: 0.95;
  margin: 0.2rem 0 0.8rem;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
}
.drain-label { font-weight: 600; margin-top: 0; }
canvas#drain-canvas { width: min(100%, 320px); height: auto; background: #161616; border-radius: 12px; }
.clock { font-variant-numeric: tabular-nums; font-size: 2rem; letter-spacing: -0.04em; margin: 0.4rem 0; }
.details summary { cursor: pointer; font-weight: 620; }
.details p, .details ul { color: var(--muted); }
.guide-list { list-style: none; padding: 0; margin: 0; display: grid; }
.guide-list li { border-top: 1px solid var(--line); }
.guide-list a { display: block; padding: 0.85rem 0; text-decoration: none; }
.guide-list a:hover { color: var(--ink); }
.guide-list p { margin: 0; color: var(--muted); }

.ad-slot:not([hidden]) { margin: 3.5rem 0 0; }
.ad-kicker {
  margin: 0 0 0.4rem;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}
.ad-frame {
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  min-height: 3.25rem;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--faint);
  font-size: 0.82rem;
  padding: 0.7rem;
}
.ad-frame p { margin: 0; }
.site-footer { padding: 0 0 2.5rem; color: var(--faint); font-size: 0.88rem; }
.site-footer a { color: var(--muted); }

@media (min-width: 760px) {
  .choices { grid-template-columns: 1fr 1fr; }
  .plan { grid-template-columns: 1fr 1fr; }
  main { padding-top: 3.5rem; }
  .hero { padding-top: 3.5rem; }
}
@media (max-width: 640px) {
  .gauge { width: min(68vw, 230px); }
  .stage-copy { margin-bottom: 0.75rem; }
  .site-header { flex-wrap: wrap; }
  .site-header nav { order: 3; width: 100%; margin-left: 0; padding-top: 0.35rem; }
  .theme-toggle { margin-left: auto; }
  h1 { font-size: 2.35rem; }
  .choice { align-items: flex-start; flex-direction: column; gap: 0.8rem; }
  .stat-row { gap: 0.4rem; }
  .stat-row dd { font-size: 1.2rem; }
  .btn:not([hidden]) { width: 100%; }
  .stage .controls { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .gauge-value { transition: none; }
}
@media print {
  .site-header, .ad-slot, .controls, .site-footer, .theme-toggle { display: none !important; }
  body { background: white; color: black; }
}

a.btn:not([hidden]) { text-decoration: none; }
a.btn:hover { color: var(--accent-ink); }
.hero-cta { justify-content: flex-start; margin: 1.75rem 0 0; }
.stage .hero-cta { margin-top: 1.25rem; }
.confidence {
  margin: 0 0 0.35rem;
  color: var(--faint);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.fixes { margin: 0.8rem 0 0; padding-left: 1.15rem; }
.fixes li { margin: 0.4rem 0; }
.score-hero {
  font-size: clamp(4.2rem, 12vw, 6.5rem);
  letter-spacing: -0.07em;
  line-height: 0.9;
  margin: 0.2rem 0 0.4rem;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
}
.subscores { display: grid; margin: 1.25rem 0; }
.subscore {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0;
  border-top: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.checkup-stage .stage-copy { max-width: 40rem; }
