/* Layout concept: a calm exam console. The home page is a briefing sheet. The session is one column
   (passage above, answers below; numerical data keeps its side-by-side desk) between a one-row toolbar
   at the top and the question navigation fixed to the bottom, so a whole question fits on a laptop. */
:root {
  --paper: #f3f5fa;
  --surface: #ffffff;
  --sunken: #e9edf6;
  --ink: #15203b;
  --muted: #5a6479;
  --line: #d6dcea;
  --accent: #1d3fa6;
  --accent-ink: #ffffff;
  --accent-soft: #e2e8fa;
  --gold: #d9a400;
  --gold-soft: #fff4cc;
  --good: #1b7a4b;
  --good-soft: #e3f4ea;
  --bad: #b3261e;
  --bad-soft: #fbe7e5;
  --mark: #ffe680;
  --mark2: #b9f0c4;
  --mark3: #ffc9e0;
  --mark-ink: inherit;
  --fig-grey: #9aa3b6;
  --s1: #1d3fa6;
  --s2: #d9a400;
  --s3: #2f8f83;
  --s4: #b5527a;
  --s5: #7a6a3a;
  --s6: #6b7f99;
  --s7: #7a3e9d;
  --s8: #b5651d;
  --s9: #2e7d32;
  --s10: #c2185b;
  --s11: #00838f;
  --s12: #5d4037;
  --scroll-shadow: rgba(21, 32, 59, 0.22);
  /* System fonts only: no third-party font requests (privacy) and fully offline. */
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-read: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d1322; --surface: #151d31; --sunken: #1b2440; --ink: #e5e9f4; --muted: #9aa3ba; --line: #2a3452;
    --accent: #8ea6ff; --accent-ink: #0d1322; --accent-soft: #1f2a4f; --gold: #f2c94c; --gold-soft: #3a3214;
    --good: #5cc98f; --good-soft: #17352a; --bad: #ff8a80; --bad-soft: #3d1d1d; --mark: #6b5a12; --mark2: #1f4d2c; --mark3: #5a2440; --mark-ink: inherit; --fig-grey: #7a849c;
    --s1: #8ea6ff; --s2: #f2c94c; --s3: #5fc7b8; --s4: #e88fb3; --s5: #c8b27a; --s6: #a3b4cc; --s7: #c39bd3; --s8: #f0a868; --s9: #8fd18f; --s10: #f48fb1; --s11: #80deea; --s12: #d7b9a8; --scroll-shadow: rgba(0, 0, 0, 0.7); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0d1322; --surface: #151d31; --sunken: #1b2440; --ink: #e5e9f4; --muted: #9aa3ba; --line: #2a3452;
  --accent: #8ea6ff; --accent-ink: #0d1322; --accent-soft: #1f2a4f; --gold: #f2c94c; --gold-soft: #3a3214;
  --good: #5cc98f; --good-soft: #17352a; --bad: #ff8a80; --bad-soft: #3d1d1d; --mark: #6b5a12; --mark2: #1f4d2c; --mark3: #5a2440; --mark-ink: inherit; --fig-grey: #7a849c;
  --s1: #8ea6ff; --s2: #f2c94c; --s3: #5fc7b8; --s4: #e88fb3; --s5: #c8b27a; --s6: #a3b4cc; --s7: #c39bd3; --s8: #f0a868; --s9: #8fd18f; --s10: #f48fb1; --s11: #80deea; --s12: #d7b9a8; --scroll-shadow: rgba(0, 0, 0, 0.7); color-scheme: dark;
}

