/* HardHat Prep design system — "Calibrated Panel".
 *
 * Scene: a plant operator, phone in one hand, standing in a bright headworks
 * building or sitting in a truck at lunch — and then the same person at 10pm at
 * the kitchen table, an hour into a study session. That forces the answer: LIGHT
 * by default (glare, credibility), with a real dark mode they can switch to.
 *
 * Art direction: a calibrated field instrument. Surfaces are machined
 * faceplates (one inset top highlight + one soft shadow — never neumorphism),
 * meters are recessed gauge channels with ticks, every number reads off the
 * panel in Plex Mono with an engraved unit label under it. The accent is a
 * deep treated-water teal used ONLY for primary action, current selection, and
 * state — never decoration. Nobody in this market owns teal: the incumbent is
 * baby blue, Pocket Prep is amber, OpenExamPrep is gold. Correct/incorrect are
 * never signalled by color alone.
 *
 * SAFETY-YELLOW RULE (do not relax): the hat yellow #ffc63f means "attention",
 * never "brand". It may appear ONLY as the keyboard focus ring and the
 * flagged-question state, always on sub-24px elements or low-alpha tints —
 * never fills, never headings, never backgrounds.
 *
 * DARK-MODE DEPTH RULE: drop shadows read as smudges on dark surfaces. In dark
 * mode depth comes exclusively from surface lightness steps plus a 1px
 * oklch(100% 0 0 / .06) top-edge highlight; card shadows go to none.
 */

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url("/fonts/plex-sans-var.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/plex-mono-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/plex-mono-600.woff2") format("woff2");
}

