/* no accent hue, so a link is ink plus an underline, never browser blue */
a { color: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--text); text-decoration-thickness: 2px; }

/* FAST — one token set, two themes, no accent doing two jobs.

Colour: the three status hues are the only hue in the interface — the accent is
the ink itself, warm bone on navy. A coloured mark therefore always means a
verdict. Every text pair below is at least 4.5:1 in the theme it is used in.
Type: one family (the system stack), six sizes, two weights.
Spacing: 4 / 8 / 12 / 16 / 24 / 32 / 48 only.
*/

:root {
  /* The plate: a navy-black ground, warm bone ink, and no accent hue at all.
     The only colour in the interface is the traffic light, so a coloured mark
     always means a verdict and never decoration. */
  --bg: #0E0E18;
  --surface: #16161F;
  --raised: #1E1E29;
  --line: #2A2A38;
  --line-strong: #6E6E85;   /* 3.3:1 on raised: a real boundary */
  --text: #F2EFE8;
  --text-2: #A9A7B0;
  --text-3: #8C8A94;
  --accent: #F2EFE8;
  --accent-hover: #FFFFFF;
  --accent-ink: #0E0E18;
  --accent-dim: rgba(242, 239, 232, .12);
  --ok: #3FE0A8;
  --ok-soft: #12241E;
  --warn: #F6B73C;
  --warn-soft: #2A2113;
  --bad: #F2505F;   /* darker than the amber, so the pair splits by lightness */
  --bad-soft: #2C1519;
  --grey: #7A7885;
  --grey-soft: #1D1D28;
  --focus: #F2EFE8;
  --radius: 3px;
  --radius-card: 6px;
  --rail-h: 68px;
  --spine: 0px;
  --nav-n: 4;
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset,
            0 18px 40px rgba(0, 0, 0, .45);
  --glow: 0 0 0 1px rgba(242, 239, 232, .28), 0 0 28px rgba(242, 239, 232, .10);
  --step: 4px;
  color-scheme: dark;
}

/* Dark is the default: this is an instrument, and the toggle is explicit. */

:root[data-theme="dark"] {
  --bg: #0E0E18;
  --surface: #16161F;
  --raised: #1E1E29;
  --line: #2A2A38;
  --line-strong: #6E6E85;   /* 3.3:1 on raised: a real boundary */
  --text: #F2EFE8;
  --text-2: #A9A7B0;
  --text-3: #8C8A94;
  --accent: #F2EFE8;
  --accent-hover: #FFFFFF;
  --accent-ink: #0E0E18;
  --accent-dim: rgba(242, 239, 232, .12);
  --ok: #3FE0A8;
  --ok-soft: #12241E;
  --warn: #F6B73C;
  --warn-soft: #2A2113;
  --bad: #F2505F;   /* darker than the amber, so the pair splits by lightness */
  --bad-soft: #2C1519;
  --grey: #7A7885;
  --grey-soft: #1D1D28;
  --focus: #F2EFE8;
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset,
            0 18px 40px rgba(0, 0, 0, .45);
  --glow: 0 0 0 1px rgba(242, 239, 232, .28), 0 0 28px rgba(242, 239, 232, .10);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #F3F1EA;
  --surface: #FBFAF6;
  --raised: #ECE9E1;
  --line: #DAD6CB;
  --line-strong: #858173;   /* 3.2:1 on raised */
  --text: #12131A;
  --text-2: #4E505C;
  --text-3: #636570;   /* 4.8:1 on raised */
  --accent: #12131A;
  --accent-hover: #000000;
  --accent-ink: #F7F6F1;
  --accent-dim: rgba(18, 19, 26, .08);
  --ok: #0B7444;
  --ok-soft: #E4F3EB;
  --warn: #8A5A08;
  --warn-soft: #F8EFDC;
  --bad: #B32338;
  --bad-soft: #FAE7EA;
  --grey: #6B6B74;
  --grey-soft: #EFEFF1;
  --focus: #12131A;
  --shadow: 0 1px 2px rgba(18, 18, 20, .06), 0 8px 24px rgba(18, 18, 20, .08);
  --glow: 0 0 0 1px rgba(18, 19, 26, .25);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
               Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px 96px; }

