/* ============================================================================
   Medoro — stylesheet

   COLOUR IS LOCKED. Every value in the colour block below is byte-identical
   to the previous stylesheet, and the roles are unchanged:
       orange  = identity and accent, never an action
       teal    = every interactive thing
       cream   = page, white = raised surface, warm greys = rules and text
   Nothing outside :root contains a hex value, so the palette cannot drift.

   EVERYTHING ELSE IS NEW. The previous design was a centred hero above a grid
   of floating rounded cards with soft blurred shadows, set in a serif display
   face. This one is a ledger: left-aligned, ruled, near-square, flat, with
   hard-offset shadows and a geometric/mono type pairing. Same colours, and
   deliberately not the same app.
   ============================================================================ */

:root {
  /* ---- COLOUR — unchanged, locked ------------------------------------- */
  --page: #FDF8F3;
  --page-2: #F6EDE4;
  --card: #FFFFFF;
  --white: #FFFFFF;
  --tint: #EFE4D8;

  --line: #EDE4DA;
  --line-strong: #E0D2C4;
  --line-input: #97897B;

  --ink: #292524;
  --ink-2: #57534E;
  --ink-3: #6F6862;

  --brand: #C2410C;
  --brand-ink: #9A3412;
  --brand-tint: #FBEDE4;

  --sky: #0E7490;
  --sky-ink: #0B5A70;
  --sky-tint: #E8F2F5;
  --focus: #0E7490;

  --ok: #4D7C0F;
  --ok-ink: #3F6A0C;
  --ok-tint: #F1F6E5;

  --wrong: #B42318;
  --wrong-ink: #9B2C1C;
  --wrong-tint: #FCECE9;

  --warn: #92400E;
  --warn-tint: #FBF0DE;

  /* ---- TYPE — new ------------------------------------------------------
     Three jobs, three faces. Space Grotesk carries headings and figures:
     geometric, tightly spaced, nothing like the serif it replaces. Plex Sans
     carries reading text. Plex Mono carries every label, status and ordinal,
     which is what gives the page its clinical, spec-sheet voice.            */
  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-sans: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  /* Body moves 15px -> 16px. The smallest functional size is now 11.5px and
     is only ever used for tracked mono labels, which read larger than they
     measure. */
  --t-xs: 11.5px;
  --t-sm: 13px;
  --t-base: 16px;
  --t-md: 18px;
  --t-lg: clamp(19px, 1.5vw, 21px);
  --t-xl: clamp(22px, 2.2vw, 26px);
  --t-2xl: clamp(26px, 3.2vw, 32px);
  --t-3xl: clamp(30px, 4.6vw, 44px);
  --t-4xl: clamp(34px, 5.8vw, 58px);

  --lh-tight: 1.05;
  --lh-snug: 1.28;
  --lh-normal: 1.6;
  --lh-relaxed: 1.7;

  --track-label: .16em;   /* tracking for uppercase mono labels */

  /* ---- SPACE ----------------------------------------------------------- */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;
  --s-16: 64px;
  --s-20: 80px;

  /* ---- GEOMETRY — square, not rounded ---------------------------------- */
  --r-sm: 2px;
  --r: 2px;
  --r-lg: 3px;
  --r-xl: 3px;

  /* ---- DEPTH — hard offsets, zero blur ---------------------------------
     Same warm brown as before, but the blur is gone. A shadow here reads as
     a printed offset, not as a floating card.                              */
  --sh-sm: 2px 2px 0 rgba(69, 26, 3, .05);
  --sh: 3px 3px 0 rgba(69, 26, 3, .07);
  --sh-md: 4px 4px 0 rgba(69, 26, 3, .10);
  --sh-lg: 6px 6px 0 rgba(69, 26, 3, .16);

  /* ---- MOTION ----------------------------------------------------------- */
  --ease: cubic-bezier(.2, 0, 0, 1);
  --dur-1: 120ms;
  --dur-2: 180ms;

  /* ---- LAYOUT ----------------------------------------------------------- */
  --container: 1080px;
  --tap: 44px;
}

/* ============================================================================
   RESET
   ============================================================================ */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--t-base);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