:root {
  color-scheme: light;

  /* Neutrals, tinted very slightly toward the brand hue (not "warm by default") */
  --bg:            oklch(98.5% 0.004 210);
  --surface:       oklch(100% 0 0);
  --surface-2:     oklch(96.8% 0.006 210);
  --surface-sunk:  oklch(95.2% 0.008 210);
  --line:          oklch(90.5% 0.009 210);
  --line-strong:   oklch(83% 0.012 210);

  --ink:           oklch(23% 0.016 220);   /* body text — 12:1 on --bg */
  --ink-2:         oklch(45% 0.014 220);   /* secondary — 5.6:1 on --bg */
  --ink-3:         oklch(57% 0.012 220);   /* tertiary/labels — 3.6:1, large text only */

  /* Accent: deep treated-water teal, deepened for a denser, machined read —
     8:1 on white, so it works as button fill under white text AND as a text
     color in its own right. --accent-fill is the BRAND teal used for solid
     fills; it stays the same deep teal in dark mode so both themes read as
     one product (dark must never drift cyan). --accent is the text/border
     variant, retuned per theme for contrast. */
  --accent:        oklch(42% 0.09 195);
  --accent-hover:  oklch(37% 0.085 195);
  --accent-fill:        oklch(42% 0.09 195);
  --accent-fill-hover:  oklch(37% 0.085 195);
  --accent-soft:   oklch(94.5% 0.03 190);
  --accent-line:   oklch(80% 0.06 192);
  --on-accent:     oklch(100% 0 0);

  /* Hazard yellow (see SAFETY-YELLOW RULE above). --hazard-deep is the hat
     yellow pulled down to 3:1+ against light surfaces for the focus ring. */
  --hazard:        #ffc63f;
  --hazard-deep:   oklch(56% 0.12 80);
  --hazard-soft:   oklch(95% 0.045 88);
  --hazard-ring:   var(--hazard-deep);

  /* Semantic state */
  --ok:            oklch(48% 0.115 155);
  --ok-soft:       oklch(94.5% 0.03 155);
  --ok-line:       oklch(78% 0.07 155);
  --bad:           oklch(50% 0.16 25);
  --bad-soft:      oklch(95% 0.028 25);
  --bad-line:      oklch(80% 0.075 25);
  --warn:          oklch(52% 0.12 75);
  --warn-soft:     oklch(95% 0.035 80);

  /* Machined radius scale: small uniform radii read milled, not molded.
     Controls 5px, panels 10px, meters 2px. Pills are banned except <kbd>. */
  --radius:    10px;
  --radius-sm: 5px;
  --radius-lg: 10px;
  --r-meter:   2px;

  --shadow-sm: 0 1px 2px oklch(24% 0.02 250 / 0.06);
  --shadow:    0 2px 4px oklch(24% 0.02 250 / 0.05), 0 8px 20px oklch(24% 0.02 250 / 0.06);
  --shadow-lg: 0 4px 8px oklch(24% 0.02 250 / 0.06), 0 20px 44px oklch(24% 0.02 250 / 0.09);

  /* Faceplate surface model: one inset top highlight (beveled metal edge) +
     one soft drop. Recessed wells invert it. This is the whole materiality
     budget — nothing else gets a bespoke shadow. */
  --edge-top:        inset 0 1px 0 oklch(100% 0 0 / 0.85);
  --shadow-face:     var(--edge-top), 0 1px 2px oklch(25% 0.01 235 / 0.06), 0 3px 10px oklch(25% 0.01 235 / 0.05);
  --shadow-well:     inset 0 1px 2px oklch(20% 0 0 / 0.15);
  --shadow-press:    inset 0 2px 4px oklch(0% 0 0 / 0.25);
  --shadow-btn:      inset 0 1px 0 oklch(100% 0 0 / 0.2), inset 0 -1px 0 oklch(0% 0 0 / 0.25), 0 1px 2px oklch(0% 0 0 / 0.15);

  /* Blueprint substrate: a drafting grid so faint it only registers as
     texture. Page background only — never inside cards. */
  --grid-line: oklch(30% 0.01 235 / 0.035);

  /* One superfamily: Plex Sans for prose, Plex Mono for values and formulas.
     Both self-hosted (CSP has no external hosts) — the variable Sans file
     carries every weight from 100–700. */
  --font: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;

  /* Motion at instrument speed: one curve, three durations. Hover 140ms,
     press 80ms, meter fill 450ms. Only transform/opacity/box-shadow/border-
     color/background animate. */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --t-hover: 140ms;
  --t-press: 80ms;
  --t-fill:  450ms;

  /* Semantic z-scale — never arbitrary 9999 */
  --z-sticky: 10;
  --z-header: 20;
  --z-toast:  40;
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg:            oklch(20% 0.012 220);
  --surface:       oklch(24.5% 0.014 220);
  --surface-2:     oklch(28% 0.015 220);
  --surface-sunk:  oklch(22% 0.013 220);
  --line:          oklch(33% 0.016 220);
  --line-strong:   oklch(42% 0.018 220);

  --ink:           oklch(96% 0.006 220);
  --ink-2:         oklch(78% 0.01 220);
  --ink-3:         oklch(64% 0.012 220);

  /* Dark accent stays TEAL, not cyan: fills keep the light theme's deep brand
     teal (white text on top), and the text variant is the same hue with just
     enough lightness to clear 4.5:1 on dark surfaces. */
  --accent:        oklch(72% 0.07 195);
  --accent-hover:  oklch(80% 0.075 195);
  --accent-fill:        oklch(46% 0.095 195);
  --accent-fill-hover:  oklch(52% 0.1 195);
  --accent-soft:   oklch(29% 0.038 195);
  --accent-line:   oklch(45% 0.055 195);
  --on-accent:     oklch(100% 0 0);

  --ok:            oklch(76% 0.13 158);
  --ok-soft:       oklch(30% 0.05 158);
  --ok-line:       oklch(45% 0.08 158);
  --bad:           oklch(72% 0.14 25);
  --bad-soft:      oklch(31% 0.06 25);
  --bad-line:      oklch(46% 0.09 25);
  --warn:          oklch(80% 0.12 80);
  --warn-soft:     oklch(32% 0.05 80);

  --hazard-ring:   var(--hazard);
  --hazard-soft:   oklch(30% 0.045 88);
  --hazard-deep:   oklch(82% 0.13 85);

  /* DARK-MODE DEPTH RULE: no drop shadows — depth is the surface lightness
     step (+4% L card over page) plus the 1px top-edge highlight. Dialogs keep
     a real shadow because they float over a scrim. */
  --edge-top:    inset 0 1px 0 oklch(100% 0 0 / 0.06);
  --shadow-face: var(--edge-top);
  --shadow-well: inset 0 1px 3px oklch(0% 0 0 / 0.4);
  --shadow-press:inset 0 2px 4px oklch(0% 0 0 / 0.45);
  --shadow-btn:  inset 0 1px 0 oklch(100% 0 0 / 0.18), inset 0 -1px 0 oklch(0% 0 0 / 0.3);

  /* No drafting grid in dark — on dark grounds it reads as a generic AI-UI
     texture instead of a workbench. Light keeps the faint substrate. */
  --grid-line: transparent;

  --shadow-sm: 0 1px 2px oklch(0% 0 0 / 0.3);
  --shadow:    0 2px 6px oklch(0% 0 0 / 0.32), 0 10px 26px oklch(0% 0 0 / 0.3);
  --shadow-lg: 0 6px 14px oklch(0% 0 0 / 0.36), 0 24px 50px oklch(0% 0 0 / 0.4);
}

*, *::before, *::after { box-sizing: border-box; }

/* display:inline-flex on .btn beats the UA's [hidden]{display:none}, which showed
   "Sign out" to signed-out visitors. Hidden must mean hidden. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  /* Workbench substrate: a 28px drafting grid so faint it reads as texture,
     behind the page only — cards sit on top of it. */
  background:
    repeating-linear-gradient(0deg,  var(--grid-line) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(90deg, var(--grid-line) 0 1px, transparent 1px 28px),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}

