/* SignalPath — styles
   Tokens: one neutral ink for shared foundation, one hue per path group.
   Colours validated for colour-vision deficiency (light and dark). */

@font-face { font-family: 'Barlow'; font-weight: 400; font-display: swap; src: url('../fonts/barlow-400.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 500; font-display: swap; src: url('../fonts/barlow-500.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 600; font-display: swap; src: url('../fonts/barlow-600.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Semi Condensed'; font-weight: 600; font-display: swap; src: url('../fonts/barlow-sc-600.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Semi Condensed'; font-weight: 700; font-display: swap; src: url('../fonts/barlow-sc-700.woff2') format('woff2'); }

:root {
  --paper: #F4F6F8;
  --surface: #FFFFFF;
  --ink: #15212B;
  --ink-2: #4A5966;
  --ink-3: #647280;
  --rule: #D3DAE0;
  --rule-strong: #A9B5BF;
  --c-found: #15212B;
  --c-chip: #3557D6;
  --c-hardware: #B88600;
  --c-beyond: #B1307A;
  --ok: #1F7A4D;
  --focus: #3557D6;
  /* Status colours are reserved for state (never reused for path groups). */
  --err: #B42318; --warn: #B54708; --info: #3557D6;
  --err-bg: #FEF3F2; --warn-bg: #FFFAEB; --ok-bg: #ECFDF3;
  /* Geometry */
  --radius-sm: 4px; --radius-lg: 10px; --control-h: 2.5rem;
  --shadow-1: 0 1px 2px rgba(21, 33, 43, .06), 0 1px 3px rgba(21, 33, 43, .08);
  --shadow-2: 0 8px 28px rgba(21, 33, 43, .16);
  --seq-1: #E6ECFA; --seq-2: #C3D0F2; --seq-3: #94A9E6; --seq-4: #5F7BD8; --seq-5: #3557D6;
  --seq-ink-dark: #15212B; --seq-ink-light: #FFFFFF;

  --font-body: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-head: 'Barlow Semi Condensed', 'Barlow', system-ui, sans-serif;

  --s-1: 0.25rem; --s-2: 0.5rem; --s-3: 0.75rem; --s-4: 1rem; --s-5: 1.5rem; --s-6: 2rem; --s-7: 3rem; --s-8: 4.5rem;
  --t-sm: 0.875rem; --t-base: 1.0625rem; --t-md: 1.3125rem; --t-lg: 1.625rem; --t-xl: 2.0625rem; --t-2xl: 2.625rem; --t-3xl: 3.25rem;
  --radius: 6px;
  --wrap: 72rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #111B23; --surface: #17232D; --ink: #E4EAEF; --ink-2: #A3B0BB; --ink-3: #8A98A4;
    --rule: #283743; --rule-strong: #3C4D5A; --c-found: #E4EAEF;
    --c-chip: #6F87F2; --c-hardware: #B98A14; --c-beyond: #D4609C; --ok: #4CB884; --focus: #8DA2F2; --err: #F97066; --warn: #F79009; --info: #8DA2F2; --err-bg: #2A1416; --warn-bg: #2A1F0E; --ok-bg: #0F2A1E; --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 10px 30px rgba(0,0,0,.5);
    --seq-1: #1E2A4A; --seq-2: #2A3D73; --seq-3: #3A55A0; --seq-4: #5A76D0; --seq-5: #8DA2F2;
    --seq-ink-dark: #E4EAEF; --seq-ink-light: #111B23;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --paper: #111B23; --surface: #17232D; --ink: #E4EAEF; --ink-2: #A3B0BB; --ink-3: #8A98A4;
  --rule: #283743; --rule-strong: #3C4D5A; --c-found: #E4EAEF;
  --c-chip: #6F87F2; --c-hardware: #B98A14; --c-beyond: #D4609C; --ok: #4CB884; --focus: #8DA2F2; --err: #F97066; --warn: #F79009; --info: #8DA2F2; --err-bg: #2A1416; --warn-bg: #2A1F0E; --ok-bg: #0F2A1E; --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 10px 30px rgba(0,0,0,.5);
  --seq-1: #1E2A4A; --seq-2: #2A3D73; --seq-3: #3A55A0; --seq-4: #5A76D0; --seq-5: #8DA2F2;
  --seq-ink-dark: #E4EAEF; --seq-ink-light: #111B23;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font-body); font-size: var(--t-base); line-height: 1.55;
  text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: var(--s-2) var(--s-4); z-index: 10; }
.skip:focus { left: var(--s-4); }

h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; line-height: 1.15; margin: 0 0 var(--s-3); letter-spacing: -0.005em; }
h1 { font-size: clamp(2.1rem, 4.4vw + 0.6rem, var(--t-3xl)); font-weight: 700; letter-spacing: -0.015em; }
h2 { font-size: clamp(1.6rem, 2vw + 0.8rem, var(--t-xl)); }
h3 { font-size: var(--t-md); }
h4 { font-size: var(--t-base); }
p { margin: 0 0 var(--s-4); max-width: 68ch; }
.lede { font-size: var(--t-md); color: var(--ink-2); line-height: 1.45; max-width: 52ch; }
.muted { color: var(--ink-2); }
.small { font-size: var(--t-sm); }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--s-5); }
@media (max-width: 40rem) { .wrap { padding: 0 var(--s-4); } }

/* ── Header ─────────────────────────────────────────────── */
.site-head { border-bottom: 1px solid var(--rule); background: var(--paper); position: sticky; top: 0; z-index: 5; }
.site-head .wrap { display: flex; align-items: center; gap: var(--s-5); min-height: 3.75rem; }
.brand { display: flex; align-items: center; gap: var(--s-2); text-decoration: none; font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; letter-spacing: -0.01em; }
.brand svg { width: 28px; height: 28px; }
.nav { display: flex; gap: var(--s-1); margin-left: auto; }
.nav a { text-decoration: none; padding: var(--s-2) var(--s-3); border-radius: var(--radius); color: var(--ink-2); font-weight: 500; }
.nav a:hover { color: var(--ink); background: var(--surface); }
.nav a[aria-current='page'] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); border-radius: 0; }
.head-tools { display: flex; align-items: center; gap: var(--s-2); }
.streak-chip { display: none; align-items: center; gap: 6px; font-size: var(--t-sm); color: var(--ink-2); padding: 4px 10px; border: 1px solid var(--rule); border-radius: 999px; text-decoration: none; white-space: nowrap; }
.streak-chip.on { display: inline-flex; }
.streak-chip svg { width: 14px; height: 14px; }
.icon-btn { background: none; border: 1px solid var(--rule); color: var(--ink-2); width: 2.25rem; height: 2.25rem; border-radius: var(--radius); cursor: pointer; display: inline-grid; place-items: center; }
.icon-btn:hover { color: var(--ink); border-color: var(--rule-strong); }
.icon-btn svg { width: 18px; height: 18px; }
.menu-btn { display: none; }

@media (max-width: 68rem) {
  .menu-btn { display: inline-grid; }
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--paper); border-bottom: 1px solid var(--rule); flex-direction: column; padding: var(--s-2) var(--s-4) var(--s-4); }
  .nav.open { display: flex; }
  .nav a { padding: var(--s-3) var(--s-2); }
  .nav a[aria-current='page'] { box-shadow: inset 3px 0 0 var(--ink); padding-left: var(--s-4); }
  .head-tools { margin-left: auto; }
}

/* ── Buttons ────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: var(--s-2); font: inherit; font-weight: 600; padding: 0.65rem 1.1rem; border-radius: var(--radius); border: 1px solid var(--ink); background: var(--ink); color: var(--paper); text-decoration: none; cursor: pointer; line-height: 1.2; }
.btn:hover { background: color-mix(in srgb, var(--ink) 86%, var(--paper)); text-decoration: none; }
.btn.secondary { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.btn.secondary:hover { border-color: var(--ink); background: var(--surface); }
.btn.small { padding: 0.4rem 0.75rem; font-size: var(--t-sm); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s-3); margin: var(--s-5) 0; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ── Sections ───────────────────────────────────────────── */
main { display: block; }
.section { padding: var(--s-7) 0; border-top: 1px solid var(--rule); }
.section:first-child { border-top: 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-5); }
.section-head p { margin: 0; color: var(--ink-2); }
.page-head { padding: var(--s-7) 0 var(--s-5); }
.crumbs { font-size: var(--t-sm); color: var(--ink-2); margin-bottom: var(--s-4); }
.crumbs a { color: var(--ink-2); }
.explain { font-size: var(--t-sm); color: var(--ink-2); border-left: 2px solid var(--rule-strong); padding: 2px 0 2px var(--s-3); margin: 0 0 var(--s-5); max-width: 68ch; }

/* ── Hero with route map ────────────────────────────────── */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 26rem); gap: var(--s-7); padding: var(--s-7) 0 var(--s-6); align-items: start; }
.hero-copy { padding-top: var(--s-5); position: sticky; top: 5rem; }
.hero h1 { max-width: 14ch; }
@media (max-width: 60rem) { .hero { grid-template-columns: minmax(0, 1fr); gap: var(--s-5); } .hero-copy { position: static; padding-top: 0; } }

