:root{
  --bg:#f4f7fb; --card:#ffffff; --ink:#1c2431; --muted:#5c6b7f; --line:#e3e9f2;
  --brand:#2f6df0; --brand-dk:#1f52c0; --good:#1a9d5a; --warn:#e0922f; --bad:#d1495b;
  --shadow:0 6px 24px rgba(24,43,77,.08);
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  background:var(--bg);color:var(--ink);line-height:1.5}
a{color:var(--brand);text-decoration:none}
.topbar{position:sticky;top:0;z-index:50;display:flex;align-items:center;justify-content:space-between;
  padding:12px 20px;background:#fff;border-bottom:1px solid var(--line)}
.brand{font-weight:800;font-size:20px;letter-spacing:-.3px;cursor:pointer;color:var(--ink)}
.brand span{color:var(--brand);margin:0 1px}
.userbox{display:flex;align-items:center;gap:12px;font-size:14px;color:var(--muted)}
.app{max-width:920px;margin:0 auto;padding:24px 18px 60px}
.foot{max-width:920px;margin:0 auto;padding:0 18px 40px;color:var(--muted);font-size:12px;text-align:center}

.card{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:22px;box-shadow:var(--shadow);margin-bottom:18px}
h1{font-size:28px;margin:.2em 0 .3em;letter-spacing:-.5px}
h2{font-size:20px;margin:.2em 0 .5em}
h3{font-size:16px;margin:.2em 0 .4em}
.muted{color:var(--muted)}
.row{display:flex;gap:12px;flex-wrap:wrap}
.grow{flex:1}
.center{text-align:center}
.spacer{height:10px}

label{display:block;font-size:13px;font-weight:600;color:var(--muted);margin:10px 0 4px}
input,select{width:100%;padding:11px 12px;border:1px solid var(--line);border-radius:10px;font-size:15px;background:#fff}
input:focus,select:focus{outline:none;border-color:var(--brand)}

.btn{display:inline-block;border:0;border-radius:10px;padding:11px 18px;font-size:15px;font-weight:700;
  background:var(--brand);color:#fff;cursor:pointer;transition:transform .05s ease, background .15s}
.btn:hover{background:var(--brand-dk)}
.btn:active{transform:translateY(1px)}
.btn.ghost{background:#eef3fd;color:var(--brand-dk)}
.btn.ghost:hover{background:#e2ebfb}
.btn.wide{width:100%}
.btn:disabled{opacity:.5;cursor:default}
.btn.lg{padding:14px 22px;font-size:16px}

.hero{background:linear-gradient(135deg,#2f6df0,#5b8bff);color:#fff;border:0}
.hero h1{color:#fff}
.hero .muted{color:#e8f0ff}
.hero-strip{display:flex;flex-wrap:wrap;gap:8px 20px;margin-top:16px;font-size:13px;opacity:.92}
.pill{display:inline-block;background:#eaf1ff;color:var(--brand-dk);border-radius:999px;padding:3px 10px;font-size:12px;font-weight:700}

.bar{height:14px;background:#e9eef6;border-radius:999px;overflow:hidden}
.bar > i{display:block;height:100%;border-radius:999px;background:var(--good);transition:width .6s ease}
.barlabel{display:flex;justify-content:space-between;font-size:13px;margin-bottom:4px}

.kid{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:14px;border:1px solid var(--line);border-radius:12px;margin-bottom:10px}
.kid .grow{min-width:0}
.tabs{display:flex;gap:8px;margin-bottom:14px}
.tab{padding:8px 14px;border-radius:999px;background:#fff;border:1px solid var(--line);cursor:pointer;font-weight:600;font-size:14px}
.tab.on{background:var(--brand);color:#fff;border-color:var(--brand)}

.q .stem{font-size:18px;font-weight:600;margin:6px 0 14px;white-space:pre-wrap}
.opt{display:block;width:100%;text-align:left;padding:13px 14px;border:1px solid var(--line);border-radius:11px;background:#fff;margin-bottom:10px;cursor:pointer;font-size:15px;color:#1a1a2e}
.opt:hover{border-color:var(--brand)}
/* Glimpse (viewTry, public/app.js) disables option buttons the instant one is picked, so it
   can grade immediately -- with no override here that fell through to the browser's default
   :disabled dimming (~30% opacity text), which auto-test evidence (2026-08-26) showed reading
   as broken/unstyled on the product's single most important first-impression screen. */
.opt:disabled{color:#1a1a2e;opacity:.85;cursor:default}
.opt.sel{border-color:var(--brand);background:#eef3fd}
.opt.correct{border-color:var(--good);background:#e9f8f0}
.opt.wrong{border-color:var(--bad);background:#fbecef}
.progress-dots{display:flex;gap:6px;margin:4px 0 16px}
.dot{width:26px;height:6px;border-radius:999px;background:#dfe6f0}
.dot.done{background:var(--brand)}

.result-score{font-size:52px;font-weight:800;letter-spacing:-1px}
.tag{display:inline-block;font-size:13px;font-weight:700;padding:3px 10px;border-radius:999px}
.list{margin:8px 0 0;padding-left:18px}
.list li{margin:5px 0}
.err{background:#fbecef;color:#a12b3d;border:1px solid #f3c9d1;padding:10px 12px;border-radius:10px;font-size:14px;margin:8px 0}
.ok{background:#e9f8f0;color:#137a45;border:1px solid #bfe8d1;padding:10px 12px;border-radius:10px;font-size:14px;margin:8px 0}
.review .item{border:1px solid var(--line);border-radius:11px;padding:12px;margin-bottom:10px}
.email{background:#fbfdff;border:1px solid var(--line);border-radius:11px;padding:14px;white-space:pre-wrap;font-size:14px}
.small{font-size:13px}
.hide{display:none}
.pwrow{display:flex;gap:8px;align-items:stretch}
.pwrow input{flex:1}
.eye{border:1px solid var(--line);background:#fff;border-radius:10px;padding:0 14px;font-size:13px;font-weight:600;cursor:pointer;color:var(--muted);white-space:nowrap}
.note-good{color:var(--good);font-weight:700}
.note-bad{color:var(--bad);font-weight:700}
.req{color:var(--bad)}
#userNote,#pwNote{margin-top:5px;min-height:18px}
.toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);background:var(--good);color:#fff;padding:12px 22px;border-radius:12px;font-weight:700;box-shadow:var(--shadow);z-index:60}

/* ---- domain groups, dashboard (G1) ---- */
.domain{padding:0;overflow:hidden}
.domain > summary{list-style:none;cursor:pointer;padding:18px 22px;display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:6px 12px;font-weight:700;font-size:16px}
.domain > summary::-webkit-details-marker{display:none}
.domain > summary::before{content:'▸';display:inline-block;margin-right:8px;color:var(--brand);transition:transform .15s ease}
.domain[open] > summary::before{transform:rotate(90deg)}
.domain-body{padding:0 22px 20px}

/* ---- question screen: timer, cross-out, flag (G3) ---- */
.optrow{display:flex;align-items:center;gap:8px;margin-bottom:10px}
.optrow .opt{margin-bottom:0;flex:1}
.opt.elim{text-decoration:line-through;opacity:.45}
.strike{border:1px solid var(--line);background:#fff;border-radius:8px;width:38px;height:38px;font-size:16px;font-weight:700;color:var(--muted);cursor:pointer;white-space:nowrap;flex-shrink:0;line-height:1}
.strike.on{color:var(--brand-dk);border-color:var(--brand);background:#eef3fd}
.dot.flag{background:var(--warn)}

/* ---- grid-in entry widget (C4a step 5) — sizing/layout only, no new color tokens;
   the input/focus colors already come from the global input rule above. ---- */
.gridin-input{max-width:200px;font-size:20px;font-weight:700;letter-spacing:1px;text-align:center}

/* ---- per-question immediate feedback (G4) ---- */
.feedback-banner{font-weight:800;font-size:17px;border-radius:11px;padding:11px 14px;margin:12px 0}
.feedback-banner.good{background:#e9f8f0;color:#137a45}
.feedback-banner.bad{background:#fbecef;color:#a12b3d}
.rationale{font-size:14px;color:var(--ink);background:#f7f9fd;border:1px solid var(--line);border-radius:10px;padding:10px 12px;margin:4px 0 8px}
.worked-solution{font-size:15px;line-height:1.5;color:var(--ink);background:#eef4fc;border:1px solid var(--line);border-left:3px solid var(--accent,#3a8fd0);border-radius:10px;padding:10px 12px;margin:4px 0 8px}
.worked-solution b{display:block;margin-bottom:4px}
.trap-pill{display:inline-block;background:var(--bad);color:#fff;font-size:10px;font-weight:800;letter-spacing:.4px;text-transform:uppercase;border-radius:999px;padding:2px 8px;margin-right:7px;vertical-align:middle}

/* ---- results summary strip (G5) ---- */
.summary-hero .qpillrow{display:flex;flex-wrap:wrap;gap:6px;justify-content:center;margin-top:14px}
.qpill{display:inline-flex;align-items:center;justify-content:center;min-width:26px;height:26px;padding:0 4px;border-radius:8px;font-size:12px;font-weight:800;color:#fff}
.qpill.pass{background:var(--good)}
.qpill.fail{background:var(--bad)}

/* ---- Finish-the-Test chunk: module clock, check-your-work, celebratory result ---- */
.clock{font-variant-numeric:tabular-nums;font-weight:700;font-size:14px;color:var(--muted);
  background:#f1f5fb;border-radius:8px;padding:3px 9px}
.clock.low{color:#fff;background:var(--bad)}

.checklist{display:flex;flex-direction:column;gap:8px;margin-top:12px}
.checkrow{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;
  text-align:left;font-size:14px;font-family:inherit;color:var(--ink);cursor:pointer;
  background:#fff;border:1px solid var(--line);border-radius:11px;padding:12px 14px}
.checkrow:hover{border-color:var(--brand)}
.flagpill{background:#fdf0dd;color:#a4691b;margin-left:6px}

.cheer{font-size:44px;line-height:1}
.cheer-line{font-weight:800;font-size:18px;margin:2px 0 6px}
.review .item.flagged{border-color:var(--warn);box-shadow:inset 3px 0 0 var(--warn)}

/* ---- C4: phones. The kids open this on a 375px screen, so 375 IS the demo.
   Overflow fixes only — no layout redesign, no hidden controls. ---- */
.stem, .opt, .rationale, .barlabel span, .domain-name, .passage{overflow-wrap:anywhere}

/* ---- C7b: R&W passage block. Sits inside the existing .card.q container, above .stem. ---- */
.passage{background:#f7f8fa;border:1px solid var(--line);border-radius:11px;
  padding:14px 16px;margin-bottom:14px;line-height:1.5;white-space:pre-wrap;font-size:16px}
.passage-label{font-weight:700;font-size:12px;text-transform:uppercase;letter-spacing:.04em;
  color:var(--brand);margin-bottom:4px}
.passage-source{font-style:italic;font-size:12px;color:var(--muted);margin-top:8px}

/* ---- v24 (Sid dry-run item 12): Bluebook-style split for stimulus questions — passage/notes/
   graphic on the left, stem+choices on the right, each side scrolling independently so a long
   passage doesn't push the choices off screen. Desktop-only, per this project's standing law. ---- */
.q-split{display:grid;grid-template-columns:1fr 1fr;gap:24px;align-items:start}
.q-split-left{max-height:70vh;overflow-y:auto;padding-right:4px}
.q-split-left .passage{margin-bottom:0}
.q-split-right{min-width:0}

/* Font-size control (item 12): three presets, toggled by the Aa buttons in the question header,
   persisted to localStorage (qFontScale) so it carries across questions in the same session. */
.qfont-2 .stem{font-size:21px}
.qfont-2 .opt{font-size:17px}
.qfont-2 .passage{font-size:18px}
.qfont-3 .stem{font-size:24px}
.qfont-3 .opt{font-size:19px}
.qfont-3 .passage{font-size:20px}

/* ---- C7e-0: rw_evidence_quant data table. Sits where .passage would, above .stem. ---- */
.graphic{background:#f7f8fa;border:1px solid var(--line);border-radius:11px;
  padding:14px 16px;margin-bottom:14px;overflow-x:auto}
.graphic-caption{font-weight:700;font-size:13px;margin-bottom:8px}
.graphic-table{border-collapse:collapse;width:100%;font-size:14px}
.graphic-table th,.graphic-table td{border:1px solid var(--line);padding:6px 10px;text-align:left}
.graphic-table th{background:#eef0f4;font-weight:700}

/* ---- Math figures/graphs retrofit: hand-authored SVG diagram, sits above .stem. ---- */
.figure{background:#f7f8fa;border:1px solid var(--line);border-radius:11px;
  padding:14px 16px;margin-bottom:14px;text-align:center;overflow-x:auto}
.figure svg{max-width:100%;height:auto}

/* ---- C7f-2 Chunk 2: rw_rhet_synthesis research notes. Renders inside .passage, above .stem. ---- */
.notes-list{margin:4px 0 0;padding-left:20px}
.notes-list li{margin-bottom:6px;line-height:1.4}

/* ===== C1a shell (2026-08-19) ===== */
:root{
  --top-bg:#0F2A43; --top-ink:#EAF1F8; --accent:#00A60E; --accent-ink:#FFFFFF;
  --rail-w:220px; --top-h:56px;
}

/* Z-INDEX SCALE: rail 40 · topbar 50 · toast 60 · modal 100 */

.topbar{position:sticky;top:0;z-index:50;display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:var(--top-h);background:var(--top-bg);color:var(--top-ink)}
.topbar .brand{color:var(--top-ink)}

.topbar-left{display:flex;align-items:center;gap:10px}

.rail-toggle{background:transparent;border:0;color:var(--top-ink);font-size:20px;cursor:pointer;padding:4px 8px;border-radius:8px}
.rail-toggle:hover{background:rgba(234,241,248,.15)}

.shell{display:flex;align-items:flex-start}

.rail{width:var(--rail-w);flex:0 0 var(--rail-w);position:sticky;top:var(--top-h);height:calc(100vh - var(--top-h));overflow-y:auto;background:#fff;border-right:1px solid var(--line);z-index:40;padding:12px 8px}

.rail-group{margin-bottom:14px}
.rail-head{font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);padding:6px 10px}
.rail-item{display:block;padding:9px 10px;border-radius:10px;color:var(--ink);cursor:pointer;text-decoration:none;font-size:14px}
.rail-item:hover{background:rgba(47,109,240,.08)}
.rail-item.active{box-shadow:inset 0 0 0 2px var(--accent);font-weight:600}

.shell .app{flex:1;min-width:0}

body.rail-hidden .rail{display:none}
body.shell-off .rail, body.shell-off .rail-toggle, body.testing .rail, body.testing .rail-toggle{display:none}

@media(max-width:1024px){
  .rail{position:fixed;left:0;top:var(--top-h);bottom:0;height:auto;box-shadow:0 12px 30px rgba(15,42,67,.25)}
}

/* ===== C1b nav IA (2026-08-19) ===== */
.hdr-hi{flex:1;text-align:center;font-weight:700;font-size:15px;color:var(--top-ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.rail-sub{margin:2px 0 6px 14px;border-left:2px solid var(--line);padding-left:6px}
.rail-sub .rail-item{font-size:13px;padding:7px 10px}
.rail-item.locked{color:var(--muted);cursor:pointer;opacity:.75}
.rail-item.locked .lock{float:right}
.rail-item.expandable .chev{float:right;transition:transform .15s}
.rail-item.expandable.open .chev{transform:rotate(90deg)}

/* ===== SidV palette adoption (Ram ruling "B", 2026-08-19) =====
   One block, deliberately last, so reverting to the SAT blue is deleting this section.
   Values are SidV's ACCESSIBILITY-TUNED ones, not the raw brand sheet: --brand #7458F0
   (#7C5CFF measured 4.35:1 with white text; this clears 4.5:1), --muted #45445C (Ram's
   app-wide ruling A2), and the text-safe green/red pair — SidV's --good/--error are fill
   colors and fail as small body text, which is exactly how SAT uses them. */
:root{
  --bg:#F7F8FC; --card:#FFFFFF; --panel2:#EDEBFF;
  --ink:#2A2440; --muted:#45445C; --line:#E3E6F2;
  --brand:#7458F0; --brand-dk:#5230C9;
  --good:#1C8A4B; --bad:#B23A3A;
  --top-bg:#2A2440; --top-ink:#F0EDFF;
  --accent:#00D4B8; --accent-ink:#062B26;
  --radius:16px;
  --shadow:0 4px 14px rgba(42,36,64,.08);
}
/* SidV rounds its surfaces harder than the old SAT sheet did. */
.card,.kid,.domain,.review,.summary-hero{border-radius:var(--radius)}
.btn,.opt,.optrow .opt{border-radius:12px}
.rail-item,.tag,.pill{border-radius:999px}
.rail-item{border-radius:12px}
/* Three blue literals predate the tokens and would have left a blue hero on a purple site.
   Gradient ends at --brand-shade rather than a tint: measured, white body text on the old
   light end came in at 4.03:1. */
.hero{background:linear-gradient(135deg,var(--brand),var(--brand-dk))}
.hero .muted{color:#EDE9FF}
.hero .pill{background:rgba(6,43,38,.35);color:#FFFFFF}
.rail-item:hover{background:rgba(116,88,240,.08)}
/* The topbar went dark in C1a; --muted body text on it is dark-on-dark (measured 1.57:1). */
.topbar .userbox{color:var(--top-ink)}
.pill{background:var(--panel2);color:var(--brand-dk)}
/* Accent (teal) drives the active ring and the log-out button, as in the Dojo. */
.rail-item.active{box-shadow:inset 0 0 0 2px var(--accent)}
.userbox .btn.ghost{background:var(--accent);color:var(--accent-ink);border-color:transparent;font-weight:700}

/* ===== C5 gamification chips (2026-08-20): XP + streak + Level, top bar. Student role only,
   private to the family (no leaderboard styling — this never renders anyone else's numbers). ===== */
.hdr-chips{display:flex;align-items:center;gap:8px;flex-shrink:0}
.chip{display:flex;align-items:center;gap:5px;background:rgba(240,237,255,.1);color:var(--top-ink);
  border-radius:999px;padding:4px 10px;font-size:12px;font-weight:700;white-space:nowrap}
.chip .chip-ic{font-size:13px;line-height:1}
.chip.streak.on{background:var(--accent);color:var(--accent-ink)}
.chip-lvl-bar{width:44px;height:5px;border-radius:999px;background:rgba(240,237,255,.25);overflow:hidden;display:inline-block}
.chip-lvl-bar > i{display:block;height:100%;background:var(--accent);border-radius:999px}
@media(max-width:720px){ .hdr-chips .chip-label{display:none} }

.xp-toast{background:var(--accent);color:var(--accent-ink)}
.strongweak{display:flex;gap:12px;flex-wrap:wrap}
.strongweak .sw-card{flex:1;min-width:220px;border:1px solid var(--line);border-radius:12px;padding:12px 14px}
.strongweak .sw-card.strong{border-left:4px solid var(--good)}
.strongweak .sw-card.weak{border-left:4px solid var(--warn)}

/* ===== C6 reference sheet (2026-08-20): slide-over on PRACTICE screens only, never during
   the timed full test. Z-INDEX SCALE says modal = 100 — this sits there. ===== */
.refsheet-overlay{position:fixed;inset:0;background:rgba(20,16,40,.45);z-index:100;
  display:flex;justify-content:flex-end}
.refsheet-panel{background:var(--card);width:min(360px,92vw);height:100%;overflow:auto;
  padding:20px;box-shadow:-8px 0 30px rgba(24,43,77,.18);animation:refsheet-in .18s ease;
  min-width:280px;min-height:240px;max-width:96vw;max-height:96vh;resize:both}
@keyframes refsheet-in{from{transform:translateX(100%)}to{transform:translateX(0)}}
.refsheet-group{margin-top:14px}
.refsheet-group .list{margin-top:4px}
.refsheet-group .list li{margin:4px 0;font-size:14px}
.refsheet-diagram{color:var(--ink);margin-top:4px;overflow-x:auto}
.refsheet-diagram svg{display:block;max-width:100%;height:auto}

.list-table{width:100%;border-collapse:collapse;font-size:14px;margin-top:8px}
.list-table th{text-align:left;font-size:12px;text-transform:uppercase;letter-spacing:.03em;color:var(--muted);padding:6px 10px;border-bottom:1px solid var(--line)}
.list-table td{padding:8px 10px;border-bottom:1px solid var(--line)}
.list-table tr:last-child td{border-bottom:none}

/* ===== C2b (2026-08-19) ===== */
.progress-dots{flex-wrap:wrap;row-gap:4px}
/* Long modules (full test) use a bar, not 44 dots — see paintQuestion's DOTS_MAX. */
.progress-track{height:6px;border-radius:999px;background:#dfe6f0;margin:4px 0 16px;overflow:hidden}
.progress-track span{display:block;height:100%;background:var(--brand);border-radius:999px;transition:width .2s}

/* ===== V25: real Desmos GraphingCalculator, centered modal, not a slide-over — the reference
   sheet's drawer is too narrow for it. Same Z-INDEX SCALE modal=100 as refsheet-overlay.
   Desktop-only per the project rule, so no small-viewport tuning here. ===== */
.calc-overlay{position:fixed;inset:0;background:rgba(20,16,40,.45);z-index:100;
  display:flex;align-items:center;justify-content:center}
.calc-panel{background:var(--card);width:min(760px,94vw);max-height:92vh;overflow-y:auto;
  border-radius:14px;padding:20px;box-shadow:0 12px 40px rgba(24,43,77,.25)}
.calc-canvas-wrap{position:relative;margin-top:14px;width:100%;height:520px;
  border:1px solid var(--line);border-radius:10px;overflow:hidden}

/* ===== v24: report-a-bug widget — dancing FAB (restored, Ram 2026-08-24) + left-rail entries, both ===== */
@keyframes bug-dance{0%,100%{transform:translateY(0) rotate(0deg)}25%{transform:translateY(-4px) rotate(-8deg)}
  50%{transform:translateY(0) rotate(0deg)}75%{transform:translateY(-4px) rotate(8deg)}}
.bug-fab{position:fixed;right:18px;bottom:18px;z-index:90;width:48px;height:48px;border-radius:50%;
  background:var(--bad,#e0473e);color:#fff;border:none;font-size:22px;cursor:pointer;
  box-shadow:0 6px 18px rgba(224,71,62,.4);animation:bug-dance 2.2s ease-in-out infinite}
.bug-fab:hover{animation-play-state:paused;transform:scale(1.08)}
.bug-overlay{position:fixed;inset:0;background:rgba(20,16,40,.45);z-index:100;
  display:flex;align-items:center;justify-content:center}
.bug-overlay[hidden]{display:none}
.bug-panel{width:min(440px,92vw);padding:20px}
.bug-panel textarea,.bug-panel input[type=text]{width:100%;border:1px solid var(--line);border-radius:8px;
  padding:8px 10px;font:inherit;resize:vertical}

/* ===== V21 vocab flashcards ===== */
.vocab-card{min-height:160px;display:flex;flex-direction:column;justify-content:center;
  border:1px solid var(--line);transition:box-shadow .15s}
.vocab-card:hover{box-shadow:0 4px 16px rgba(24,43,77,.12)}
.vocab-card.flipped{border-color:var(--brand)}