/* Variable-axis in-between weights: 640 display / 560 stems instead of stock
   600/700 — machined tolerances, not template bold. */
h1, h2, h3 { text-wrap: balance; font-weight: 640; letter-spacing: -0.022em; line-height: 1.15; }
p { text-wrap: pretty; }

::selection { background: var(--accent-soft); }

/* Values read like a plant panel: every number the product asserts is set in
   mono. Weight tops out at 600 — that's the heaviest Mono we ship, and a
   synthesized 700 would smear. */
.proof-value, .bigscore, .readiness-score, .stat-value,
.timer, .domain-acc, .calc-result, .qgrid-cell {
  font-family: var(--mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

/* Hazard semantics: yellow = "attention here" (keyboard focus, flags);
   teal = "action". This is one of yellow's two permitted uses. */
:focus-visible {
  outline: 2px solid var(--hazard-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- header ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  background: color-mix(in oklab, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-hover) var(--ease), box-shadow var(--t-hover) var(--ease);
}
/* theme.js stamps .is-scrolled past 8px — the header "engages" a hairline. */
.topbar.is-scrolled { border-bottom-color: var(--line); box-shadow: 0 1px 2px oklch(25% 0.01 235 / 0.05); }
[data-theme="dark"] .topbar.is-scrolled { box-shadow: none; }

/* Nav is signage, not a bank of form controls: quiet text buttons with a
   tonal hover fill. The one solid CTA keeps its weight. */
.topnav .btn-ghost { border-color: transparent; background: transparent; }
.topnav .btn-ghost:hover { background: var(--surface-2); border-color: transparent; box-shadow: none; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink-2); font-weight: 700; }
/* The hard-hat mark is an inline SVG with fixed brand colors (safety yellow on
   deep teal) — a logo must not flip with the light/dark theme, so it does not
   use the accent variables. Geometry lives in the HTML and tools/gen-brand-assets.mjs. */
.brand-mark { width: 26px; height: 26px; flex: none; display: block; }
.brand-name { font-size: 1.02rem; letter-spacing: -0.02em; }
.brand-name strong { font-weight: 700; }
.topnav { display: flex; align-items: center; gap: 6px; }
.nav-user {
  color: var(--ink-2); font-size: .85rem;
  max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.theme-toggle {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  cursor: pointer;
  font-size: 1rem;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.theme-toggle:hover { background: var(--surface-2); color: var(--ink); }
.theme-toggle svg { width: 18px; height: 18px; }
/* Light shows the moon ("switch to dark"), dark shows the sun. */
[data-theme="dark"] .icon-moon { display: none; }
:root:not([data-theme="dark"]) .icon-sun { display: none; }

/* ---------- buttons ---------- */

.btn {
  font: inherit;
  font-weight: 600;
  font-size: .95rem;
  min-height: 44px;                 /* thumb-first */
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: background var(--t-hover) var(--ease), border-color var(--t-hover) var(--ease),
              color var(--t-hover) var(--ease), box-shadow var(--t-hover) var(--ease),
              transform var(--t-press) var(--ease);
}
/* Machined press: the control physically depresses. */
.btn:active { transform: translateY(1px); }
.btn-solid {
  background: var(--accent-fill);
  color: var(--on-accent);
  box-shadow: var(--shadow-btn);
}
.btn-solid:hover { background: var(--accent-fill-hover); }
.btn-solid:active { box-shadow: var(--shadow-press); }
.btn-solid:disabled {
  background: var(--surface-sunk);
  color: var(--ink-3);
  box-shadow: none;
  cursor: not-allowed;
}
.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--line);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line-strong); box-shadow: var(--edge-top); }
.btn-ghost:active { box-shadow: var(--shadow-press); }
.btn-lg { min-height: 52px; padding: 14px 26px; font-size: 1.02rem; }
.btn-block { width: 100%; }
.linkbtn {
  background: none; border: none; padding: 0;
  color: var(--accent); font: inherit; font-weight: 600; cursor: pointer;
}
.linkbtn:hover { text-decoration: underline; }

/* ---------- layout ---------- */

#main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 32px 20px 72px; }
#main.wide { max-width: 1080px; }
/* The landing is the one page that earns a wider stage: the hero text and the
   gauge instrument sit side by side without squeezing the headline. */
body:has(#view-landing:not([hidden])) #main { max-width: 1040px; }

.view { animation: rise .28s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Faceplate: beveled top edge + soft drop in light; lightness step + edge
   highlight in dark (the tokens carry the difference). */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-face);
}
.card-narrow { max-width: 430px; margin: 0 auto; }
.center { text-align: center; }
.muted { color: var(--ink-2); }
.small { font-size: .87rem; }
/* Section grammar — the machined detent that ties every page together: an
   engraved 11px label, a 16×2px teal tick, then a hairline rule to the edge. */
.subhead {
  display: flex; align-items: center; gap: 12px;
  margin: 44px 0 14px;
  font-size: .72rem; font-weight: 560;
  color: var(--ink-2);
  text-transform: uppercase; letter-spacing: .09em;
}
.subhead::before { content: ""; flex: none; width: 16px; height: 2px; background: var(--accent); order: 2; }
.subhead::after  { content: ""; flex: 1; height: 1px; background: var(--line); order: 3; }

/* ---------- landing ---------- */

/* Spec-plate label, not a marketing pill: mono, uppercase.
   It states which exam this is — treat it like an equipment nameplate. */
.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  margin: 0 0 18px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: .78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
}