.year-pick { margin-top: var(--s-6); }
.year-pick fieldset { border: 0; padding: 0; margin: 0; }
.year-pick legend { font-weight: 600; margin-bottom: var(--s-2); }
.seg { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: var(--radius); overflow: hidden; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: block; padding: 0.5rem 0.95rem; border-right: 1px solid var(--rule); cursor: pointer; font-weight: 500; }
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { background: var(--ink); color: var(--paper); }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -2px; }
.next-step { margin-top: var(--s-4); padding: var(--s-4); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); max-width: 34rem; }
.next-step[hidden] { display: none; }
.next-step h3 { font-size: var(--t-base); margin-bottom: var(--s-2); }
.next-step p { margin-bottom: var(--s-2); color: var(--ink-2); }

.routemap { width: 100%; height: auto; display: block; font-family: var(--font-body); }
.routemap .trunk { stroke: var(--c-found); stroke-width: 6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.routemap .rail { stroke-width: 6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.routemap .rail.chip { stroke: var(--c-chip); } .routemap .rail.hardware { stroke: var(--c-hardware); } .routemap .rail.beyond { stroke: var(--c-beyond); }
.routemap .stop { fill: var(--paper); stroke-width: 3; }
.routemap .stop.found { stroke: var(--c-found); }
.routemap .stop.chip { stroke: var(--c-chip); } .routemap .stop.hardware { stroke: var(--c-hardware); } .routemap .stop.beyond { stroke: var(--c-beyond); }
.routemap .stop.done.chip { fill: var(--c-chip); } .routemap .stop.done.hardware { fill: var(--c-hardware); } .routemap .stop.done.beyond { fill: var(--c-beyond); }
.routemap .name { font-family: var(--font-head); font-weight: 600; font-size: 16px; fill: var(--ink); }
.routemap .meta { font-size: 12.5px; fill: var(--ink-2); }
.routemap .gname { font-family: var(--font-head); font-weight: 700; font-size: 13px; fill: var(--ink-2); letter-spacing: .02em; }
.routemap a:hover .name, .routemap a:focus .name { text-decoration: underline; }
.routemap a:focus { outline: none; }
.routemap a:focus-visible .hit { stroke: var(--focus); stroke-width: 2; }
.routemap .hit { fill: transparent; }
.routemap .pct { font-size: 12.5px; font-weight: 600; fill: var(--ink); }
.map-caption { font-size: var(--t-sm); color: var(--ink-2); margin-top: var(--s-3); }

/* ── Group / path list ──────────────────────────────────── */
.group { margin-bottom: var(--s-7); }
.group:last-child { margin-bottom: 0; }
.group-head { display: grid; grid-template-columns: 6px 1fr; gap: var(--s-4); margin-bottom: var(--s-4); }
.group-head .bar { border-radius: 3px; }
.group-head h3 { margin-bottom: 2px; font-size: var(--t-lg); }
.group-head p { margin: 0; color: var(--ink-2); }
.bar.chip, .sw.chip { background: var(--c-chip); } .bar.hardware, .sw.hardware { background: var(--c-hardware); } .bar.beyond, .sw.beyond { background: var(--c-beyond); } .bar.found, .sw.found { background: var(--c-found); }

.path-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.path-item { border-bottom: 1px solid var(--rule); }
.path-item a { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.6fr) auto; gap: var(--s-5); align-items: baseline; padding: var(--s-4) var(--s-2); text-decoration: none; }
.path-item a:hover { background: var(--surface); }
.path-item h4 { font-size: var(--t-md); margin: 0; display: flex; align-items: center; gap: var(--s-3); }
.path-item h4 .sw { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.path-item p { margin: 0; color: var(--ink-2); }
.path-item .when { font-size: var(--t-sm); color: var(--ink-2); white-space: nowrap; text-align: right; }
.path-item .when b { display: block; color: var(--ink); font-weight: 600; }
@media (max-width: 48rem) {
  .path-item a { grid-template-columns: minmax(0, 1fr); gap: var(--s-1); }
  .path-item .when { text-align: left; white-space: normal; }
  .path-item .when b { display: inline; margin-right: var(--s-2); }
}

/* ── Path page ──────────────────────────────────────────── */
.path-hero { padding: var(--s-7) 0 var(--s-5); border-bottom: 1px solid var(--rule); }
.path-hero .line { height: 6px; border-radius: 3px; width: 5rem; margin-bottom: var(--s-5); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--s-5) var(--s-6); margin-top: var(--s-6); }
.facts h3 { font-size: var(--t-base); margin-bottom: var(--s-2); }
.facts ul { margin: 0; padding-left: 1.1rem; }
.facts p { margin: 0; color: var(--ink-2); }
.overall { display: flex; align-items: center; gap: var(--s-4); margin-top: var(--s-6); flex-wrap: wrap; }
.meter { flex: 1 1 14rem; max-width: 22rem; height: 8px; background: var(--rule); border-radius: 4px; overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; border-radius: 4px; transition: width .3s ease; }
.meter.chip > i { background: var(--c-chip); } .meter.hardware > i { background: var(--c-hardware); } .meter.beyond > i { background: var(--c-beyond); } .meter.found > i { background: var(--c-found); }
.overall .num { font-weight: 600; font-variant-numeric: tabular-nums; }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-7); }
@media (max-width: 52rem) { .two-col { grid-template-columns: minmax(0, 1fr); gap: var(--s-6); } }

/* Route diagram: stages as stations, ending in job roles */
.route { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)) minmax(0, 1.2fr); position: relative; counter-reset: st; }
.route::before { content: ''; position: absolute; left: 14px; right: 0; top: 13px; height: 6px; border-radius: 3px; background: var(--line); }
.route > li { position: relative; padding: 42px var(--s-3) 0 0; counter-increment: st; }
.route > li a { text-decoration: none; display: block; }
.route > li a:hover strong { text-decoration: underline; }
.route .dot { position: absolute; top: 2px; left: 2px; width: 28px; height: 28px; border-radius: 50%; background: var(--paper); border: 4px solid var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--ink); }
.route .dot::after { content: counter(st); }
.route > li.done .dot { background: var(--line); color: var(--paper); }
.route > li.done .dot::after { content: '✓'; }
.route strong { display: block; font-family: var(--font-head); font-weight: 600; font-size: 1.05rem; line-height: 1.2; }
.route small { display: block; color: var(--ink-2); font-size: var(--t-sm); margin-top: 2px; font-variant-numeric: tabular-nums; }
.route > li.end .dot { border-radius: 4px; background: var(--ink); border-color: var(--ink); }
.route > li.end .dot::after { content: ''; }
.route li.end ul { margin: 4px 0 0; padding-left: 1rem; font-size: var(--t-sm); color: var(--ink-2); }
@media (max-width: 52rem) {
  .route { grid-template-columns: minmax(0, 1fr); }
  .route::before { left: 13px; right: auto; top: 14px; bottom: 14px; width: 6px; height: auto; }
  .route > li { padding: 2px 0 var(--s-5) 48px; }
}

.stage { padding: var(--s-7) 0; border-top: 1px solid var(--rule); scroll-margin-top: 4.5rem; }
.stage-head { display: grid; grid-template-columns: 2.5rem minmax(0, 1fr) auto; gap: var(--s-4); align-items: start; margin-bottom: var(--s-5); }
.stage-num { width: 2.5rem; height: 2.5rem; border-radius: 50%; border: 4px solid var(--line); display: grid; place-items: center; font-weight: 700; font-family: var(--font-head); }
.stage.done .stage-num { background: var(--line); color: var(--paper); }
.stage-head h2 { margin-bottom: 4px; font-size: var(--t-lg); }
.stage-head p { margin: 0; color: var(--ink-2); }
.stage-count { font-size: var(--t-sm); color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; padding-top: 6px; }
.stage-body { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: var(--s-7); padding-left: calc(2.5rem + var(--s-4)); }
@media (max-width: 52rem) { .stage-body { grid-template-columns: minmax(0, 1fr); gap: var(--s-6); padding-left: 0; } .stage-head { grid-template-columns: 2.5rem 1fr; } .stage-count { grid-column: 2; padding-top: 0; } }
.stage-body h3 { font-size: var(--t-base); color: var(--ink-2); font-family: var(--font-body); font-weight: 600; margin-bottom: var(--s-3); }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { border-bottom: 1px solid var(--rule); }
.checklist li:first-child { border-top: 1px solid var(--rule); }
.checklist label { display: flex; gap: var(--s-3); align-items: flex-start; padding: 0.7rem 0; cursor: pointer; }
.checklist input { appearance: none; -webkit-appearance: none; width: 1.25rem; height: 1.25rem; border: 2px solid var(--rule-strong); border-radius: 4px; margin: 2px 0 0; flex: none; display: grid; place-items: center; cursor: pointer; background: var(--surface); }
.checklist input::after { content: ''; width: 0.65rem; height: 0.35rem; border-left: 2px solid var(--paper); border-bottom: 2px solid var(--paper); transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
.checklist input:checked { background: var(--line, var(--ink)); border-color: var(--line, var(--ink)); }
.checklist input:checked::after { opacity: 1; }
.checklist input:checked + span { color: var(--ink-2); }
.checklist .when-done { margin-left: auto; font-size: var(--t-sm); color: var(--ink-3); white-space: nowrap; }

.resources { list-style: none; margin: 0; padding: 0; }
.resources li { padding: var(--s-3) 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 5.25rem minmax(0, 1fr); gap: var(--s-3); }
.resources li:first-child { border-top: 1px solid var(--rule); }
.rtype { font-size: 0.75rem; font-weight: 600; color: var(--ink-2); border: 1px solid var(--rule-strong); border-radius: 4px; padding: 1px 6px; height: fit-content; text-align: center; margin-top: 3px; }
.resources a { font-weight: 600; }
.resources .by { color: var(--ink-2); font-size: var(--t-sm); }
.resources .note { display: block; font-size: var(--t-sm); color: var(--ink-2); margin-top: 2px; }
.project { margin-top: var(--s-5); padding: var(--s-4); background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--line); border-radius: var(--radius); }
.project h4 { margin-bottom: 4px; font-family: var(--font-body); font-weight: 600; }
.project p { margin: 0; color: var(--ink-2); }