/* ── header ─────────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 0 12px;
  position: sticky; top: 0; z-index: 20;
  background: transparent;   /* the body glow runs under the header, no seam */
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 15px; letter-spacing: .06em;
  color: var(--text); text-decoration: none;
}
.brand .mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--text); color: var(--bg);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; letter-spacing: 0;
}
.topbar .spacer { flex: 1; }
.iconbtn {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: none; border: none; border-radius: var(--radius);
  color: var(--text-2); cursor: pointer;
}
.iconbtn:hover { color: var(--text); background: var(--raised); }
.iconbtn svg { display: block; }

/* ── type ───────────────────────────────────────────────────────────────── */
h1 { font-size: 28px; line-height: 1.15; letter-spacing: -.02em; font-weight: 600; }
h2 { font-size: 20px; line-height: 1.25; letter-spacing: -.01em; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
p { color: var(--text-2); }
.lede { font-size: 16px; color: var(--text-2); max-width: 46ch; margin-top: 8px; }
.meta { font-size: 12px; color: var(--text-3); }
.mono { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ── cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 12px;
}
.card > h2 + p, .card > h3 + p { margin-top: 4px; }
.card--flat { border: none; background: none; padding: 0; }

/* ── buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px;
  border-radius: var(--radius); border: 1px solid transparent;
  font: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: background .15s ease-out, border-color .15s ease-out, color .15s ease-out;
}
.btn--primary {
  background: transparent; color: var(--text); width: 100%;
  border: 1px solid var(--line-strong);
}
.btn--primary:hover {
  background: var(--text); color: var(--accent-ink); border-color: var(--text);
}
.btn--quiet { background: transparent; border-color: var(--line-strong); color: var(--text); }
.btn--quiet:hover { border-color: var(--text-3); }
.btn--text { background: none; border: none; color: var(--text-2); padding: 0 4px; min-height: 32px; }
.btn--text:hover { color: var(--text); }
.btn--danger { background: var(--bad); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
/* The heading takes focus so a screen reader starts at the top of the chapter.
   It is not a control, so it does not wear a focus ring. */
h1[tabindex="-1"]:focus { outline: none; }

.btn:focus-visible, .iconbtn:focus-visible, input:focus-visible,
.choice:focus-within, .tab:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px;
}
.btn-row { display: flex; gap: 8px; }

/* ── inputs ─────────────────────────────────────────────────────────────── */
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
input[type="text"], input[type="number"], input[type="password"], select {
  width: 100%; min-height: 44px; padding: 10px 12px;
  font: inherit; font-size: 15px; color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}
input::placeholder { color: var(--text-3); }
.hint { font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* ── upload ─────────────────────────────────────────────────────────────── */
.dropzone {
  display: grid; place-items: center; gap: 8px;
  padding: 32px 16px; text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-card);
  cursor: pointer;
  transition: border-color .15s ease-out, background .15s ease-out;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); }
.dropzone svg { color: var(--text-3); }
.dropzone strong { font-weight: 600; }
.dropzone small { color: var(--text-3); font-size: 13px; }

/* ── file summary ───────────────────────────────────────────────────────── */
.filemeta { display: grid; gap: 8px; }
.filemeta div { display: flex; justify-content: space-between; gap: 16px; font-size: 14px; }
.filemeta dt { color: var(--text-2); }
.filemeta dd { color: var(--text); font-variant-numeric: tabular-nums; text-align: right; }
.notice {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 13px; line-height: 1.5;
  color: var(--text-2); background: var(--raised);
  border-radius: var(--radius); padding: 10px 12px; margin-top: 12px;
}
.notice svg { flex: none; margin-top: 2px; color: var(--text-3); }
.notice--warn { background: var(--warn-soft); color: var(--text); }
.notice--warn svg { color: var(--warn); }