.hero-grid { display: grid; gap: 44px; align-items: center; }
@media (min-width: 860px) { .hero-grid { grid-template-columns: 1fr auto; } }
/* The hero instrument: a faceplate panel carrying the readiness gauge. */
.hero-visual {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-face);
  padding: 24px 28px 20px;
  justify-self: center;
  width: min(320px, 100%);
}
.hero-gauge-note {
  margin: 12px 0 0;
  color: var(--ink-2);
  font-size: .8rem; line-height: 1.5;
  text-align: center;
}

.hero h1 { font-size: 2.55rem; margin: 0 0 16px; }
.lede { color: var(--ink-2); font-size: 1.08rem; max-width: 60ch; margin: 0; }
.cta-row { display: flex; align-items: center; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.center-row { justify-content: center; }
.cta-note { color: var(--ink-2); font-size: .88rem; }

/* Masthead data band: broadsheet rule pairing (2px ink rule above, 1px
   hairline below) with hairline column separators — authority without box
   chrome. Values read like a gauge face: big mono readout, engraved unit. */
.proof {
  margin-top: 60px;
  display: grid;
  gap: 1px;
  background: var(--line);
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line-strong);
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.proof-item { background: var(--bg); padding: 18px 20px 16px; }
.proof-value { font-size: 1.7rem; }
/* Plex Mono's ∞ is small and spindly at readout size — set the glyph in the
   Sans face, scaled to sit like a digit. */
.proof-value .inf {
  font-family: var(--font);
  font-size: 1.32em; font-weight: 620;
  line-height: 1; display: inline-block; vertical-align: -0.08em;
}
.proof-label {
  color: var(--ink-2);
  font-size: .72rem; font-weight: 560;
  text-transform: uppercase; letter-spacing: .09em;
}

.pillars { display: grid; gap: 14px; margin-top: 60px; }
.pillar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-face);
}
.pillar h3 { margin: 0 0 6px; font-size: 1.02rem; }
.pillar p { margin: 0; color: var(--ink-2); font-size: .94rem; }

.disclaimer { color: var(--ink-3); font-size: .8rem; max-width: 70ch; margin-top: 60px; }
.footer { border-top: 1px solid var(--line); padding: 22px 20px; background: var(--surface); }
.footer p { margin: 0; color: var(--ink-3); font-size: .8rem; }
.footer p + p { margin-top: 6px; }

/* ---------- forms ---------- */

form label { display: block; margin: 18px 0 6px; font-size: .88rem; font-weight: 600; color: var(--ink-2); }
input[type="email"], input[type="password"], input[type="text"], input[type="search"], select {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input::placeholder { color: var(--ink-3); }
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.error { color: var(--bad); font-size: .9rem; margin: 12px 0 0; font-weight: 500; }
.switch { margin-top: 20px; font-size: .92rem; color: var(--ink-2); }

.field { border: 0; padding: 0; margin: 0 0 24px; }
.field legend {
  padding: 0; margin-bottom: 10px;
  font-size: .72rem; font-weight: 560; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: .09em;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: .92rem; font-weight: 550;
  min-height: 44px; padding: 10px 16px;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: all var(--t-hover) var(--ease);
}
.chip:hover { border-color: var(--accent-line); color: var(--ink); }
.chip[aria-pressed="true"] {
  background: var(--accent-fill);
  border-color: var(--accent-fill);
  color: var(--on-accent);
}

/* ---------- practice ---------- */

.practice-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.context-line { margin: 0 0 2px; font-family: var(--mono); font-size: .76rem; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.progress-line { margin: 0; color: var(--ink-2); font-size: .9rem; }
/* Gauge channel: a recessed track with tick marks every 10%, fill with a
   machined top edge. Shared by the session bar and the domain meters. */
.progressbar {
  position: relative;
  height: 10px; background: var(--surface-sunk);
  border-radius: var(--r-meter); overflow: hidden;
  box-shadow: var(--shadow-well);
  margin-bottom: 20px;
}
.progressbar-fill {
  height: 100%; width: 0; background: var(--accent);
  border-radius: var(--r-meter);
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 0.25);
  transition: width var(--t-fill) var(--ease);
}
.progressbar::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), oklch(50% 0 0 / 0.12) calc(10% - 1px) 10%);
}