svg { display: block; flex: none; }
img { max-width: 100%; height: auto; }
ul { list-style: none; margin: 0; padding: 0; }
dl, dd, dt { margin: 0; }

/* Long module names and clinical stems must wrap, never overflow. */
p, li, h1, h2, h3, h4, .lead, .module-name { overflow-wrap: anywhere; }

::selection { background: var(--brand-tint); color: var(--brand-ink); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

/* ============================================================================
   ICONS
   ============================================================================ */
.icon {
  width: 1em;
  height: 1em;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* ============================================================================
   TYPE PRIMITIVES
   ============================================================================ */
.display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: var(--lh-tight);
  color: var(--ink);
}

.h1 { font-size: var(--t-3xl); margin: 0; }
.h2 { font-size: var(--t-2xl); margin: 0; }

.lead {
  margin: var(--s-3) 0 0;
  font-size: var(--t-md);
  line-height: var(--lh-normal);
  color: var(--ink-2);
  max-width: 54ch;
}

/* Every uppercase label in the app is mono. This is the single strongest
   signal of the new look, so it is defined once and reused. */
.cap, .eyebrow, .section-label {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}
.cap, .eyebrow { color: var(--brand); }
.section-label { color: var(--ink-3); }

.num {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ============================================================================
   SHELL
   ============================================================================ */
.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Flat. The previous topbar was translucent with a 12px backdrop blur; this
   one is opaque and separated by a single rule. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--page);
  border-bottom: 1px solid var(--line-strong);
}

.topbar-in {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  max-width: var(--container);
  min-height: 60px;
  margin-inline: auto;
  padding: 0 var(--s-4);
}

.logo {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  background: var(--brand);
  color: var(--white);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
}

.topbar-title {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-2);
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; }

.iconbtn {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  transition: background var(--dur-1) var(--ease),
              color var(--dur-1) var(--ease),
              border-color var(--dur-1) var(--ease);
}
.iconbtn .icon { width: 18px; height: 18px; }
.iconbtn:hover {
  background: var(--page-2);
  border-color: var(--line-strong);
  color: var(--ink);
}

.content {
  flex: 1;
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding: var(--s-8) var(--s-4) var(--s-20);
}

@media (min-width: 640px) {
  .topbar-in { padding: 0 var(--s-6); }
  .content { padding: var(--s-10) var(--s-6) var(--s-20); }
}
@media (min-width: 1024px) {
  .topbar-in { padding: 0 var(--s-8); }
  .content { padding: var(--s-12) var(--s-8) var(--s-20); }
}

/* ============================================================================
   PAGE HEADER
   Left-aligned, with a heavy rule under it. Nothing is centred.
   ============================================================================ */
.pagehead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-6);
  flex-wrap: wrap;
  padding-bottom: var(--s-5);
  margin-bottom: var(--s-8);
  border-bottom: 2px solid var(--ink);
}

.pagehead-text { min-width: 0; flex: 1 1 320px; }
.pagehead .h1 { margin-top: var(--s-2); }

/* Figures sit in a ruled strip beside the title, like a spec sheet. */
.facts {
  display: flex;
  flex: none;
  border: 1px solid var(--line-strong);
  background: var(--card);
}
.fact {
  padding: var(--s-3) var(--s-4);
  min-width: 78px;
}
.fact + .fact { border-left: 1px solid var(--line-strong); }
.fact dt {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-3);
}
.fact dd {
  margin-top: var(--s-1);
  font-size: var(--t-xl);
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
}

/* ============================================================================
   BLOCKS — the Year 4 structure
   A bordered container per block, with modules as ruled rows inside it.
   Rows are not cards: they share one border and are separated by hairlines.
   ============================================================================ */
.block {
  border: 1px solid var(--line-strong);
  background: var(--card);
  box-shadow: var(--sh-sm);
}
.block + .block { margin-top: var(--s-6); }

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
  padding: var(--s-4) var(--s-5);
  background: var(--page-2);
  border-bottom: 1px solid var(--line-strong);
}

.block-num {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--t-xl);
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink);
}

/* "Block" is a mono label; the number beside it is the display face. */
.block-word {
  margin-right: var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  /* --brand on --page-2 measures 4.48:1, just under AA for text this small.
     --brand-ink is the same family, already in the palette, and clears it
     at 6.32:1. */
  color: var(--brand-ink);
  vertical-align: middle;
}