/* ── muscle choices ─────────────────────────────────────────────────────── */
.choices { display: grid; gap: 8px; margin: 12px 0; }
.choices--grid { grid-template-columns: 1fr 1fr; }
.choice {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; min-height: 48px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s ease-out, background .15s ease-out;
}
.choice:hover { border-color: var(--line-strong); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice .box {
  width: 18px; height: 18px; flex: none;
  border: 1.5px solid var(--line-strong); border-radius: 5px;
  display: grid; place-items: center;
  transition: background .15s ease-out, border-color .15s ease-out;
}
.choice .box svg { opacity: 0; width: 12px; height: 12px; color: var(--accent-ink); }
.choice input:checked ~ .box { background: var(--accent); border-color: var(--accent); }
.choice input:checked ~ .box svg { opacity: 1; }
.choice .label { min-width: 0; }
.choice .label strong { display: block; font-size: 14px; font-weight: 600; }
.choice .label span { display: block; font-size: 12px; color: var(--text-2); }
.choice:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--surface); }

/* ── sticky action bar ──────────────────────────────────────────────────── */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.actionbar .inner { max-width: 720px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.actionbar .count { font-size: 14px; color: var(--text-2); }
.actionbar .btn { width: auto; flex: 1; }

/* ── progress ───────────────────────────────────────────────────────────── */
.progress { display: grid; place-items: center; gap: 16px; padding: 64px 0; text-align: center; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2.5px solid var(--line);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress p { font-size: 15px; }

/* ── verdict ────────────────────────────────────────────────────────────── */
.verdict { padding: 24px 0 20px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.verdict h1 { max-width: 24ch; }
.verdict .lede { margin-top: 10px; }
.verdict .status { font-weight: 600; }
.status--green { color: var(--ok); }
.status--amber { color: var(--warn); }
.status--red { color: var(--bad); }
.status--grey { color: var(--grey); }
.counts { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.count {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--raised); font-size: 13px; color: var(--text-2);
}
.count strong { color: var(--text); font-weight: 600; }

/* ── result rows ────────────────────────────────────────────────────────── */
.rows { display: grid; }
.row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto auto;
  align-items: center; gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot--green { background: var(--ok); }
.dot--amber { background: var(--warn); }
.dot--red { background: var(--bad); }
.dot--grey { background: transparent; border: 1.5px solid var(--line-strong); }
.row .name { min-width: 0; }
.row .name strong { display: block; font-size: 15px; font-weight: 600; }
.row .name span { display: block; font-size: 12px; color: var(--text-3); }
.row .score { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.row .word { font-size: 13px; color: var(--text-2); min-width: 11ch; text-align: right; }
.row .score--green { color: var(--ok); }
.row .score--amber { color: var(--warn); }
.row .score--red { color: var(--bad); }
.row .score--grey { color: var(--grey); }

/* ── disclosure ─────────────────────────────────────────────────────────── */
details.disclose { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
details.disclose summary {
  cursor: pointer; font-size: 14px; color: var(--text-2);
  list-style: none; display: flex; align-items: center; gap: 8px; min-height: 32px;
}
details.disclose summary::-webkit-details-marker { display: none; }
details.disclose summary:hover { color: var(--text); }
details.disclose summary svg { transition: transform .15s ease-out; }
details.disclose[open] summary svg { transform: rotate(90deg); }
details.disclose dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin-top: 12px; font-size: 13px; }
details.disclose dt { color: var(--text-3); }
details.disclose dd { color: var(--text-2); }

/* ── body map ───────────────────────────────────────────────────────────── */
.mapcard { display: grid; gap: 12px; }
.segmented { display: inline-flex; gap: 2px; padding: 2px; background: var(--raised); border-radius: 999px; }
.segmented button {
  border: none; background: none; font: inherit; font-size: 12px; font-weight: 600;
  color: var(--text-2); padding: 6px 14px; border-radius: 999px; cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); }
.mapcanvas { width: min(280px, 100%); height: 420px; margin: 0 auto; }
.maplegend { display: flex; gap: 16px; justify-content: center; font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.maplegend span { display: inline-flex; align-items: center; gap: 6px; }

/* ── train ──────────────────────────────────────────────────────────────── */
.call { padding-bottom: 16px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.call h2 { font-size: 24px; }
.call p { margin-top: 8px; }
.week { display: flex; gap: 6px; margin-top: 12px; }
.week > div { flex: 1; display: grid; justify-items: center; gap: 6px; }
.week .dot { width: 12px; height: 12px; }
.week span { font-size: 11px; color: var(--text-3); letter-spacing: .02em; }
.week .none { border: 1.5px dashed var(--line-strong); background: none; }
.advice { display: grid; gap: 10px; margin-top: 12px; }
.advice p { font-size: 14px; }

/* ── history ────────────────────────────────────────────────────────────── */
.trend { width: 100%; height: auto; display: block; }
.summary3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.summary3 div { text-align: center; padding: 8px 0; }
.summary3 strong { display: block; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.summary3 span { font-size: 12px; color: var(--text-2); }
.hist {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  padding: 14px 16px; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-card);
  font: inherit; color: inherit; cursor: pointer;
}
.hist:hover { border-color: var(--line-strong); }
.hist .score { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 3ch; }
.hist .when { min-width: 0; flex: 1; }
.hist .when strong { display: block; font-size: 14px; font-weight: 600; }
.hist .when span { display: block; font-size: 12px; color: var(--text-3); }
.empty { text-align: center; color: var(--text-2); font-size: 14px; padding: 32px 16px; }
.empty svg { color: var(--text-3); margin-bottom: 8px; }

/* ── navigation: the instrument rail ────────────────────────────────────── */
/* Not tabs. An index of the instrument: numbered chapters, engraved glyphs,
   hairlines only. Below 900px it is a rail along the foot; above, a spine
   down the left edge, the way a plate is captioned. */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 0 max(6px, env(safe-area-inset-left)) env(safe-area-inset-bottom)
           max(6px, env(safe-area-inset-right));
}
.tabs .inner {
  position: relative; max-width: 720px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(var(--nav-n), 1fr);
}
/* one cursor that moves, rather than five marks that blink */
.cursor {
  position: absolute; top: 0; left: 0;
  width: calc(100% / var(--nav-n)); height: 2px;
  background: var(--accent);
  transform: translateX(calc(var(--i, 0) * 100%));
  transition: transform .28s cubic-bezier(.22, .61, .36, 1);
}
.cursor::after {
  content: ""; position: absolute; left: 50%; top: -3px; width: 8px; height: 8px;
  margin-left: -4px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 60%, transparent);
}
.tab {
  position: relative; display: flex; flex-direction: column; align-items: center;
  gap: 7px; padding: 12px 2px 11px; min-height: 64px;
  background: none; border: 0; font: inherit; cursor: pointer;
  color: var(--text-3);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: color .15s;
}
.tab:active { color: var(--text-2); }
.tab .num { display: none; }
.tab svg { width: 21px; height: 21px; }
.tab .glyph {
  fill: none; stroke: currentColor; stroke-width: 1.2;
  stroke-linecap: round; stroke-linejoin: round;
}
.tab .word {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  padding-left: .14em;   /* the trailing tracking would otherwise pull centring left */
}
@media (max-width: 340px) { .tab .word { font-size: 10px; letter-spacing: .1em; padding-left: .1em; } }
.tab[aria-current="page"] { color: var(--text); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }

@media (min-width: 941px) {
  :root { --spine: 152px; }
  .tabs {
    top: 0; right: auto; bottom: 0; width: var(--spine);
    border-top: 0; border-right: 1px solid var(--line);
    background: var(--bg); backdrop-filter: none;
    display: flex; align-items: flex-start;
    padding: 76px 0 0 env(safe-area-inset-left);
  }
  .tabs .inner { display: grid; grid-template-columns: 1fr; gap: 2px; width: 100%; padding: 0; }
  .tab {
    flex-direction: row; justify-content: flex-start; gap: 10px;
    padding: 11px 12px 11px 18px; min-height: 0;
  }
  .tab .num {
    display: block; width: 14px; flex: none;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 10px; letter-spacing: .04em; color: var(--text-3);
  }
  .tab .word { font-size: 10.5px; letter-spacing: .16em; padding-left: 0; }
  .tab svg { width: 22px; height: 22px; flex: none; }
  .tab:hover { color: var(--text-2); }

  /* the cursor turns on its side and runs down the spine */
  .cursor {
    top: 0; left: auto; right: 0; width: 2px; height: calc(100% / var(--nav-n));
    transform: translateY(calc(var(--i, 0) * 100%));
  }
  .cursor::after { display: none; }

  /* the active glyph draws itself, as the dial does */
  .tab[aria-current="page"] .glyph > * {
    stroke-dasharray: 60;
    animation: ink .55s cubic-bezier(.22, .61, .36, 1) both;
  }
  .tab[aria-current="page"] .word { animation: riseink .5s .18s ease-out both; }
  @keyframes ink { from { stroke-dashoffset: 60; } to { stroke-dashoffset: 0; } }
  @keyframes riseink { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
  .tab[aria-current="page"] .num { color: var(--accent); }

  /* a measuring scale down the spine's edge, fading at both ends */
  .tabs::after {
    content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 7px;
    background: repeating-linear-gradient(to bottom,
      color-mix(in srgb, var(--text) 26%, transparent) 0 1px, transparent 1px 14px);
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 82%, transparent);
    mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 82%, transparent);
    opacity: .5; pointer-events: none;
  }
  body { padding-left: var(--spine); }
}

@media (min-width: 1440px) {
  :root { --spine: 168px; }
  .tab .word { font-size: 11px; letter-spacing: .2em; }
  .tab .num { font-size: 10.5px; }
}

/* ── sheets ─────────────────────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(16, 17, 20, .5);
  display: grid; align-items: end;
}
.overlay[hidden] { display: none; }
.sheet {
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
  max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow);
  animation: rise .25s ease-out;
}
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }
.sheet header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.sheet header h2 { flex: 1; }

/* ── toast ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translate(-50%, 8px);
  z-index: 50; max-width: min(90vw, 420px);
  background: var(--text); color: var(--bg);
  font-size: 14px; padding: 10px 16px; border-radius: var(--radius);
  opacity: 0; pointer-events: none;
  transition: opacity .15s ease-out, transform .15s ease-out;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.h-group { margin: 20px 0 4px; }
.h-section { margin: 24px 0 4px; }
.grow { flex: 1; }

/* ── responsive ─────────────────────────────────────────────────────────── */
@media (min-width: 640px) {
  .wrap { padding: 0 24px 112px; }
  h1 { font-size: 32px; }
  .choices--grid { grid-template-columns: repeat(3, 1fr); }
  .sheet { border-radius: 16px; max-width: 560px; margin: 0 auto 24px; }
  .overlay { align-items: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}


/* ══════════════════════════════════════════════════════════════════════════
   Evolution: the instrument look. Appended so the component rules above stay
   intact; these raise the identity without changing the structure.
   ══════════════════════════════════════════════════════════════════════════ */

body {
  background:
    radial-gradient(900px 500px at 50% -180px, rgba(242, 239, 232, .05), transparent 70%),
    var(--bg);
}

.wrap { max-width: 1080px; padding: 0 20px 112px; }

/* header */
.topbar {
  padding: 18px max(20px, calc((100% - 1040px) / 2)) 14px; gap: 14px;
}
@media (min-width: 941px) {
  .topbar { padding-left: max(20px, calc((100% - 1040px) / 2)); }
}
.brand {
  font-size: 15px; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase;
}
.brand .mark {
  width: 30px; height: 30px; border-radius: 2px;
  background: none; color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: none;
  display: grid; place-items: center;
}
.brand .mark svg { width: 18px; height: 18px; display: block; }
.topbar.scrolled {
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom-color: var(--line);
}

/* type scale up: the verdict has to carry the screen */
h1 { font-size: clamp(32px, 4.4vw, 54px); line-height: 1.04; letter-spacing: -.03em;
     font-weight: 300; }
.eyebrow {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; letter-spacing: .15em; text-transform: uppercase; color: var(--text-3);
}
.eyebrow::before { content: attr(data-n); color: var(--accent); margin-right: 10px;
  font-variant-numeric: tabular-nums; }
h2 { font-size: clamp(20px, 2.2vw, 24px); letter-spacing: -.02em; }
h3 { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }

/* surfaces */
.empty {
  display: block; text-align: left; padding: 22px;
}
.empty svg { width: 20px; height: 20px; color: var(--text-3); margin-bottom: 12px; }
.empty p { max-width: 46ch; font-size: 14.5px; line-height: 1.55; color: var(--text-2); }
.empty .btn { width: auto; min-width: 0; margin-top: 16px; padding: 12px 18px; }

.card {
  border-radius: var(--radius-card);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.card h3 + * { margin-top: 10px; }

/* actions */
.btn { border-radius: var(--radius); font-weight: 600; letter-spacing: -.01em; }
/* The primary action is a hairline, not a lit slab: on this screen the verdict
   is the loudest thing, and a bone fill out-shouted it. */
.btn--primary:focus-visible { outline-offset: 3px; }

/* ── you: the account ──────────────────────────────────────────────────── */
.acct-head { display: flex; align-items: center; gap: 14px; }
.acct-mark {
  flex: none; width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: grid; place-items: center;
  font-size: 17px; letter-spacing: .02em; color: var(--text);
}
.acct h2 { font-size: 20px; letter-spacing: -.01em; }
.btn--danger-quiet { color: var(--text-2); }
.btn--danger-quiet:hover { border-color: var(--bad); color: var(--bad); }

.seg {
  display: inline-flex; border: 1px solid var(--line-strong);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 20px;
}
.seg button {
  background: transparent; border: 0; color: var(--text-2);
  padding: 10px 16px; font: inherit; font-size: 13px; letter-spacing: .02em;
  cursor: pointer; min-height: 40px;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--text); color: var(--accent-ink); }
.seg button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

.auth-form { max-width: 400px; }
.hint { color: var(--text-3); font-size: 12.5px; line-height: 1.55; margin: -2px 0 12px; }
.form-error { color: var(--bad); font-size: 13px; line-height: 1.5; margin: 4px 0 10px; }

/* navigation is styled once, above */

/* ── home ──────────────────────────────────────────────────────────────── */
.hero { padding: 28px 0 8px; max-width: 760px; }
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent); font-weight: 600; margin-bottom: 14px;
}
.eyebrow::before {
  content: attr(data-n); color: var(--accent); margin-right: 10px;
  font-variant-numeric: tabular-nums;
}
.hero p.lede { margin-top: 14px; font-size: 17px; color: var(--text-2); max-width: 62ch; }

.steps { display: grid; gap: 14px; margin-top: 26px; }
@media (min-width: 820px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { padding: 20px; position: relative; }
.step .num {
  font-variant-numeric: tabular-nums;
  font-size: 12px; letter-spacing: .12em; color: var(--accent);
  font-weight: 700;
}
.step h3 { margin: 10px 0 6px; font-size: 15px; letter-spacing: -.01em;
           text-transform: none; color: var(--text); font-weight: 600; }
.step p { font-size: 14px; color: var(--text-2); }

.cta-row { display: flex; gap: 12px; align-items: center; margin-top: 26px; flex-wrap: wrap; }
.cta-row .btn--primary { padding: 16px 26px; font-size: 16px; }

/* ── the fatigue plane ─────────────────────────────────────────────────── */
.plane-card { padding: 18px 18px 10px; }
.plane-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.plane-head .legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); }
.plane-head .legend i {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px;
}
.plane-wrap { position: relative; margin-top: 8px; }
canvas.plane { width: 100%; height: auto; display: block; }
.plane-note { font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* provenance: what makes it read as an instrument, not a dashboard */
.provenance {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px; color: var(--text-3);
}
.provenance b { color: var(--text-2); font-weight: 500; }


/* ── home: the dial ────────────────────────────────────────────────────── */
.home {
  display: grid; grid-template-columns: 1.02fr .98fr; gap: 16px;
  align-items: center; min-height: 68vh; padding-top: 12px;
}
.ask {
  display: flex; align-items: center; gap: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; letter-spacing: .15em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 16px;
}
.ask i { display: block; width: 26px; height: 1px; background: currentColor; }
.home h1 {
  font-size: clamp(40px, 5.6vw, 78px); line-height: .96;
  letter-spacing: -.03em; font-weight: 300;
}
.home h1 b { font-weight: 500; }
.home-verdict {
  display: flex; align-items: center; gap: 12px; margin-top: 24px;
  font-size: 24px; font-weight: 500; letter-spacing: -.01em;
}
.home-verdict i { width: 12px; height: 12px; border-radius: 50%; background: var(--grey); }
.home .lead {
  margin-top: 14px; max-width: 40ch; font-size: 15.5px; line-height: 1.62;
  color: var(--text-2);
}
.home-cta { margin-top: 26px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.home-cta .btn { width: auto; min-width: 0; padding-left: 22px; padding-right: 22px; }
.home-cta .hint {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; letter-spacing: .1em; color: var(--text-3);
}

/* the way from "red" to "why" */
.more { margin-top: 22px; }
.more-btn,
.about-more summary,
.det-more summary {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  list-style: none; min-height: 44px; padding: 10px 0;
  color: var(--text); font-size: 15px; font-weight: 500; letter-spacing: -.01em;
}
.more-btn::-webkit-details-marker,
.det-more summary::-webkit-details-marker,
.about-more summary::-webkit-details-marker { display: none; }
.more-btn::after,
.det-more summary::after,
.about-more summary::after { content: "+"; color: var(--text-3); font-weight: 400; margin-left: auto; }
details[open] > .more-btn::after,
details[open] > .about-more summary::after,
.det-more[open] > summary::after { content: "–"; }
.answer { margin-top: 2px; max-width: 42ch; }
.answer p { font-size: 14.5px; line-height: 1.62; color: var(--text-2); }
.home .safety {
  margin-top: 18px; max-width: 42ch;
  color: var(--text-2); font-size: 13.5px; line-height: 1.55;
  border-left: 2px solid var(--warn); padding-left: 12px;
}
.det-more { margin-top: 10px; border-top: 1px solid var(--line); }
.det-more summary {
  color: var(--text-3); font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 500;
}
.det-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 20px; padding: 4px 0 14px; }
.det-more:not([open]) .det-list { display: none; }
.det-list dt {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-3); padding-top: 3px;
}
.det-list dd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; color: var(--text);
  min-width: 0; overflow-wrap: anywhere;
}