.qmeta { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.tag {
  font-size: .72rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
}
.tag-accent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
[data-theme="dark"] .tag-accent { color: var(--ink); }
/* The stem is the product's core content — it gets display treatment. */
.qstem { font-size: 1.375rem; line-height: 1.45; margin: 0 0 20px; font-weight: 560; }

.options { display: grid; gap: 10px; }
.option {
  display: flex; gap: 12px; align-items: flex-start; text-align: left;
  width: 100%; min-height: 56px;
  font: inherit; font-size: 1rem; cursor: pointer;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color var(--t-hover) var(--ease), background var(--t-hover) var(--ease), box-shadow var(--t-hover) var(--ease);
}
.option:hover:not(:disabled) { border-color: var(--accent-line); box-shadow: var(--edge-top); }
.option:disabled { cursor: default; }
.option-letter {
  flex: none;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  background: var(--surface-sunk);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: .82rem; font-weight: 600;
  transition: background var(--t-hover) var(--ease), color var(--t-hover) var(--ease);
}
/* Engaged, like a thrown switch: accent edge-bar + engraved ring + inverted
   letter chip — not a pale wash. */
.option[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--surface-2);
  box-shadow: inset 3px 0 0 var(--accent), inset 0 0 0 1px var(--accent);
}
.option[aria-pressed="true"] .option-letter { background: var(--accent-fill); color: var(--on-accent); }

/* Correct/incorrect are marked by icon + text, never colour alone. */
.option.correct { border-color: var(--ok); background: var(--ok-soft); }
.option.correct .option-letter { background: var(--ok); color: var(--on-accent); }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); }
.option.wrong .option-letter { background: var(--bad); color: var(--on-accent); }
/* Once graded, the verdict owns the styling — drop the engaged-switch shadow
   so the teal edge bar doesn't muddy the red/green read. */
.option.correct[aria-pressed="true"], .option.wrong[aria-pressed="true"] { box-shadow: none; }
.option-flag { margin-left: auto; flex: none; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.option.correct .option-flag { color: var(--ok); }
.option.wrong .option-flag { color: var(--bad); }

.feedback {
  margin-top: 20px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--line);
  animation: rise .16s var(--ease) both;
}
.verdict { display: flex; align-items: center; gap: 8px; font-weight: 700; margin: 0 0 8px; }
.verdict.right { color: var(--ok); }
.verdict.wrong { color: var(--bad); }
.explanation { margin: 0; color: var(--ink-2); white-space: pre-line; }
.practice-actions { margin-top: 22px; display: flex; gap: 10px; }
.practice-actions .btn { flex: 1; }
.kbd-hint { margin: 14px 0 0; color: var(--ink-3); font-size: .8rem; }
.kbd-hint kbd {
  font: inherit; font-family: var(--mono); font-size: .78rem;
  background: var(--surface-sunk); border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 5px;
}
.report-link { display: inline-block; margin-top: 14px; font-size: .85rem; color: var(--ink-3); font-weight: 500; }
.report-link:hover { color: var(--accent); }
.reported { margin-top: 14px; font-size: .85rem; color: var(--ok); font-weight: 600; }

.bigscore { font-size: 2.8rem; margin: 8px 0; }
.bigscore.pass { color: var(--ok); }
.bigscore.fail { color: var(--warn); }

/* ---------- mock exam ---------- */

.mock-right { display: flex; align-items: center; gap: 10px; }
/* The clock is a panel readout: recessed well, mono digits. */
.timer {
  font-size: 1.05rem;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-well);
  padding: 8px 12px;
  min-height: 44px;
  display: grid; place-items: center;
}
.timer.urgent { color: var(--bad); border-color: var(--bad-line); background: var(--bad-soft); }
.mock-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; }