/* ── Charts ─────────────────────────────────────────────── */
.chart-title { font-size: var(--t-base); font-family: var(--font-body); font-weight: 600; margin-bottom: 2px; }
.chart-sub { font-size: var(--t-sm); color: var(--ink-2); margin-bottom: var(--s-4); }
.hbars { display: grid; grid-template-columns: max-content minmax(0, 1fr) 2.5rem; gap: 10px var(--s-3); align-items: center; }
.hbars .lbl { font-size: var(--t-sm); color: var(--ink); }
.hbars .track { position: relative; height: 14px; background-image: linear-gradient(to right, var(--rule) 1px, transparent 1px); background-size: 20% 100%; border-left: 1px solid var(--rule-strong); }
.hbars .fill { height: 100%; border-radius: 0 4px 4px 0; display: block; }
.hbars .val { font-size: var(--t-sm); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.tip { position: relative; }
.tip:hover::after, .tip:focus-visible::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); background: var(--ink); color: var(--paper); font-size: 0.8125rem; line-height: 1.35; padding: 6px 9px; border-radius: 4px; white-space: nowrap; z-index: 3; pointer-events: none; }

.heat { border-collapse: separate; border-spacing: 2px; width: 100%; font-size: var(--t-sm); }
.heat th { font-weight: 600; text-align: left; padding: 6px 8px; vertical-align: bottom; }
.heat thead th { font-size: 0.8125rem; color: var(--ink-2); text-align: center; }
.heat tbody th a { text-decoration: none; display: flex; align-items: center; gap: 8px; }
.heat tbody th a:hover { text-decoration: underline; }
.heat tbody th .sw { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.heat td { text-align: center; padding: 8px 4px; border-radius: 4px; font-variant-numeric: tabular-nums; font-weight: 600; min-width: 3.25rem; }
.heat td.v1 { background: var(--seq-1); color: var(--seq-ink-dark); } .heat td.v2 { background: var(--seq-2); color: var(--seq-ink-dark); }
.heat td.v3 { background: var(--seq-3); color: var(--seq-ink-dark); } .heat td.v4 { background: var(--seq-4); color: var(--seq-ink-light); } .heat td.v5 { background: var(--seq-5); color: var(--seq-ink-light); }
.heat-wrap { overflow-x: auto; }
.legend-seq { display: flex; align-items: center; gap: 6px; font-size: var(--t-sm); color: var(--ink-2); margin-top: var(--s-3); }
.legend-seq i { width: 22px; height: 12px; border-radius: 2px; display: inline-block; }

.ranges { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr); gap: 10px var(--s-4); align-items: center; }
.ranges .lbl { font-size: var(--t-sm); display: flex; align-items: center; gap: 8px; }
.ranges .lbl .sw { width: 8px; height: 8px; border-radius: 50%; }
.ranges .track { position: relative; height: 18px; background-image: linear-gradient(to right, var(--rule) 1px, transparent 1px); background-size: calc(100% / 6) 100%; border-left: 1px solid var(--rule-strong); }
.ranges .span { position: absolute; top: 5px; height: 8px; border-radius: 4px; }
.ranges .span.chip { background: var(--c-chip); } .ranges .span.hardware { background: var(--c-hardware); } .ranges .span.beyond { background: var(--c-beyond); }
.ranges .axis { grid-column: 2; display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ── Foundation timeline ────────────────────────────────── */
.years { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-6); }
@media (max-width: 48rem) { .years { grid-template-columns: minmax(0, 1fr); } }
.year h3 { display: flex; align-items: center; gap: var(--s-3); }
.year h3::before { content: ''; width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--c-found); }
.subjects { list-style: none; margin: 0; padding: 0 0 0 6px; border-left: 4px solid var(--c-found); }
.subjects li { padding: var(--s-3) 0 var(--s-3) var(--s-4); position: relative; }
.subjects li::before { content: ''; position: absolute; left: -4px; top: 1.15rem; width: 12px; height: 2px; background: var(--c-found); }
.subjects strong { display: block; font-weight: 600; }
.feeds { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 4px; }
.feeds a { font-size: 0.8125rem; text-decoration: none; display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); border: 1px solid var(--rule); border-radius: 999px; padding: 1px 8px 1px 6px; }
.feeds a:hover { color: var(--ink); border-color: var(--rule-strong); }
.feeds .sw { width: 7px; height: 7px; border-radius: 50%; }

/* ── Daily ──────────────────────────────────────────────── */
.daily-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: var(--s-7); }
@media (max-width: 52rem) { .daily-grid { grid-template-columns: minmax(0, 1fr); } }
.concept .subject, .iq .subject { font-size: var(--t-sm); color: var(--ink-2); margin-bottom: var(--s-2); }
.concept .formula { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 0.95rem; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--s-3) var(--s-4); display: inline-block; margin-bottom: var(--s-4); }
.concept .diagram { color: var(--ink); max-width: 22rem; margin: var(--s-2) 0 var(--s-4); }
.concept .diagram svg { width: 100%; height: auto; }
.qz { counter-reset: q; }
.qz fieldset { border: 0; padding: 0; margin: 0 0 var(--s-5); counter-increment: q; }
.qz legend { font-weight: 600; margin-bottom: var(--s-2); }
.qz legend::before { content: counter(q) '. '; color: var(--ink-2); }
.qz label { display: flex; gap: var(--s-3); align-items: flex-start; padding: 0.45rem 0.6rem; border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 6px; cursor: pointer; background: var(--surface); }
.qz label:hover { border-color: var(--rule-strong); }
.qz input { margin-top: 5px; accent-color: var(--ink); }
.qz label.right { border-color: var(--ok); box-shadow: inset 3px 0 0 var(--ok); }
.qz label.wrong { border-color: var(--err); box-shadow: inset 3px 0 0 var(--err); }
.qz .why { font-size: var(--t-sm); color: var(--ink-2); margin: 4px 0 0; }
.score { font-family: var(--font-head); font-size: var(--t-xl); font-weight: 700; }
.iq details { border-top: 1px solid var(--rule); padding: var(--s-3) 0; }
.iq summary { cursor: pointer; font-weight: 600; }

/* ── Tools ──────────────────────────────────────────────── */
.tool-index { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-5); }
.tool-index a { font-size: var(--t-sm); text-decoration: none; border: 1px solid var(--rule); padding: 4px 10px; border-radius: 999px; color: var(--ink-2); }
.tool-index a:hover { color: var(--ink); border-color: var(--rule-strong); }
.tool { padding: var(--s-6) 0; border-top: 1px solid var(--rule); scroll-margin-top: 4.5rem; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-6); }
@media (max-width: 52rem) { .tool { grid-template-columns: minmax(0, 1fr); gap: var(--s-4); } }
.tool h2 { font-size: var(--t-lg); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: var(--s-3); }
.field { display: flex; flex-direction: column; gap: 4px; font-size: var(--t-sm); font-weight: 500; }
.field input, .field select { font: inherit; font-size: var(--t-base); padding: 0.5rem 0.6rem; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); width: 100%; }
.result { margin-top: var(--s-4); padding: var(--s-4); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); font-variant-numeric: tabular-nums; }
.result strong { font-family: var(--font-head); font-size: var(--t-lg); display: block; }
.resistor-svg { width: 100%; max-width: 20rem; height: auto; display: block; margin-top: var(--s-3); }