.block-meta {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-3);
}

.module {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
}
.module + .module { border-top: 1px solid var(--line); }

.module-ord {
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--ink-3);
  font-family: var(--font-mono);
}

.module-name {
  font-size: var(--t-base);
  font-weight: 500;
  line-height: var(--lh-snug);
  color: var(--ink);
}

/* The state is carried by the word "Coming Soon" as well as by colour, so it
   survives greyscale and colour-blind vision. */
.status {
  flex: none;
  padding: 5px var(--s-2);
  border-radius: var(--r-sm);
  background: var(--warn-tint);
  color: var(--warn);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Below 560px the status drops under the name rather than squeezing it. */
@media (max-width: 559px) {
  .module {
    grid-template-columns: auto 1fr;
    row-gap: var(--s-2);
  }
  .status { grid-column: 2; justify-self: start; }
}

/* ============================================================================
   BUTTONS, LINKS, EMPTY STATE
   ============================================================================ */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  width: 100%;
  min-height: var(--tap);
  padding: 0 var(--s-5);
  background: var(--sky);
  color: var(--white);
  border: 1px solid var(--sky);
  border-radius: var(--r-sm);
  font-size: var(--t-base);
  font-weight: 600;
  text-decoration: none;
  transition: background var(--dur-1) var(--ease);
}
.btn:hover:not(:disabled) { background: var(--sky-ink); border-color: var(--sky-ink); }
.btn.auto { width: auto; display: inline-flex; }
.btn.secondary {
  background: var(--card);
  color: var(--ink);
  border-color: var(--line-input);
}
.btn.secondary:hover:not(:disabled) { background: var(--page-2); }

.link {
  color: var(--sky);
  font-size: var(--t-sm);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link:hover { color: var(--sky-ink); }

.back {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: var(--tap);
  margin-bottom: var(--s-4);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-2);
  text-decoration: none;
}
.back:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.back .icon { width: 15px; height: 15px; }

.empty {
  display: grid;
  justify-items: start;
  gap: var(--s-2);
  padding: var(--s-12) var(--s-6);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--brand);
  background: var(--card);
}
.empty .ic {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: var(--s-3);
  border-radius: var(--r-sm);
  background: var(--brand-tint);
  color: var(--brand-ink);
}
.empty .ic .icon { width: 22px; height: 22px; }
.empty h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--t-xl);
  font-weight: 700;
  letter-spacing: -.02em;
}
.empty p {
  margin: 0;
  max-width: 48ch;
  color: var(--ink-2);
}

/* ============================================================================
   SIGN IN
   Left-aligned inside a square panel with a hard offset. The previous card
   was centred, rounded and softly shadowed.
   ============================================================================ */
.signin-wrap {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: var(--s-6) var(--s-4);
}

.signin {
  width: 100%;
  max-width: 400px;
  padding: var(--s-8);
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--brand);
  box-shadow: var(--sh-md);
  text-align: left;
}

.signin .logo { margin-bottom: var(--s-5); }
.signin .eyebrow { margin-bottom: var(--s-2); }
.signin .h1 { font-size: var(--t-2xl); }
.signin .lead { margin-bottom: var(--s-6); font-size: var(--t-base); }

.signin label {
  display: block;
  margin: var(--s-4) 0 var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-2);
}

.field {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: 0 var(--s-3);
  background: var(--card);
  border: 1px solid var(--line-input);
  border-radius: var(--r-sm);
  font-size: var(--t-base);
  color: var(--ink);
  transition: border-color var(--dur-1) var(--ease),
              box-shadow var(--dur-1) var(--ease);
}
.field:hover { border-color: var(--ink-3); }
.field:focus {
  outline: none;
  border-color: var(--sky);
  box-shadow: 0 0 0 3px var(--sky-tint);
}

/* Empty on a clean load, so it must not reserve space or draw a box. */
.err { display: none; }
.err:not(:empty) {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  margin-top: var(--s-4);
  padding: var(--s-3);
  background: var(--wrong-tint);
  border: 1px solid var(--wrong);
  border-radius: var(--r-sm);
  color: var(--wrong-ink);
  font-size: var(--t-sm);
}
.err .icon { margin-top: 2px; }