.qgrid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 22px; }
.qgrid-cell {
  width: 40px; height: 40px;
  font: inherit; font-family: var(--mono); font-size: .8rem; font-weight: 600;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: all .12s var(--ease);
}
.qgrid-cell:hover { border-color: var(--accent-line); color: var(--ink); }
.qgrid-cell.done { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
[data-theme="dark"] .qgrid-cell.done { color: var(--ink); }
.qgrid-cell.current { outline: 2px solid var(--accent); outline-offset: 1px; }

.review { margin-top: 26px; display: grid; gap: 14px; }
.review-item {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.review-head { display: flex; align-items: center; gap: 7px; margin: 0 0 8px; font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.review-item.right .review-head { color: var(--ok); }
.review-item.wrong .review-head { color: var(--bad); }
.review-stem { margin: 0 0 10px; font-weight: 600; }
.review-options { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 5px; font-size: .93rem; color: var(--ink-2); }
.review-options .opt-correct { color: var(--ok); font-weight: 600; }
.review-options .opt-yours { color: var(--bad); }
.review-options em { font-style: normal; opacity: .8; font-size: .84rem; }

/* ---------- readiness + progress ---------- */

/* The single most important number in the product sits in a recessed gauge
   well; the well's tint tracks readiness (icon+word label carries the meaning,
   the tint just makes it legible at arm's length). */
.readiness {
  margin-top: 20px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-well);
  padding: 22px;
}
.readiness:has(.readiness-score.good) { background: color-mix(in oklab, var(--ok-soft) 55%, var(--surface-sunk)); border-color: var(--ok-line); }
.readiness:has(.readiness-score.mid)  { background: color-mix(in oklab, var(--warn-soft) 45%, var(--surface-sunk)); }
.readiness:has(.readiness-score.bad)  { background: color-mix(in oklab, var(--bad-soft) 45%, var(--surface-sunk)); border-color: var(--bad-line); }
.readiness-main { display: flex; gap: 26px; align-items: center; flex-wrap: wrap; }
.readiness-label { margin: 0; font-size: .72rem; font-weight: 560; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-2); }
.readiness-score { margin: 2px 0 0; font-size: 2.8rem; line-height: 1; }
.readiness-score.good { color: var(--ok); }
.readiness-score.mid  { color: var(--warn); }
.readiness-score.bad  { color: var(--bad); }
.readiness-score.none { color: var(--ink-3); }
.readiness-meta { flex: 1 1 250px; }
.readiness-conf { margin: 0 0 5px; font-size: .84rem; color: var(--ink-3); }
.readiness-note { margin: 0; color: var(--ink); font-size: .95rem; }

/* Gauge faces: big mono readout over a small engraved unit label. */
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-top: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; box-shadow: var(--shadow-face); }
.stat-value { font-size: 1.55rem; }
.stat-label {
  color: var(--ink-2);
  font-size: .72rem; font-weight: 560;
  text-transform: uppercase; letter-spacing: .09em;
}

.domainlist { display: grid; gap: 10px; }
.domain-row { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; }
.domain-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.domain-name { font-weight: 600; }
.domain-acc { font-size: .95rem; }
.domain-acc.good { color: var(--ok); }
.domain-acc.mid  { color: var(--warn); }
.domain-acc.bad  { color: var(--bad); }
.domain-acc.none { color: var(--ink-3); font-weight: 500; }
.domain-meter {
  position: relative;
  height: 8px; background: var(--surface-sunk);
  border-radius: var(--r-meter);
  box-shadow: var(--shadow-well);
  margin-top: 10px; overflow: hidden;
}
.domain-meter-fill {
  height: 100%; background: var(--accent);
  border-radius: var(--r-meter);
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 0.25);
  transition: width var(--t-fill) var(--ease);
}
.domain-meter::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), oklch(50% 0 0 / 0.12) calc(10% - 1px) 10%);
}
.domain-sub { color: var(--ink-3); font-size: .84rem; margin-top: 6px; }

/* ---------- readiness gauge (the signature instrument) ---------- */

.gauge { width: 264px; max-width: 100%; }
.gauge svg { width: 100%; height: auto; display: block; overflow: visible; }
.gauge-track { fill: none; stroke: var(--surface-sunk); stroke-width: 12; }
.gauge-zone { fill: none; stroke-width: 12; }
.gauge-zone.bad { stroke: color-mix(in oklab, var(--bad) 15%, transparent); }
.gauge-zone.ok  { stroke: color-mix(in oklab, var(--accent) 22%, transparent); }
.gauge-tick { stroke: var(--line-strong); stroke-width: 1; fill: none; }
.gauge-tick.major { stroke: var(--ink-3); stroke-width: 1.5; }
.gauge-tick.pass { stroke: var(--bad); stroke-width: 2; }
.gauge-label {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  fill: var(--ink-3); text-anchor: middle;
}
.gauge-label.pass { fill: var(--bad); }
.gauge-needle {
  transform-origin: 110px 110px;
  transform: rotate(var(--gauge-deg));
  animation: gauge-sweep .9s var(--ease) both;
}
.gauge-needle polygon { fill: var(--ink); }
.gauge-hub { fill: var(--accent-fill); stroke: var(--surface); stroke-width: 2.5; }
@keyframes gauge-sweep { from { transform: rotate(-90deg); } }
.gauge-read { text-align: center; margin-top: 10px; }
.gauge-read .readiness-score { font-size: 2.1rem; margin: 2px 0 0; line-height: 1.1; }
.gauge-read .readiness-label { justify-content: center; }

/* ---------- calculators ---------- */

.tools-h1 { font-size: 2.1rem; margin: 0 0 14px; }
.calc-list { margin-top: 34px; }
#calc-dialog-list { margin-top: 0; }
.calc-grid { display: grid; gap: 16px; }