/* ── Progress ───────────────────────────────────────────── */
.stat-row { display: flex; flex-wrap: wrap; gap: var(--s-6); margin: var(--s-5) 0; }
.stat b { display: block; font-family: var(--font-head); font-size: var(--t-2xl); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.stat span { color: var(--ink-2); font-size: var(--t-sm); }
.prog-table { width: 100%; border-collapse: collapse; }
.prog-table th, .prog-table td { text-align: left; padding: var(--s-3) var(--s-2); border-bottom: 1px solid var(--rule); vertical-align: middle; }
.prog-table th { font-size: var(--t-sm); color: var(--ink-2); font-weight: 600; }
.prog-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.prog-table .meter { max-width: 12rem; }
.cal { display: grid; grid-template-columns: repeat(auto-fill, 14px); gap: 3px; max-width: 40rem; }
.cal i { width: 14px; height: 14px; border-radius: 3px; background: var(--rule); }
.cal i.on { background: var(--ok); }
.panel { padding: var(--s-5); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.panel + .panel { margin-top: var(--s-4); }
.panel h3 { font-size: var(--t-md); }
.notice { padding: var(--s-3) var(--s-4); border-radius: var(--radius); border: 1px solid var(--rule-strong); background: var(--surface); margin: var(--s-4) 0; font-size: var(--t-sm); }
.notice[hidden] { display: none; }
.notice.ok { border-color: var(--ok); }
.notice.warn { border-color: var(--warn); background: var(--warn-bg); }
.notice.error { border-color: var(--err); background: var(--err-bg); }
.notice.ok { background: var(--ok-bg); }
.share-preview { width: 100%; max-width: 36rem; height: auto; border: 1px solid var(--rule); border-radius: var(--radius); display: block; margin: var(--s-4) 0; }

/* ── Finder ─────────────────────────────────────────────── */
.finder { max-width: 44rem; }
.finder .step-count { font-size: var(--t-sm); color: var(--ink-2); margin-bottom: var(--s-2); font-variant-numeric: tabular-nums; }
.finder .q { font-size: var(--t-lg); font-family: var(--font-head); font-weight: 600; margin-bottom: var(--s-4); }
.finder .opts { display: grid; gap: var(--s-2); }
.finder .opt { text-align: left; font: inherit; padding: var(--s-3) var(--s-4); border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink); border-radius: var(--radius); cursor: pointer; }
.finder .opt:hover { border-color: var(--ink); }
.finder .progressbar { height: 4px; background: var(--rule); border-radius: 2px; margin-bottom: var(--s-5); overflow: hidden; }
.finder .progressbar i { display: block; height: 100%; background: var(--ink); transition: width .25s ease; }
.match { display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); gap: var(--s-4); padding: var(--s-4) 0; border-bottom: 1px solid var(--rule); }
.match .rank { font-family: var(--font-head); font-weight: 700; font-size: var(--t-xl); color: var(--ink-2); line-height: 1; }
.match h3 { margin-bottom: 4px; }
.match p { margin: 0 0 var(--s-2); color: var(--ink-2); }

/* ── Ads ────────────────────────────────────────────────── */
.ad { margin: var(--s-6) auto; max-width: 100%; text-align: center; }
.ad .ad-label { display: block; font-size: 0.6875rem; color: var(--ink-3); margin-bottom: 4px; letter-spacing: .02em; }
.ad .ad-box { margin: 0 auto; display: grid; place-items: center; color: var(--ink-3); font-size: var(--t-sm); }
.ad.placeholder .ad-box { border: 1px dashed var(--rule-strong); border-radius: var(--radius); }
.ad.banner .ad-box { width: 100%; max-width: 728px; min-height: 90px; }
.ad.inline .ad-box { width: 100%; max-width: 336px; min-height: 280px; }
@media (max-width: 40rem) { .ad.banner .ad-box { min-height: 100px; max-width: 320px; } }
.ad.wide .ad-box { width: 100%; min-height: 120px; }

/* ── Footer ─────────────────────────────────────────────── */
.site-foot { border-top: 1px solid var(--rule); margin-top: var(--s-8); padding: var(--s-6) 0 var(--s-7); color: var(--ink-2); font-size: var(--t-sm); }
.site-foot .wrap { display: grid; grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)); gap: var(--s-6); }
@media (max-width: 48rem) { .site-foot .wrap { grid-template-columns: minmax(0, 1fr); gap: var(--s-4); } }
.site-foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.site-foot h4 { color: var(--ink); font-family: var(--font-body); font-weight: 600; font-size: var(--t-sm); }

/* ── Install / update toast ─────────────────────────────── */
.toast { position: fixed; left: 50%; bottom: var(--s-4); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: var(--s-3) var(--s-4); border-radius: var(--radius); font-size: var(--t-sm); display: flex; gap: var(--s-4); align-items: center; z-index: 20; max-width: calc(100% - 2rem); }
.toast[hidden] { display: none; }
.toast button { background: none; border: 1px solid color-mix(in srgb, var(--paper) 50%, transparent); color: var(--paper); border-radius: 4px; padding: 4px 10px; font: inherit; cursor: pointer; }

.prose h2 { margin-top: var(--s-6); font-size: var(--t-lg); }
.prose ul { padding-left: 1.2rem; max-width: 68ch; }
.prose li { margin-bottom: 6px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
@media print { .site-head, .site-foot, .ad, .toast { display: none !important; } body { background: #fff; } }

/* ── Announcements ──────────────────────────────────────── */
.announce-bar { background: var(--surface); border-bottom: 1px solid var(--rule); font-size: var(--t-sm); }
.announce-bar[hidden] { display: none; }
.announce-bar .wrap { display: flex; align-items: center; gap: var(--s-3); min-height: 2.5rem; }
.announce-bar p { margin: 0; max-width: none; flex: 1; padding: 6px 0; }
.announce-close { background: none; border: 0; color: var(--ink-2); font-size: 1.25rem; line-height: 1; width: 2rem; height: 2rem; cursor: pointer; border-radius: var(--radius); }
.announce-close:hover { color: var(--ink); background: var(--paper); }
.updates { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.updates li { padding: var(--s-4) 0; border-bottom: 1px solid var(--rule); }
.updates li[hidden] { display: none; }
.updates h3 { margin: 6px 0 4px; font-size: var(--t-md); }
.updates p { margin: 0 0 6px; color: var(--ink-2); }
.update-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); font-size: var(--t-sm); color: var(--ink-2); }
.update-meta .rtype { margin-top: 0; }
.update-meta .deadline { color: var(--ink); font-weight: 600; }
.past-updates { margin-top: var(--s-6); }
.past-updates summary { cursor: pointer; font-weight: 600; margin-bottom: var(--s-3); }
.updates-home { padding-bottom: var(--s-5); }

/* ── Year focus and folded stages ───────────────────────── */
.year-focus { margin-top: var(--s-5); max-width: 44rem; }
.later-note { display: none; color: var(--ink-2); padding-left: calc(2.5rem + var(--s-4)); margin: 0; }
.stage.later { padding: var(--s-5) 0; }
.stage.later .stage-body { display: none; }
.stage.later .later-note { display: block; }
.stage.later .stage-head { margin-bottom: var(--s-2); opacity: .7; }
@media (max-width: 52rem) { .later-note { padding-left: 0; } }

/* ── Badges ─────────────────────────────────────────────── */
.badge-list { list-style: none; margin: var(--s-3) 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: var(--s-3); }
.badge { display: flex; gap: var(--s-3); align-items: center; padding: var(--s-3); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.badge strong { display: block; font-family: var(--font-head); font-weight: 600; }
.badge-mark { width: 2.25rem; height: 2.25rem; flex: none; border-radius: 50%; display: grid; place-items: center; color: var(--paper); font-weight: 700; background: var(--c-found); }
.badge.chip .badge-mark { background: var(--c-chip); } .badge.hardware .badge-mark { background: var(--c-hardware); } .badge.beyond .badge-mark { background: var(--c-beyond); }

/* ── Chips (quiz subject, input toggles) ────────────────── */
.subject-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: var(--s-4); }
.pill, .toggle { font: inherit; font-size: var(--t-sm); padding: 4px 11px; border: 1px solid var(--rule-strong); border-radius: 999px; background: var(--surface); color: var(--ink); cursor: pointer; }
.pill:hover, .toggle:hover { border-color: var(--ink); }
.pill[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ── Finder mini route ──────────────────────────────────── */
.mini-route { list-style: none; margin: var(--s-3) 0; padding: 0 0 0 4px; border-left: 4px solid var(--c-found); counter-reset: mr; }
.mini-route.chip { border-color: var(--c-chip); } .mini-route.hardware { border-color: var(--c-hardware); } .mini-route.beyond { border-color: var(--c-beyond); }
.mini-route li { padding: 3px 0 3px var(--s-3); font-size: var(--t-sm); counter-increment: mr; }
.mini-route li::before { content: counter(mr) ". "; color: var(--ink-2); }

/* ── Logic tools ────────────────────────────────────────── */
.mono, .field input.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.result strong.mono { font-size: 1.15rem; word-break: break-word; margin-bottom: var(--s-2); }
.kv { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: var(--s-3); font-size: var(--t-sm); padding: 3px 0; }
.kv .k, .groups .k { color: var(--ink-2); }
.kv .v { word-break: break-word; }
.error-text { color: var(--err); margin: 0; font-weight: 500; }
.tt-wrap { max-height: 22rem; overflow: auto; margin-top: var(--s-3); border: 1px solid var(--rule); border-radius: var(--radius); }
.tt { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: var(--t-sm); text-align: center; }
.tt th { position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--rule-strong); padding: 5px 8px; }
.tt td { padding: 3px 8px; border-bottom: 1px solid var(--rule); }
.tt .idx { color: var(--ink-3); }
.tt .out { font-weight: 700; border-left: 1px solid var(--rule-strong); }
.tt tr.one td { background: color-mix(in srgb, var(--c-chip) 12%, transparent); }
.kmap-wrap { margin-top: var(--s-4); overflow-x: auto; }
.kmap { border-collapse: separate; border-spacing: 4px; font-variant-numeric: tabular-nums; }
.kmap th { font-size: var(--t-sm); color: var(--ink-2); font-weight: 600; padding: 2px 6px; }
.kmap th.corner { position: relative; width: 3.25rem; height: 2.5rem; background: linear-gradient(to top right, transparent calc(50% - 1px), var(--rule-strong) 50%, transparent calc(50% + 1px)); }
.kmap .corner .cv { position: absolute; right: 4px; top: 0; }
.kmap .corner .rv { position: absolute; left: 4px; bottom: 0; }
.kmap .cell { position: relative; width: 3.25rem; height: 3.25rem; font: inherit; font-size: 1.2rem; font-weight: 700; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink-3); cursor: pointer; }
.kmap .cell.v1 { color: var(--ink); background: color-mix(in srgb, var(--c-chip) 14%, var(--surface)); border-color: var(--c-chip); }
.kmap .cell.v2 { color: var(--c-hardware); }
.kmap .cell.hl { outline: 3px solid var(--c-beyond); outline-offset: -3px; }
.kmap .cell .m { position: absolute; left: 4px; top: 2px; font-size: 0.625rem; font-weight: 500; color: var(--ink-3); }
.groups { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: var(--s-2); font-size: var(--t-sm); }
.group-chip { font-size: 0.9rem; padding: 3px 10px; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--paper); color: var(--ink); cursor: pointer; }
.group-chip:hover, .group-chip:focus-visible { border-color: var(--c-beyond); }
.toggles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s-3); }
.toggle { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; border-radius: var(--radius); }
.toggle[aria-pressed="true"] { background: var(--c-chip); border-color: var(--c-chip); color: #fff; }
.gate-canvas { grid-column: 1 / -1; overflow-x: auto; }
.circuit { display: block; max-width: 100%; height: auto; margin: var(--s-4) auto 0; font-family: var(--font-body); }
.circuit .wire { fill: none; stroke-linejoin: round; }
.circuit .wire.off { stroke: var(--rule-strong); stroke-width: 2; }
.circuit .wire.on { stroke: var(--c-chip); stroke-width: 3.5; }
.circuit .gate path, .circuit .gate circle { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.circuit .gate .xor-back { fill: none; }
.circuit .glabel { font-size: 10px; font-weight: 600; fill: var(--ink-2); }
.circuit .gval { font-size: 11px; font-weight: 700; fill: var(--ink); }
.circuit .pin { font-size: 15px; font-weight: 600; fill: var(--ink); }
.circuit .node.on, .circuit .led.on { fill: var(--c-chip); }
.circuit .node.off, .circuit .led.off { fill: var(--rule-strong); }
.circuit .led { stroke: var(--ink); stroke-width: 2; }

/* ── SGPA ───────────────────────────────────────────────── */
.sg-rows { display: grid; gap: 6px; margin-top: var(--s-3); }
.sg-row { display: grid; grid-template-columns: minmax(0, 1fr) 5.5rem 5.5rem 2.25rem; gap: 6px; }
.sg-row input, .sg-row select { font: inherit; padding: 0.45rem 0.55rem; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); min-width: 0; }
.grade-scale { margin-bottom: var(--s-2); font-size: var(--t-sm); }
.grade-scale summary { cursor: pointer; color: var(--ink-2); }
.grade-scale .form-grid { grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr)); margin-top: var(--s-2); }