/* ENV-06: high-contrast theme, one of the contrast themes of TAO's accessibility tools. */
:root[data-theme="contrast"] {
  --paper: #000000; --surface: #000000; --sunken: #141414; --ink: #ffffff; --muted: #e6e6e6; --line: #ffffff;
  --accent: #ffff00; --accent-ink: #000000; --accent-soft: #2a2a00; --gold: #ffd700; --gold-soft: #332b00;
  --good: #00ff7f; --good-soft: #003319; --bad: #ff6b6b; --bad-soft: #330000; --mark: #ffff00; --mark2: #00ff7f; --mark3: #ff9ad5; --mark-ink: #000000; --fig-grey: #bbbbbb;
  --s1: #ffff00; --s2: #00ffff; --s3: #00ff7f; --s4: #ff9ad5; --s5: #ffb347; --s6: #ffffff; --s7: #ff6b6b; --s8: #b0ff57; --s9: #87cefa; --s10: #ffd700; --s11: #ff8c00; --s12: #da70d6; --scroll-shadow: rgba(255, 255, 255, 0.5); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { background: var(--paper); color: var(--ink); }
body {
  margin: 0;
  font: 15px/1.55 var(--font-ui);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 48px;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3 { line-height: 1.2; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; margin-top: 20px; }
p { margin: 0; }
a { color: var(--accent); }
.small { font-size: 0.82rem; }
.muted { color: var(--muted); }
.eyebrow { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.lede { font-size: 1.05rem; color: var(--muted); max-width: 60ch; }
kbd { font: 0.8rem var(--font-mono); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--surface); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.app { max-width: 1180px; margin: 0 auto; padding-top: 20px; }

/* buttons & controls */
.btn {
  font: 600 0.92rem var(--font-ui); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 14px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-lg { padding: 12px 20px; font-size: 1rem; }
.btn-quiet { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.btn-flag svg { width: 16px; height: 16px; fill: currentColor; }
.btn-flag.on { background: var(--gold-soft); border-color: var(--gold); }
.link-btn { font: 600 0.85rem var(--font-ui); background: none; border: 0; color: var(--accent); cursor: pointer; padding: 4px 2px; text-decoration: underline; text-underline-offset: 3px; }
select, input[type="checkbox"] { font: inherit; color: var(--ink); }
select { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 40px; max-width: 100%; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 24px; }
.pill { font-size: 0.75rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--sunken); color: var(--muted); white-space: nowrap; }
.pill-ok { background: var(--good-soft); color: var(--good); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.chip { font-weight: 700; font-size: 0.95rem; margin: 0; letter-spacing: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.alert { background: var(--gold-soft); border: 1px solid var(--gold); border-radius: 8px; padding: 10px 14px; font-size: 0.9rem; margin: 14px 0; }

/* home */
.home { display: grid; gap: 28px; }
.masthead { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 28px; align-items: end; padding: 12px 0 8px; border-bottom: 2px solid var(--ink); padding-bottom: 22px; }
.mast-text { display: grid; gap: 10px; min-width: 0; }
.format { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.format > div { padding: 12px 14px; border-left: 1px solid var(--line); }
.format > div:first-child { border-left: 0; }
.format dt { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.format dd { margin: 2px 0 0; font-variant-numeric: tabular-nums; }
.format dd b { font-family: var(--font-mono); font-size: 1.05rem; }

.exam-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; background: var(--accent); color: var(--accent-ink); border-radius: 14px; padding: 22px 24px; }
.exam-card h2 { font-size: 1.4rem; margin-bottom: 6px; }
.exam-card .muted { color: inherit; opacity: 0.85; max-width: 62ch; }
.exam-start { display: flex; flex-direction: column; gap: 8px; min-width: 220px; }
.exam-start select { border-color: transparent; }
.exam-card .btn-primary { background: var(--accent-ink); color: var(--accent); border-color: var(--accent-ink); }

.train { display: grid; gap: 14px; }
.train-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 16px 28px; align-items: end; }
.train-head p { max-width: 60ch; margin-top: 4px; }
.train-opts { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; justify-content: flex-end; }
.ttable { display: grid; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.trow { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.7fr) minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line); }
.trow:first-child { border-top: 0; }
.tcell { display: flex; flex-direction: column; min-width: 0; }
.tact { flex-direction: row; gap: 8px; }
.big-num { font: 600 1.35rem var(--font-mono); font-variant-numeric: tabular-nums; }

.history h2 { margin-bottom: 10px; }
.hist { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.hist li { display: grid; grid-template-columns: 130px 120px minmax(0, 1fr) auto; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); align-items: center; font-size: 0.9rem; }
.hist li:first-child { border-top: 0; }
.hist-date, .hist-score { font-family: var(--font-mono); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.hist-mode { font-weight: 600; }
.foot { border-top: 1px solid var(--line); padding-top: 16px; display: grid; gap: 6px; font-size: 0.9rem; }

/* cards (brief, lesson, between) */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: grid; gap: 14px; }
.narrow { max-width: 720px; margin: 0 auto; }
.lesson { max-width: 820px; margin: 0 auto; }
.lesson h2 { margin-top: 10px; }
.brief-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--radius); }
.brief-list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.brief-list li:first-child { border-top: 0; }
.rules { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.steps { counter-reset: st; list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.steps li { counter-increment: st; display: grid; grid-template-columns: 34px minmax(0, 1fr); column-gap: 12px; }
.steps li::before { content: counter(st); grid-row: span 2; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font: 700 0.9rem var(--font-mono); }
.steps li span { color: var(--muted); }
.traps { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

/* session */
.exam-bar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px;
}
.bar-left, .bar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; }
.tools { position: relative; display: flex; flex-wrap: wrap; gap: 4px; background: var(--sunken); border-radius: 8px; padding: 3px; }
.zoom { display: inline-flex; align-items: center; gap: 0; border-left: 1px solid var(--line); margin-left: 2px; padding-left: 2px; }
.zoom .tool { padding: 6px 8px; min-width: 32px; justify-content: center; }
.zoom .zoom-level { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
/* Settings and accessibility menus open under the toolbar, as TAO's do. */
.tool-pop { position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; width: min(340px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18); padding: 14px; display: grid; gap: 8px; font-weight: 400; text-align: left; }
.tool-pop h2 { font-size: 1rem; }
.tool-pop .row-actions { margin-top: 6px; }
.a11y-theme { border: 0; padding: 0; margin: 0; display: grid; gap: 4px; }
.a11y-theme legend { padding: 0; margin-bottom: 4px; }
.a11y-row { display: grid; grid-template-columns: minmax(0, 1fr) 40px 56px 40px; align-items: center; gap: 6px; }
.a11y-row .btn { min-height: 34px; padding: 4px 0; justify-content: center; }
.a11y-row b { text-align: center; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tool { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--ink); font: 600 0.82rem var(--font-ui); padding: 6px 10px; border-radius: 6px; cursor: pointer; min-height: 34px; }
.tool svg { width: 18px; height: 18px; fill: currentColor; }
.tool.on { background: var(--surface); color: var(--accent); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.timer { font: 600 1rem var(--font-mono); font-variant-numeric: tabular-nums; padding: 6px 10px; border-radius: 6px; background: var(--sunken); white-space: nowrap; }
.timer.warn { background: var(--gold-soft); color: var(--ink); }
.timer.crit { background: var(--bad-soft); color: var(--bad); }
.timer-q { display: inline-flex; align-items: center; gap: 6px; background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.timer-q.stopped { color: var(--muted); }
.timer-tag { font: 700 0.7rem var(--font-ui); letter-spacing: 0.04em; padding: 1px 5px; border-radius: 4px; background: var(--sunken); color: var(--muted); }
.btn-exit { color: var(--bad); border-color: var(--bad); }
.btn-exit:hover { background: var(--bad-soft); }

.session { margin-top: 14px; display: grid; gap: 12px; }
/* ENV-08: TAO navigation bar: arrows, numbered circles (grey not opened, outlined opened, filled answered),
   a small arrow under the current question and the Overview button. */
.qnav { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; }
.qdots { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.nav-arrow { width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--surface); color: var(--ink); font-size: 1.1rem; cursor: pointer; }
.nav-arrow:disabled { opacity: 0.35; cursor: not-allowed; }
.nav-overview { min-height: 36px; padding: 6px 12px; border-radius: 999px; border-color: var(--ink); font-size: 0.82rem; }
.qdot { width: 36px; height: 36px; margin-bottom: 8px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--sunken); color: var(--muted); font: 600 0.85rem var(--font-mono); cursor: pointer; position: relative; }
.qdot.opened { background: var(--surface); border: 2px solid var(--ink); color: var(--ink); }
.qdot.answered { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.qdot.current { outline: 2px solid var(--accent); outline-offset: 1px; }
.qdot.current::after { content: ""; position: absolute; left: 50%; bottom: -9px; width: 0; height: 0; margin-left: -5px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 6px solid var(--ink); }
.qdot.flagged { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--gold); }
.qdot.ok { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.qdot.bad { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); border-style: dashed; }
.qdot.ok::before, .qdot.bad::before { position: absolute; bottom: -4px; right: -4px; width: 15px; height: 15px; border-radius: 50%; font: 700 10px/15px var(--font-ui); color: var(--surface); }
.qdot.ok::before { content: "✓"; background: var(--good); }
.qdot.bad::before { content: "✗"; background: var(--bad); }
.legend-row { display: flex; flex-wrap: wrap; gap: 14px; }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--line); display: inline-block; background: var(--surface); }
.lg-unopened { background: var(--sunken); }
.lg-opened { border: 2px solid var(--ink); }
.lg-ans { background: var(--ink); border-color: var(--ink); }
.lg-flag { background: var(--surface); box-shadow: 0 0 0 2px var(--gold); }
.lg-ok, .lg-bad { width: 15px; height: 15px; font: 700 10px/12px var(--font-ui); text-align: center; color: var(--surface); font-style: normal; }
.lg-ok { background: var(--good); border-color: var(--good); }
.lg-bad { background: var(--bad); border-color: var(--bad); }

/* Zoom (movable toolbar) and the accessibility text settings apply to the question area. */
.q-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  zoom: var(--q-zoom, 1); font-size: calc(1em * var(--a11y-font, 1)); line-height: calc(1.55 * var(--a11y-lhf, 1)); word-spacing: var(--a11y-ws, normal); letter-spacing: var(--a11y-ls, normal);
}
.q-abstract { grid-template-columns: minmax(0, 1fr); }
.stimulus { padding: 22px 24px; border-right: 1px solid var(--line); min-width: 0; }
.q-abstract .stimulus { border-right: 0; border-bottom: 1px solid var(--line); }
.answer-pane { padding: 22px 24px; display: grid; gap: 14px; align-content: start; min-width: 0; }
.stim-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.passage { font: calc(1.06rem * var(--a11y-font, 1)) / calc(1.7 * var(--a11y-lhf, 1)) var(--font-read); max-width: 65ch; display: grid; gap: 12px; }
.passage.hl-on { cursor: text; }
.hl-hint { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.passage.hl-erase mark { cursor: pointer; }
.passage mark { background: var(--mark); color: var(--mark-ink); border-radius: 2px; }
.passage mark.mark-1 { background: var(--mark2); }
.passage mark.mark-2 { background: var(--mark3); }
.hl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.hl-swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; }
.hl-swatch.swatch-0 { background: var(--mark); }
.hl-swatch.swatch-1 { background: var(--mark2); }
.hl-swatch.swatch-2 { background: var(--mark3); }
.hl-swatch[aria-pressed="true"] { border-color: var(--ink); outline: 2px solid var(--accent); outline-offset: 1px; }
.hl-tool { min-height: 30px; padding: 4px 10px; font-size: 0.82rem; }
.hl-tool[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.stem { font-size: calc(1.12rem * var(--a11y-font, 1)); }
.qhead { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.qnum { font: 600 0.85rem var(--font-mono); color: var(--muted); }

.opts { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.opt { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.opt-main { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: start; text-align: left; width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; }
.opt-main:hover:not(:disabled) { border-color: var(--accent); }
.opt-main:disabled { cursor: default; }
.letter { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font: 700 0.85rem var(--font-mono); }
.opt-body { display: grid; gap: 6px; min-width: 0; }
.opt.chosen .opt-main { border-color: var(--accent); background: var(--accent-soft); }
.opt.chosen .letter { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.opt.struck .opt-body > span { text-decoration: line-through; color: var(--muted); }
.opt.struck .opt-body .fig { opacity: 0.3; }
.opt.right .opt-main { border-color: var(--good); background: var(--good-soft); }
.opt.right .letter { background: var(--good); border-color: var(--good); color: var(--surface); }
.opt.wrong .opt-main { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .letter { background: var(--bad); border-color: var(--bad); color: var(--surface); }
.opt-note { font-size: 0.86rem; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 6px; }
.opt.right .opt-note, .opt.wrong .opt-note { color: var(--ink); }
.strike { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; font-size: 0.85rem; margin-top: 8px; }
.opt.struck .strike { background: var(--sunken); color: var(--ink); }

.opts-fig { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.opts-fig .opt { grid-template-columns: minmax(0, 1fr); }
.opts-fig .opt-main { grid-template-columns: minmax(0, 1fr); justify-items: center; padding: 10px; }
.opts-fig .opt-body { width: 100%; }
.opts-fig .strike { margin: 0 auto; }
.opts-fig .opt-note { font-size: 0.78rem; }

.series { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.frame { position: relative; border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface); aspect-ratio: 1; max-width: 100%; display: grid; place-items: center; padding: 6px; }
.frame-n { position: absolute; top: 4px; left: 6px; font: 600 0.7rem var(--font-mono); color: var(--muted); }
.frame-q { border-style: dashed; background: var(--sunken); }
.qmark { font: 700 2rem var(--font-mono); color: var(--muted); }
.fig { --ink: #15203b; --surface: #fff; --fig-grey: #9aa3b6; background: #fff; border-radius: 4px; width: 100%; max-width: 140px; aspect-ratio: 1; height: auto; display: block; }
.fig * { stroke: var(--ink); stroke-width: 2.2; stroke-linejoin: round; }
.fig .f-black { fill: var(--ink); }
.fig .f-grey { fill: var(--fig-grey); }
.fig .f-white { fill: var(--surface); }
.fig .f-none { fill: none; }
.fig .f-line { fill: none; stroke-width: 3; }
.fig pattern .p-bg { fill: var(--surface); stroke: none; }
.fig pattern .p-line { fill: none; stroke: var(--ink); stroke-width: 1.1; }
.fig pattern .p-dot { fill: var(--ink); stroke: none; }

.exhibit { margin: 0; display: grid; gap: 10px; }
.exhibit figcaption { font-weight: 700; }
.exhibit-note { font-size: 0.88rem; color: var(--muted); font-style: italic; }
/* N9: a shadow at the edge shows that a wide table scrolls sideways. */
/* Numerical items: the data column gets more room than the answers, so a year of months fits without scrolling. */
.q-numerical { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.table-wrap {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--muted) var(--sunken);
  background:
    linear-gradient(to right, var(--surface) 30%, transparent) left / 32px 100% no-repeat local,
    linear-gradient(to left, var(--surface) 30%, transparent) right / 32px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, var(--scroll-shadow), transparent) left / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, var(--scroll-shadow), transparent) right / 12px 100% no-repeat scroll;
}
/* A table that overflows shows a permanent scrollbar, keeps its row labels in view and offers scroll buttons. */
.table-wrap::-webkit-scrollbar { height: 10px; }
.table-wrap::-webkit-scrollbar-track { background: var(--sunken); border-radius: 5px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 5px; }
.table-box { min-width: 0; }
.table-wrap.is-scrollable { border: 1px solid var(--line); border-radius: 8px; }
.table-wrap.is-scrollable .exhibit-table th[scope="row"], .table-wrap.is-scrollable .exhibit-table thead th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--line); }
.table-wrap.is-scrollable .exhibit-table thead th:first-child { background: var(--sunken); }
.table-scroll-hint { display: none; align-items: center; gap: 8px; margin-top: 6px; }
.table-wrap.is-scrollable + .table-scroll-hint { display: flex; }
.table-scroll-hint .link-btn { text-decoration: none; font-size: 0.9rem; padding: 2px 8px; border: 1px solid var(--line); border-radius: 6px; }
.exhibit-table.wide { font-size: 0.84rem; }
.exhibit-table.wide th, .exhibit-table.wide td { padding: 7px 6px; }
.data-details summary { cursor: pointer; font-size: 0.85rem; color: var(--muted); padding: 2px 0; }
.data-details[open] summary { margin-bottom: 6px; }
.chart-table-sm { display: none; }
.small-values { margin-top: 4px; }
.exhibit-table { border-collapse: collapse; width: 100%; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.exhibit-table th, .exhibit-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.exhibit-table thead th { background: var(--sunken); font-size: 0.8rem; }
.exhibit-table .num { text-align: right; font-family: var(--font-mono); }
.chart-wrap { overflow-x: auto; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--muted); stroke-width: 1.2; }
.chart text { fill: var(--muted); font: 11px var(--font-mono); }
.chart .val { fill: var(--ink); font-size: 10.5px; }
.chart .halo { paint-order: stroke; stroke: var(--surface); stroke-width: 3.5px; stroke-linejoin: round; font-weight: 600; }
.chart .cat { fill: var(--ink); font: 600 11.5px var(--font-ui); }
.bar.s0, .sw.s0 { fill: var(--s1); background: var(--s1); }
.bar.s1, .sw.s1 { fill: var(--s2); background: var(--s2); }
.bar.s2, .sw.s2 { fill: var(--s3); background: var(--s3); }
.bar.s3, .sw.s3 { fill: var(--s4); background: var(--s4); }
.chart .ln { fill: none; stroke-width: 2.5; }
.chart .ln.s0, .chart .pt.s0 { stroke: var(--s1); } .chart .pt.s0 { fill: var(--s1); }
.chart .ln.s1, .chart .pt.s1 { stroke: var(--s2); } .chart .pt.s1 { fill: var(--s2); }
.chart .ln.s2, .chart .pt.s2 { stroke: var(--s3); } .chart .pt.s2 { fill: var(--s3); }
.chart .ln.s3, .chart .pt.s3 { stroke: var(--s4); } .chart .pt.s3 { fill: var(--s4); }
.chart .ln.s1 { stroke-dasharray: 7 4; } .chart .ln.s2 { stroke-dasharray: 2 3; }
.chart .seg { fill: #fff; font-size: 10.5px; font-weight: 600; }
.exhibit-table.compact { font-size: 0.82rem; margin-top: 6px; }
.exhibit-table.compact th, .exhibit-table.compact td { padding: 4px 8px; }
.pie-wrap { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }
.pie { width: 200px; max-width: 100%; height: auto; flex: 0 0 auto; }
.pie .slice { stroke: var(--surface); stroke-width: 1.5; }
.pie-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 0.9rem; min-width: 0; }
.pie-legend li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.pie-legend b { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.slice.p0, .sw.p0 { fill: var(--s1); background: var(--s1); }
.slice.p1, .sw.p1 { fill: var(--s2); background: var(--s2); }
.slice.p2, .sw.p2 { fill: var(--s3); background: var(--s3); }
.slice.p3, .sw.p3 { fill: var(--s4); background: var(--s4); }
.slice.p4, .sw.p4 { fill: var(--s5); background: var(--s5); }
.slice.p5, .sw.p5 { fill: var(--s6); background: var(--s6); }
.slice.p6, .sw.p6 { fill: var(--s7); background: var(--s7); }
.slice.p7, .sw.p7 { fill: var(--s8); background: var(--s8); }
.slice.p8, .sw.p8 { fill: var(--s9); background: var(--s9); }
.slice.p9, .sw.p9 { fill: var(--s10); background: var(--s10); }
.slice.p10, .sw.p10 { fill: var(--s11); background: var(--s11); }
.slice.p11, .sw.p11 { fill: var(--s12); background: var(--s12); }
.exhibit + .exhibit { margin-top: 18px; }
.legend { display: flex; gap: 16px; font-size: 0.85rem; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.unit { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }

.coach { border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent-soft); padding: 14px 16px; display: grid; gap: 10px; }
.coach-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.coach .eyebrow { color: var(--accent); }
.method summary { cursor: pointer; font-weight: 700; font-size: 0.9rem; }
.method ol { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; font-size: 0.9rem; }
.hints { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hints li { background: var(--surface); border-radius: 8px; padding: 10px 12px; font-size: 0.93rem; }
.hint-n { font: 700 0.72rem var(--font-mono); color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; margin-right: 6px; }
.coach-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.feedback { display: grid; gap: 12px; }
.verdict { font-weight: 700; padding: 10px 14px; border-radius: 8px; }
.verdict-ok { background: var(--good-soft); color: var(--good); }
.verdict-bad, .verdict-skip { background: var(--bad-soft); color: var(--bad); }
.solution, .takeaway { border-left: 3px solid var(--line); padding-left: 14px; display: grid; gap: 4px; }
.solution ol { margin: 0; padding-left: 20px; font-family: var(--font-mono); font-size: 0.86rem; display: grid; gap: 2px; }
.takeaway { border-left-color: var(--gold); }
.q-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 14px; }

.tool-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--sunken); padding: 12px; display: grid; gap: 10px; max-width: 360px; }
.tool-panel h2 { margin: 0; font-size: 0.95rem; }
.pop-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
/* ENV-01/02: floating tool windows. Dragged by the header, resized from the corner, above the question. */
.tool-layer { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
.tool-win { position: fixed; pointer-events: auto; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); resize: both; overflow: auto; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.25); background: var(--surface); display: grid; align-content: start; }
.tool-win.pad { display: flex; flex-direction: column; min-height: 240px; }
.win-head { cursor: move; user-select: none; -webkit-user-select: none; touch-action: none; margin: -12px -12px 0; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--sunken); border-radius: var(--radius) var(--radius) 0 0; }
.win-head h2 { font-size: 0.9rem; }
.win-head .link-btn { text-decoration: none; font-size: 1rem; line-height: 1; padding: 2px 6px; }
.pad-actions { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.pad-actions .link-btn { font-size: 0.8rem; }
.pad-actions .link-btn:disabled { opacity: 0.4; cursor: default; text-decoration: none; }
.calc-screen { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; text-align: right; font-family: var(--font-mono); min-height: 58px; overflow-wrap: anywhere; }
.calc-expr { font-size: 1.15rem; }
.calc-out { font-size: 0.85rem; color: var(--muted); min-height: 1.2em; }
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.calc-keys button { font: 600 1rem var(--font-mono); padding: 10px 0; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.calc-keys button:hover { border-color: var(--accent); }
.calc-keys .calc-eq { grid-column: 1 / -1; background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
/* Scratchpad: a drawing window with select, text, brush, shape and erase tools. */
.pad-body { flex: 1; display: flex; flex-direction: column; min-height: 0; gap: 6px; }
.pad-tools { display: flex; flex-wrap: wrap; gap: 4px; }
.pad-tool { font: 600 0.78rem var(--font-ui); padding: 5px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; min-height: 30px; }
.pad-tool[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pad-area { position: relative; flex: 1; min-height: 160px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; touch-action: none; cursor: crosshair; color: var(--ink); }
.pad-area[data-tool="select"] { cursor: move; }
.pad-area[data-tool="text"] { cursor: text; }
.pad-area[data-tool="erase"] { cursor: not-allowed; }
.pad-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pad-text-item { font: 14px/18px var(--font-mono); fill: currentColor; white-space: pre; }
.pad-text { position: absolute; margin: 0; padding: 0 2px; border: 1px dashed var(--accent); border-radius: 2px; background: var(--surface); color: var(--ink); font: 14px/18px var(--font-mono); resize: none; overflow: hidden; white-space: pre; min-width: 4ch; outline: none; }
.pad-help { margin-top: 6px; }
/* Line reader: everything but the strip is greyed out; the handles move and resize it. */
.line-reader { position: fixed; left: 0; right: 0; z-index: 35; pointer-events: none; box-shadow: 0 0 0 200vmax rgba(0, 0, 0, 0.5); border-top: 1px solid rgba(255, 255, 255, 0.6); border-bottom: 1px solid rgba(255, 255, 255, 0.6); }
.line-reader button { pointer-events: auto; position: absolute; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: ns-resize; font-size: 1rem; touch-action: none; }
.line-reader .lr-size { left: 10px; }
.line-reader .lr-move { left: 50%; margin-left: -16px; cursor: move; }
/* Answer masking: the option is concealed until revealed again. */
.mask { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; font-size: 0.85rem; margin-top: 8px; }
.opt .opt-side { display: grid; gap: 4px; }
.opt.masked .opt-main { cursor: default; }
.opt-masked { display: block; min-height: 22px; background: var(--ink); border-radius: 4px; }
.opts-fig .mask { margin: 0 auto; }
.opt { grid-template-columns: minmax(0, 1fr) auto auto; }
.instr-count { font-weight: 600; }
.instr-count b { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.exam-card .check { color: inherit; }
.exam-card .check input { accent-color: var(--accent-ink); }

/* results */
.results { display: grid; gap: 20px; }
.verdict-box { border-radius: 14px; padding: 20px 22px; border: 2px solid; display: grid; gap: 10px; }
.verdict-box.ok { border-color: var(--good); background: var(--good-soft); }
.verdict-box.bad { border-color: var(--bad); background: var(--bad-soft); }
.verdict-box ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.verdict-box li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 12px; align-items: center; font-variant-numeric: tabular-nums; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.score-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 6px; }
.score-big { font: 700 2.2rem var(--font-mono); font-variant-numeric: tabular-nums; }
.score-big small { font-size: 1rem; color: var(--muted); }
.meter { position: relative; height: 8px; border-radius: 4px; background: var(--sunken); }
.meter i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 4px; }
.meter b { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); }
.weak ul { margin: 6px 0 0; padding-left: 20px; }
.review-list { list-style: none; padding: 0; margin: 8px 0 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.review-list li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 0.9rem; }
.review-list li:first-child { border-top: 0; }
.rv-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 700 0.85rem var(--font-ui); }
.review-list .ok .rv-n { background: var(--good-soft); color: var(--good); }
.review-list .bad .rv-n { background: var(--bad-soft); color: var(--bad); }
.rv-ans { font-family: var(--font-mono); font-size: 0.82rem; white-space: nowrap; }

.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(8, 14, 30, 0.55); display: grid; place-items: center; padding: 16px; }
.dialog { background: var(--surface); border-radius: 14px; padding: 22px; max-width: 440px; width: 100%; display: grid; gap: 10px; }
.toast { position: fixed; z-index: 70; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 8px; font-size: 0.9rem; max-width: calc(100vw - 32px); }

/* responsive */
@media (max-width: 900px) {
  .masthead { grid-template-columns: minmax(0, 1fr); }
  .exam-card { grid-template-columns: minmax(0, 1fr); }
  .train-head { grid-template-columns: minmax(0, 1fr); }
  .train-opts { justify-content: flex-start; }
  .q-layout, .q-numerical { grid-template-columns: minmax(0, 1fr); }
  .stimulus { border-right: 0; border-bottom: 1px solid var(--line); }
  .trow { grid-template-columns: minmax(0, 1fr) auto auto; }
  .tact { grid-column: 1 / -1; }
  .tact .btn { flex: 1; justify-content: center; }
  .hist li { grid-template-columns: minmax(0, 1fr) auto; }
  .hist-score { grid-column: 1 / -1; }
}
/* N9: on narrow phones a chart's labels become unreadably small, so its values are shown as a table instead. */
@media (max-width: 480px) {
  .chart-wrap .chart, .chart-wrap .legend, .chart-wrap .data-details, .chart-wrap .small-values { display: none; }
  .chart-table-sm { display: block; }
}
@media (max-width: 560px) {
  .format { grid-template-columns: minmax(0, 1fr); }
  .format > div { border-left: 0; border-top: 1px solid var(--line); }
  .format > div:first-child { border-top: 0; }
  .stimulus, .answer-pane { padding: 16px; }
  .card { padding: 20px; }
  .series { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .opts-fig { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tool span { display: none; }
  .exam-bar { padding: 8px 10px; gap: 6px; }
  .bar-left .muted { display: none; }
  .bar-right { flex-wrap: nowrap; gap: 6px; width: 100%; justify-content: space-between; }
  .bar-right .btn { padding: 7px 10px; min-height: 36px; }
  .timer { font-size: 0.9rem; padding: 5px 8px; }
  .qdot { width: 34px; height: 34px; }
  .review-list li { grid-template-columns: 30px minmax(0, 1fr) auto; }
  .rv-topic { display: none; }
  .verdict-box li { grid-template-columns: minmax(0, 1fr) auto auto; }
  .verdict-box li .muted { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .opt-main, .btn, .qdot { transition: border-color 0.15s, background-color 0.15s; }
}

/* option status icons (not colour alone) */
.opt-main { position: relative; }
.mark-icon { position: absolute; top: 8px; right: 10px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 700 0.8rem var(--font-ui); color: var(--surface); }
.opt.right .mark-icon { background: var(--good); }
.opt.wrong .mark-icon { background: var(--bad); }
.opt.wrong .opt-main { border-style: dashed; }
.opts-fig .mark-icon { top: 6px; right: 6px; }

/* resume banner, ranking box, verbal trend */
.resume { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; border: 2px solid var(--gold); background: var(--gold-soft); border-radius: 14px; padding: 16px 20px; }
.resume .row-actions { margin-top: 0; }
.rank-box { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 20px 22px; display: grid; gap: 10px; }
.rank-box p { max-width: 70ch; }
.fresh { margin-top: 10px; font-weight: 600; font-size: 0.9rem; }
.trend { margin: 12px 0 0; display: grid; gap: 4px; max-width: 300px; }
.trend svg { width: 100%; height: auto; }
.trend .pass { stroke: var(--muted); stroke-dasharray: 4 3; stroke-width: 1; }
.trend .line { fill: none; stroke: var(--accent); stroke-width: 2; }
.trend .end { fill: var(--accent); }
.theme-btn { margin-left: 6px; }

/* ---------- guidance: how-to strip, field labels, info tips ---------- */
.howto { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; display: grid; gap: 8px; }
.howto h2 { font-size: 1rem; margin: 0; }
.howto ol { margin: 0; padding-left: 1.4em; display: grid; gap: 6px; }
.howto p { margin: 0; display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.field-label { display: inline-flex; align-items: center; gap: 2px; }
.exam-start .field-label { font-weight: 600; font-size: 0.9rem; }
.check-row { display: inline-flex; align-items: center; gap: 2px; }

.info-wrap { position: relative; display: inline-flex; vertical-align: middle; }
/* 24 × 24 px target with an 18 px circle inside */
.info-btn { width: 24px; height: 24px; padding: 0; border: 0; background: none; cursor: help; display: inline-grid; place-items: center; color: var(--muted); border-radius: 50%; }
.info-btn span { width: 17px; height: 17px; border-radius: 50%; border: 1.5px solid currentColor; display: grid; place-items: center; font: italic 700 11px/1 Georgia, "Times New Roman", serif; }
.info-btn:hover, .info-btn:focus-visible, .info-btn[aria-expanded="true"] { color: var(--accent); }
.info-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tip {
  display: none; position: absolute; z-index: 40; top: calc(100% + 6px); left: -6px;
  width: max-content; max-width: min(300px, 80vw); padding: 9px 12px; border-radius: 8px;
  background: var(--ink); color: var(--paper); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  max-height: calc(100vh - 32px); overflow-y: auto;
  font: 400 0.84rem/1.45 var(--font-ui); font-style: normal; text-align: left; letter-spacing: 0; text-transform: none; white-space: normal;
}
.tip b { color: inherit; }
.tip-r .tip { left: auto; right: -6px; }
.tip.open { display: block; }
/* Phones: no reliable hover and little room, so an open tip becomes a card at the bottom of the screen. */
@media (max-width: 560px), (hover: none) {
  .tip.open { display: block; }
  .tip, .tip-r .tip { position: fixed; left: 16px; right: 16px; top: auto; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: auto; max-width: none; font-size: 0.92rem; padding: 14px 16px; }
}
.exam-card .info-btn { color: var(--accent-ink); opacity: 0.85; }
.exam-card .info-btn:hover, .exam-card .info-btn:focus-visible, .exam-card .info-btn[aria-expanded="true"] { color: var(--accent-ink); opacity: 1; }
.exam-card .info-btn:focus-visible { outline-color: var(--accent-ink); }
.h-row { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.h-row h2 { margin: 0; }
@media (max-width: 560px) {
  .trow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .trow .tname, .trow .tact { grid-column: 1 / -1; }
}
/* Headings receive focus from script (so screen readers start in the right place); they are not
   controls, so no focus box is drawn around them. */
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { outline: none; }
.stat-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }


/* Practice overview mirrors useful TAO navigation states without relying on colour alone. */
.overview-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.overview-filters [aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 -3px var(--accent); }
.overview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 8px; }
.overview-grid button { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 4px; white-space: normal; }
.overview-grid [aria-current] { outline: 2px solid var(--accent); outline-offset: 2px; }
.calc-history { padding-left: 20px; max-height: 150px; overflow: auto; overflow-wrap: anywhere; }
.calc-history .link-btn { white-space: normal; text-align: left; overflow-wrap: anywhere; }
.exam-start p { max-width: 34ch; }

@media (max-width: 560px) {
  .bar-right { flex-wrap: wrap; }
  .bar-right .tools { flex-basis: 100%; flex-wrap: wrap; min-width: 0; max-width: 100%; }
}

/* Overview and instructions: a side panel beside the question on wide screens, so opening them never
   pushes the passage and answers out of view. */
.side-panels { display: grid; gap: 12px; align-content: start; }
.side-panels .tool-panel { max-width: none; }
.session.with-panel .side-panels { max-height: 42vh; overflow: auto; }
@media (min-width: 1100px) {
  .session.with-panel { grid-template-columns: minmax(260px, 300px) minmax(0, 1fr); align-items: start; }
  .session.with-panel > .qnav, .session.with-panel > .legend-row { grid-column: 1 / -1; }
  .session.with-panel .side-panels { position: sticky; top: 12px; max-height: calc(100vh - 24px); }
  .session.with-panel .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* On narrow screens (not a supported test-day set-up) the tool windows become a bottom sheet. */
@media (max-width: 899px) {
  .tool-win { left: 8px !important; right: 8px; top: auto !important; bottom: 8px; width: auto !important; height: auto !important; max-height: 55vh; resize: none; }
  .tool-win.pad { height: 55vh !important; }
  .win-head { cursor: default; }
  .zoom { display: none; }
}

.lesson-figures { display:flex; flex-wrap:wrap; gap:1rem; margin:1rem 0; }
.lesson-figures figure { margin:0; width:100px; text-align:center; }
.lesson-figures .fig { width:100px; }
.lesson-figures figcaption { font-size:.85rem; }

/* ---------- Session layout for laptops: the whole question on one screen ----------
   One-row toolbar at the top, the passage across the full width with the answers stacked under it,
   and the question navigation as a bar fixed to the bottom of the window. */
.view-session { max-width: 1400px; padding-top: 6px; padding-bottom: 24px; }
/* Numerical keeps its side-by-side data desk at the original width, so the calculator's default place
   (top right) leaves the answers clear. */
.view-session.sec-numerical { max-width: 1180px; }
.view-session .session { margin-top: 10px; gap: 10px; }
.view-session .exam-bar { padding: 4px 12px; }
.view-session .exam-bar .btn { min-height: 36px; padding-block: 6px; }
.view-session .tool { min-height: 32px; }
.q-verbal { grid-template-columns: minmax(0, 1fr); }
.q-verbal .stimulus { border-right: 0; border-bottom: 1px solid var(--line); }
.q-verbal .passage { max-width: none; gap: 8px; line-height: calc(1.55 * var(--a11y-lhf, 1)); }
.view-session .stimulus { padding: 12px 22px 14px; }
.view-session .answer-pane { padding: 12px 22px 14px; gap: 8px; }
.view-session .stim-head { margin-bottom: 4px; }
.stem-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; }
.view-session .opts { gap: 6px; }
.view-session .opt-main { padding: 6px 12px; align-items: center; }
.view-session .letter { width: 26px; height: 26px; }
.view-session .opts-fig .opt-main { padding: 10px; }
.view-session .strike, .view-session .mask { margin-top: 2px; width: 32px; height: 32px; }
.view-session .q-actions { border-top: 0; padding-top: 2px; }
.view-session .q-actions .btn { min-height: 38px; padding-block: 7px; }
.view-session .legend-row { justify-content: center; }
/* Abstract figures keep their size on wide screens instead of growing with the column. */
@media (min-width: 900px) {
  .view-session .series { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 156px); justify-content: center; }
}
@media (min-width: 561px) {
  .view-session .opts-fig { grid-template-columns: repeat(5, minmax(0, 176px)); justify-content: center; }
}
@media (min-width: 900px) {
  .view-session .exam-bar { flex-wrap: nowrap; }
  .view-session .bar-right { flex-wrap: nowrap; }
}
/* Below 1700px the tool buttons show their icons only (the label stays for screen readers and as a tooltip). */
@media (min-width: 561px) and (max-width: 1699px) {
  .view-session .tool > span { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .view-session .tool { padding: 6px 8px; }
}
/* Laptop and desktop: the navigation is a bar along the bottom of the window, previous arrow on the left,
   question numbers in the middle, Overview and next arrow on the right. */
@media (min-width: 1100px) and (min-height: 560px) {
  .view-session { padding-bottom: 40px; }
  .view-session .qnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.06);
    padding: 4px max(16px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  }
  /* One row of numbers, centred; a long round scrolls sideways instead of growing the bar. */
  .view-session .qdots { flex-wrap: nowrap; gap: 4px; overflow-x: auto; padding: 3px; scrollbar-width: thin; }
  .view-session .qdot { flex: 0 0 auto; margin: 6px 0 0; }
  .view-session .qdot:first-child { margin-left: auto; }
  .view-session .qdot:last-child { margin-right: auto; }
  .view-session .qdot.current::after { top: -9px; bottom: auto; border-bottom: 0; border-top: 6px solid var(--ink); }
  .view-session .toast { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  /* Overview and instructions float on the right above the navigation bar, next to the Overview button,
     so opening them leaves the question exactly where it is. */
  .view-session .session.with-panel { grid-template-columns: minmax(0, 1fr); }
  .view-session .session.with-panel .side-panels {
    position: fixed; z-index: 25; top: auto; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(66px + env(safe-area-inset-bottom, 0px));
    width: 340px; max-height: calc(100vh - 140px); overflow: auto; padding: 10px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  }
}