/* Trade tabs + search. Tabs mirror the setup chips; the row wraps on narrow
   screens and the search box drops to full width beneath the tabs. */
.calc-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 20px; }
.calc-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.calc-tab {
  font: inherit; font-size: .9rem; font-weight: 550;
  min-height: 40px; padding: 8px 15px;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: all var(--t-hover) var(--ease);
}
.calc-tab:hover { border-color: var(--accent-line); color: var(--ink); }
.calc-tab[aria-selected="true"] {
  background: var(--accent-fill);
  border-color: var(--accent-fill);
  color: var(--on-accent);
}
.calc-search {
  font: inherit; font-size: .92rem;
  min-height: 40px; padding: 8px 14px;
  flex: 1 1 200px; min-width: 160px; margin-left: auto;
  background: var(--surface-sunk);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
}
.calc-search:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 1px; }
.calc-empty { margin: 24px 2px; color: var(--ink-2); }

.calc-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px 24px; box-shadow: var(--shadow-face); }
.calc-card[hidden] { display: none; }
.calc-name { margin: 0 0 4px; font-size: 1.08rem; }
.calc-blurb { margin: 0 0 16px; color: var(--ink-2); font-size: .93rem; }
.calc-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.calc-field { display: grid; gap: 6px; }
.calc-label { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.calc-label em { font-style: normal; font-weight: 400; color: var(--ink-3); }
.calc-out { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; animation: rise .2s var(--ease) both; }
.calc-result { margin: 0 0 12px; font-size: 1.4rem; color: var(--accent); }
[data-theme="dark"] .calc-result { color: var(--ink); }
/* The worked math IS the product — set it like instrument output. */
.calc-steps {
  margin: 0 0 12px; padding: 14px 16px 14px 32px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--ink); display: grid; gap: 6px;
  font-family: var(--mono); font-size: .84rem;
}
.calc-note { margin: 0; color: var(--ink-2); font-size: .89rem; }

/* ---------- review console ---------- */

.review-bar {
  position: sticky; top: 60px; z-index: var(--z-sticky);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 16px 0; margin: 26px 0 20px;
}
.review-stats { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 12px; font-size: .88rem; color: var(--ink-2); }
.rstat strong { color: var(--ink); font-size: 1rem; }
.rstat.good strong { color: var(--ok); }
.rstat.bad strong { color: var(--bad); }
.review-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.review-filters input { flex: 1 1 220px; }
.review-filters select { width: auto; flex: 0 1 auto; }