/* ── Daily motivation card ──────────────────────────────── */
.quote-card { position: fixed; right: var(--s-4); bottom: var(--s-4); max-width: 24rem; background: var(--surface); border: 1px solid var(--rule-strong); border-left: 4px solid var(--c-chip); border-radius: var(--radius); padding: var(--s-4) var(--s-6) var(--s-4) var(--s-4); z-index: 21; box-shadow: 0 6px 24px color-mix(in srgb, var(--ink) 14%, transparent); transition: opacity .5s ease; }
.quote-card.fade { opacity: 0; }
.quote-card p { margin: 4px 0 0; font-size: var(--t-md); line-height: 1.4; font-family: var(--font-head); font-weight: 600; }
.quote-label { font-size: var(--t-sm); color: var(--ink-2); }
.quote-card .announce-close { position: absolute; top: 6px; right: 6px; }
@media (max-width: 40rem) { .quote-card { left: var(--s-3); right: var(--s-3); bottom: var(--s-3); max-width: none; } }

/* ── Settings ───────────────────────────────────────────── */
.switch { display: inline-flex; align-items: center; gap: var(--s-3); font-weight: 600; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; width: 2.75rem; height: 1.5rem; border-radius: 999px; background: var(--rule-strong); position: relative; cursor: pointer; margin: 0; transition: background .2s ease; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 1.125rem; height: 1.125rem; border-radius: 50%; background: var(--surface); transition: transform .2s ease; }
.switch input:checked { background: var(--c-chip); }
.switch input:checked::after { transform: translateX(1.25rem); }
.how-works { margin-top: var(--s-4); max-width: 44rem; }
.how-works summary { cursor: pointer; font-weight: 600; }
.how-works li { color: var(--ink-2); margin-bottom: 6px; }

/* ── Formula sheets ─────────────────────────────────────── */
.sheet-list, .game-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: var(--s-4); }
.sheet-list a, .game-list a { display: block; height: 100%; padding: var(--s-4) var(--s-5); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); text-decoration: none; }
.sheet-list a:hover, .game-list a:hover { border-color: var(--ink); }
.sheet-list h3, .game-list h2 { margin-bottom: 4px; font-size: var(--t-md); }
.sheet-list p, .game-list p { color: var(--ink-2); margin-bottom: var(--s-2); }
.sheet-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); }
.sheet-body { columns: 2 26rem; column-gap: var(--s-7); }
.sheet-sec { break-inside: avoid-column; margin-bottom: var(--s-6); }
.sheet-sec h2 { font-size: var(--t-md); border-bottom: 2px solid var(--ink); padding-bottom: 4px; margin-bottom: var(--s-2); }
.sheet-sec dl { margin: 0; }
.fx { padding: 6px 0; border-bottom: 1px solid var(--rule); break-inside: avoid; }
.fx dt { font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); }
.fx dd { margin: 2px 0 0; }
.fx dd.mono { font-size: 0.95rem; line-height: 1.45; }
.fx-note { font-size: var(--t-sm); color: var(--ink-2); }
.print-only { display: none; }