.signin .btn { margin-top: var(--s-6); }
.signin .link { display: inline-block; margin-top: var(--s-4); }

.note {
  margin: var(--s-5) 0 0;
  padding-top: var(--s-4);
  border-top: 1px solid var(--line);
  font-size: var(--t-sm);
  line-height: var(--lh-snug);
  color: var(--ink-3);
}

/* ============================================================================
   TOAST
   ============================================================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: var(--s-6);
  z-index: 200;
  transform: translate(-50%, 10px);
  max-width: calc(100% - var(--s-10));
  padding: var(--s-3) var(--s-4);
  background: var(--ink);
  color: var(--white);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-lg);
  font-size: var(--t-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.shake { animation: shake 240ms var(--ease); }

/* ============================================================================
   HOME — active module row
   Every other row in .modules is still the plain span-based row from the
   original design (untouched). An 'active' row is the same grid recipe,
   moved onto an <a> so hover/focus read as a real link; the "Coming Soon"
   badge slot is simply gone, replaced by a chevron.
   ============================================================================ */
.module.module--active { display: block; padding: 0; }
.module-link {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  color: inherit;
  text-decoration: none;
  transition: background var(--dur-1) var(--ease);
}
.module-link:hover { background: var(--page-2); }
.module-link:hover .module-name { color: var(--sky-ink); }
.module-link .icon { flex: none; color: var(--ink-3); }

/* ============================================================================
   TOPIC LIST — one open module's topics
   Same ruled-rows-inside-a-border recipe as .block/.module.
   ============================================================================ */
.topics .topic + .topic { border-top: 1px solid var(--line); }

.topic-link {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  color: inherit;
  text-decoration: none;
  transition: background var(--dur-1) var(--ease);
}
.topic-link:hover { background: var(--page-2); }
.topic-link:hover .topic-name { color: var(--sky-ink); }
.topic-link .icon { flex: none; color: var(--ink-3); }

.topic-code {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: .03em;
  color: var(--ink-3);
  white-space: nowrap;
}
.topic-name-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-2);
  min-width: 0;
}
.topic-name {
  font-size: var(--t-base);
  font-weight: 500;
  line-height: var(--lh-snug);
  color: var(--ink);
}
/* Dev/QA marker: flags a fallback-sourced topic right in the list, before a
   tester even opens it - same purpose and colour as the quiz page's
   FALLBACK ACTIVE banner (see migration 004). Standing workflow for every
   module loaded from here on. */
.topic-fallback-badge {
  flex: none;
  padding: 3px var(--s-2);
  border: 1px solid var(--warn);
  border-radius: var(--r-sm);
  background: var(--warn-tint);
  color: var(--warn);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  white-space: nowrap;
}
.topic-count {
  flex: none;
  padding: 5px var(--s-2);
  border-radius: var(--r-sm);
  background: var(--sky-tint);
  color: var(--sky-ink);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 559px) {
  .topic-link { grid-template-columns: 1fr auto; row-gap: var(--s-1); }
  .topic-code { grid-column: 1 / -1; }
}

/* ---- Search + QID jump ---- */
.searchbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  margin-bottom: var(--s-6);
}
.search-field { position: relative; flex: 1 1 240px; }
.search-field .icon {
  position: absolute;
  left: var(--s-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}
.search-field .field { padding-left: calc(var(--s-3) + 22px); }

.qid-jump { display: flex; gap: var(--s-2); flex: 1 1 340px; }
.qid-jump .field { flex: 1; min-width: 0; }

.empty-search {
  margin-top: var(--s-4);
  color: var(--ink-3);
  font-size: var(--t-sm);
}

/* Dev/QA verification aid: whenever a topic is serving another topic's
   questions (see migration 004 / y4_topic_questions), this banner makes
   that fact impossible to miss on the page itself, without querying the
   database to confirm it fired. Loud on purpose - not styled to blend in
   like .err, since its entire job is to stand out during testing. Standing
   workflow for every module loaded from here on. */
.fallback-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  margin-bottom: var(--s-6);
  padding: var(--s-4);
  background: var(--warn-tint);
  border: 2px solid var(--warn);
  border-radius: var(--r-sm);
  color: var(--warn);
}
.fallback-banner .icon { flex: none; margin-top: 2px; }
.fallback-banner p { margin: 0; font-size: var(--t-sm); line-height: var(--lh-normal); }
.fallback-banner strong {
  font-family: var(--font-mono);
  letter-spacing: .05em;
}