.review-list { display: grid; gap: 14px; }
.rq { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.rq.ok { border-color: var(--ok-line); }
.rq.flagged { border-color: var(--bad-line); }
.rq-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; }
.tag-gen { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
[data-theme="dark"] .tag-gen { color: var(--ink); }
.rq-id { margin-left: auto; font-size: .74rem; color: var(--ink-3); font-family: var(--mono); }
.rq-stem { margin: 0 0 12px; font-weight: 650; font-size: 1.03rem; }
.rq-options { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 5px; font-size: .94rem; color: var(--ink-2); }
.rq-options li { display: flex; gap: 8px; align-items: baseline; }
.rq-options .is-correct { color: var(--ok); font-weight: 650; }
.rq-letter { flex: none; width: 16px; font-size: .78rem; font-weight: 700; color: var(--ink-3); }
.rq-options .is-correct .rq-letter { color: var(--ok); }
.rq-options em { font-style: normal; font-size: .8rem; opacity: .85; }
.rq-expl {
  font-size: .93rem; padding: 14px 16px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.rq-verify { margin: 14px 0 0; font-size: .88rem; border-radius: var(--radius-sm); padding: 12px 14px; }
.rq-verify.ok { background: var(--ok-soft); border: 1px solid var(--ok-line); color: var(--ink); }
.rq-verify.bad { background: var(--bad-soft); border: 1px solid var(--bad-line); color: var(--ink); }
.rq-verify-head { margin: 0 0 8px; font-weight: 700; color: var(--bad); }
.rq-verify ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.rq-verify-src { margin: 8px 0 0; font-size: .8rem; color: var(--ink-3); word-break: break-all; }
.rq-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.rq-actions .btn { min-height: 40px; padding: 8px 14px; font-size: .88rem; }
.rq-note { font-size: .86rem; color: var(--ink-2); }

/* ---------- session chrome: flags, calculator popup, question maps ---------- */

.btn svg { width: 16px; height: 16px; flex: none; }
.head-actions { display: flex; gap: 8px; flex: none; flex-wrap: wrap; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.field-hint { margin: 10px 0 0; color: var(--ink-3); font-size: .84rem; max-width: 68ch; }

/* Quiet chrome, not a boxed control: the flag is a text button that only
   speaks up once pressed. Exam-only furniture (practice hides it). */
.flag-btn {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: .78rem; font-weight: 600;
  min-height: 44px; padding: 6px 10px;   /* thumb-first, even for small chrome */
  background: transparent; color: var(--ink-3);
  border: none; border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--t-hover) var(--ease), color var(--t-hover) var(--ease);
}
.flag-btn svg { width: 14px; height: 14px; flex: none; }
/* Flagged = hazard yellow, the second of yellow's two permitted uses. The
   flag glyph + label carry the meaning; the tint stays low-alpha. */
.flag-btn:hover { color: var(--ink); background: var(--surface-2); }
.flag-btn[aria-pressed="true"] {
  background: var(--hazard-soft);
  color: var(--ink);
}
.flag-btn[aria-pressed="true"] svg { color: var(--hazard-deep); }
.qmeta { align-items: center; }

/* Grid-cell states. Every state also carries a glyph or aria-label — never
   colour alone (colour blindness is common in this trade). */
.qgrid-cell { position: relative; }
.qgrid-cell.flagged::after {
  content: "⚑";
  position: absolute; top: -7px; right: -4px;
  font-size: .72rem; line-height: 1;
  color: var(--hazard-deep);
}
.qgrid-cell.right { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.qgrid-cell.wrong { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
.qgrid-cell.right::before, .qgrid-cell.wrong::before {
  position: absolute; top: -7px; right: -3px;
  font-size: .68rem; line-height: 1;
}
.qgrid-cell.right::before { content: "✓"; color: var(--ok); }
.qgrid-cell.wrong::before { content: "✕"; color: var(--bad); }
[data-theme="dark"] .qgrid-cell.right, [data-theme="dark"] .qgrid-cell.wrong { color: var(--ink); }

/* The in-session calculator popup: native <dialog>, so Esc, focus trapping and
   the backdrop come from the platform instead of hand-rolled code. */
#calc-dialog {
  width: min(720px, calc(100vw - 24px));
  max-height: min(85dvh, 900px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}
#calc-dialog::backdrop { background: oklch(15% 0.02 220 / 0.55); }
.calc-dialog-head {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.calc-dialog-head h2 { font-size: 1.15rem; }
#calc-dialog-list { padding: 16px 18px 22px; display: grid; gap: 14px; }

/* Progress area rows are buttons: hover invites the focused-session popup. */
.domain-row-btn {
  display: block; width: 100%;
  font: inherit; text-align: left;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .15s var(--ease), background .15s var(--ease),
              box-shadow .15s var(--ease), transform .08s var(--ease);
}
.domain-row-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: var(--shadow-sm);
}
.domain-row-btn:active { transform: translateY(1px); }

#drill-dialog {
  width: min(440px, calc(100vw - 24px));
  margin: auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}
#drill-dialog::backdrop { background: oklch(15% 0.02 220 / 0.55); }
.drill-body { padding: 24px; }
.drill-body h2 { font-size: 1.25rem; }

.resume-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  margin: 0 0 22px; padding: 14px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
}
.resume-title { margin: 0 0 2px; font-weight: 650; }
.mock-right { flex-wrap: wrap; justify-content: flex-end; }

.fab-top {
  position: fixed;
  right: 18px; bottom: 18px;
  z-index: var(--z-sticky);
  width: 50px; height: 50px;
  padding: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.fab-top svg { width: 22px; height: 22px; }

/* ---------- responsive ---------- */

@media (min-width: 640px) {
  .hero h1 { font-size: 3.2rem; }
  .pillars { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 639px) {
  .topbar { padding: 10px 14px; }
  #main { padding: 24px 14px 56px; }
  .card { padding: 20px; border-radius: var(--radius); }
  .hero h1 { font-size: 2.05rem; }
  .qstem { font-size: 1.15rem; }
  .practice-actions { flex-direction: column; }
  .qgrid-cell { width: 38px; height: 38px; }
  .readiness-main { gap: 16px; }

  /* A 390px header cannot carry five controls. Keep the two that matter on a
     phone (primary action + theme) and drop the rest into the page itself. */
  .nav-user,
  .topnav a.btn,
  #nav-progress,
  #nav-logout { display: none; }
  .topnav { gap: 6px; }
  .topnav .btn { padding: 10px 14px; font-size: .9rem; }
  .brand-name { font-size: .95rem; }

  .practice-head { flex-wrap: wrap; }
  .mock-right { width: 100%; justify-content: space-between; }

  /* Don't let the ✓ Correct / ✕ Your answer label squeeze the option text into a
     narrow column — give it its own line. */
  .option { flex-wrap: wrap; }
  .option-flag { width: 100%; margin: 6px 0 0 38px; }
}

/* Signed-in phone users still need progress and sign-out: surface them in-page. */
@media (max-width: 639px) {
  .mobile-actions { display: flex; gap: 8px; margin-top: 20px; }
  .mobile-actions .btn { flex: 1; }
}
@media (min-width: 640px) {
  .mobile-actions { display: none; }
}

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