  :root{
    --bg:#0b0d10; --surface:#11161c; --surface-2:#161c24; --line:#232b35;
    --text:#e7edf3; --muted:#8b97a6; --teal:#46c2a8; --rose:#ff6577;
    --radius:16px; --shadow:0 8px 30px rgba(0,0,0,.35);
  }
  *{box-sizing:border-box}
  html,body{margin:0;height:100%}
  body{
    background:radial-gradient(1200px 600px at 50% -10%, #12181f 0%, var(--bg) 60%);
    color:var(--text); font-family:'Inter',system-ui,-apple-system,sans-serif;
    -webkit-font-smoothing:antialiased; display:flex; flex-direction:column;
    min-height:100dvh;
  }
  header{
    padding:14px 18px calc(14px); display:flex; align-items:center; gap:12px;
    border-bottom:1px solid var(--line); position:sticky; top:0; z-index:5;
    background:rgba(11,13,16,.7); backdrop-filter:blur(12px);
  }
  .logo{width:34px;height:34px;border-radius:10px;flex:0 0 auto;
    background:linear-gradient(135deg,var(--teal),#2f8f7d); display:grid;place-items:center;
    font-weight:800;color:#04120e}
  header h1{font-size:15px;margin:0;font-weight:600;letter-spacing:.2px}
  header .sub{font-size:12px;color:var(--muted);margin-top:1px}
  .who{margin-left:auto;font-size:12px;color:var(--muted)}
  main{flex:1 1 auto;overflow-y:auto;padding:18px;display:flex;flex-direction:column;gap:14px;width:100%;max-width:820px;margin:0 auto}
  .msg{padding:14px 16px;border-radius:var(--radius);line-height:1.55;font-size:15px;max-width:92%;word-wrap:break-word}
  .me{align-self:flex-end;background:var(--teal);color:#04120e;border-bottom-right-radius:6px;font-weight:500}
  .bot{align-self:flex-start;background:var(--surface);border:1px solid var(--line);border-bottom-left-radius:6px}
  .bot .anchor{margin-top:10px;font-size:12.5px;color:var(--teal)}
  .bot .ext{margin-top:8px;font-size:13.5px;color:var(--text);background:var(--surface-2);border-left:3px solid var(--rose);padding:8px 12px;border-radius:8px}
  .sources{margin-top:10px;display:flex;flex-wrap:wrap;gap:6px}
  .chip{font-size:11.5px;color:var(--muted);background:var(--surface-2);border:1px solid var(--line);
    padding:4px 9px;border-radius:999px}
  .next{margin-top:10px;font-size:13px;color:var(--muted);cursor:pointer;text-decoration:underline dotted}
  /* mode switch */
  .modebar{display:flex;gap:6px;justify-content:center;padding:10px;position:sticky;top:57px;z-index:4;
    background:rgba(11,13,16,.7);backdrop-filter:blur(12px);border-bottom:1px solid var(--line)}
  .pill{font-size:13px;font-weight:600;color:var(--muted);background:transparent;border:1px solid var(--line);
    padding:7px 16px;border-radius:999px;cursor:pointer}
  .pill.active{color:#04120e;background:var(--teal);border-color:var(--teal)}
  /* practice */
  #practice{max-width:820px;margin:0 auto;padding:18px;width:100%}
  .qcard{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:18px}
  .qmeta{display:flex;gap:8px;margin-bottom:12px;flex-wrap:wrap}
  .qstem{font-size:16px;line-height:1.5;margin-bottom:14px}
  .opt{display:block;width:100%;text-align:left;background:var(--surface-2);border:1px solid var(--line);
    color:var(--text);border-radius:12px;padding:13px 15px;margin-bottom:10px;font:inherit;font-size:15px;cursor:pointer;
    transition:border-color .1s}
  .opt:hover{border-color:var(--teal)}
  .opt:disabled{cursor:default}
  .opt.correct{border-color:var(--teal);background:rgba(70,194,168,.12)}
  .opt.wrong{border-color:var(--rose);background:rgba(255,101,119,.12)}
  .feedback{margin-top:12px;font-size:14px}
  .feedback.ok{color:var(--teal)} .feedback.no{color:var(--rose)}
  .barwrap{height:6px;background:var(--surface-2);border-radius:999px;overflow:hidden;margin-top:8px}
  .bar{height:100%;background:var(--teal);border-radius:999px;transition:width .4s}
  .pnext{margin-top:16px;width:100%;background:var(--teal);color:#04120e;border:none;border-radius:12px;
    padding:13px;font-weight:700;font-size:15px;cursor:pointer}
  .pstat{text-align:center;font-size:12.5px;color:var(--muted);margin-top:12px}
  /* class mode (dual-channel) */
  #classroom{max-width:820px;margin:0 auto;padding:18px;width:100%}
  .topicrow{display:flex;gap:10px;margin-bottom:16px}
  .topicrow input{flex:1;background:var(--surface);border:1px solid var(--line);color:var(--text);
    border-radius:12px;padding:12px 14px;font:inherit;font-size:15px;outline:none}
  .topicrow input:focus{border-color:var(--teal)}
  .topicrow button{background:var(--teal);color:#04120e;border:none;border-radius:12px;padding:0 18px;
    height:46px;font-weight:700;cursor:pointer}
  .chips-row{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:8px}
  .topic-chip{font-size:12.5px;color:var(--teal);background:var(--surface-2);border:1px solid var(--line);
    padding:6px 12px;border-radius:999px;cursor:pointer}
  .board{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
    padding:22px 18px;min-height:230px;display:flex;flex-direction:column;gap:14px}
  .board .phase{font-size:11px;letter-spacing:1px;text-transform:uppercase;color:var(--muted)}
  .visual{background:var(--surface-2);border:1px dashed var(--line);border-radius:12px;padding:26px 16px;
    text-align:center;color:var(--muted);font-size:14px}
  .visual.cue{border-color:var(--teal);color:var(--teal);box-shadow:0 0 0 2px rgba(70,194,168,.15)}
  .eqbox{font-size:20px;text-align:center;padding:12px;background:var(--surface-2);border-radius:12px}
  .eqbox.cue{box-shadow:0 0 0 2px rgba(70,194,168,.25)}
  .kw{display:flex;flex-wrap:wrap;gap:8px;justify-content:center}
  .kw .k{font-size:13px;color:var(--text);background:var(--surface-2);border:1px solid var(--line);
    padding:6px 12px;border-radius:999px;transition:all .15s}
  .kw .k.cue{background:var(--teal);color:#04120e;border-color:var(--teal)}
  .steps{margin:0;padding-left:18px;color:var(--text);font-size:14.5px;line-height:1.7}
  .cktext{font-size:15px}
  .ckq{color:var(--rose);font-weight:600;margin-bottom:10px}
  .speaking{display:flex;align-items:center;gap:8px;font-size:12.5px;color:var(--muted);min-height:18px}
  .wave{display:inline-flex;gap:2px}
  .wave i{width:3px;height:12px;background:var(--teal);border-radius:2px;animation:w 1s infinite ease-in-out}
  .wave i:nth-child(2){animation-delay:.15s} .wave i:nth-child(3){animation-delay:.3s}
  .wave i:nth-child(4){animation-delay:.45s}
  @keyframes w{0%,100%{transform:scaleY(.5)}50%{transform:scaleY(1.3)}}
  .lessonnav{display:flex;gap:10px;align-items:center;margin-top:16px;flex-wrap:wrap}
  .lessonnav button{background:var(--surface-2);border:1px solid var(--line);color:var(--text);
    border-radius:12px;padding:11px 16px;font:inherit;font-size:14px;font-weight:600;cursor:pointer}
  .lessonnav button.primary{background:var(--teal);color:#04120e;border-color:var(--teal)}
  .lessonnav button:disabled{opacity:.4;cursor:default}
  .voicebar{display:flex;gap:8px;align-items:center;justify-content:center;margin-top:14px;flex-wrap:wrap;
    font-size:12.5px;color:var(--muted)}
  .vtoggle{background:var(--surface-2);border:1px solid var(--line);color:var(--text);border-radius:999px;
    padding:6px 12px;font:inherit;font-size:12.5px;cursor:pointer}
  .vtoggle.on{background:var(--teal);color:#04120e;border-color:var(--teal)}
  .progressdots{display:flex;gap:5px;justify-content:center;margin:14px 0 2px}
  .progressdots i{width:7px;height:7px;border-radius:50%;background:var(--surface-2);border:1px solid var(--line)}
  .progressdots i.done{background:var(--muted)} .progressdots i.active{background:var(--teal);border-color:var(--teal)}
  .cap{margin-top:12px;font-size:13px;color:var(--muted);font-style:italic;border-top:1px dashed var(--line);padding-top:10px}
  .status{align-self:flex-start;font-size:12px;color:var(--muted);display:flex;align-items:center;gap:8px}
  .dot{width:7px;height:7px;border-radius:50%;background:var(--teal);animation:pulse 1s infinite}
  @keyframes pulse{0%,100%{opacity:.3}50%{opacity:1}}
  footer{padding:12px 16px calc(12px + env(safe-area-inset-bottom));border-top:1px solid var(--line);
    background:rgba(11,13,16,.85);backdrop-filter:blur(12px)}
  .composer{display:flex;gap:10px;max-width:820px;margin:0 auto;align-items:flex-end}
  textarea{flex:1;resize:none;background:var(--surface);color:var(--text);border:1px solid var(--line);
    border-radius:14px;padding:12px 14px;font:inherit;font-size:15px;max-height:140px;outline:none}
  textarea:focus{border-color:var(--teal)}
  button.send{background:var(--teal);color:#04120e;border:none;border-radius:14px;padding:0 18px;height:46px;
    font-weight:700;font-size:15px;cursor:pointer;transition:transform .08s}
  button.send:active{transform:scale(.96)}
  button.send:disabled{opacity:.45;cursor:default}
  /* Gate */
  .gate{position:fixed;inset:0;display:grid;place-items:center;padding:24px;background:var(--bg);z-index:20}
  .card{background:var(--surface);border:1px solid var(--line);border-radius:20px;padding:28px 24px;width:100%;
    max-width:360px;box-shadow:var(--shadow);text-align:center}
  .card .logo{width:52px;height:52px;border-radius:14px;margin:0 auto 14px;font-size:22px}
  .card h2{margin:0 0 6px;font-size:19px}
  .card p{margin:0 0 20px;color:var(--muted);font-size:13.5px}
  .card input:not([type="radio"]):not([type="checkbox"]):not([type="range"]){width:100%;text-align:center;letter-spacing:4px;font-size:20px;padding:14px;border-radius:12px;
    background:var(--surface-2);border:1px solid var(--line);color:var(--text);outline:none;margin-bottom:14px}
  .card input:focus{border-color:var(--teal)}
  .card button{width:100%;background:var(--teal);color:#04120e;border:none;border-radius:12px;padding:14px;
    font-weight:700;font-size:15px;cursor:pointer}
  .err{color:var(--rose);font-size:13px;min-height:18px;margin-bottom:6px}
  /* Guardian authorization */
  .guardian{max-width:760px;margin:0 auto;padding:24px 18px 40px;width:100%;overflow-y:auto}
  .guardian-head{display:flex;align-items:center;gap:12px;margin-bottom:18px}
  .guardian-head h1{font-size:20px;margin:0}.guardian-head p{font-size:13px;color:var(--muted);margin:4px 0 0}
  .guardian-note{font-size:13px;line-height:1.55;color:var(--muted);background:var(--surface);
    border:1px solid var(--line);border-left:3px solid var(--teal);border-radius:12px;padding:14px;margin-bottom:14px}
  .guardian-card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
    padding:16px;margin-bottom:12px}.guardian-card h2{font-size:15px;margin:0 0 10px}
  .guardian-choice{display:flex;align-items:flex-start;gap:10px;padding:10px 0;border-top:1px solid var(--line)}
  .guardian-choice input{margin-top:3px;accent-color:var(--teal)}
  .guardian-choice strong{display:block;font-size:13px;text-transform:capitalize}
  .guardian-choice small{display:block;color:var(--muted);font-size:12px;line-height:1.45;margin-top:2px}
  .guardian-ack{display:flex;gap:10px;align-items:flex-start;font-size:13px;line-height:1.45;margin:18px 0 12px}
  .guardian-ack input{margin-top:3px;accent-color:var(--teal)}
  .guardian-save{width:100%;padding:13px;border:0;border-radius:12px;background:var(--teal);
    color:#04120e;font:inherit;font-weight:700;cursor:pointer}.guardian-save:disabled{opacity:.45;cursor:default}
  .guardian-status{min-height:22px;text-align:center;color:var(--muted);font-size:13px;margin-top:10px}
  .hidden{display:none!important}
  a.plain{color:var(--teal);text-decoration:none}

/* ══ Visual Engine ═════════════════════════════════════════════════════════
   Animated SVG physics diagrams. Colour carries meaning: teal = the object and
   its real forces, rose = resolved components and dimension marks, amber = the
   element the narration is cueing right now (Mayer's signalling principle). */
.visual{margin:0 0 12px;padding:10px;background:var(--surface-2);border:1px solid var(--line);
  border-radius:12px}
.visual figcaption{margin-top:6px;font-size:12px;color:var(--muted);text-align:center}
.vsvg{width:100%;height:auto;display:block;color:var(--teal);overflow:visible}
.vline,.vaxis{stroke:var(--line);stroke-width:1.5}
.vaxis{stroke:var(--muted);stroke-width:1.5}
.vground{stroke:var(--muted);stroke-width:2;stroke-linecap:round}
.vwall{stroke:var(--muted);stroke-width:4;stroke-linecap:round}
.vdimline{stroke:var(--rose);stroke-width:1;stroke-dasharray:3 3}
.vbody{fill:var(--teal);fill-opacity:.85;stroke:var(--teal);stroke-width:1.5}
.vbodylab{fill:#04120e;font-size:10px;font-weight:700}
.vincline{fill:var(--surface);stroke:var(--muted);stroke-width:1.5}
.varrow{color:var(--teal)}
.varrow line{stroke:currentColor;stroke-width:2.2}
.varrow.vdim{color:var(--rose)}
.varrow.vdim line{stroke-width:1.6;stroke-dasharray:4 3}
.varrow.vresultant{color:#ffd479}
.varrow.vresultant line{stroke-width:2.8}
.vlab{fill:var(--muted);font-size:10px;font-family:'Inter',sans-serif}
.vtitle{fill:var(--text);font-size:11px;font-weight:600}
.vpath,.vwave,.vcurve{fill:none;stroke:var(--teal);stroke-width:2}
.vpath{stroke-dasharray:4 4;opacity:.6}
.varea{fill:var(--teal);fill-opacity:.14}
.vball{fill:#ffd479;stroke:none}
.vdot{fill:var(--rose)}
.vspring{fill:none;stroke:var(--muted);stroke-width:1.6}
.vorbit{fill:none;stroke:var(--line);stroke-width:1.5;stroke-dasharray:4 4}
.vedge{stroke:var(--line);stroke-width:1.5}
.vnode rect{fill:var(--surface);stroke:var(--line);stroke-width:1.5}
.vnode.solid rect{stroke:var(--teal);fill:rgba(70,194,168,.16)}
.vnode.shaky rect{stroke:#ffd479;fill:rgba(255,212,121,.12)}
.vnode.weak rect{stroke:var(--rose);fill:rgba(255,101,119,.10)}
.vnodelab{fill:var(--text);font-size:9px}
@keyframes vspin{to{transform:rotate(360deg)}}
.vspin{animation:vspin var(--dur,3s) linear infinite}
@keyframes vwavemove{to{transform:translateX(-80px)}}
.vwavemove{animation:vwavemove 2.4s linear infinite}
/* Signalling: the cued element brightens and thickens as it is spoken about. */
[data-hl]{transition:filter .25s ease, opacity .25s ease}
[data-hl].cued{filter:drop-shadow(0 0 6px #ffd479)}
[data-hl].cued line,[data-hl].cued polyline,[data-hl].cued path{stroke:#ffd479;stroke-width:3}
[data-hl].cued rect,[data-hl].cued circle{stroke:#ffd479;stroke-width:2.5}
[data-hl].cued text{fill:#ffd479}
@media (prefers-reduced-motion: reduce){
  .vspin,.vwavemove{animation:none}
  [data-hl]{transition:none}
}

/* ══ Shared screen furniture ══════════════════════════════════════════════ */
section{flex:1 1 auto;overflow-y:auto;padding:16px;width:100%;max-width:820px;margin:0 auto}
.panel{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
  padding:14px 16px;margin-bottom:14px}
.ptitle{font-size:14px;font-weight:600;margin-bottom:10px;display:flex;align-items:baseline;gap:8px}
.ptitle.sm{font-size:12px;color:var(--muted);font-weight:500;margin:14px 0 6px;text-transform:uppercase;
  letter-spacing:.06em}
.psub{font-size:12px;color:var(--muted);font-weight:400;margin-left:auto}
.emptystate{color:var(--muted);font-size:14px;line-height:1.6;padding:10px 0}
.loading{color:var(--muted);font-size:14px;padding:20px;text-align:center}
.hintline{font-size:13px;color:var(--muted);line-height:1.55;margin:10px 0;padding:10px 12px;
  background:var(--surface-2);border-left:2px solid var(--teal);border-radius:0 8px 8px 0}
.linkbtn{background:none;border:none;color:var(--teal);font:inherit;font-size:13px;cursor:pointer;
  padding:2px 0;text-align:left}
.linkbtn:hover{text-decoration:underline}
button.wide{width:100%;margin-top:10px;padding:12px;border-radius:12px;border:1px solid var(--line);
  background:var(--surface-2);color:var(--text);font:inherit;font-weight:500;cursor:pointer;
  transition:transform .12s ease, background .2s ease}
button.wide:active{transform:scale(.985)}
button.primary{background:var(--teal);color:#04120e;border-color:transparent;font-weight:600}
.chips{display:flex;flex-wrap:wrap;gap:8px}
.topic-chip.on{background:var(--teal);color:#04120e;border-color:transparent;font-weight:600}
.details{margin-top:10px;border-top:1px solid var(--line);padding-top:10px}
.details summary{font-size:13px;color:var(--muted);cursor:pointer}
.details textarea,input:not([type="radio"]):not([type="checkbox"]):not([type="range"]),select{width:100%;margin-top:8px;padding:11px 12px;border-radius:10px;
  border:1px solid var(--line);background:var(--surface-2);color:var(--text);font:inherit;font-size:14px}
.row{display:flex;align-items:center;gap:10px;margin-top:10px}
.row label{font-size:13px;color:var(--muted);flex:0 0 auto}
.row input{margin-top:0;flex:1 1 auto}
.row button{padding:10px 14px;border-radius:10px;border:1px solid var(--line);background:var(--surface-2);
  color:var(--text);font:inherit;cursor:pointer}
.revlist{list-style:none;margin:0;padding:0}
.revlist li{display:flex;align-items:center;gap:10px;padding:9px 0;border-bottom:1px solid var(--line);
  font-size:14px;flex-wrap:wrap}
.revlist li:last-child{border-bottom:none}
.revch{font-weight:500}
.revmeta{font-size:12px;color:var(--muted);margin-left:auto}
.gapcard{background:var(--surface-2);border:1px solid var(--line);border-left:2px solid var(--rose);
  border-radius:0 10px 10px 0;padding:11px 13px;margin-bottom:9px;font-size:13.5px;line-height:1.55}
.mis{margin-top:8px;font-size:13px;color:var(--muted);line-height:1.6}
.tag{font-size:11px;padding:2px 8px;border-radius:99px;background:var(--surface);border:1px solid var(--line);
  text-transform:uppercase;letter-spacing:.05em}
.tag.diagnostic{border-color:var(--rose);color:var(--rose)}
.tag.focus{border-color:#ffd479;color:#ffd479}
.tag.revise,.tag.maintain{border-color:var(--teal);color:var(--teal)}
.advice{margin:8px 0 0;padding-left:18px;font-size:13.5px;line-height:1.65;color:var(--text)}
.advice li{margin-bottom:7px}
.ttable{width:100%;border-collapse:collapse;font-size:13px;margin-top:8px}
.ttable th{text-align:left;color:var(--muted);font-weight:500;font-size:11.5px;
  text-transform:uppercase;letter-spacing:.05em;padding:6px 6px 6px 0}
.ttable td{padding:7px 6px 7px 0;border-top:1px solid var(--line);vertical-align:top}
.ttable .lost{color:var(--rose)}
.ttable .cnote{color:var(--muted);font-size:12.5px}
.scoreline{display:flex;align-items:baseline;gap:8px}
.scoreline b{font-size:32px;font-weight:700;color:var(--teal)}
.scoreline span{color:var(--muted);font-size:14px}

/* ══ Revise ═══════════════════════════════════════════════════════════════ */
.acronym{font-size:28px;font-weight:800;letter-spacing:.22em;color:var(--teal);text-align:center;
  padding:14px 0}
.chunk{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px}
.chunk span{background:var(--surface-2);border:1px solid var(--line);border-radius:8px;
  padding:6px 10px;font-size:12.5px}
.peglist{margin:6px 0 0;padding-left:20px;font-size:13.5px;line-height:1.6}
.peglist li{margin-bottom:10px}
.pegprompt{color:var(--muted);font-size:12.5px;margin-top:3px}
.aid{background:var(--surface-2);border-radius:10px;padding:10px 12px;margin-bottom:8px;font-size:13px}
.aidsub{color:var(--muted);font-size:12.5px;margin-top:4px}

/* ══ Tests ════════════════════════════════════════════════════════════════ */
.testbar{position:sticky;top:0;z-index:4;display:flex;align-items:center;gap:12px;
  background:rgba(11,13,16,.86);backdrop-filter:blur(12px);border-bottom:1px solid var(--line);
  padding:12px 2px;margin:-16px -16px 14px;padding-left:16px;padding-right:16px}
.clock{margin-left:auto;font-variant-numeric:tabular-nums;font-size:20px;font-weight:700;
  color:var(--teal);padding:4px 10px;border-radius:10px;background:var(--surface-2)}
.clock.urgent{color:var(--rose);animation:pulse 1.6s ease-in-out infinite}
@keyframes pulse{50%{opacity:.55}}
@media (prefers-reduced-motion: reduce){.clock.urgent{animation:none}}
.tsection{font-size:12px;color:var(--muted);text-transform:uppercase;letter-spacing:.07em;
  margin:18px 0 8px;padding-bottom:6px;border-bottom:1px solid var(--line)}
.tq{margin-bottom:12px}
.qhead{display:flex;align-items:center;gap:10px;margin-bottom:8px;font-size:12px;color:var(--muted)}
.qnum{font-weight:700;color:var(--text)}
.tmarks{background:var(--surface-2);border-radius:99px;padding:2px 9px;font-size:11.5px}
.qchap{margin-left:auto}
.qstem{font-size:15px;line-height:1.6;margin-bottom:10px;white-space:pre-wrap}
.topts{display:flex;flex-direction:column;gap:8px}
.opt.chosen{border-color:var(--teal);background:rgba(70,194,168,.14)}
.tanswer{min-height:96px;resize:vertical}

/* ══ Plan ═════════════════════════════════════════════════════════════════ */
.planday{margin-bottom:12px}
.pdate{font-size:12px;color:var(--muted);margin-bottom:6px;font-weight:500}
.pblock{display:flex;align-items:center;gap:9px;background:var(--surface-2);border-radius:10px;
  padding:9px 12px;margin-bottom:6px;font-size:13.5px;border-left:2px solid var(--line)}
.pblock.learn{border-left-color:var(--teal)}
.pblock.revise{border-left-color:#ffd479}
.pblock.mock{border-left-color:var(--rose)}
.pkind{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);
  flex:0 0 auto;min-width:52px}

/* ══ Marking ══════════════════════════════════════════════════════════════ */
.filedrop{display:block;margin-top:10px;padding:26px 14px;text-align:center;border-radius:12px;
  border:1.5px dashed var(--line);background:var(--surface-2);color:var(--muted);font-size:14px;
  cursor:pointer;transition:border-color .2s ease,color .2s ease}
.filedrop:hover{border-color:var(--teal);color:var(--text)}
.transcript{white-space:pre-wrap;font-size:12.5px;color:var(--muted);line-height:1.6;margin:8px 0 0;
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace}

/* ══ Progress ═════════════════════════════════════════════════════════════ */
.bands{display:flex;gap:10px;margin-bottom:12px}
.band{flex:1 1 0;text-align:center;background:var(--surface-2);border-radius:12px;padding:12px 6px;
  border-top:2px solid var(--line)}
.band b{display:block;font-size:24px;font-weight:700}
.band span{font-size:11.5px;color:var(--muted)}
.band.solid{border-top-color:var(--teal)}
.band.solid b{color:var(--teal)}
.band.shaky{border-top-color:#ffd479}
.band.weak{border-top-color:var(--rose)}
.statrow{display:flex;gap:10px;flex-wrap:wrap}
.statrow div{flex:1 1 68px;text-align:center;padding:8px 4px}
.statrow b{display:block;font-size:20px;font-weight:700}
.statrow span{font-size:11.5px;color:var(--muted)}
.mixrow{display:flex;align-items:center;gap:10px;font-size:13px;margin-bottom:7px}
.mixrow span:first-child{flex:0 0 88px;color:var(--muted);text-transform:capitalize}
.mixrow .bar{flex:1 1 auto;height:7px;border-radius:99px;background:var(--surface-2);overflow:hidden}
.mixrow .bar i{display:block;height:100%;background:var(--teal);border-radius:99px;
  transition:width .5s ease}
.phead{font-weight:600;font-size:15px;line-height:1.55}
#progress p{font-size:14px;line-height:1.65;color:var(--text);margin:8px 0}

/* The modebar now carries eight destinations — let it scroll on a phone. */
.modebar{overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.modebar::-webkit-scrollbar{display:none}
.modebar .pill{flex:0 0 auto;white-space:nowrap}

/* Sign in with Google — Google's own mark on a neutral surface, per their branding guidance
   that the button be clearly legible and the logo unmodified. */
.gbtn{display:flex;align-items:center;justify-content:center;gap:.6rem;width:100%;
  background:#fff;color:#1f1f1f;border:1px solid #dadce0;border-radius:10px;
  padding:.75rem 1rem;font-weight:600;font-size:.95rem;cursor:pointer;
  transition:background .15s ease,box-shadow .15s ease}
.gbtn:hover{background:#f7f8f8;box-shadow:0 1px 3px rgba(0,0,0,.18)}
.gbtn svg{flex:0 0 auto}
#passBlock{margin-top:.9rem}

/* revision session */
.revq{margin:12px 0;padding:10px 12px;border:1px solid var(--line, #d9e2e7);border-radius:10px}
.revq .stem{margin-bottom:8px}
.revres{margin:10px 0;padding:10px 12px;border-radius:10px;border-left:4px solid}
.revres.ok{border-color:#3f9b76;background:rgba(63,155,118,.07)}
.revres.miss{border-color:#d9822b;background:rgba(217,130,43,.07)}
.revres .why{margin-top:6px;opacity:.85}
.revres .booktext{white-space:pre-wrap;margin-top:6px;font-size:.95em;opacity:.9}
.nextplan{margin-top:12px}


/* ══ AlphaGuru v2 Warm Cream Canvas & Zero-Shadow Bento Tokens (Plan 20 D3/D4/D5) ══ */
.ag-warm-canvas{background:#FFFAF0;color:#1E293B;font-family:'Manrope','Inter',system-ui,sans-serif}
.ag-bento-card{background:#FFFFFF;border:1px solid #E2E8F0;border-radius:12px;box-shadow:none;padding:16px}
.ag-split-pane{display:grid;grid-template-columns:1fr 1fr;gap:16px;width:100%;max-width:1360px;margin:0 auto}
@media (max-width: 767px){.ag-split-pane{grid-template-columns:1fr}}


/* ══ AlphaGuru v2.0 Scholar's Desk Default Palette & 8-Gap Closure Styles (Section 3.10 & 8.5) ══ */
:root {
  --ag-bg-canvas: #FFFAF0;
  --ag-bg-elevated: #F5EFE6;
  --ag-bg-card: #FFFFFF;
  --ag-ink-primary: #1E1B18;
  --ag-ink-secondary: #57534E;
  --ag-border-hairline: #E7E0D6;
  --ag-accent-sage: #0D9488;
  --ag-accent-indigo: #4F46E5;
  --ag-accent-amber: #D97706;
  --ag-accent-rose: #E11D48;
  --ag-grader-stage: #F5F5F5;
  --ag-font-board-hand: 'Excalifont', 'Kalam', 'Segoe Print', cursive;
}

body.ag-scholars-desk {
  background: #FFFAF0;
  color: #1E1B18;
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
}

/* Legacy screens inside the Scholar's Desk: the dark palette above is re-pointed to warm
 * parchment so every inherited #1E1B18 text sits on a light surface (WCAG AA >= 4.5:1).
 * Ink #1E1B18 on #FBF8F2 is about 16:1; teal #0F766E on #FBF8F2 about 5.2:1. */
body.ag-scholars-desk {
  --bg: #FFFAF0;
  --surface: #FBF8F2;
  --surface-2: #F3EFE6;
  --line: #E7E0D6;
  --text: #1E1B18;
  --muted: #57534E;
  --teal: #0F766E;
  --rose: #BE123C;
  --shadow: none;
}

body.ag-scholars-desk header,
body.ag-scholars-desk .modebar,
body.ag-scholars-desk footer,
body.ag-scholars-desk .testbar {
  background: rgba(255, 250, 240, 0.94);
}

body.ag-scholars-desk .bot,
body.ag-scholars-desk .msg.bot {
  background: #FBF8F2;
  color: #1E1B18;
  border: 1px solid #E7E0D6;
}

body.ag-scholars-desk .bot .ext {
  background: #F3EFE6;
  color: #1E1B18;
}

body.ag-scholars-desk .bot .anchor {
  color: #0F766E;
}

body.ag-scholars-desk .me,
body.ag-scholars-desk .pill.active,
body.ag-scholars-desk .pnext,
body.ag-scholars-desk .topicrow button,
body.ag-scholars-desk .kw .k.cue,
body.ag-scholars-desk .lessonnav button.primary,
body.ag-scholars-desk .vtoggle.on,
body.ag-scholars-desk button.send,
body.ag-scholars-desk .card button,
body.ag-scholars-desk .guardian-save,
body.ag-scholars-desk button.primary,
body.ag-scholars-desk .topic-chip.on {
  color: #FFFAF0;
}

body.ag-scholars-desk .varrow.vresultant,
body.ag-scholars-desk .tag.focus {
  color: #B45309;
  border-color: #B45309;
}

body.ag-scholars-desk .gate {
  background: #FFFAF0;
  color: #1E1B18;
}

body.ag-scholars-desk .card {
  background: #FBF8F2;
  color: #1E1B18;
  border: 1px solid #E7E0D6;
  box-shadow: none;
}

.ag-desk-shell {
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: 12px 16px 24px;
  background: #FFFAF0;
  color: #1E1B18;
  box-sizing: border-box;
}

.ag-desk-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: #F5EFE6;
  border: 1px solid #E7E0D6;
  border-radius: 10px;
  margin-bottom: 10px;
  box-shadow: none;
}

.ag-desk-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ag-desk-brand h2 {
  margin: 0;
  font-family: 'Newsreader', Georgia, serif;
  font-size: 18px;
  color: #1E1B18;
}

.ag-desk-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ag-desk-btn, .ag-desk-select {
  background: #FFFAF0;
  color: #1E1B18;
  border: 1px solid #E7E0D6;
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
}

.ag-desk-btn.primary {
  background: #0F766E;
  color: #FFFAF0;
  border-color: #0F766E;
}

.ag-workspace-tabbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #F5EFE6;
  border: 1px solid #E7E0D6;
  border-radius: 10px;
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  box-shadow: none;
}

.ag-workspace-tabbar::-webkit-scrollbar {
  display: none;
}

.ag-tab-btn {
  flex: 0 0 auto;
  background: #FFFAF0;
  color: #57534E;
  border: 1px solid #E7E0D6;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
}

.ag-tab-btn[aria-selected="true"] {
  background: #0F766E;
  color: #FFFAF0;
  border-color: #0F766E;
}

.ag-workspace-stage {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
}

.ag-keep-alive-panel {
  width: 100%;
  background: #FFFAF0;
  color: #1E1B18;
  border: 1px solid #E7E0D6;
  border-radius: 12px;
  padding: 16px;
  box-shadow: none;
  box-sizing: border-box;
}

.ag-board-handwriting {
  font-family: 'Excalifont', 'Kalam', 'Segoe Print', cursive;
  font-size: 18px;
  line-height: 1.5;
  color: #1E1B18;
}

.ag-keyword-chip {
  background: #F5EFE6;
  color: #0F766E;
  border: 1px solid #0F766E;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
}

.ag-socratic-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 14px;
  background: #F5EFE6;
  border: 1px solid #E7E0D6;
  border-radius: 10px;
  box-shadow: none;
}

.ag-socratic-chip {
  background: #FFFAF0;
  color: #1E1B18;
  border: 1px solid #E7E0D6;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
}

.ag-photomath-step {
  position: relative;
  padding: 10px 12px 10px 14px;
  background: #FFFAF0;
  border: 1px solid #E7E0D6;
  border-radius: 8px;
  margin-bottom: 6px;
  box-shadow: none;
}

.ag-photomath-step.active {
  border-left: 4px solid #E11D48;
  background: #F5EFE6;
}

.ag-step-connector {
  text-align: center;
  color: #57534E;
  font-size: 14px;
  line-height: 1;
  margin: 2px 0;
}

.ag-grader-scan-stage {
  background: #F5F5F5;
  border: 1px solid #E7E0D6;
  border-radius: 10px;
  padding: 12px;
  box-shadow: none;
}

@media (max-width: 767px) {
  .ag-workspace-stage {
    flex-direction: column;
  }
  .ag-keep-alive-panel {
    width: 100% !important;
  }
}

/* Board pause state, keyword links and pause-only popover refusal (workspace_tabs.js) */
#wbPauseBtn[data-board-state="playing"] {
  background: #0F766E;
  color: #FFFAF0;
  border-color: #0F766E;
}

.ag-keyword-link:focus-visible,
.ag-tab-btn:focus-visible,
.ag-socratic-chip:focus-visible,
.ag-desk-btn:focus-visible {
  outline: 2px solid #4F46E5;
  outline-offset: 2px;
}

#wbPauseBtn[data-board-state="playing"] ~ .ag-keyword-link {
  opacity: 0.6;
  cursor: not-allowed;
}

.ag-popover-refusal {
  margin: 8px 0;
  padding: 8px 12px;
  background: #F5EFE6;
  color: #57534E;
  border: 1px solid #E7E0D6;
  border-left: 3px solid #D97706;
  border-radius: 8px;
  box-shadow: none;
  font-size: 13px;
}

.ag-tab-btn[hidden] {
  display: none;
}

/* Docked Doubt Studio: paused-step context banner and the live Socratic thread */
.ag-dock-context {
  margin: 0 0 10px;
  padding: 8px 12px;
  background: #F3EFE6;
  color: #1E1B18;
  border: 1px solid #E7E0D6;
  border-left: 3px solid #0F766E;
  border-radius: 8px;
  font-size: 13px;
}

.ag-socratic-thread {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.ag-socratic-turn {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #E7E0D6;
  background: #FBF8F2;
  color: #1E1B18;
  font-size: 14px;
  line-height: 1.5;
}

.ag-socratic-turn.student {
  align-self: flex-end;
  background: #F3EFE6;
}

.ag-socratic-turn.tutor {
  border-left: 3px solid #0F766E;
}

/* Startup: first-run intro overlay and the returning-student banner */
.ag-intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--ag-intro-aurora, #FFFAF0);
}

.ag-intro-overlay[hidden] {
  display: none;
}

#startupBannerHost:empty,
#tierUpgradePromptHost:empty {
  display: none;
}

#startupBannerHost,
#tierUpgradePromptHost {
  margin-bottom: 10px;
}

.ag-tier-prompt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #FBF8F2;
  color: #1E1B18;
  border: 1px solid #E7E0D6;
  border-left: 3px solid #D97706;
  border-radius: 10px;
}

/* Settings drawer next to the complexity tier */
.ag-settings-drawer {
  position: relative;
}

.ag-settings-drawer > summary {
  list-style: none;
}

.ag-settings-drawer > summary::-webkit-details-marker {
  display: none;
}

.ag-settings-drawer[open] > #workspaceSettingsHost {
  position: absolute;
  right: 0;
  z-index: 20;
  width: min(420px, 92vw);
  max-height: 70vh;
  overflow-y: auto;
  margin-top: 6px;
}

/* Whiteboard lesson stage drawn by renderWhiteboardClassroom() */
.wb-lesson-stage svg {
  width: 100%;
  max-height: 320px;
  background: #FFFAF0;
  border: 1px solid #E7E0D6;
  border-radius: 8px;
}

.wb-lesson-caption {
  min-height: 1.4em;
  color: #1E1B18;
  font-size: 14px;
}

/* Encyclopedia callout pins open the pause-only concept popover */
.wb-callout-pin {
  cursor: pointer;
}

.wb-callout-pin:focus-visible {
  outline: 2px solid #4F46E5;
  outline-offset: 2px;
}

/* 15 s idle hint pill (dismissible, non-modal, no sound) */
.ag-hint-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 12px;
  background: #FFFAF0;
  color: #1E1B18;
  border: 1px solid #D97706;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: none;
}

.ag-hint-pill button {
  background: transparent;
  color: #1E1B18;
  border: 0;
  padding: 2px 6px;
  font: inherit;
  cursor: pointer;
}

/* ══ PLAN-021 Browser-QA Ergonomic & WCAG 2.2 AA Polish ══ */
header,
.modebar {
  flex: 0 0 auto;
}

.modebar .pill,
.ag-desk-btn,
.ag-desk-select,
.ag-socratic-chip {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.ag-tab-btn {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ag-tab-btn[hidden] {
  display: none !important;
}

.ag-intro fieldset {
  border: 1px solid #E7E0D6;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 10px;
  background: #FBF8F2;
}

.ag-intro legend {
  padding: 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: #1E1B18;
}

.ag-intro fieldset label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin: 3px 10px 3px 0;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid #E7E0D6;
  background: #FFFAF0;
  color: #1E1B18;
  font-weight: 500;
  cursor: pointer;
}

.ag-intro fieldset label[for^="intro-"] {
  display: block;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 6px 0 2px;
  min-height: 0;
  font-weight: 600;
}

.ag-intro input[type="radio"],
.ag-intro input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  accent-color: #0F766E;
  flex: 0 0 auto;
  cursor: pointer;
}

/* Pre-sign-in gate isolation (OR-136) */
body:has(#gate:not(.hidden)) #scholarsDeskShell,
body:has(#gate:not(.hidden)) #startupIntroHost {
  display: none !important;
}

.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; }
.offline-study-card { margin-top: 10px; padding: 12px 14px; border: 1px solid #CBD5E1; border-left: 4px solid #D97706; border-radius: 8px; background: #FFFDF7; color: #1E293B; }
.offline-study-card h4 { margin: 0 0 6px; font-size: 0.95rem; color: #92400E; }
.offline-study-item { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #E2E8F0; font-size: 0.9rem; line-height: 1.5; }