.disc { display: grid; justify-items: center; }
.disc canvas {
  width: 100%; max-width: min(560px, 46svh); height: auto; display: block;
}
.disc-foot {
  margin-top: 16px; display: flex; align-items: center; justify-content: center; gap: 14px;
}
.replay {
  background: none; border: 0; cursor: pointer; padding: 6px 4px; min-height: 32px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3);
}
.replay:hover { color: var(--text); }
.disc-label {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; letter-spacing: .13em; text-transform: uppercase; color: var(--text-3);
}

.home-foot {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  margin-top: 10px; padding: 16px 0 0; border-top: 1px solid var(--line);
}
.foot-txt {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3);
}
/* the dates sit under the marks, so a run reads as a sequence of days */
.foot-strip { display: flex; gap: 15px; align-items: flex-end; }
.fs-item { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.fs-item .d { width: 10px; height: 10px; display: block; border-radius: 50%; }
.fs-item .d.green { background: var(--ok); }
.fs-item .d.red { background: var(--bad); border-radius: 2px; transform: rotate(45deg); }
.fs-item .d.amber { background: transparent; border: 2.5px solid var(--warn); }
.fs-item .d.grey { background: var(--grey); opacity: .55; }
.fs-day {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9.5px; letter-spacing: .1em; line-height: 1; color: var(--text-3);
}
.fs-item.live .fs-day { color: var(--text); }

.mobile-cta { display: none; }

/* every chapter opens at the same height, so navigating does not jump */
main > section:not(#screen-home) { padding-top: 78px; }
/* empty states are notes, not panels: they do not run the width of the page */
#train-body > .empty,
#profile-body > *,
#history-body > *,
#history-body > .empty,
main > section:not(#screen-home) > .empty,
main > section:not(#screen-home) > .panel { max-width: 720px; }

@media (max-width: 940px) {
  .home { grid-template-columns: 1fr; gap: 8px; min-height: 0; }
  #screen-home { padding-bottom: 128px; }
  .disc { order: -1; }
  .disc canvas { max-width: 340px; }
  .home h1 { font-size: 34px; }
  .disc-label { display: none; }
  .home-verdict { font-size: 19px; margin-top: 18px; }
  .home-cta { display: none; }
  .det-list { margin-bottom: 84px; }
  /* the fixed action sits over the page, so the page must end below it */
  .wrap { padding-bottom: 190px; }

  .mobile-cta {
    display: block; position: fixed; left: 0; right: 0; z-index: 25;
    bottom: calc(var(--rail-h) + env(safe-area-inset-bottom));
    padding: 12px 16px;
    background: linear-gradient(transparent, var(--bg) 45%);
  }
  .mobile-cta button {
    width: 100%; height: 56px; border-radius: var(--radius);
    background: transparent; color: var(--text); border: 1px solid var(--line-strong);
    font-size: 15px; font-weight: 600; letter-spacing: .02em; cursor: pointer;
  }
}

/* ── what the app is ───────────────────────────────────────────────────── */
.about { margin-top: 26px; }
.about-row {
  display: grid; gap: 0; border-top: 1px solid var(--line);
}
@media (min-width: 760px) { .about-row { grid-template-columns: repeat(3, 1fr); } }
.about-row > div { padding: 14px 18px 14px 0; border-bottom: 1px solid var(--line); }
@media (min-width: 760px) {
  .about-row > div { border-bottom: 0; border-right: 1px solid var(--line); padding-right: 20px; }
  .about-row > div:last-child { border-right: 0; }
}
.about-row span {
  display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3);
  margin-bottom: 6px;
}
.about-row p { font-size: 13.5px; line-height: 1.5; color: var(--text-2); }
.about-more { margin-top: 4px; border-bottom: 1px solid var(--line); }
.about-more summary {
  cursor: pointer; list-style: none; padding: 14px 0;
  display: flex; align-items: center; gap: 9px;
  font-size: 14px; color: var(--text); font-weight: 500;
}
.about-more summary::-webkit-details-marker { display: none; }
.about-more summary::after { content: "+"; color: var(--text-3); margin-left: auto; }
.about-more[open] summary::after { content: "–"; }
.about-more p {
  font-size: 13.5px; line-height: 1.6; color: var(--text-2);
  max-width: 60ch; padding-bottom: 12px;
}

/* the copy column arrives a beat after the dial starts drawing */
@media (prefers-reduced-motion: no-preference) {
  .home-copy { animation: rise .45s cubic-bezier(.2,.7,.2,1) .1s both; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
  }
}