@media print {
  @page { margin: 12mm; }
  .no-print, .announce-bar, .quote-card { display: none !important; }
  .print-only { display: block; }
  body { font-size: 10.5pt; color: #000; }
  .wrap { max-width: none; padding: 0; }
  .page-head { padding: 0 0 6pt; }
  .sheet-head h1 { font-size: 18pt; }
  .sheet-head .lede { font-size: 10pt; }
  .sheet-body { columns: 2; column-gap: 10mm; }
  .sheet-sec { margin-bottom: 8pt; }
  .sheet-sec h2 { font-size: 11.5pt; border-bottom-color: #000; }
  .fx { padding: 2pt 0; border-bottom-color: #ccc; }
  .fx dt { color: #333; font-size: 8.5pt; }
  .fx dd.mono { font-size: 9pt; }
  .fx-note { font-size: 8pt; }
  a { text-decoration: none; }
}

/* ── Games ──────────────────────────────────────────────── */
.game { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--s-4) var(--s-5) var(--s-5); max-width: 46rem; }
.game-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4); padding-bottom: var(--s-3); border-bottom: 1px solid var(--rule); margin-bottom: var(--s-4); }
.game-modes { display: flex; gap: 6px; }
.game-timer, .game-score { font-family: var(--font-head); font-weight: 700; font-size: var(--t-md); font-variant-numeric: tabular-nums; }
.game-timer { margin-left: auto; }
.game-stage { min-height: 16rem; border-radius: var(--radius); }
.game-stage.ok { animation: flash-ok .45s ease; }
.game-stage.bad { animation: flash-bad .45s ease; }
@keyframes flash-ok { from { background: color-mix(in srgb, var(--ok) 18%, transparent); } to { background: transparent; } }
@keyframes flash-bad { from { background: color-mix(in srgb, var(--err) 16%, transparent); } to { background: transparent; } }
.game-q { font-family: var(--font-head); font-weight: 600; font-size: var(--t-lg); margin-bottom: var(--s-3); }
.game-intro, .game-result { padding: var(--s-5) 0; }
.game-result .score { display: block; font-family: var(--font-head); font-size: var(--t-3xl); font-weight: 700; line-height: 1.1; margin: 4px 0 var(--s-2); }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); margin-top: var(--s-3); }
.choice { font: inherit; font-weight: 600; font-size: 1.05rem; padding: 0.8rem 1rem; text-align: left; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--paper); color: var(--ink); cursor: pointer; font-variant-numeric: tabular-nums; }
.choice:hover { border-color: var(--ink); }
.choice.right { border-color: var(--ok); box-shadow: inset 4px 0 0 var(--ok); }
.choice.wrong { border-color: var(--err); box-shadow: inset 4px 0 0 var(--err); }
.rr-resistor { display: block; width: 100%; max-width: 26rem; height: auto; color: var(--ink); margin: var(--s-2) 0; }
.bb-form { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.bb-input { flex: 1 1 12rem; font-size: 1.25rem; padding: 0.6rem 0.75rem; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--paper); color: var(--ink); }
.scope { display: block; width: 100%; max-width: 30rem; height: auto; }
.scope-bg { fill: #0E1A16; }
.scope-grid { stroke: #2A3D36; stroke-width: 1; }
.scope-axis { stroke: #3E5A50; stroke-width: 1.5; }
.scope-trace { fill: none; stroke: #F2C94C; stroke-width: 2.5; stroke-linejoin: round; }
.scope-label { fill: #F2C94C; font-size: 13px; font-weight: 700; }
.scope-settings { font-size: var(--t-sm); color: var(--ink-2); margin: 6px 0 0; }
.gp-wrap { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--s-4); align-items: start; }
@media (max-width: 40rem) { .gp-wrap { grid-template-columns: minmax(0, 1fr); } .choices { grid-template-columns: minmax(0, 1fr); } }
.gp-svg { display: block; width: 100%; height: auto; }
.gp-wire { fill: none; stroke: var(--ink-2); stroke-width: 2; }
.gp-gate { fill: var(--paper); stroke: var(--ink-3); stroke-width: 2; stroke-dasharray: 4 3; }
.gp-gate.set { stroke: var(--ink); stroke-dasharray: none; }
.gp-sym { font-size: 18px; font-weight: 700; fill: var(--ink); }
.gp-name { font-size: 10px; fill: var(--ink-2); }
.gp-svg .pin { font-size: 16px; font-weight: 600; fill: var(--ink); }
.gp-table .tt { font-size: var(--t-sm); }
.gp-table tr.match td.out:last-child { color: var(--ok); }
.gp-table tr.miss td.out:last-child { color: var(--err); }
.gp-selects { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-3); margin-top: var(--s-3); }
.gp-selects .field { min-width: 7rem; }
.gp-selects select { font: inherit; padding: 0.45rem 0.55rem; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--paper); color: var(--ink); }

/* ── Flashcards ─────────────────────────────────────────── */
.fc-all { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4); margin-bottom: var(--s-4); }
.deck-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.deck { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); padding: var(--s-3) 0; border-bottom: 1px solid var(--rule); }
.deck strong { display: block; font-family: var(--font-head); font-weight: 600; font-size: var(--t-md); }
.fc-stage { max-width: 44rem; }
.fc-card { background: var(--surface); border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: var(--s-5); min-height: 15rem; display: flex; flex-direction: column; }
.fc-front { font-family: var(--font-head); font-weight: 700; font-size: var(--t-xl); line-height: 1.2; margin: var(--s-2) 0 var(--s-4); }
.fc-back { border-top: 1px dashed var(--rule-strong); padding-top: var(--s-4); margin-bottom: var(--s-4); }
.fc-formula { font-size: 1.15rem; line-height: 1.5; margin-bottom: var(--s-2); }
.fc-controls { margin-top: auto; }
.fc-grades { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-2); }
.fc-grades .btn { flex-direction: column; align-items: flex-start; gap: 2px; }
.fc-grades small { font-weight: 400; font-size: 0.75rem; opacity: .85; }
@media (max-width: 40rem) { .fc-grades { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fc-done { padding: var(--s-5) 0; }

/* ── Study timer ────────────────────────────────────────── */
.tm-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-7); align-items: start; }
@media (max-width: 52rem) { .tm-grid { grid-template-columns: minmax(0, 1fr); } }
.tm-main { position: relative; text-align: center; max-width: 24rem; margin: 0 auto; }
.tm-dial { width: 100%; max-width: 20rem; height: auto; display: block; margin: 0 auto; }
.tm-track { fill: none; stroke: var(--rule); stroke-width: 10; }
.tm-ring { fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset .9s linear; }
.tm-ring.focus { stroke: var(--c-chip); } .tm-ring.break { stroke: var(--ok); } .tm-ring.idle { stroke: var(--rule-strong); }
.tm-center { position: absolute; left: 0; right: 0; top: 0; aspect-ratio: 1 / 1; max-width: 20rem; margin: 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.tm-phase { font-size: var(--t-sm); color: var(--ink-2); }
.tm-time { font-family: var(--font-head); font-weight: 700; font-size: 4rem; line-height: 1; font-variant-numeric: tabular-nums; }
.tm-buttons { justify-content: center; }
.tm-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 7rem; align-items: end; }
.tm-day { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.tm-bar { width: 100%; max-width: 2rem; background: var(--c-chip); border-radius: 4px 4px 0 0; display: block; }
.tm-day small { font-size: 0.75rem; color: var(--ink-2); }
.timer-chip.on { border-color: var(--c-chip); color: var(--ink); }

@media (max-width: 40rem) {
  .ranges { grid-template-columns: minmax(0, 1fr); row-gap: 4px; }
  .ranges .lbl { margin-top: 6px; }
  .ranges .axis { grid-column: 1; }
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll > table { min-width: 34rem; }

/* ── Search dialog ──────────────────────────────────────── */
.search-dlg { width: min(42rem, calc(100% - 2rem)); max-height: min(36rem, calc(100% - 4rem)); margin: 8vh auto auto; padding: 0; border: 1px solid var(--rule-strong); border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2); }
.search-dlg[open] { display: flex; flex-direction: column; }
.search-dlg::backdrop { background: rgba(10, 18, 24, .45); }
.search-head { display: flex; gap: var(--s-2); align-items: center; padding: var(--s-3); border-bottom: 1px solid var(--rule); }
.search-head input { flex: 1; font: inherit; font-size: 1.1rem; padding: 0.55rem 0.7rem; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--paper); color: var(--ink); min-width: 0; }
.search-status { margin: var(--s-2) var(--s-4) 0; }
.search-list { list-style: none; margin: 0; padding: var(--s-2); overflow-y: auto; flex: 1; }
.sr-item a { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: var(--s-3); padding: var(--s-2) var(--s-3); border-radius: var(--radius); text-decoration: none; align-items: start; }
.sr-item[aria-selected="true"] a { background: color-mix(in srgb, var(--c-chip) 12%, transparent); outline: 2px solid var(--focus); outline-offset: -2px; }
.sr-text strong { display: block; font-weight: 600; }
.sr-text .small { display: block; }
.search-hint { margin: 0; padding: var(--s-2) var(--s-4); border-top: 1px solid var(--rule); }
@media (max-width: 40rem) { .search-dlg { margin-top: 2vh; max-height: calc(100% - 2rem); } .sr-item a { grid-template-columns: minmax(0, 1fr); gap: 2px; } }

/* ── Breadcrumbs ────────────────────────────────────────── */
nav.crumbs { font-size: var(--t-sm); color: var(--ink-2); margin-bottom: var(--s-4); }
nav.crumbs a { color: var(--ink-2); }

/* ── Offline indicator ──────────────────────────────────── */
.offline-chip { display: inline-flex; border-color: var(--warn); color: var(--ink); }
.offline-chip[hidden] { display: none; }
@media (max-width: 40rem) { .offline-chip { font-size: 0.75rem; padding: 2px 8px; } }

/* ── Home: continue panel ───────────────────────────────── */
.continue { margin-top: var(--s-5); padding: var(--s-4); border: 1px solid var(--rule); border-left: 4px solid var(--c-chip); border-radius: var(--radius); background: var(--surface); max-width: 34rem; }
.continue-h { font-size: var(--t-base); font-family: var(--font-body); font-weight: 600; margin-bottom: var(--s-2); }
.continue p { margin: 0 0 6px; color: var(--ink-2); }
.continue p:last-child { margin-bottom: 0; }
.continue a { color: var(--ink); font-weight: 600; }

/* ── Paths filter ───────────────────────────────────────── */
.path-filter { display: grid; gap: var(--s-3); margin-bottom: var(--s-6); max-width: 46rem; }
.path-filter input { font: inherit; padding: 0.55rem 0.7rem; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); width: 100%; }
.filter-groups { display: flex; flex-wrap: wrap; gap: 6px; }
.path-filter p { margin: 0; }
.path-item[hidden], .group[hidden] { display: none; }

/* ── Footer headings (correct level, same look) ─────────── */
.site-foot .foot-h { color: var(--ink); font-family: var(--font-body); font-weight: 600; font-size: var(--t-sm); margin-bottom: var(--s-3); }

/* ── Badges still to earn ───────────────────────────────── */
.badge.locked { background: transparent; border-style: dashed; }
.badge.locked .badge-mark { background: var(--paper); color: var(--ink-2); border: 2px dashed var(--rule-strong); font-size: var(--t-sm); }
#badges .chart-title { margin-top: var(--s-5); }

/* ── Your data / import preview ─────────────────────────── */
.kv-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px var(--s-5); margin: 0 0 var(--s-4); }
.kv-list dt { font-weight: 600; }
.kv-list dd { margin: 0; color: var(--ink-2); }
@media (max-width: 40rem) { .kv-list { grid-template-columns: minmax(0, 1fr); } .kv-list dd { margin-bottom: var(--s-2); } }
.import-list { margin: 6px 0; padding-left: 1.2rem; }
.notice strong { display: block; }

/* Visual QA fixes */
.brand svg { flex: none; }
.search-head input::-webkit-search-cancel-button { display: none; }
.search-head .icon-btn { font-size: 1.4rem; line-height: 1; flex: none; }
@media (max-width: 26rem) { .brand span { font-size: 1.05rem; } .head-tools { gap: 4px; } .head-tools .icon-btn { width: 2.1rem; height: 2.1rem; } }

/* ════════════════════════════════════════════════════════════════════════
   Theme upgrade: one brand colour (deep petrol, like a PCB solder mask seen
   under lab light) for actions, links and focus. Path-group colours stay
   reserved for the three career groups; status colours stay reserved for
   state. Both themes tested for contrast (≥ 6.5:1 for brand text).
   ════════════════════════════════════════════════════════════════════════ */