/* ============================================================================
   QUIZ
   A number strip for jumping between questions, one question card at a
   time, and a reveal panel that only exists once the server has answered
   back - nothing here is pre-filled with the key.
   ============================================================================ */
.qnav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-bottom: var(--s-6);
}
.qnav-item {
  display: grid;
  place-items: center;
  min-width: var(--tap);
  height: var(--tap);
  padding: 0 var(--s-2);
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--ink-2);
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.qnav-item:hover { background: var(--page-2); border-color: var(--ink-3); }
.qnav-item.is-current { border-color: var(--sky); box-shadow: 0 0 0 2px var(--sky-tint); }
.qnav-item.is-correct { background: var(--ok-tint); border-color: var(--ok); color: var(--ok-ink); }
.qnav-item.is-wrong { background: var(--wrong-tint); border-color: var(--wrong); color: var(--wrong-ink); }

.qcard {
  padding: var(--s-6);
  margin-bottom: var(--s-6);
  background: var(--card);
  border: 1px solid var(--line-strong);
  box-shadow: var(--sh-sm);
}
.qid {
  margin: 0 0 var(--s-3);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-3);
}
.qtext {
  margin: 0 0 var(--s-6);
  font-size: var(--t-md);
  font-weight: 500;
  line-height: var(--lh-normal);
  color: var(--ink);
}

.opts { display: grid; gap: var(--s-3); }
.opt {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s-1) var(--s-3);
  width: 100%;
  min-height: var(--tap);
  padding: var(--s-3) var(--s-4);
  background: var(--card);
  border: 1px solid var(--line-input);
  border-radius: var(--r-sm);
  text-align: left;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.opt:hover:not(:disabled) { border-color: var(--sky); background: var(--sky-tint); }
.opt:disabled { cursor: default; }
.opt.pending { opacity: .6; }

.opt-letter {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--r-sm);
  background: var(--page-2);
  border: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--ink-2);
}
.opt-text {
  font-size: var(--t-base);
  line-height: var(--lh-snug);
  color: var(--ink);
}
.opt-rationale {
  grid-column: 2;
  font-size: var(--t-sm);
  line-height: var(--lh-snug);
  color: var(--ink-3);
}

.opt.correct { background: var(--ok-tint); border-color: var(--ok); }
.opt.correct .opt-letter { background: var(--ok); border-color: var(--ok); color: var(--white); }
.opt.wrong { background: var(--wrong-tint); border-color: var(--wrong); }
.opt.wrong .opt-letter { background: var(--wrong); border-color: var(--wrong); color: var(--white); }

.reveal {
  margin-top: var(--s-5);
  padding: var(--s-4) var(--s-5);
  border: 1px solid var(--line-strong);
  border-left-width: 3px;
  border-radius: var(--r-sm);
}
.reveal-correct { background: var(--ok-tint); border-left-color: var(--ok); }
.reveal-wrong { background: var(--wrong-tint); border-left-color: var(--wrong); }
.reveal-verdict {
  margin: 0 0 var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}
.reveal-correct .reveal-verdict { color: var(--ok-ink); }
.reveal-wrong .reveal-verdict { color: var(--wrong-ink); }
.reveal-explain {
  margin: 0 0 var(--s-3);
  font-size: var(--t-base);
  line-height: var(--lh-normal);
  color: var(--ink);
}
.reveal-keypoint {
  margin: 0;
  padding-top: var(--s-3);
  border-top: 1px solid var(--line);
  font-size: var(--t-sm);
  line-height: var(--lh-snug);
  color: var(--ink-2);
}

.qfooter { display: flex; gap: var(--s-4); }
.qfooter .btn { flex: 1; }

/* ============================================================================
   MOTION
   ============================================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