:root {
  --brand: #0B5C6E; --brand-ink: #FFFFFF; --brand-tint: #E3F0F2; --brand-strong: #084756;
  --math: 'Cambria Math', Cambria, 'STIX Two Math', 'STIX Two Text', 'Latin Modern Math', 'Noto Serif', 'Times New Roman', serif;
  --grid-line: rgba(11, 92, 110, .07);
  --focus: #0B5C6E;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) { --brand: #4CB6C9; --brand-ink: #0B1A20; --brand-tint: #12313A; --brand-strong: #7ACBD9; --grid-line: rgba(76, 182, 201, .08); --focus: #4CB6C9; }
}
:root[data-theme='dark'] { --brand: #4CB6C9; --brand-ink: #0B1A20; --brand-tint: #12313A; --brand-strong: #7ACBD9; --grid-line: rgba(76, 182, 201, .08); --focus: #4CB6C9; }

/* Actions */
.btn { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.secondary { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.btn.secondary:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-tint); }
a:hover { color: var(--brand); }
.seg input:checked + span, .pill[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.continue { border-left-color: var(--brand); }

/* Header: thin brand rule and brand underline for the current page */
.site-head { border-top: 3px solid var(--brand); }
.nav a[aria-current='page'] { box-shadow: inset 0 -2px 0 var(--brand); color: var(--ink); }
.nav a:hover { color: var(--brand); }
@media (max-width: 68rem) { .nav a[aria-current='page'] { box-shadow: inset 3px 0 0 var(--brand); } }

/* Engineering graph paper, used only behind the home route map and reference headers */
.hero > div:last-child { background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px); background-size: 24px 24px; border-radius: var(--radius-lg); padding: var(--s-4); }

/* Footer as its own band */
.site-foot { background: #13232B; color: #C9D4DC; border-top: 0; }
.site-foot a { color: #E4EAEF; }
.site-foot a:hover { color: #7ACBD9; }
.site-foot .foot-h, .site-foot strong { color: #FFFFFF; }
.site-foot .small { color: #8FA3B0; }

/* ── Formula reference ─────────────────────────────────── */
.math { font-family: var(--math); font-size: 1.08rem; line-height: 1.55; font-feature-settings: 'lnum'; }
.math sub, .math sup, .fx sub, .fx sup, .fc-front sub, .fc-front sup { font-size: 0.72em; line-height: 0; }
.ref-hero { border-bottom: 1px solid var(--rule); background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px); background-size: 24px 24px; }
.ref-hero .wrap { padding-top: var(--s-6); padding-bottom: var(--s-6); }
.ref-hero h1 { margin-bottom: var(--s-3); }
.ref-stats { list-style: none; margin: var(--s-4) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-6); }
.ref-stats li { color: var(--ink-2); }
.ref-stats b { font-family: var(--font-head); font-size: var(--t-lg); color: var(--ink); margin-right: 4px; font-variant-numeric: tabular-nums; }

/* Catalogue of sheets */
.sheet-cat { list-style: none; margin: var(--s-6) 0; padding: 0; border-top: 2px solid var(--ink); }
.cat-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; border-bottom: 1px solid var(--rule); }
.cat-main { display: grid; grid-template-columns: 3.5rem 2.25rem minmax(0, 1fr); gap: var(--s-4); align-items: start; padding: var(--s-4) var(--s-2); text-decoration: none; }
.cat-main:hover { background: var(--surface); }
.cat-main:hover .cat-title { color: var(--brand); }
.cat-no { font-family: var(--font-head); font-weight: 700; font-size: var(--t-2xl); line-height: 1; color: var(--brand); font-variant-numeric: tabular-nums; }
.cat-main .sheet-glyph { width: 2.25rem; height: 2.25rem; color: var(--ink-2); margin-top: 2px; }
.cat-title { display: block; font-family: var(--font-head); font-weight: 600; font-size: var(--t-md); }
.cat-intro { display: block; color: var(--ink-2); margin-top: 2px; max-width: 62ch; }
.cat-count { display: block; font-size: var(--t-sm); color: var(--ink-3); margin-top: 4px; }
.cat-fc { margin-right: var(--s-2); font-size: var(--t-sm); font-weight: 600; text-decoration: none; padding: 6px 12px; border: 1px solid var(--rule-strong); border-radius: 999px; white-space: nowrap; }
.cat-fc:hover { border-color: var(--brand); background: var(--brand-tint); }
@media (max-width: 40rem) {
  .cat-row { grid-template-columns: minmax(0, 1fr); }
  .cat-main { grid-template-columns: 2.5rem minmax(0, 1fr); }
  .cat-main .sheet-glyph { display: none; }
  .cat-fc { justify-self: start; margin: 0 0 var(--s-3) calc(2.5rem + var(--s-4) + var(--s-2)); }
}

/* One sheet */
.sheet-title { display: flex; align-items: center; gap: var(--s-4); }
.sheet-title .sheet-glyph { width: 3rem; height: 3rem; flex: none; color: var(--brand); border: 1.5px solid var(--brand); border-radius: var(--radius-lg); padding: 8px; background: var(--surface); }
.sheet-kicker { margin: 0 0 4px; color: var(--ink-2); font-size: var(--t-sm); }
.sheet-title h1 { margin: 0; }
.sheet-layout { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: var(--s-7); padding-top: var(--s-6); padding-bottom: var(--s-6); align-items: start; }
.sheet-side-inner { position: sticky; top: 5rem; }
.sheet-find input { font: inherit; padding: 0.5rem 0.65rem; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); width: 100%; }
.sheet-toc { list-style: none; margin: var(--s-3) 0 0; padding: 0; border-left: 2px solid var(--rule); }
.sheet-toc a { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr); padding: 5px 0 5px var(--s-3); margin-left: -2px; border-left: 2px solid transparent; text-decoration: none; font-size: var(--t-sm); color: var(--ink-2); }
.sheet-toc a:hover, .sheet-toc a.on { color: var(--ink); border-left-color: var(--brand); }
.sheet-toc a.on { font-weight: 600; }
.toc-no { font-variant-numeric: tabular-nums; color: var(--ink-3); }
.sheet-body { columns: auto; }
.sheet-sec { break-inside: auto; margin: 0 0 var(--s-7); scroll-margin-top: 5rem; }
.sheet-sec[hidden], .fx[hidden] { display: none; }
.sheet-sec h2 { display: flex; align-items: baseline; gap: var(--s-3); font-size: var(--t-lg); border-bottom: 2px solid var(--ink); padding-bottom: 6px; margin-bottom: 0; }
.sec-no { font-family: var(--font-head); color: var(--brand); font-variant-numeric: tabular-nums; font-size: var(--t-md); }
.fx-list { margin: 0; }
.fx { display: grid; grid-template-columns: minmax(0, 13rem) minmax(0, 1fr) auto; column-gap: var(--s-5); align-items: baseline; padding: 0.7rem 0; border-bottom: 1px solid var(--rule); break-inside: avoid; }
.fx dt { font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); grid-column: 1; grid-row: 1 / span 2; }
.fx dd { margin: 0; }
.fx-eq { grid-column: 2; color: var(--ink); }
.fx-note { grid-column: 2; font-size: var(--t-sm); color: var(--ink-2); margin-top: 2px !important; }
.fx-no { grid-column: 3; grid-row: 1; font-size: 0.75rem; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fx:hover { background: linear-gradient(90deg, var(--brand-tint), transparent 70%); }
@media (max-width: 60rem) {
  .sheet-layout { grid-template-columns: minmax(0, 1fr); gap: var(--s-4); }
  .sheet-side-inner { position: static; }
  .sheet-toc { display: flex; flex-wrap: wrap; gap: 6px; border-left: 0; }
  .sheet-toc a { display: inline-flex; gap: 6px; border: 1px solid var(--rule); border-radius: 999px; padding: 3px 10px; margin: 0; }
  .sheet-toc a.on, .sheet-toc a:hover { border-color: var(--brand); }
}
@media (max-width: 40rem) {
  .fx { grid-template-columns: minmax(0, 1fr) auto; }
  .fx dt { grid-row: auto; grid-column: 1; }
  .fx-no { grid-column: 2; }
  .fx-eq, .fx-note { grid-column: 1 / -1; }
}

/* Flashcards use the same equation face */
.fc-formula.math { font-size: 1.3rem; }

@media print {
  .ref-hero { background: none; border: 0; }
  .ref-hero .wrap { padding: 0 0 6pt; }
  .ref-stats, .sheet-side { display: none !important; }
  .sheet-layout { display: block; padding: 0; }
  .sheet-body { columns: 2; column-gap: 9mm; }
  .sheet-sec { margin-bottom: 8pt; break-inside: auto; }
  .sheet-sec h2 { font-size: 11pt; border-bottom: 1.5pt solid #000; }
  .sec-no { color: #000; }
  .fx { grid-template-columns: minmax(0, 1fr) auto; padding: 3pt 0; border-bottom-color: #ccc; }
  .fx dt { grid-row: auto; font-size: 8pt; color: #333; }
  .fx-eq, .fx-note { grid-column: 1 / -1; }
  .math { font-size: 9.5pt; }
  .fx-note { font-size: 7.5pt; }
  .fx-no { font-size: 7pt; color: #555; }
  .fx:hover { background: none; }
  .sheet-title .sheet-glyph { border-color: #000; color: #000; }
}
@media (max-width: 60rem) { .hero > div:last-child { max-width: 30rem; } }
@media print { .sheet-sec h2 { break-after: avoid; page-break-after: avoid; } .fx:first-of-type { break-before: avoid; } }

/* ── "When you feel like giving up" ─────────────────────── */
.giveup { margin: var(--s-7) 0 var(--s-5); display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: var(--s-6); padding: var(--s-6); border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--surface); }
.giveup-head h2 { font-size: var(--t-xl); line-height: 1.1; margin-bottom: var(--s-3); }
.giveup-head p { color: var(--ink-2); margin: 0; }
.story { border-left: 3px solid var(--brand); padding-left: var(--s-5); }
.story-title { font-size: var(--t-lg); margin-bottom: 4px; }
.story-who { color: var(--ink-2); font-size: var(--t-sm); margin-bottom: var(--s-3); }
.story-body { font-size: 1.1rem; line-height: 1.65; max-width: 62ch; }
.story-lesson { background: var(--brand-tint); border-radius: var(--radius); padding: var(--s-3) var(--s-4); max-width: 62ch; }
.story-lesson strong { color: var(--ink); }
@media (max-width: 52rem) { .giveup { grid-template-columns: minmax(0, 1fr); padding: var(--s-5); gap: var(--s-4); } .story { padding-left: var(--s-4); } }
.giveup-link { display: grid; gap: 2px; margin: var(--s-4) 0 0; padding: var(--s-4) var(--s-5); border: 1px solid var(--rule); border-left: 3px solid var(--brand); border-radius: var(--radius); background: var(--surface); text-decoration: none; max-width: 46rem; }
.giveup-link:hover { border-color: var(--brand); }
.giveup-link-k { font-size: var(--t-sm); color: var(--ink-2); }
.giveup-link-t { font-family: var(--font-head); font-weight: 600; font-size: var(--t-md); color: var(--ink); }

/* ════════════════════════════════════════════════════════════════════════
   Printed formula sheet: an A4 reference card.
   Title block, dark numbered topic tabs, shaded rows for scanning, a column
   rule, running footer with page numbers, and a notes box at the end.
   ════════════════════════════════════════════════════════════════════════ */
.notes-box, .print-meta { display: none; }
@media print {
  @page {
    size: A4;
    margin: 13mm 12mm 15mm;
    @bottom-left { content: "SignalPath formula sheet"; font: 7.5pt Barlow, sans-serif; color: #6b7a86; }
    @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 7.5pt Barlow, sans-serif; color: #6b7a86; }
  }
  body[data-page="sheet"] { -webkit-print-color-adjust: exact; print-color-adjust: exact; background: #fff; color: #111; }
  body[data-page="sheet"] main { display: block; }

  /* Title block */
  body[data-page="sheet"] .sheet-hero { border: 0; margin: 0 0 4mm; }
  body[data-page="sheet"] .sheet-hero .wrap { border: 1.4pt solid #0B5C6E; border-radius: 3mm; padding: 4mm 5mm 3.5mm; }
  body[data-page="sheet"] .sheet-title { gap: 4mm; }
  body[data-page="sheet"] .sheet-title .sheet-glyph { width: 12mm; height: 12mm; padding: 2mm; border: 0; border-radius: 2mm; background: #0B5C6E; color: #fff; }
  body[data-page="sheet"] .sheet-kicker { font-size: 8pt; letter-spacing: .02em; color: #0B5C6E; margin-bottom: 1mm; }
  body[data-page="sheet"] .sheet-title h1 { font-size: 21pt; line-height: 1.05; }
  body[data-page="sheet"] .sheet-hero .lede { font-size: 9.5pt; line-height: 1.4; color: #333; margin: 2.5mm 0 1.5mm; max-width: none; }
  body[data-page="sheet"] .print-meta { display: block; font-size: 8pt; color: #555; margin: 0; padding-top: 1.5mm; border-top: 0.5pt solid #c9d2d8; }

  /* Two columns with a rule between them */
  body[data-page="sheet"] .sheet-body { columns: 2; column-gap: 8mm; column-rule: 0.5pt solid #c9d2d8; }

  /* Topic headings as dark numbered tabs */
  body[data-page="sheet"] .sheet-sec { margin: 0 0 4mm; }
  body[data-page="sheet"] .sheet-sec h2 { display: flex; align-items: stretch; gap: 0; border: 0; padding: 0; margin: 0 0 1mm; font-size: 10pt; background: #E8EEF0; border-radius: 1.2mm; overflow: hidden; break-after: avoid; }
  body[data-page="sheet"] .sec-no { background: #0B5C6E; color: #fff; padding: 1mm 2.2mm; font-size: 9.5pt; font-weight: 700; }
  body[data-page="sheet"] .sheet-sec h2 { line-height: 1.6; }
  body[data-page="sheet"] .sheet-sec h2 > :not(.sec-no) { padding-left: 2mm; }
  body[data-page="sheet"] .sheet-sec h2 { padding-right: 2mm; }

  /* Formula rows: label line, equation, note; light shading on every other row */
  body[data-page="sheet"] .fx { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 2mm; padding: 1.4mm 1.6mm; border: 0; border-radius: 1mm; break-inside: avoid; }
  body[data-page="sheet"] .fx:nth-child(even) { background: #F3F6F7; }
  body[data-page="sheet"] .fx dt { grid-row: auto; grid-column: 1; font-size: 7.6pt; font-weight: 600; color: #3d4b55; }
  body[data-page="sheet"] .fx-no { grid-column: 2; grid-row: 1; font-size: 6.8pt; color: #7a8893; }
  body[data-page="sheet"] .fx-eq { grid-column: 1 / -1; font-size: 9.6pt; line-height: 1.45; color: #000; margin-top: 0.4mm; }
  body[data-page="sheet"] .fx-note { grid-column: 1 / -1; font-size: 7.4pt; color: #4a5966; font-style: italic; }
  body[data-page="sheet"] .fx:hover { background: inherit; }

  /* Notes box at the end */
  body[data-page="sheet"] .notes-box { display: block; break-inside: avoid; margin-top: 3mm; border: 0.8pt solid #9aa8b2; border-radius: 2mm; padding: 2mm 3mm 3mm; }
  body[data-page="sheet"] .notes-box h2 { font-size: 9pt; margin: 0 0 1mm; color: #0B5C6E; }
  body[data-page="sheet"] .note-lines { height: 36mm; background-image: linear-gradient(#cfd8de 0.4pt, transparent 0.4pt); background-size: 100% 6mm; background-position: 0 5.6mm; }
  body[data-page="sheet"] .print-foot { display: none; }
}

@media print { body[data-page="sheet"] .sec-no { margin-right: 2.2mm; } }

.giveup { scroll-margin-top: 5rem; }

/* A4 PDF tuning: roomier type and spacing so each sheet fills its two pages */
@media print {
  @page { size: A4 portrait; margin: 14mm 13mm 16mm; }
  body[data-page="sheet"] .sheet-hero { margin-bottom: 5mm; }
  body[data-page="sheet"] .sheet-hero .wrap { padding: 5mm 6mm 4.5mm; }
  body[data-page="sheet"] .sheet-title h1 { font-size: 23pt; }
  body[data-page="sheet"] .sheet-hero .lede { font-size: 10pt; }
  body[data-page="sheet"] .sheet-body { column-gap: 9mm; }
  body[data-page="sheet"] .sheet-sec { margin-bottom: 5.5mm; }
  body[data-page="sheet"] .sheet-sec h2 { font-size: 10.5pt; margin-bottom: 1.6mm; }
  body[data-page="sheet"] .sec-no { font-size: 10pt; padding: 1.2mm 2.4mm; }
  body[data-page="sheet"] .fx { padding: 2mm 2mm; margin-bottom: 0.3mm; }
  body[data-page="sheet"] .fx dt { font-size: 8pt; }
  body[data-page="sheet"] .fx-eq { font-size: 10.4pt; line-height: 1.5; margin-top: 0.6mm; }
  body[data-page="sheet"] .fx-note { font-size: 7.8pt; margin-top: 0.4mm; }
  body[data-page="sheet"] .fx-no { font-size: 7pt; }
  body[data-page="sheet"] .notes-box { margin-top: 5mm; }
  body[data-page="sheet"] .note-lines { height: 54mm; background-size: 100% 6.5mm; background-position: 0 6.1mm; }
}
@media print { body[data-page="sheet"] .note-lines { height: 40mm; } }
@media print { body[data-page="sheet"] .sheet-body { column-fill: auto; } }
/* Long sheets (50+ formulas) print a little tighter so they still fit two A4 pages */
@media print {
  body[data-page="sheet"] .compact .fx { padding: 1.3mm 1.8mm; }
  body[data-page="sheet"] .compact .fx-eq { font-size: 9.8pt; line-height: 1.4; }
  body[data-page="sheet"] .compact .fx dt { font-size: 7.6pt; }
  body[data-page="sheet"] .compact .sheet-sec { margin-bottom: 4mm; }
  body[data-page="sheet"] .compact .note-lines { height: 30mm; }
}

.cat-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-right: var(--s-2); }
.cat-actions .cat-fc { margin: 0; }
@media (max-width: 40rem) { .cat-actions { margin: 0 0 var(--s-3) calc(2.5rem + var(--s-4) + var(--s-2)); } }
