/* Maths Mzansi - Teacher Zanele. Locked surface tokens (dark), white classroom board. */
:root{
  --canvas:#0A0A0A; --surface-1:#141414; --surface-2:#1E1E1E;
  --primary:#0C7447; --glyph:#19A465; --ink-on-green:#FFFFFF;
  --text:#EDEFEE; --text-2:#C9CBCA; --muted:#707070;
  --line:rgba(237,239,238,0.075); --radius:14px;
  --sowetan:#ED2027;
  /* whiteboard markers */
  --board:#FCFCFA; --marker:#1D2B4F; --marker-red:#D62839; --marker-blue:#1F6FEB; --marker-green:#0C7447;
  --hand:"Andika","Comic Sans MS",sans-serif;
}
*{box-sizing:border-box}
html,body{margin:0;background:var(--canvas);color:var(--text);font:400 16px/1.55 Inter,system-ui,sans-serif}
button{font:inherit;color:inherit;cursor:pointer}
[hidden]{display:none!important}

.app{max-width:1200px;margin:0 auto;padding:28px 16px 40px;transition:max-width .45s ease}

/* ---------- header ---------- */
.top{display:flex;align-items:center;gap:16px;margin-bottom:22px;min-height:64px}
.brand{display:flex;flex-direction:column;gap:4px}
.brand-name{font-family:"Archivo Black",Inter,sans-serif;font-weight:600;font-size:34px;line-height:1;letter-spacing:-.02em}
.brand-name span{color:var(--sowetan)}
.powered{display:flex;align-items:center;gap:8px;color:var(--text-2);font-size:13px}
.powered img{height:20px;width:auto;display:block}
.lesson-chip{margin-left:auto;background:var(--surface-2);border:1px solid var(--line);border-radius:999px;padding:8px 14px;font-size:14px;color:var(--text)}
.ghost{background:var(--surface-2);border:1px solid var(--line);border-radius:10px;padding:9px 14px;font-size:14px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.055);transition:transform 180ms ease, box-shadow 180ms ease}
.ghost:active{transform:translateY(2px) scale(.982);box-shadow:inset 0 2px 6px rgba(0,0,0,.6);transition-duration:40ms}

/* ---------- cards ---------- */
.card{background:var(--surface-1);border:1px solid var(--line);border-radius:var(--radius);padding:20px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.055),0 8px 24px rgba(0,0,0,.45)}
.card h2{margin:0;font-size:18px;font-weight:600}

/* ---------- normal layout: teacher left, picker right ---------- */
.layout{display:grid;grid-template-columns:minmax(0,1.05fr) minmax(0,1fr);gap:16px;align-items:start}
.tutor{display:flex;flex-direction:column;gap:12px}
.tutor-head p{margin:4px 0 0;color:var(--text-2);font-size:15px}
.stage{position:relative;aspect-ratio:4/3;background:var(--surface-2);border-radius:12px;overflow:hidden}
.stage anam-agent{display:block;position:absolute;inset:0;width:100%;height:100%}

.picker{display:flex;flex-direction:column;gap:18px}
.step h2{display:flex;align-items:center;gap:10px;margin-bottom:12px}
.num{width:28px;height:28px;border-radius:50%;background:var(--surface-2);display:inline-grid;place-items:center;font-size:14px;font-weight:600;color:var(--text)}
.grades{display:grid;grid-template-columns:repeat(auto-fill,minmax(64px,1fr));gap:8px}
.phase-label{grid-column:1/-1;font-size:12px;color:var(--muted);text-transform:uppercase;letter-spacing:.06em;margin-top:4px}
.grade{background:var(--surface-2);border:1px solid var(--line);border-radius:12px;padding:10px 0;text-align:center;font-weight:600;font-size:17px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.055);transition:transform 180ms ease, background 150ms ease}
.grade small{display:block;font-weight:400;font-size:11px;color:var(--text-2)}
.grade:active,.topic-btn:active,.sub:active{transform:translateY(2px) scale(.982);transition-duration:40ms}
.grade[aria-checked="true"]{background:var(--primary);color:var(--ink-on-green);border-color:transparent}
.grade[aria-checked="true"] small{color:var(--ink-on-green)}

.topics{display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:8px}
.topic{background:var(--surface-2);border:1px solid var(--line);border-radius:12px;overflow:hidden}
.topic-btn{display:flex;align-items:center;gap:10px;width:100%;background:none;border:0;padding:12px;text-align:left;font-weight:600;font-size:15px}
.topic-btn .ico{font-size:22px;line-height:1}
.topic.open{grid-column:1/-1;border-color:var(--glyph)}
.subs{display:flex;flex-wrap:wrap;gap:6px;padding:0 12px 12px}
.sub{background:var(--surface-1);border:1px solid var(--line);border-radius:999px;padding:6px 12px;font-size:14px;color:var(--text-2)}
.sub[aria-pressed="true"]{background:var(--primary);color:var(--ink-on-green);border-color:transparent}
.ready{background:var(--surface-2);border-radius:12px;padding:12px 14px;font-size:15px;color:var(--text)}
.ready b{color:var(--glyph)}

.foot{margin-top:22px;color:var(--muted);font-size:13px}

/* ---------- classroom mode: board takes the room, teacher moves to the side ---------- */
body.lesson .app{max-width:1500px}
body.lesson .picker,body.lesson .foot,body.lesson .tutor-head{display:none}
body.lesson .layout{grid-template-columns:minmax(0,1fr) 300px}
body.lesson .tutor{order:2;padding:10px;position:sticky;top:16px}
body.lesson .stage{aspect-ratio:4/3}
body.lesson .board-wrap{order:1}

.board-wrap{display:flex;flex-direction:column;animation:boardIn .45s cubic-bezier(.2,.8,.2,1)}
@keyframes boardIn{from{opacity:0;transform:scale(.97)}to{opacity:1;transform:none}}
.board{background:var(--board);color:var(--marker);border-radius:10px;min-height:min(72vh,640px);padding:28px 34px 34px;
  border:12px solid #8A9099;border-image:linear-gradient(145deg,#B9BEC5,#7D838C) 1;
  box-shadow:0 18px 40px rgba(0,0,0,.55),inset 0 0 60px rgba(0,0,0,.035)}
.board-tray{height:12px;margin:0 28px;background:linear-gradient(#9AA0A8,#6E747C);border-radius:0 0 8px 8px;display:flex;gap:10px;padding:2px 30px}
.board-tray i{display:block;width:46px;height:7px;border-radius:4px;background:var(--marker)}
.board-tray i:nth-child(2){background:var(--marker-red)}.board-tray i:nth-child(3){background:var(--marker-blue)}

.board-title{font-family:var(--hand);font-weight:700;font-size:44px;line-height:1.1;margin:0 0 18px;color:var(--marker-blue);
  text-decoration:underline;text-decoration-thickness:3px;text-underline-offset:8px}
.board-body{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.1fr);gap:28px;align-items:start}
@media (max-width:1180px){.board-body{grid-template-columns:1fr}.board-visual{max-width:560px}}
.board-body.no-visual{grid-template-columns:1fr}
.board-lines{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:14px}
.bl{font-family:var(--hand);font-weight:500;font-size:36px;line-height:1.25;color:var(--marker);opacity:.12;transition:opacity .3s}
.bl.on{opacity:1}
.bl.now{position:relative}
.bl.now::before{content:"";position:absolute;left:-22px;top:50%;width:10px;height:10px;margin-top:-5px;border-radius:50%;background:var(--marker-red)}
.bl .ink{display:inline-block;clip-path:inset(0 100% 0 0)}
.bl.on .ink{animation:write var(--dur,1.2s) steps(24,end) forwards}
@keyframes write{to{clip-path:inset(0 0 0 0)}}
.bl.math .katex{font-size:1.05em;color:var(--marker)}
.bl.answer{color:var(--marker-green);font-weight:700}
.bl.answer .katex{color:var(--marker-green)}
.bl.answer .ink{border:3px solid var(--marker-green);border-radius:14px;padding:2px 14px}
.bl.hint .ink{background:#FFF3B0;border-radius:6px;padding:4px 12px;transform:rotate(-1deg);font-size:30px}
.bl.your_turn .ink{color:var(--marker-red)}
.bl.your_turn .ink::before{content:"Your turn: ";font-weight:700}
.board-visual svg{width:100%;height:auto;display:block;overflow:visible}
.board-visual .draw{stroke-dasharray:var(--len,600);stroke-dashoffset:var(--len,600);animation:draw 1.4s ease forwards}
@keyframes draw{to{stroke-dashoffset:0}}
.board-visual .pop{opacity:0;animation:pop .35s ease forwards}
@keyframes pop{to{opacity:1}}
.board-visual text{font-family:"Andika",sans-serif}
.board-visual text:not([fill]){fill:var(--marker)}

@media (max-width:900px){
  .layout{grid-template-columns:1fr}
  body.lesson .layout{grid-template-columns:1fr}
  body.lesson .tutor{order:0;position:static}
  body.lesson .stage{aspect-ratio:16/9}
  .board-body{grid-template-columns:1fr}
  .bl{font-size:28px}.board-title{font-size:34px}
  .board{padding:18px;border-width:8px}
  .top{flex-wrap:wrap}
}
@media (prefers-reduced-motion:reduce){
  .bl.on .ink{animation:none;clip-path:none}
  .board-visual .draw{animation:none;stroke-dashoffset:0}
  .board-visual .pop{animation:none;opacity:1}
  .board-wrap{animation:none}
}

/* ---------- score, stars, spinner button ---------- */
.score{margin-left:auto;display:flex;align-items:center;gap:8px}
.lesson-chip:not([hidden]) + .score{margin-left:0}
.lesson-chip{margin-left:auto}
.pill{background:var(--surface-2);border:1px solid var(--line);border-radius:999px;padding:7px 14px;font-size:16px;white-space:nowrap}
.pill b{font-weight:600}
.stars-pill.bump{animation:bump .5s ease}
@keyframes bump{40%{transform:scale(1.25)}}
.spin-open,.primary{background:var(--primary);color:var(--ink-on-green);border:0;border-radius:12px;padding:10px 16px;font-weight:600;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.18),0 4px 12px rgba(0,0,0,.4);transition:transform 180ms ease, box-shadow 180ms ease}
.spin-open:active,.primary:active{transform:translateY(2px) scale(.982);box-shadow:inset 0 3px 8px rgba(0,0,0,.45);transition-duration:40ms}
.primary.big{font-size:24px;padding:14px 44px;border-radius:16px;letter-spacing:.04em}

/* ---------- quiz on the board ---------- */
.quiz{margin-top:22px;display:flex;flex-direction:column;gap:16px}
.quiz-q{font-family:var(--hand);font-weight:700;font-size:42px;line-height:1.2;color:var(--marker)}
.quiz-q .katex{font-size:.9em}
.quiz-choices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.choice{display:flex;align-items:center;gap:14px;border:4px solid currentColor;background:#fff;border-radius:18px;padding:14px 18px;
  font-family:var(--hand);font-weight:700;font-size:36px;text-align:left;transition:transform 180ms ease}
.choice:active{transform:translateY(2px) scale(.97);transition-duration:40ms}
.choice .letter{width:46px;height:46px;flex:none;border-radius:50%;display:grid;place-items:center;color:#fff;font:600 22px Inter,sans-serif}
.choice.c0{color:var(--marker-blue)}.choice.c0 .letter{background:var(--marker-blue)}
.choice.c1{color:var(--marker-red)}.choice.c1 .letter{background:var(--marker-red)}
.choice.c2{color:#C27C0E}.choice.c2 .letter{background:#E67E22}
.choice.c3{color:#7D3C98}.choice.c3 .letter{background:#8E44AD}
.choice.right{background:#DFF5E8;color:var(--marker-green);animation:bump .5s ease}
.choice.right .letter{background:var(--marker-green)}
.choice.wrong{opacity:.55;animation:shake .4s ease}
.choice:disabled{cursor:default}
@keyframes shake{25%{transform:translateX(-8px)}75%{transform:translateX(8px)}}
.quiz-feedback{font-family:var(--hand);font-weight:700;font-size:34px;color:var(--marker-red);min-height:44px}

/* ---------- overlays: homework + wheel ---------- */
.overlay{position:fixed;inset:0;background:rgba(0,0,0,.72);display:grid;place-items:center;z-index:50;padding:16px}
.paper{background:#FFFDF5;color:var(--marker);width:min(640px,100%);max-height:90vh;overflow:auto;border-radius:12px;padding:28px 32px;
  background-image:repeating-linear-gradient(#FFFDF5 0 38px,#CFE0F5 38px 39px);box-shadow:0 24px 60px rgba(0,0,0,.6)}
.paper h2{font-family:var(--hand);font-size:44px;margin:0 0 10px;color:var(--marker-red)}
.paper ol{font-family:var(--hand);font-size:32px;line-height:39px;margin:0;padding-left:34px}
.paper ol li{margin-bottom:10px}
.paper ol li .katex{font-size:.8em}
.hw-note{font-family:var(--hand);font-size:26px;color:var(--marker-blue);margin:14px 0 0}
.paper-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:18px}
.paper .ghost{color:var(--marker);background:#fff;border-color:#D5D9E0}
.wheel-card{position:relative;background:var(--surface-1);border:1px solid var(--line);border-radius:20px;padding:24px 28px 28px;text-align:center;width:min(420px,100%)}
.wheel-card h2{margin:0 0 14px;font-size:24px}
.x{position:absolute;top:10px;right:12px;width:36px;height:36px;border-radius:50%;background:var(--surface-2);border:1px solid var(--line);font-size:22px;line-height:1}
.wheel{position:relative;width:min(320px,80vw);margin:0 auto 18px}
.wheel svg{width:100%;display:block;transition:transform 4s cubic-bezier(.12,.75,.12,1);border-radius:50%;box-shadow:0 10px 30px rgba(0,0,0,.6)}
.pointer{position:absolute;left:50%;top:-6px;transform:translateX(-50%);width:0;height:0;border-left:16px solid transparent;border-right:16px solid transparent;border-top:30px solid var(--sowetan);z-index:2;filter:drop-shadow(0 2px 2px rgba(0,0,0,.5))}
.spin-result{margin-top:14px;font-size:24px;font-weight:600;min-height:34px}

/* ---------- toast + confetti ---------- */
.toast{position:fixed;left:50%;bottom:28px;transform:translate(-50%,40px);opacity:0;background:var(--surface-2);border:1px solid var(--line);
  border-radius:999px;padding:12px 20px;font-weight:600;z-index:60;transition:all .3s ease;pointer-events:none}
.toast.show{opacity:1;transform:translate(-50%,0)}
.confetti{position:fixed;inset:0;pointer-events:none;z-index:70;overflow:hidden}
.confetti i{position:absolute;top:-20px;width:10px;height:16px;border-radius:2px;animation:fall 2.2s cubic-bezier(.3,.6,.4,1) forwards}
@keyframes fall{to{top:105vh;margin-left:var(--dx);transform:rotate(720deg)}}

@media (max-width:900px){.quiz-choices{grid-template-columns:1fr}.choice{font-size:30px}.quiz-q{font-size:34px}.score{margin-left:0}}
@media print{
  body.print-hw .app > *:not(#homework){display:none!important}
  body.print-hw #homework{position:static;background:none}
  body.print-hw .paper{box-shadow:none;max-height:none}
  body.print-hw .paper-actions{display:none}
}

/* ---------- this term, upload, marked work ---------- */
.term-note{margin:-4px 0 12px;color:var(--text-2);font-size:14px}
.now-badge{margin-left:auto;background:var(--primary);color:var(--ink-on-green);border-radius:999px;padding:2px 8px;font-size:11px;font-weight:600;white-space:nowrap}
.topic.this-term{border-color:rgba(25,164,101,.45)}
.upload{width:100%;background:var(--surface-2);border:1px solid var(--line);border-radius:12px;padding:12px;font-weight:600;font-size:15px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.055);transition:transform 180ms ease}
.upload:active{transform:translateY(2px) scale(.982);box-shadow:inset 0 2px 6px rgba(0,0,0,.6);transition-duration:40ms}
.upload:disabled{opacity:.6;cursor:progress}
body.lesson .upload{margin-top:10px}
.bl.wrong-item{color:var(--marker-red)}
.work-photo{width:100%;border-radius:8px;border:2px solid #D5D9E0;transform:rotate(-1.2deg);box-shadow:0 6px 16px rgba(0,0,0,.18)}

/* ---------- level check ---------- */
.level{display:flex;flex-direction:column;align-items:flex-start;gap:2px;width:100%;background:var(--primary);color:var(--ink-on-green);border:0;border-radius:12px;
  padding:12px 16px;font-weight:600;font-size:17px;text-align:left;box-shadow:inset 0 1px 0 rgba(255,255,255,.18),0 4px 12px rgba(0,0,0,.4);transition:transform 180ms ease}
.level small{font-weight:400;font-size:13px;opacity:.9}
.level:active{transform:translateY(2px) scale(.982);box-shadow:inset 0 3px 8px rgba(0,0,0,.45);transition-duration:40ms}
.choice.not-sure{grid-column:1/-1;justify-content:center;color:#5B6475;border-style:dashed;font-size:28px;padding:8px}

/* ---------- compact, void-free start screen (teacher card sets the row height) ---------- */
.layout{align-items:stretch}
.tutor{gap:10px}
.actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.actions .level,.actions .upload{margin:0;padding:10px 12px;font-size:15px;display:flex;flex-direction:column;align-items:flex-start;gap:1px;text-align:left}
.actions .upload small{font-weight:400;font-size:12px;color:var(--text-2)}
.actions .level small{font-size:12px}
.actions .level[hidden] + .upload{grid-column:1/-1}
.picker{position:relative;padding:0;overflow:hidden}
.picker-inner{position:absolute;inset:0;overflow-y:auto;padding:16px 18px;display:flex;flex-direction:column;gap:12px;scrollbar-width:thin;scrollbar-color:#333 transparent}
.step h2{margin-bottom:8px;font-size:16px}
.num{width:24px;height:24px;font-size:13px}
.grades{display:flex;flex-wrap:wrap;gap:10px 14px}
.phase-group{display:flex;flex-direction:column;gap:4px}
.phase-label{font-size:10.5px;color:var(--muted);text-transform:uppercase;letter-spacing:.07em;margin:0}
.phase-row{display:flex;gap:6px}
.grade{width:40px;height:40px;padding:0;border-radius:10px;font-size:16px;display:grid;place-items:center}
.ready{padding:8px 12px;font-size:14px}
.term-note{margin:-2px 0 8px;font-size:13px}
.topics{grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:6px}
.topic-btn{padding:8px 10px;gap:8px;font-size:14px;line-height:1.25}
.topic-btn .ico{font-size:18px}
.now-badge{font-size:10px;padding:2px 7px}
.subs{padding:0 10px 10px}
.sub{padding:5px 10px;font-size:13px}
@media (max-width:900px){
  .picker{overflow:visible}
  .picker-inner{position:static;overflow:visible}
  .actions{grid-template-columns:1fr}
}
.topics{grid-template-columns:repeat(auto-fill,minmax(185px,1fr))}
.topic-btn{min-height:44px}

/* ---------- example lesson button + start nudge ---------- */
.tutor-head{display:grid;grid-template-columns:1fr auto;column-gap:12px;align-items:center}
.tutor-head h2{grid-column:1}.tutor-head p{grid-column:1}
.demo-btn{grid-column:2;grid-row:1/span 2;background:var(--surface-2);border:1px solid var(--line);border-radius:10px;padding:9px 14px;font-weight:600;font-size:14px;white-space:nowrap;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.055);transition:transform 180ms ease}
.demo-btn:active{transform:translateY(2px) scale(.982);box-shadow:inset 0 2px 6px rgba(0,0,0,.6);transition-duration:40ms}
.stage.nudge{animation:nudge 1.2s ease 2}
@keyframes nudge{0%,100%{box-shadow:0 0 0 0 rgba(25,164,101,0)}50%{box-shadow:0 0 0 6px rgba(25,164,101,.55)}}

/* ---------- Andika: SIL's literacy font for beginning readers (clear a, g, l, I, 1) ---------- */
.board-title{font-size:34px;font-weight:700;text-underline-offset:7px}
.bl{font-size:28px;line-height:1.35}
.bl.hint .ink{font-size:24px}
.quiz-q{font-size:32px}
.choice{font-size:28px}
.quiz-feedback{font-size:24px}
.paper h2{font-size:32px}
.paper ol{font-size:22px}
.hw-note{font-size:20px}
.board-visual text{font-family:"Andika",sans-serif}
@media (max-width:900px){.bl{font-size:23px}.board-title{font-size:27px}.quiz-q{font-size:26px}.choice{font-size:23px}}

/* ---------- board fits its content (no empty lower half), readable maths, avatar panel hugs content ---------- */
.board{min-height:0}
.board-body{min-height:300px;align-items:center}
.bl.math .katex,.bl.answer .katex{font-size:1.3em}
.quiz-q .katex{font-size:1.2em}
.choice .katex{font-size:1.05em}
body.lesson .tutor{align-self:start}

.demo-clip{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:40;opacity:0;pointer-events:none;transition:opacity .25s;background:#000}
.demo-clip.on{opacity:1}
.stage anam-agent{z-index:1}
.play-overlay{position:fixed;inset:0;z-index:80;background:rgba(0,0,0,.78);display:grid;place-items:center}
.play-overlay button{display:flex;flex-direction:column;align-items:center;gap:10px;background:var(--primary);color:#fff;border:0;border-radius:20px;padding:26px 40px;font:600 26px Inter,sans-serif;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 20px 50px rgba(0,0,0,.6)}
.play-overlay button small{font-weight:400;font-size:15px;opacity:.9}

/* ---------- how it works (fills the picker until a grade is chosen) ---------- */
.how{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:1fr 1fr;gap:8px;flex:1}
.how li{background:var(--surface-2);border:1px solid var(--line);border-radius:12px;padding:12px 14px;display:flex;flex-direction:column;gap:4px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.055)}
.how span{font-size:26px;line-height:1}
.how b{font-size:15px;font-weight:600}
.how small{font-size:13px;color:var(--text-2);line-height:1.4}
@media (max-width:520px){.how{grid-template-columns:1fr}}

.memo{margin-top:14px;border-top:3px dashed #CFE0F5;padding-top:10px}
.memo h3{font-family:var(--hand);color:var(--marker-green);margin:0 0 6px;font-size:22px}
.memo ol{font-size:19px!important;line-height:32px!important;color:var(--marker-green)}

.lang{display:flex;align-items:center;gap:8px;margin-top:10px;font-size:13px;color:var(--text-2)}
.lang select{background:var(--surface-2);color:var(--text);border:1px solid var(--line);border-radius:8px;padding:6px 8px;font:inherit;font-size:13px}

/* ---------- Grade R-3: Playwrite ZA, modelled on South African school handwriting ---------- */
body.junior{--hand:"Playwrite ZA","Andika",cursive}
body.junior .board-title{font-size:28px;font-weight:400;line-height:1.5}
body.junior .bl{font-size:23px;line-height:1.7;font-weight:400}
body.junior .bl.answer{font-weight:400}
body.junior .bl.hint .ink{font-size:20px}
body.junior .quiz-q{font-size:26px;line-height:1.6;font-weight:400}
body.junior .choice{font-size:24px;font-weight:400}
body.junior .quiz-feedback{font-size:20px;font-weight:400}
body.junior .paper h2{font-size:26px;font-weight:400}
body.junior .paper ol{font-size:19px;line-height:39px}
body.junior .board-visual text{font-family:"Playwrite ZA","Andika",cursive}
@media (max-width:900px){body.junior .bl{font-size:19px}body.junior .quiz-q{font-size:21px}body.junior .choice{font-size:20px}}

/* ---------- no void during quizzes and the level check ---------- */
.board-body:has(> .board-lines:empty):has(> .board-visual:empty){display:none}
.board-body:has(> .board-lines:empty){grid-template-columns:1fr;min-height:0;justify-items:center}
.board-body:has(> .board-lines:empty) .board-visual{width:min(560px,100%)}
.board:has(#quiz:not([hidden])) .board-body{min-height:0}
.board:has(#quiz:not([hidden])) .quiz{margin-top:14px}

/* ---------- grade gate, learning plan menu ---------- */
.grade-gate{position:absolute;inset:0;z-index:45;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;
  background:rgba(10,10,10,.72);color:#fff;font-weight:600;font-size:20px;text-align:center;backdrop-filter:blur(2px)}
.grade-gate small{font-weight:400;font-size:14px;color:var(--text-2)}
.plan-btn{background:var(--surface-2);border:1px solid var(--line);border-radius:12px;padding:9px 14px;font-weight:600;font-size:14px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.055);transition:transform 180ms ease}
.plan-btn:active{transform:translateY(2px) scale(.982);transition-duration:40ms}
.plan-btn.pulse{animation:nudge 1.2s ease 3}
.plan-head{font-family:var(--hand);font-weight:700;font-size:22px;color:var(--marker-blue);list-style:none;margin-bottom:2px}
.plan-item{list-style:none}
.plan-item button{display:flex;align-items:center;gap:12px;width:100%;text-align:left;background:#fff;border:3px solid #D5DBE5;border-radius:14px;
  padding:10px 14px;color:var(--marker);transition:transform 180ms ease}
.plan-item button:active{transform:translateY(2px) scale(.985);transition-duration:40ms}
.plan-item.gap button{border-color:#F2B8BF}
.plan-item.doing button{border-color:var(--marker-blue);background:#EEF4FF}
.plan-item.done button{border-color:#BFE3CF;background:#F1FAF5;opacity:.8}
.pi-ico{font-size:24px;line-height:1}
.pi-txt{display:flex;flex-direction:column;font-family:var(--hand)}
.pi-txt b{font-size:20px;font-weight:700;line-height:1.25}
.pi-txt small{font-size:14px;color:#5B6475}
body.junior .pi-txt b{font-size:17px;font-weight:400}

/* ---------- results brief above the plan ---------- */
.brief{list-style:none;background:#F4F7FC;border:2px solid #D5DEEC;border-radius:14px;padding:12px 14px;display:flex;flex-direction:column;gap:6px;font-family:var(--hand)}
.brief-row{display:grid;grid-template-columns:120px 1fr;gap:10px;font-size:17px;line-height:1.35;color:var(--marker)}
.brief-row b{font-weight:700;color:var(--marker-blue)}
.brief-row.good b{color:var(--marker-green)}
.brief-row.bad b{color:var(--marker-red)}
body.junior .brief-row{font-size:15px}
@media (max-width:900px){.brief-row{grid-template-columns:1fr;gap:0}}

/* ---------- classroom additions: rule card, countdown, fill-in table ---------- */
.board{position:relative}
.bl.rule .ink{background:#FFE45C;color:#1D2B4F;border:3px solid #E0A800;border-radius:12px;padding:8px 16px;font-weight:700;
  box-shadow:4px 4px 0 rgba(0,0,0,.12);transform:rotate(-.6deg)}
.bl.rule .ink::before{content:"⭐ Rule: ";color:var(--marker-red)}
.countdown{position:absolute;top:16px;right:18px;display:flex;align-items:center;gap:8px;background:#1D2B4F;color:#fff;border-radius:999px;padding:4px 14px 4px 4px;
  font:700 22px Inter,sans-serif;box-shadow:0 4px 12px rgba(0,0,0,.25)}
.countdown svg{width:40px;height:40px;background:#fff;border-radius:50%}
.countdown.done{background:var(--marker-red);animation:bump .5s ease 2}
.fill-table{width:100%;border-collapse:separate;border-spacing:0;font-family:var(--hand);font-size:24px;border:3px solid #1D2B4F;border-radius:12px;overflow:hidden}
.fill-table th{background:#3B6FD8;color:#fff;font-weight:700;padding:10px 8px}
.fill-table td{background:#EEF3FC;text-align:center;padding:10px 8px;border-top:2px solid #C9D6EE;color:var(--marker)}
.fill-table tr:nth-child(even) td{background:#DDE7F8}
.fill-table td.blank{color:var(--marker-red);font-weight:700}
body.junior .fill-table{font-size:20px}

/* ---------- avatar OR whiteboard, never both ---------- */
/* while the board is up her video is hidden (still playing, so her voice continues) and the board gets the room */
body.lesson .layout{grid-template-columns:1fr}
body.lesson .tutor{position:fixed;right:0;bottom:0;width:2px;height:2px;padding:0;border:0;opacity:0;overflow:hidden;pointer-events:none;box-shadow:none}
/* the board fits its content: no forced height, so no empty block under the lines */
body.lesson .board-body{min-height:0;align-items:center}
.talk-pill{display:inline-flex;align-items:center;gap:3px;background:var(--surface-2);border:1px solid var(--line);border-radius:999px;padding:7px 14px 7px 12px;font-size:14px;font-weight:600}
.talk-pill i{display:inline-block;width:3px;height:8px;border-radius:2px;background:var(--glyph);margin-right:1px;transition:height .12s}
.talk-pill.speaking i{animation:talk .5s ease-in-out infinite alternate}
.talk-pill.speaking i:nth-child(2){animation-delay:.15s}.talk-pill.speaking i:nth-child(3){animation-delay:.3s}
.talk-pill i:last-of-type{margin-right:6px}
@keyframes talk{from{height:5px}to{height:16px}}
@media (max-width:900px){body.lesson .tutor{position:fixed}}
/* lesson mode on a wide screen: the board is the whole room, so the maths grows to fill it (no empty page under the board) */
@media (min-width:1181px){
  body.lesson .board{min-height:calc(100vh - 118px);display:flex;flex-direction:column}
  body.lesson .board-body{flex:1;align-items:center;grid-template-columns:minmax(0,1fr) minmax(0,1.25fr)}
  body.lesson .board-body.no-visual{grid-template-columns:1fr}
  body.lesson .board-visual svg{height:min(60vh,640px);width:100%}
  body.lesson .bl{font-size:clamp(32px,4.3vh,46px)}
  body.lesson .bl.math .katex{white-space:nowrap}
  body.lesson .bl.wrap .katex{white-space:normal}
  body.lesson .board:has(#quiz:not([hidden])) .board-visual svg{height:min(34vh,360px)}
}

/* ---------- help buttons on the board: Say again / Show another way / I don't know ---------- */
.help-bar{display:flex;flex-wrap:wrap;gap:12px;justify-content:center;margin-top:22px;padding-top:18px;border-top:2px dashed #D5D9E0}
.help-btn{font:600 18px/1.2 "Andika",Inter,sans-serif;color:var(--marker);background:#fff;border:2px solid #C9D2E3;border-radius:999px;
  padding:12px 22px;min-height:52px;cursor:pointer;box-shadow:inset 0 1px 0 rgba(255,255,255,.9),0 2px 0 #C9D2E3;transition:transform .18s,box-shadow .18s}
.help-btn:hover{border-color:var(--marker-blue)}
.help-btn:active{transform:translateY(2px) scale(.982);box-shadow:inset 0 2px 6px rgba(0,0,0,.18);transition-duration:40ms}
.help-btn:focus-visible{outline:3px solid var(--marker-blue);outline-offset:2px}
@media (max-width:620px){.help-btn{flex:1 1 100%;font-size:17px}}
.help-bar[hidden]{display:none}

/* ---------- class topic this week + formal test card (teaching plan) ---------- */
.class-card,.test-card{list-style:none;background:#fff;border:2px solid #D5DEEC;border-radius:14px;padding:12px 14px;display:flex;flex-direction:column;gap:10px;font-family:var(--hand)}
.test-card{border-color:#F3D27A;background:#FFFBEF}
.cc-row{display:flex;align-items:center;gap:12px}
.cc-ico{font-size:26px;line-height:1}
.cc-txt{display:flex;flex-direction:column;flex:1;min-width:0}
.cc-txt small{font-size:14px;color:#5B6B86}
.cc-txt b{font-size:19px;color:var(--marker);line-height:1.25}
.cc-ask{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.cc-ask>span{font-size:16px;color:var(--marker);margin-right:4px}
.cc-btn{font:600 16px/1.2 "Andika",Inter,sans-serif;color:var(--marker);background:#fff;border:2px solid #C9D2E3;border-radius:999px;padding:9px 16px;min-height:44px;cursor:pointer}
.cc-btn:hover{border-color:var(--marker-blue)}
.cc-btn:active{transform:translateY(2px) scale(.982);transition-duration:40ms}
.cc-btn.primary{background:var(--marker-blue);border-color:var(--marker-blue);color:#fff}
.cc-link{background:none;border:0;color:var(--marker-blue);font:600 15px "Andika",Inter,sans-serif;text-decoration:underline;cursor:pointer;padding:6px}
.cc-note{font-size:13px;color:#6B7A93;flex-basis:100%}
.cc-pick{display:flex;flex-wrap:wrap;gap:8px}
.plan-item.class button{border-color:#A9C7F5}
.plan-item.test button{border-color:#F3D27A;background:#FFFBEF}
body.junior .cc-txt b{font-size:17px}

/* plan menu: list on the left, building + class/test cards on the right, both from the top (no void above the building) */
.board-body:has(.plan-item),.board-body:has(.plan-head),body.lesson .board-body:has(.plan-head){align-items:stretch}
/* both plan columns are the same height; any small difference is shared out between the items, never left as one empty block */
.board-body:has(.plan-head) .board-lines,.board-body:has(.plan-head) .board-visual{display:flex;flex-direction:column;justify-content:space-between;gap:10px}
.board-body:has(.plan-head) .board-visual .plan-side{margin-top:0}
body.lesson .board-body:has(.plan-head){grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
body.lesson .board-body:has(.plan-head) .board-visual svg{height:auto;max-height:44vh}
.plan-side{list-style:none;margin:14px 0 0;padding:0;display:flex;flex-direction:column;gap:12px}
.plan-top{list-style:none;margin:0;padding:0}
.cc-ask .cc-btn{padding:7px 13px;min-height:40px;font-size:15px}

/* ---------- real exam question (DBE NSC papers, shown with credit) ---------- */
.pp-q{list-style:none;font-family:"Andika",Inter,sans-serif;color:var(--marker);display:flex;flex-direction:column;gap:12px}
.pp-context{font-size:22px;line-height:1.45;color:#3D4C6A}
.pp-text{font-size:28px;line-height:1.45}
.pp-q .katex{font-size:1.05em}
.pp-actions{list-style:none;display:flex;flex-wrap:wrap;gap:10px;margin-top:6px}
.pp-credit{list-style:none;font-size:13px;color:#6B7A93;font-family:Inter,sans-serif;margin-top:6px}
body.lesson .board-body.no-visual .pp-text{font-size:clamp(26px,3.4vh,34px)}
/* real exam question fills the board (no empty half): big text, centred in the room */
body.lesson .board-body:has(.pp-q){display:flex;flex-direction:column;justify-content:center}
body.lesson .board-body:has(.pp-q) .board-lines{gap:26px}
body.lesson .pp-context{font-size:clamp(26px,3.9vh,40px)}
body.lesson .pp-text,body.lesson .board-body.no-visual .pp-text{font-size:clamp(38px,6.6vh,66px);line-height:1.35}
body.lesson .pp-actions .cc-btn{font-size:clamp(17px,2.1vh,22px);padding:12px 22px;min-height:52px}
body.lesson .pp-credit{font-size:clamp(13px,1.5vh,16px)}

/* diagram from the real exam paper (DBE scan, cropped) */
.pp-fig{display:block;width:100%;height:auto;max-height:min(62vh,640px);object-fit:contain;background:#fff;border:1px solid #E3E7EE;border-radius:8px}
.pp-fig-cap{font:13px Inter,sans-serif;color:#6B7A93;margin-top:6px;text-align:center}
body.lesson .board-body:has(.pp-q):not(.no-visual){display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.15fr);align-items:center}
/* with the paper's diagram beside it, the question text is smaller so both fit the board */
body.lesson .board-body:has(.pp-q):not(.no-visual) .pp-context{font-size:clamp(17px,2.3vh,23px)}
body.lesson .board-body:has(.pp-q):not(.no-visual) .pp-text{font-size:clamp(22px,3.1vh,30px)}
body.lesson .board-body:has(.pp-q):not(.no-visual) .pp-fig{max-height:min(66vh,700px)}

/* whose turn it is to speak (the learner's mic only opens when Zanele has finished) */
.mic-pill{display:inline-flex;align-items:center;gap:6px;border-radius:999px;padding:7px 14px;font:600 14px Inter,sans-serif;border:1px solid var(--line);
  background:var(--surface-2);color:var(--text);cursor:pointer;white-space:nowrap}
.mic-pill.open{background:var(--primary);border-color:var(--primary);color:#fff}
.mic-pill.closed{color:#9AA0A6}
.mic-pill:active{transform:translateY(2px) scale(.982);transition-duration:40ms}
.mic-pill[hidden]{display:none}

/* dense brief after a test: score, marks by topic, the exact mistakes, what to revise first */
.brief.dense{gap:10px;font-size:1.06em}
.brief.dense .brief-row{font-size:19px;line-height:1.45}
body.junior .brief.dense .brief-row{font-size:17px}
.brief.dense .big{font-size:1.15em;color:var(--marker)}
.brief.dense small{font-size:.86em;color:#5B6478}
.brief .topics{display:flex;flex-wrap:wrap;gap:6px}
.brief .topics i{font-style:normal;border-radius:8px;padding:2px 9px;border:2px solid #D5DEEC;background:#fff;white-space:nowrap}
.brief .topics i.ok{border-color:#9FD3B6}
.brief .topics i.mid{border-color:#F1D27A}
.brief .topics i.bad{border-color:#EFA3AC}

/* full lesson (lesson file): plot grid input + its buttons */
.plot-grid{width:100%;max-width:560px;margin:0 auto}
.plot-grid svg{width:100%;height:auto;touch-action:manipulation}
.plot-grid .pt-hit{cursor:pointer}
.plot-grid .pt-hit:hover{fill-opacity:.22}
.quiz-choices .plot-btn{font-size:17px;justify-content:center}
.quiz-choices .plot-btn.on{background:#1F6FEB;color:#fff;border-color:#1F6FEB}
.quiz-choices .plot-submit:not([disabled]){background:var(--marker-green,#0C7447);color:#fff;border-color:var(--marker-green,#0C7447)}
.choice.picked{outline:3px solid #1F6FEB;outline-offset:2px}
.full-lesson{color:#0C7447;font-weight:700}

/* Hold to ask: raised hand waits (amber), listening (green) */
.ask-btn{border-color:#1F6FEB;color:#1F6FEB;user-select:none;-webkit-user-select:none;touch-action:none}
.ask-btn.raised{background:#FFF3B0;border-color:#E0A800;color:var(--marker)}
.ask-btn.open{background:var(--marker-green,#0C7447);border-color:var(--marker-green,#0C7447);color:#fff;animation:askpulse 1.2s ease-in-out infinite}
@keyframes askpulse{50%{box-shadow:0 0 0 8px rgba(12,116,71,.18)}}
@media (prefers-reduced-motion:reduce){.ask-btn.open{animation:none}}

/* level-check report: full board, dense */
.brief.dense.report .brief-row{font-size:17px;line-height:1.4}
.brief.report .topics i small{color:#5B6478}
.report-next{list-style:none;display:flex;justify-content:center;margin-top:12px}
.report-open{align-self:flex-start;margin-top:4px}
.brief.report .brief-row.small{font-size:14px}
.brief.report .brief-row.small .topics i{padding:1px 7px}

/* ---------- learning road: rewards bar, lesson cards with topic thumbnails, motion ---------- */
.board-body.road-board{display:block}
.rw-li,.road-head,.road,.road-foot,.badge-grid{list-style:none}
.rw-bar{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:14px;background:linear-gradient(135deg,#1D2B4F,#2F4A8A);color:#fff;
  border-radius:16px;padding:12px 16px;box-shadow:inset 0 1px 0 rgba(255,255,255,.12),0 6px 18px rgba(29,43,79,.25);animation:rw-in .45s ease-out both}
.rw-level{display:flex;align-items:center;gap:10px;font-family:var(--hand)}
.rw-level b{display:block;font-size:19px}.rw-level small{opacity:.85;font-size:14px}
.lv-num{display:inline-grid;place-items:center;width:30px;height:30px;border-radius:50%;background:linear-gradient(135deg,#FFD45E,#FF8A3D);color:#1D2B4F;font:800 15px Inter,sans-serif}
.lv-num.big{width:46px;height:46px;font-size:22px;box-shadow:0 0 0 3px rgba(255,212,94,.35);animation:lv-glow 2.4s ease-in-out infinite}
.rw-xp{height:12px;background:rgba(255,255,255,.18);border-radius:999px;overflow:hidden}
.rw-xp i{display:block;height:100%;background:linear-gradient(90deg,#FFD45E,#FF8A3D);border-radius:999px;animation:xp-fill 1.1s .2s cubic-bezier(.2,.8,.2,1) both}
.rw-badges{display:flex;align-items:center;gap:6px;flex-wrap:wrap;justify-content:flex-end}
.rw-b{font-size:24px;filter:drop-shadow(0 2px 3px rgba(0,0,0,.3));animation:pop-in .5s both}
.rw-none{font-size:14px;opacity:.85;font-family:var(--hand)}
.rw-count{font:600 13px Inter,sans-serif;background:rgba(255,255,255,.15);border-radius:999px;padding:4px 10px;cursor:pointer}
.road-head{display:flex;align-items:baseline;gap:12px;margin:14px 0 8px;font-family:var(--hand);flex-wrap:wrap}
.road-head b{font-size:22px;color:var(--marker-blue)}.road-head span{font-size:15px;color:#5B6475}
.road{display:grid;grid-template-columns:repeat(var(--cols,3),minmax(0,1fr));gap:10px}
@media (max-width:900px){.road{grid-template-columns:repeat(2,minmax(0,1fr))}}
.rc-txt small{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.road-card{position:relative;display:flex;align-items:center;gap:12px;text-align:left;background:#fff;border:2px solid #DDE3EC;border-radius:16px;padding:10px 12px;
  cursor:pointer;font:inherit;animation:card-in .5s cubic-bezier(.2,.8,.2,1) both;transition:transform .18s,box-shadow .18s,border-color .18s}
.road-card:hover{transform:translateY(-3px);box-shadow:0 10px 22px rgba(29,43,79,.14);border-color:#B9C7DE}
.road-card:active{transform:translateY(2px) scale(.982);transition-duration:40ms}
.pi-thumb{width:52px;height:52px;flex:none;border-radius:14px;box-shadow:0 4px 10px rgba(0,0,0,.15)}
.road-card:hover .pi-thumb{animation:wiggle .5s}
.rc-txt{display:flex;flex-direction:column;gap:2px;min-width:0;font-family:var(--hand)}
.rc-txt b{font-size:17px;line-height:1.2;color:var(--marker);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.rc-txt small{font-size:13px;color:#5B6475}
.rc-tag{align-self:flex-start;font:700 11px Inter,sans-serif;letter-spacing:.02em;text-transform:uppercase;border-radius:999px;padding:2px 8px;background:#EEF1F6;color:#4A5568}
.rc-tag.gap{background:#FDE7EA;color:#B4233A}.rc-tag.class{background:#E5EEFF;color:#1F55C6}.rc-tag.test{background:#FFF3D1;color:#946200}.rc-tag.review{background:#E8F7EF;color:#0C7447}
.road-card.next{border-color:#1F6FEB;box-shadow:0 0 0 4px rgba(31,111,235,.15);animation:card-in .5s both,next-glow 2s .8s ease-in-out infinite}
.rc-next{position:absolute;top:-10px;right:10px;background:#1F6FEB;color:#fff;font:700 11px Inter,sans-serif;border-radius:999px;padding:3px 9px;box-shadow:0 3px 8px rgba(31,111,235,.4)}
.road-card.done{background:#F2FBF6;border-color:#BFE3CF}
.rc-done{position:absolute;top:8px;right:10px;width:24px;height:24px;border-radius:50%;background:#0C7447;color:#fff;display:grid;place-items:center;font:800 13px Inter,sans-serif;animation:pop-in .5s both}
.road-card.doing{border-color:#1F6FEB;background:#EEF4FF}
.road-foot{display:flex;flex-wrap:wrap;gap:12px;align-items:flex-start;justify-content:space-between;margin-top:12px}
.road-foot .plan-side{margin:0;flex:1 1 320px;flex-direction:row;flex-wrap:wrap}
.road-foot .plan-side>li{flex:1 1 260px}
.road-btns{display:flex;gap:8px;flex-wrap:wrap}
.level-chip{display:inline-flex;align-items:center;gap:8px;cursor:pointer;border:0;font:inherit}
.level-chip .lv-txt{display:flex;flex-direction:column;line-height:1.05;text-align:left}.level-chip .lv-txt b{font-size:13px}.level-chip .lv-txt small{font-size:11px;opacity:.8}
.level-chip[hidden]{display:none}
.badge-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:10px;margin-top:12px}
.badge-card{display:flex;flex-direction:column;align-items:center;text-align:center;gap:4px;padding:14px 10px;border-radius:16px;background:#F3F5F9;border:2px dashed #D2D9E4;
  font-family:var(--hand);filter:grayscale(1);opacity:.6;animation:card-in .45s both}
.badge-card.got{filter:none;opacity:1;background:#fff;border:2px solid #FFD45E;box-shadow:0 6px 16px rgba(224,168,0,.18)}
.badge-card .bc-ico{font-size:36px}.badge-card b{font-size:15px;line-height:1.2}.badge-card small{font-size:12px;color:#5B6475}
.credit-pop{position:fixed;left:50%;top:18%;transform:translateX(-50%);z-index:9999;background:linear-gradient(135deg,#FFD45E,#FF8A3D);color:#1D2B4F;
  font:800 20px Inter,sans-serif;padding:10px 20px;border-radius:999px;box-shadow:0 10px 30px rgba(0,0,0,.25);animation:credit-up 2.3s ease-out both;pointer-events:none}
.celebrate{position:fixed;inset:0;z-index:9998;display:grid;place-items:center;background:rgba(10,15,30,.45);animation:fade-in .25s both}
.celebrate.out{animation:fade-out .4s both}
.cel-card{background:#fff;border-radius:24px;padding:26px 36px;text-align:center;display:flex;flex-direction:column;gap:6px;font-family:var(--hand);
  box-shadow:0 20px 60px rgba(0,0,0,.35);animation:cel-pop .6s cubic-bezier(.2,1.6,.4,1) both}
.cel-ico{font-size:64px;animation:spin-in .8s both}.cel-card b{font-size:28px;color:var(--marker-blue)}.cel-card span{font-size:18px;color:var(--marker)}
@keyframes card-in{from{opacity:0;transform:translateY(14px) scale(.97)}to{opacity:1;transform:none}}
@keyframes rw-in{from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:none}}
@keyframes xp-fill{from{width:0}}
@keyframes pop-in{0%{transform:scale(0)}70%{transform:scale(1.2)}100%{transform:scale(1)}}
@keyframes next-glow{50%{box-shadow:0 0 0 8px rgba(31,111,235,.08)}}
@keyframes lv-glow{50%{box-shadow:0 0 0 7px rgba(255,212,94,.15)}}
@keyframes wiggle{25%{transform:rotate(-6deg)}75%{transform:rotate(6deg)}}
@keyframes credit-up{0%{opacity:0;transform:translate(-50%,20px) scale(.8)}15%{opacity:1;transform:translate(-50%,0) scale(1.05)}80%{opacity:1}100%{opacity:0;transform:translate(-50%,-40px)}}
@keyframes cel-pop{from{transform:scale(.5);opacity:0}to{transform:none;opacity:1}}
@keyframes spin-in{from{transform:rotate(-180deg) scale(0)}to{transform:none}}
@keyframes fade-in{from{opacity:0}}@keyframes fade-out{to{opacity:0}}
@media (max-width:640px){.rw-bar{grid-template-columns:1fr}.rw-badges{justify-content:flex-start}.road{grid-template-columns:1fr}}
@media (prefers-reduced-motion:reduce){.road-card,.rw-bar,.rw-xp i,.rw-b,.badge-card,.cel-card,.cel-ico,.credit-pop,.lv-num.big,.road-card.next{animation:none!important}}

/* the real DBE workbook page on the board */
.wb-pages{display:flex;gap:12px;justify-content:center;align-items:flex-start;width:100%}
.wb-page{margin:0;flex:1 1 0;max-width:420px;background:#fff;border-radius:12px;box-shadow:0 6px 18px rgba(29,43,79,.18);overflow:hidden;animation:card-in .5s both}
.wb-page img{display:block;width:100%;height:auto;max-height:62vh;object-fit:contain;background:#fff}
.wb-page figcaption{font:600 13px Inter,sans-serif;color:#4A5568;padding:6px 10px;background:#F4F7FC}
.rc-wb{font-size:12px;color:#0C7447}

/* ---------- game layer: lesson values, locks, BOSS, and the animated moments (game.js) ---------- */
.rc-val{position:absolute;bottom:8px;right:10px;font:800 13px Inter,sans-serif;color:#946200;background:linear-gradient(135deg,#FFF3D1,#FFE39A);border-radius:999px;padding:3px 9px;box-shadow:0 2px 6px rgba(224,168,0,.25)}
.rc-val.boss{color:#fff;background:linear-gradient(135deg,#7B5CFF,#E2457A);box-shadow:0 2px 10px rgba(123,92,255,.4)}
.road-card.boss{border-color:#B9A6FF;background:linear-gradient(180deg,#fff,#F6F2FF)}
.road-card.boss .pi-thumb{box-shadow:0 0 0 3px rgba(123,92,255,.35),0 4px 10px rgba(0,0,0,.15)}
.road-card.locked{background:#F3F5F9;border-style:dashed;cursor:not-allowed}
.road-card.locked .pi-thumb{filter:grayscale(1) blur(1px);opacity:.55}
.road-card.locked .rc-txt b{color:#7A8395}
.rc-lock{position:absolute;top:8px;right:10px;font-size:18px;filter:drop-shadow(0 2px 2px rgba(0,0,0,.2))}
.road-card.shake{animation:gm-shake .45s}
.road-card.gm-unlocking{animation:gm-unlock 1s cubic-bezier(.2,1.4,.4,1)}
.road-card.gm-unlocking::after{content:"🔓 UNLOCKED!";position:absolute;inset:auto 0 -12px 0;margin:auto;width:max-content;font:800 12px Inter,sans-serif;color:#fff;background:#0C7447;border-radius:999px;padding:3px 10px;animation:pop-in .5s both}
.gm{position:fixed;inset:0;z-index:9997;display:grid;place-items:center;animation:fade-in .2s both;cursor:pointer}
.gm.gm-out{animation:fade-out .45s both}
.gm-tag{font:800 13px Inter,sans-serif;letter-spacing:.14em;color:#FFD45E}
.gm-prize{font:800 22px Inter,sans-serif;color:#fff}.gm-prize span{color:#FFD45E}.gm-prize em{font-style:normal;font-size:15px;color:#FF8A3D;margin-left:6px}
.gm-mission{background:radial-gradient(circle at 50% 45%,rgba(31,111,235,.35),rgba(10,15,30,.78))}
.gm-m-card,.gm-c-card,.gm-b-card,.gm-l-card{text-align:center;color:#fff;display:flex;flex-direction:column;align-items:center;gap:8px;padding:26px 34px;border-radius:24px;
  background:linear-gradient(160deg,#1D2B4F,#2F4A8A);box-shadow:0 0 0 2px rgba(255,212,94,.35),0 24px 70px rgba(0,0,0,.45);animation:gm-zoom .55s cubic-bezier(.2,1.5,.4,1) both;font-family:var(--hand)}
.gm-m-card b,.gm-c-card b,.gm-b-card b,.gm-l-card b{font-size:28px;max-width:70vw}
.gm-m-card small,.gm-c-card small,.gm-l-card small{font-size:15px;opacity:.85}
.gm-boss{font:800 15px Inter,sans-serif;color:#fff;background:linear-gradient(135deg,#7B5CFF,#E2457A);border-radius:999px;padding:4px 14px;animation:gm-pulse 1s ease-in-out infinite}
.gm-complete{background:radial-gradient(circle at 50% 45%,rgba(12,116,71,.35),rgba(10,15,30,.8))}
.gm-stars{display:flex;gap:8px}
.gm-star{font-style:normal;font-size:54px;color:rgba(255,255,255,.18);transform:scale(.4);animation:gm-star .5s both}
.gm-star.on{color:#FFD45E;text-shadow:0 0 18px rgba(255,212,94,.7)}
.gm-level{background:rgba(6,10,24,.86);overflow:hidden}
.gm-cv{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.gm-rays{position:absolute;width:160vmax;height:160vmax;left:50%;top:50%;margin:-80vmax 0 0 -80vmax;
  background:repeating-conic-gradient(from 0deg,rgba(255,212,94,.16) 0 8deg,transparent 8deg 20deg);animation:gm-spin 9s linear infinite;mask-image:radial-gradient(circle,#000 0,transparent 60%)}
.gm-l-card{position:relative;background:linear-gradient(160deg,#2B1B5E,#7B5CFF)}
.gm-num{font:900 120px/1 Inter,sans-serif;background:linear-gradient(180deg,#FFF6C8,#FFD45E 45%,#FF8A3D);-webkit-background-clip:text;background-clip:text;color:transparent;
  filter:drop-shadow(0 6px 20px rgba(255,180,60,.55));animation:gm-num 1s cubic-bezier(.2,1.6,.4,1) .2s both;position:relative}
.gm-num::after{content:"";position:absolute;inset:0;background:linear-gradient(110deg,transparent 35%,rgba(255,255,255,.85) 50%,transparent 65%);mix-blend-mode:overlay;animation:gm-shine 1.6s 1s ease-in-out infinite}
.gm-badge{background:radial-gradient(circle at 50% 45%,rgba(224,168,0,.35),rgba(10,15,30,.8))}
.gm-flip{width:120px;height:120px;border-radius:50%;display:grid;place-items:center;font-size:66px;background:radial-gradient(circle at 35% 30%,#FFF6C8,#FFD45E 55%,#E0A800);
  box-shadow:0 0 0 6px rgba(255,255,255,.25),0 10px 30px rgba(224,168,0,.5);animation:gm-flip 1s cubic-bezier(.2,1.4,.4,1) both}
.gm-xp{position:fixed;left:50%;top:34%;z-index:9996;transform:translateX(-50%);font:900 26px Inter,sans-serif;color:#FFD45E;text-shadow:0 3px 0 #946200,0 6px 18px rgba(0,0,0,.35);
  animation:gm-xp 1.4s ease-out both;pointer-events:none;white-space:nowrap}
.gm-coin{position:fixed;z-index:9999;font-size:26px;transition:transform .8s cubic-bezier(.5,-.3,.6,1),opacity .8s;pointer-events:none;filter:drop-shadow(0 3px 4px rgba(0,0,0,.3))}
.level-chip.gm-bump{animation:gm-bump .35s}
.board.gm-shake{animation:gm-shake .4s}
@keyframes gm-zoom{from{transform:scale(.4) rotate(-4deg);opacity:0}to{transform:none;opacity:1}}
@keyframes gm-pulse{50%{transform:scale(1.08)}}
@keyframes gm-star{to{transform:scale(1)}}
@keyframes gm-spin{to{transform:rotate(360deg)}}
@keyframes gm-num{from{transform:scale(3);opacity:0}to{transform:none;opacity:1}}
@keyframes gm-shine{0%{transform:translateX(-60%)}100%{transform:translateX(60%)}}
@keyframes gm-flip{0%{transform:rotateY(540deg) scale(.3)}100%{transform:none}}
@keyframes gm-xp{0%{opacity:0;transform:translate(-50%,20px) scale(.6)}20%{opacity:1;transform:translate(-50%,0) scale(1.15)}100%{opacity:0;transform:translate(-50%,-60px) scale(1)}}
@keyframes gm-bump{50%{transform:scale(1.18)}}
@keyframes gm-shake{20%{transform:translateX(-6px)}40%{transform:translateX(6px)}60%{transform:translateX(-4px)}80%{transform:translateX(3px)}}
@keyframes gm-unlock{0%{transform:scale(.92);filter:brightness(1.3)}60%{transform:scale(1.06)}100%{transform:none}}
@media (prefers-reduced-motion:reduce){.gm *,.gm,.gm-xp,.road-card.gm-unlocking,.road-card.shake,.board.gm-shake{animation:none!important}}
.rc-val.rare{color:#fff;background:linear-gradient(135deg,#1F6FEB,#5EA0FF)}
.rc-val.epic{color:#fff;background:linear-gradient(135deg,#7B5CFF,#B48CFF)}
.rc-val.boss{color:#fff;background:linear-gradient(135deg,#E2457A,#FF8A3D);animation:gm-pulse 1.6s ease-in-out infinite}
.road-card.tier-rare{border-color:#B7CFF7}.road-card.tier-epic{border-color:#C9B8FF;background:linear-gradient(180deg,#fff,#F7F3FF)}
.road-card.tier-boss{border-color:#F4A7BE;background:linear-gradient(180deg,#fff,#FFF3F1)}
.road-card.tier-epic:not(.locked) .pi-thumb,.road-card.tier-boss:not(.locked) .pi-thumb{animation:gm-glow 2.4s ease-in-out infinite}
@keyframes gm-glow{50%{box-shadow:0 0 0 4px rgba(123,92,255,.25),0 0 18px rgba(255,138,61,.35)}}

/* level-check report for children (GPT-6.1 Sol design) */
/* Report-only styles. The default desktop view has no scrolling.
   Only the deliberately opened skill drawer scrolls. */

.rp-lines {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rp-report {
  --rp-board: #FCFCFA;
  --rp-ink: #1D2B4F;
  --rp-red: #D62839;
  --rp-blue: #1F6FEB;
  --rp-green: #0C7447;
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--rp-ink);
  background: var(--rp-board);
  font-family: var(--hand);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.3;
  text-align: left;
  opacity: 1;
}

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

.rp-report h2,
.rp-report h3,
.rp-report p {
  margin: 0;
  color: inherit;
  font-family: inherit;
}

.rp-report h2 { font-size: 19px; line-height: 1.25; }
.rp-report h3 { font-size: 16px; line-height: 1.3; }

.rp-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 12px;
  align-items: stretch;
}

.rp-main,
.rp-side {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 10px;
}

.rp-snapshot {
  display: grid;
  grid-template-columns: 155px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  border: 2px solid #DCE4ED;
  border-radius: 16px 13px 17px 12px;
  background: #FFF;
}

.rp-score-box {
  padding-right: 14px;
  border-right: 2px solid #E5EAF1;
}

.rp-score-box h2 { font-size: 14px; }

.rp-score {
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.rp-score-number {
  color: var(--rp-ink);
  font-size: 52px;
  font-weight: 700;
  line-height: 1.15;
}

.rp-score-total { font-size: 23px; }

.rp-small {
  color: #4D5B72;
  font-size: 13px;
  line-height: 1.35;
}

.rp-strengths { min-width: 0; }
.rp-strengths h3 { color: var(--rp-green); margin-bottom: 7px; }

.rp-strength-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rp-strength-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  font-size: 17px;
  overflow-wrap: anywhere;
}

.rp-strength-list li > span:first-child {
  flex: 0 0 18px;
  font-weight: 700;
}

.rp-strengths .rp-small { margin-top: 5px; }
.rp-encourage { font-size: 17px; }

.rp-quest > h2 { margin-bottom: 7px; color: var(--rp-blue); }

.rp-road {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rp-step {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  padding: 10px;
  border: 2px solid #DCE4ED;
  border-radius: 12px;
  background: #FFF;
}

.rp-step-now {
  border-color: var(--rp-blue);
  background: #EDF4FF;
  box-shadow: 0 3px 0 #CFDFFD;
}

.rp-step-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #4D5B72;
  font-size: 13px;
  font-weight: 700;
}

.rp-step-tag b {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid #C5D0DF;
  border-radius: 50%;
  background: var(--rp-board);
  color: var(--rp-ink);
  font-size: 14px;
}

.rp-step-now .rp-step-tag { color: var(--rp-blue); }

.rp-step-now .rp-step-tag b {
  border-color: var(--rp-blue);
  color: #FFF;
  background: var(--rp-blue);
  animation: rp-bounce 600ms 400ms both;
}

.rp-step-name {
  display: block;
  color: var(--rp-ink);
  font-size: 16px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.rp-step-meta {
  display: block;
  margin-top: auto;
  color: #4D5B72;
  font-size: 12px;
  line-height: 1.3;
}

.rp-step-pay {
  display: block;
  color: var(--rp-green);
  font-size: 15px;
  font-weight: 700;
}

.rp-watch {
  padding: 8px 12px;
  border-left: 4px solid var(--rp-red);
  border-radius: 0 10px 10px 0;
  background: #FFF1F2;
}

.rp-watch h3 { color: #A51E2C; margin-bottom: 3px; }

.rp-watch h3 > span {
  display: inline-grid;
  width: 18px;
  height: 18px;
  margin-right: 4px;
  place-items: center;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  font-size: 13px;
}

.rp-watch ul {
  display: grid;
  gap: 3px;
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.3;
}

.rp-watch li { margin: 0; overflow-wrap: anywhere; }

.rp-grade-map {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
  padding: 12px;
  border: 2px solid #DCE4ED;
  border-radius: 14px 17px 12px 15px;
  background: #FFF;
}

.rp-grade-map h2 { font-size: 17px; }

.rp-floors {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  min-height: 90px;
}

.rp-floor {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 5px;
  align-items: center;
  min-width: 0;
}

.rp-floor-label {
  color: var(--rp-ink);
  font-size: 12px;
  white-space: nowrap;
}

.rp-floor-bar {
  display: flex;
  height: 27px;
  overflow: hidden;
  border: 1px solid #B9C6D8;
  border-radius: 5px;
  background: #F3F6FA;
}

.rp-segment {
  display: grid;
  flex-basis: 0;
  flex-shrink: 1;
  min-width: 0;
  place-items: center;
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
}

.rp-segment + .rp-segment { border-left: 2px solid #FFF; }

.rp-solid-fill { color: #FFF; background: var(--rp-green); }

.rp-likely-fill {
  color: var(--rp-blue);
  background-color: #EAF2FF;
  background-image: radial-gradient(#B6CEFA 1px, transparent 1px);
  background-size: 5px 5px;
}

.rp-build-fill {
  color: #A51E2C;
  background: repeating-linear-gradient(
    -45deg, #FDE9EC, #FDE9EC 5px, #F8D1D7 5px, #F8D1D7 7px
  );
}

.rp-floors-many { gap: 3px; }
.rp-floors-many .rp-floor-bar { height: 16px; }
.rp-floors-many .rp-floor-label { font-size: 11px; }
.rp-floors-many .rp-segment { font-size: 11px; }

.rp-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 5px;
  font-size: 12px;
}

.rp-legend i { font-style: normal; font-weight: 700; }
.rp-solid { color: var(--rp-green); }
.rp-likely { color: var(--rp-blue); }
.rp-building { color: #B32232; }
.rp-unknown { color: #4D5B72; }

.rp-tower-note {
  color: #4D5B72;
  font-size: 11px;
  text-align: center;
}

.rp-reward {
  padding: 10px 12px;
  border: 2px solid #B9D8C7;
  border-radius: 12px;
  background: #EEF8F1;
}

.rp-reward-head {
  color: var(--rp-green);
  font-size: 17px;
  font-weight: 700;
}

.rp-reward-head b { font-size: 24px; }

.rp-meter {
  height: 9px;
  margin: 7px 0 5px;
  overflow: hidden;
  border: 1px solid #B9D8C7;
  border-radius: 99px;
  background: #FFF;
}

.rp-meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--rp-green);
}

.rp-level-note { color: var(--rp-green); font-weight: 700; }

.rp-actions {
  display: grid;
  grid-template-columns: minmax(235px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 2px solid #E1E6EC;
}

.rp-report button,
.rp-details > summary {
  min-height: 46px;
  font-family: var(--hand);
  line-height: 1.2;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.rp-primary {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border: 2px solid var(--rp-blue);
  border-radius: 12px;
  color: #FFF;
  background: var(--rp-blue);
  box-shadow: 0 4px 0 #174EA6;
  font-size: 20px;
  font-weight: 700;
  transition: transform 150ms, box-shadow 150ms;
}

.rp-primary:hover:not(:disabled) { transform: translateY(-2px); }
.rp-primary:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #174EA6;
}

.rp-primary:disabled {
  border-color: #D8DEE8;
  color: #536079;
  background: #E8ECF2;
  box-shadow: none;
  cursor: default;
}

.rp-secondary,
.rp-close {
  padding: 10px 14px;
  border: 2px solid #C8D3E2;
  border-radius: 10px;
  color: var(--rp-ink);
  background: var(--rp-board);
  font-size: 15px;
  font-weight: 700;
}

.rp-secondary:hover,
.rp-close:hover { background: #EDF4FF; border-color: var(--rp-blue); }

.rp-details > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 3px;
  color: var(--rp-blue);
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
  list-style: none;
}

.rp-details > summary::-webkit-details-marker { display: none; }
.rp-details > summary::before { content: "+"; font-size: 20px; font-weight: 700; }
.rp-details[open] > summary::before { content: "−"; }

.rp-skill-panel {
  position: absolute;
  z-index: 20;
  right: 0;
  bottom: 70px;
  left: 0;
  display: flex;
  max-height: min(350px, 65vh);
  flex-direction: column;
  padding: 14px;
  border: 2px solid var(--rp-blue);
  border-radius: 15px;
  background: var(--rp-board);
  box-shadow: 0 9px 30px rgba(29, 43, 79, .2);
}

.rp-details:not([open]) .rp-skill-panel { display: none; }

.rp-panel-head {
  display: flex;
  flex: 0 0 auto;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid #DCE4ED;
}

.rp-panel-head h2 { font-size: 19px; }
.rp-close { min-height: 44px; font-size: 14px; }

.rp-skill-body {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.rp-disclosure-note { padding: 8px 0; }

.rp-skill-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rp-skill {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0;
  padding: 9px 0;
  border-bottom: 1px solid #E1E6EC;
}

.rp-skill-icon { flex: 0 0 21px; font-size: 21px; font-weight: 700; }
.rp-skill-copy { min-width: 0; overflow-wrap: anywhere; }
.rp-skill-copy b { display: block; font-size: 15px; }
.rp-skill-copy small { display: block; margin-top: 3px; font-size: 12px; }
.rp-skill-note { margin-top: 5px !important; color: #4D5B72 !important; font-size: 12px; }

.rp-class-note {
  margin-top: 12px;
  padding: 10px;
  border-radius: 8px;
  background: #EDF4FF;
}

.rp-class-note p { margin-top: 4px; font-size: 13px; }
.rp-empty { margin: 0; padding: 10px 0; color: #4D5B72; font-size: 15px; }

.rp-report button:focus-visible,
.rp-details > summary:focus-visible,
.rp-skill-body:focus-visible {
  outline: 3px solid var(--rp-ink);
  outline-offset: 4px;
}

.rp-enter { animation: rp-in 350ms both; }

@keyframes rp-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes rp-bounce {
  0%, 100% { transform: translateY(0); }
  45% { transform: translateY(-5px); }
  70% { transform: translateY(1px); }
}

@media (max-width: 780px) {
  .rp-layout { grid-template-columns: minmax(0, 1fr); }
  .rp-side { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .rp-grade-map { min-height: 180px; }
  .rp-actions { grid-template-columns: minmax(0, 1fr) auto; }
  .rp-primary { grid-column: 1 / -1; }
  .rp-skill-panel { bottom: 120px; }
}

@media (max-width: 520px) {
  .rp-report { font-size: 16px; }
  .rp-snapshot { grid-template-columns: 112px minmax(0, 1fr); gap: 12px; padding: 12px; }
  .rp-score-box { padding-right: 10px; }
  .rp-score-number { font-size: 44px; }
  .rp-score-total { font-size: 19px; }
  .rp-strength-list li { font-size: 15px; }
  .rp-road { grid-auto-flow: row; grid-template-columns: minmax(0, 1fr); }
  .rp-step { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 4px 9px; }
  .rp-step-tag { grid-column: 1; grid-row: 1 / 4; flex-direction: column; justify-content: center; }
  .rp-step-name,
  .rp-step-meta,
  .rp-step-pay { grid-column: 2; }
  .rp-step-meta { margin-top: 0; }
  .rp-side { grid-template-columns: minmax(0, 1fr); }
  .rp-grade-map { min-height: 0; }
  .rp-floors { min-height: 0; padding: 5px 0; }
  .rp-actions { display: flex; flex-direction: column; align-items: stretch; }
  .rp-primary,
  .rp-secondary { width: 100%; }
  .rp-primary { font-size: 19px; }
  .rp-skill-panel { position: static; width: 100%; max-height: 55vh; margin-top: 8px; padding: 10px; }
  .rp-skill-list { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 360px) {
  .rp-snapshot { grid-template-columns: minmax(0, 1fr); }
  .rp-score-box { padding: 0 0 8px; border-right: 0; border-bottom: 2px solid #E5EAF1; }
  .rp-score { display: inline-flex; margin-right: 8px; }
  .rp-score-box > .rp-small { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
  .rp-report *,
  .rp-report *::before,
  .rp-report *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

.board-body:has(.rp-report){align-items:start;align-content:start;min-height:0}
.board-body:has(.rp-report) .board-lines{justify-content:flex-start}
.gm-go{margin-top:10px;font:800 18px Inter,sans-serif;color:#fff;background:linear-gradient(180deg,#2F86FF,#1F6FEB);border:0;border-radius:16px;padding:12px 28px;
  box-shadow:0 5px 0 #1449A8,0 10px 20px rgba(31,111,235,.3);cursor:pointer;transition:transform 40ms}
.gm-go:active{transform:translateY(3px);box-shadow:0 2px 0 #1449A8}

/* ===== ALL-WHITE THEME + polish of every container, button and badge (GPT-6.1 Sol, 19 Nov 2026) ===== */
/* ==========================================================
   MATHS MZANSI — WHITE GAME THEME
   Append AFTER the existing stylesheet.
   White surfaces; colour is an accent, action or reward.
   ========================================================== */

:root{
  color-scheme:light;
  --canvas:#F7F9FD;
  --surface-1:#FFFFFF;
  --surface-2:#F1F5FC;
  --text:#1D2B4F;
  --text-2:#495B77;
  --muted:#596B83;
  --line:#DCE5F1;
  --radius:24px;
  --primary:#0C7447;
  --glyph:#0C7447;
  --ink-on-green:#FFFFFF;
  --sowetan:#D62839;

  --board:#FCFCFA;
  --marker:#1D2B4F;
  --marker-red:#D62839;
  --marker-blue:#1F6FEB;
  --marker-green:#0C7447;
  --hand:"Andika",sans-serif;

  --game-font:"Andika",Inter,system-ui,sans-serif;
  --game-blue:#1F6FEB;
  --game-blue-edge:#174EA6;
  --game-green:#0C7447;
  --game-green-edge:#075A36;
  --game-purple:#7651D7;
  --game-pink:#D62866;
  --game-orange:#EF8B21;
  --game-gold:#FFD45E;
  --game-gold-ink:#795000;
  --game-gold-edge:#D49A27;
  --game-edge:#CCD9EE;
  --edge:var(--game-edge);
  --accent:var(--game-blue);
  --tint:#F1F6FF;

  --shadow-sm:0 3px 8px rgba(57,85,132,.06),
              0 8px 18px rgba(57,85,132,.07);
  --shadow-card:0 4px 8px rgba(57,85,132,.04),
                0 14px 30px rgba(57,85,132,.09);
  --shadow-lift:0 6px 12px rgba(57,85,132,.07),
                0 18px 34px rgba(57,85,132,.13);
  --shadow-modal:0 12px 28px rgba(57,85,132,.10),
                 0 30px 80px rgba(57,85,132,.16);
  --gloss:inset 0 2px 0 rgba(255,255,255,.9);
  --ease-game:cubic-bezier(.2,.8,.2,1);
}

html{
  background:var(--canvas);
  scroll-padding-top:20px;
  -webkit-text-size-adjust:100%;
}
body{
  background:
    radial-gradient(ellipse at 8% 0%,#EAF4FF 0,transparent 36%),
    radial-gradient(ellipse at 96% 18%,#FFF5DF 0,transparent 30%),
    var(--canvas);
  color:var(--text);
}
body.junior{--hand:"Andika",sans-serif}
button,input,select,textarea{font:inherit}
button{color:var(--text);touch-action:manipulation}
button,summary,a{-webkit-tap-highlight-color:transparent}
button{min-height:44px}
button:focus-visible,a:focus-visible,summary:focus-visible,
select:focus-visible,[tabindex]:focus-visible{
  outline:3px solid var(--game-blue);
  outline-offset:4px;
}
button:disabled,[aria-disabled="true"]{cursor:not-allowed}
[hidden]{display:none!important}
.app,body.lesson .app{
  width:100%;
  max-width:1440px;
  margin-inline:auto;
  padding:18px 20px 32px;
}
.layout,body.lesson .layout{
  min-width:0;
  gap:20px;
  align-items:start;
}
.layout>*,
.board-wrap,.board,.board-body,.board-lines,.board-visual{
  min-width:0;
  max-width:100%;
}
.card h2,.step h2,.wheel-card h2{
  font-family:var(--game-font);
  font-weight:700;
}
.foot{color:var(--muted);font-size:12px;line-height:1.5}
.powered img{filter:none}

/* ---------- Compact, unwrapped game bar ---------- */

.top{
  display:flex;
  flex-wrap:nowrap;
  align-items:center;
  gap:10px;
  min-height:72px;
  margin:0 0 20px;
  padding:10px 14px;
  border:1px solid #E1E8F2;
  border-bottom:5px solid #D8E3F4;
  border-radius:22px;
  background:#FFF;
  box-shadow:var(--gloss),var(--shadow-sm);
}
.top>*{min-width:0}
.brand{flex:0 0 auto;flex-direction:row;align-items:center;gap:clamp(5px,1.1vw,12px)}
.brand-text{display:grid;gap:5px}
.brand-mark{
  display:grid;grid-template-columns:repeat(2,1fr);gap:2px;padding:3px;
  width:clamp(28px,4.2vw,46px);aspect-ratio:1;flex:none;
  border-radius:25%;background:var(--marker);box-shadow:0 2px 0 var(--text-2);
  font:700 clamp(10px,1.7vw,17px)/1 var(--hand);
}
.brand-mark span{
  display:grid;place-items:center;border-radius:28%;background:var(--surface-2);
  color:var(--marker);box-shadow:inset 0 -1px 0 rgb(29 43 79 / .16);
  animation:mmMathTile 660ms cubic-bezier(.2,.75,.25,1) backwards;
}
.brand-mark span:nth-child(2){background:#DCEAFF;color:#154AA0;animation-delay:75ms}
.brand-mark span:nth-child(3){background:#FFE5EA;color:#9C2032;animation-delay:150ms}
.brand-mark span:nth-child(4){background:#FFE394;color:#563B08;animation-delay:225ms}
@keyframes mmMathTile{
  0%,100%{transform:none}
  35%{transform:translateY(-4px) rotate(-10deg) scale(1.14)}
  66%{transform:translateY(1px) rotate(3deg) scale(.96)}
}
@media (prefers-reduced-motion:reduce){.brand-mark span{animation:none}}

.brand-name{
  font-size:clamp(20px,2.2vw,30px);
  line-height:1;
  white-space:nowrap;
  letter-spacing:-.045em;
}
.brand-name span{color:var(--sowetan)}
.powered{font-size:10px;color:var(--text-2);gap:5px}
.powered img{height:14px;max-width:94px}
.top .lesson-chip{
  flex:0 1 230px;
  min-width:0;
  margin-left:auto;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:12px;
}
.top .score{
  display:flex;
  flex:0 0 auto;
  flex-wrap:nowrap;
  align-items:center;
  gap:6px;
  margin-left:auto;
}
.top .lesson-chip:not([hidden])+.score{margin-left:0}
.top :is(button,.pill,.talk-pill){
  flex-shrink:0;
  white-space:nowrap;
  line-height:1.2;
  font-size:12px;
}
.top :is(.pill,.plan-btn,.spin-open,.mic-pill,.ghost,.talk-pill){
  min-height:42px;
  padding:7px 10px;
}
.top .level-chip{gap:6px}
.top .level-chip .lv-txt b{font-size:12px}
.top .level-chip .lv-txt small{font-size:10px;opacity:1}
.top .stars-pill{display:inline-flex;align-items:center;gap:4px}
.top .stars-pill b{font-size:15px}
.top #exitBoard{font-size:0;width:76px;padding-inline:8px}
.top #exitBoard::before{content:"← Back";font:700 12px var(--game-font)}
body.lesson .top .streak-pill{display:none!important}

/* JS owns is-teaching; view classes are an additional safety net. */
body:not(.is-teaching) :is(#micPill,#talkPill),
body:is(.view-road,.view-report,.view-badges) :is(#micPill,#talkPill){
  display:none!important;
}

/* ---------- Shared raised surfaces ---------- */

:is(.card,.topic,.ready,.how li,.brief,.class-card,.test-card,
    .rp-snapshot,.rp-step,.rp-grade-map,.rp-reward,.rp-watch,
    .rp-skill-panel,.wb-page,.wheel-card,.cel-card){
  --edge:var(--game-edge);
  border:1px solid var(--line);
  border-bottom:6px solid var(--edge);
  border-radius:var(--radius);
  background:#FFF;
  color:var(--text);
  box-shadow:var(--gloss),var(--shadow-card);
}
.card{padding:20px}
.tutor{gap:12px}
.tutor-head{column-gap:12px}
.tutor-head h2{font-size:21px}
.tutor-head p{font-size:14px;color:var(--text-2);line-height:1.5}
.picker{padding:0;overflow:visible}
.picker-inner{
  position:static;
  inset:auto;
  display:flex;
  flex-direction:column;
  gap:16px;
  padding:20px;
  overflow:visible;
}
.stage{
  aspect-ratio:4/3;
  border:2px solid #DFE8F5;
  border-radius:20px;
  background:linear-gradient(145deg,#EFF7FF,#FFF9ED);
  box-shadow:inset 0 2px 8px rgba(57,85,132,.06);
}
.demo-clip{background:#F4F7FC}
.grade-gate{
  gap:8px;
  padding:20px;
  background:rgba(255,255,255,.84);
  color:var(--marker);
  backdrop-filter:blur(5px);
  -webkit-backdrop-filter:blur(5px);
  font:700 22px/1.35 var(--game-font);
}
.grade-gate small{
  max-width:28ch;
  color:var(--text-2);
  font:400 14px/1.45 var(--game-font);
}
.actions{gap:12px}
.actions :is(.level,.upload){padding:13px;font-size:16px}
.actions .level small{font-size:12px;color:#FFF;opacity:1}
.actions .upload small{font-size:12px;color:var(--text-2)}
.lang{flex-wrap:wrap;gap:8px;color:var(--text-2);line-height:1.4}
.lang select{
  min-width:0;
  max-width:100%;
  min-height:44px;
  padding:8px 12px;
  border:1px solid var(--line);
  border-bottom:4px solid #CCD9EE;
  border-radius:12px;
  background:#FFF;
  color:var(--text);
}
.step h2{font-size:19px;gap:10px;margin-bottom:12px}
.num{
  width:32px;
  height:32px;
  background:linear-gradient(#F2F7FF,#DFEAFF);
  color:var(--game-blue);
  border:1px solid #C9DAF6;
  border-bottom:3px solid #AFC8F1;
  box-shadow:var(--gloss);
  font:700 16px var(--game-font);
}
.grades{gap:12px 14px}
.phase-group{max-width:100%;gap:7px}
.phase-row{flex-wrap:wrap;gap:7px}
.phase-label{font-size:11px;color:var(--text-2);letter-spacing:.04em}
.grade{width:46px;height:48px;font-size:18px}
.grade small{color:var(--text-2)}
.how{flex:0 0 auto;gap:12px}
.how li{padding:14px;gap:6px;border-radius:18px}
.how li:nth-child(1){--edge:#C8B8F4;background:linear-gradient(#FFF,#FAF7FF)}
.how li:nth-child(2){--edge:#AFCDF5;background:linear-gradient(#FFF,#F3F8FF)}
.how li:nth-child(3){--edge:#A8D7BE;background:linear-gradient(#FFF,#F2FBF6)}
.how li:nth-child(4){--edge:#F0CF7B;background:linear-gradient(#FFF,#FFF9E9)}
.how span{font-size:30px}
.how b{font:700 16px/1.3 var(--game-font)}
.how small{font-size:13px;color:var(--text-2);line-height:1.5}
.ready{
  --edge:#B5DCC6;
  padding:12px 14px;
  background:linear-gradient(110deg,#FFF,#F0FBF5);
}
.ready b{color:var(--marker-green)}
.topics{grid-template-columns:repeat(auto-fit,minmax(min(100%,190px),1fr));gap:12px}
.topic{--accent:#1F6FEB;--edge:#B9D1F6;--tint:#F0F6FF;border-radius:18px}
.topic:nth-child(4n+2){--accent:#7651D7;--edge:#D0BEF7;--tint:#F7F2FF}
.topic:nth-child(4n+3){--accent:#0C7447;--edge:#B3DCC7;--tint:#F0FBF5}
.topic:nth-child(4n+4){--accent:#AD5710;--edge:#F1CC96;--tint:#FFF7E9}
.topic-btn{min-height:58px;padding:12px;gap:10px;color:var(--text)}
.topic-btn .ico{
  display:grid;place-items:center;
  flex:0 0 38px;height:38px;
  border-radius:12px;background:var(--tint);font-size:24px;
}
.topic.open{border-color:var(--accent);border-bottom-color:var(--edge)}
.topic.this-term{border-color:#A8D7BE;border-bottom-color:#8FC5AB}
.subs{padding:0 12px 12px;gap:8px}
.term-note{color:var(--text-2);line-height:1.5}

/* ---------- Every button: rim, gloss, bottom edge ---------- */

:is(.ghost,.grade,.sub,.primary,.spin-open,.upload,.level,.demo-btn,
    .plan-btn,.help-btn,.cc-btn,.cc-link,.rp-primary,.rp-secondary,
    .rp-close,.mic-pill,.level-chip,.plan-item button,.plot-btn,
    .plot-submit,.x,.play-overlay button){
  --edge:var(--game-edge);
  min-height:44px;
  border:1px solid #CDDAED;
  border-bottom:5px solid var(--edge);
  border-radius:15px;
  background:linear-gradient(180deg,#FFF 0%,#FFF 45%,#F4F7FD 100%);
  color:var(--marker);
  box-shadow:var(--gloss),var(--shadow-sm);
  font-weight:700;
  transition:transform .18s var(--ease-game),
             box-shadow .18s ease,border-color .18s ease;
}
:is(.primary,.spin-open,.level,.rp-primary,.play-overlay button){
  --edge:var(--game-blue-edge);
  border-color:#1F6FEB;
  border-bottom-color:var(--edge);
  background:linear-gradient(180deg,#2C65D9,#1F6FEB);
  color:#FFF;
  box-shadow:inset 0 2px 0 rgba(255,255,255,.3),var(--shadow-sm);
}
.level{
  --edge:var(--game-green-edge);
  border-color:#168451;
  border-bottom-color:var(--edge);
  background:linear-gradient(180deg,#168451,#0C7447);
}
.primary.big{font:700 26px var(--game-font);padding:14px 38px;border-radius:20px}
.grade[aria-checked="true"],.sub[aria-pressed="true"]{
  --edge:#075A36;
  border-color:#0C7447;
  border-bottom-color:var(--edge);
  background:linear-gradient(#168451,#0C7447);
  color:#FFF;
}
.grade[aria-checked="true"] small{color:#FFF}
.cc-btn.primary{
  --edge:var(--game-blue-edge);
  border-color:var(--game-blue);
  border-bottom-color:var(--edge);
  background:linear-gradient(#2C65D9,#1F6FEB);
  color:#FFF;
}
.cc-link{
  padding:8px 12px;
  color:var(--game-blue);
  text-decoration:none;
  font-size:14px;
}
.help-btn{
  padding:11px 17px;
  min-height:48px;
  font:700 16px/1.3 var(--game-font);
}
.ask-btn{border-color:#AEC9F3;border-bottom-color:#7FA9E8;color:var(--game-blue)}
.ask-btn.raised{
  --edge:#D7AE46;
  background:linear-gradient(#FFF8DC,#FFE9A6);
  border-color:#E4C36B;border-bottom-color:var(--edge);
  color:var(--marker);
}
.ask-btn.open,.mic-pill.open{
  --edge:#8DC5A7;
  background:linear-gradient(#F4FFF8,#DFF5E8);
  border-color:#90CAA9;border-bottom-color:var(--edge);
  color:var(--marker-green);
  animation:none;
}
.mic-pill.closed{color:var(--text-2)}
.x{
  width:44px;height:44px;
  top:10px;right:10px;
  border-radius:50%;
  display:grid;place-items:center;
}
:is(.upload,.rp-primary):disabled{
  opacity:1;
  color:#536079;
  background:#EEF2F8;
  border-color:#D9E1ED;
  border-bottom-color:#C9D3E1;
  box-shadow:var(--gloss);
}
@media (hover:hover) and (pointer:fine){
  :is(.ghost,.grade,.sub,.primary,.spin-open,.upload,.level,.demo-btn,
      .plan-btn,.help-btn,.cc-btn,.cc-link,.rp-primary,.rp-secondary,
      .rp-close,.mic-pill,.level-chip,.plan-item button,.plot-btn,
      .plot-submit,.x,.play-overlay button):not(:disabled):not([aria-disabled="true"]):hover{
    transform:translateY(-3px);
    box-shadow:var(--gloss),var(--shadow-lift);
  }
  .topic-btn:hover{background:var(--tint)}
}
:is(.ghost,.grade,.sub,.primary,.spin-open,.upload,.level,.demo-btn,
    .plan-btn,.help-btn,.cc-btn,.cc-link,.rp-primary,.rp-secondary,
    .rp-close,.mic-pill,.level-chip,.plan-item button,.plot-btn,
    .plot-submit,.x,.play-overlay button):not(:disabled):not([aria-disabled="true"]):active{
  transform:translateY(2px);
  box-shadow:inset 0 2px 3px rgba(57,85,132,.08),0 2px 5px rgba(57,85,132,.06);
  transition-duration:60ms;
}

/* ---------- Pills and chips: light, legible, tactile ---------- */

:is(.pill,.lesson-chip,.talk-pill,.now-badge,.rc-tag,.rc-val,
    .rw-count,.rc-next,.rc-done,.gm-boss,.countdown){
  border:1px solid #D8E3F3;
  border-bottom:3px solid #C3D3EC;
  border-radius:999px;
  background:linear-gradient(#FFF,#F0F5FE);
  color:var(--marker);
  box-shadow:var(--gloss),0 3px 8px rgba(57,85,132,.06);
}
.lesson-chip{padding:8px 12px}
.stars-pill{
  border-color:#EFDAA1;border-bottom-color:#DFBD60;
  background:linear-gradient(#FFFDF1,#FFF1C7);
  color:var(--game-gold-ink);
}
.level-chip{background:linear-gradient(#FFF,#FFF8E4)}
.talk-pill{gap:3px;color:var(--marker-green)}
.talk-pill i{background:#16945C}
.now-badge{
  padding:3px 8px;
  background:#EEFAF2;border-color:#B6DDC7;
  border-bottom-color:#99CBAF;color:var(--marker-green);
}
.rc-tag{padding:3px 8px;letter-spacing:.015em;font-size:10px}
.rc-tag.gap{background:#FFF0F2;color:#A51E2C;border-color:#EEC0C8}
.rc-tag.class{background:#EDF4FF;color:#164FAE;border-color:#BED3F5}
.rc-tag.test{background:#FFF7DE;color:#795000;border-color:#EBD493}
.rc-tag.review{background:#EFFAF3;color:#0C7447;border-color:#B6DCC7}
.rc-val,.rc-val.rare,.rc-val.epic,.rc-val.boss{
  bottom:10px;right:12px;
  padding:4px 10px;
  font-size:12px;
  background:linear-gradient(#FFFBE9,#FFE6A0);
  color:var(--game-gold-ink);
  border-color:#EED18A;border-bottom-color:#D9B04F;
  animation:none;
}
.rc-val.rare{background:linear-gradient(#F5FAFF,#DDEBFF);color:#174EA6;border-color:#AFCBF5}
.rc-val.epic{background:linear-gradient(#FCF9FF,#EBDFFF);color:#6034B5;border-color:#CFB5F4}
.rc-val.boss{background:linear-gradient(#FFF8F4,#FFE1D9);color:#A83B38;border-color:#ECB4A3}
.rc-next{
  z-index:1;top:-13px;right:12px;
  padding:5px 10px;background:#EDF4FF;color:#174EA6;
  border-color:#B9CFF1;font-size:11px;
}
.rc-done{
  width:26px;height:26px;top:10px;right:10px;
  background:#E7F8EE;color:#0C7447;border-color:#A8D2BA;
}
.rw-count{padding:6px 10px;color:var(--game-blue);background:#FFF;opacity:1}
.gm-boss{
  padding:6px 12px;
  background:linear-gradient(#FFF7FF,#F0E4FF);
  color:#7132AD;border-color:#D5B7EC;
  font-size:12px;animation:none;
}
.countdown{
  position:static;
  width:max-content;max-width:100%;
  margin:0 0 14px auto;
  padding:4px 12px 4px 4px;
  background:#FFF8E8;color:#795000;border-color:#E8CA86;
  font-size:20px;
}
.countdown.done{background:#FFF0F2;color:var(--marker-red);border-color:#E9B3BD}
.countdown svg{width:34px;height:34px}

/* ---------- Content-sized classroom; 55% words / 45% visual ---------- */

body.lesson .layout{grid-template-columns:minmax(0,1fr)}
body.lesson .tutor{
  position:fixed;right:0;bottom:0;
  width:2px;height:2px;padding:0;border:0;
  opacity:0;overflow:hidden;pointer-events:none;box-shadow:none;
}
.board,body.lesson .board{
  display:block;
  height:auto;
  min-height:0;
  padding:24px 28px;
  border:8px solid #E9EEF7;
  border-bottom:10px solid #D3DEEF;
  border-image:none;
  border-radius:28px;
  background:var(--board);
  color:var(--marker);
  box-shadow:inset 0 2px 3px #FFF,var(--shadow-card);
}
.board-title,body.junior .board-title{
  margin:0 0 20px;
  color:var(--marker-blue);
  font:700 clamp(24px,2.4vw,32px)/1.3 var(--hand);
  text-decoration-thickness:2px;
  text-underline-offset:6px;
  overflow-wrap:anywhere;
}
.board-title:empty{display:none}
.board-body,body.lesson .board-body,
body.lesson .board-body:has(.plan-head),
body.lesson .board-body:has(.pp-q):not(.no-visual){
  display:grid;
  flex:none;
  grid-template-columns:minmax(0,11fr) minmax(0,9fr);
  align-items:start;
  align-content:start;
  gap:24px;
  min-height:0;
}
.board-body.no-visual,body.lesson .board-body.no-visual,
.board-body:has(> .board-visual:empty),
body.lesson .board-body:has(> .board-visual:empty){
  grid-template-columns:minmax(0,1fr);
}
.board-visual:empty{display:none}
.board-body:has(> .board-lines:empty),
body.lesson .board-body:has(> .board-lines:empty){
  grid-template-columns:minmax(0,1fr);
  justify-items:center;
}
.board-body:has(> .board-lines:empty):has(> .board-visual:empty){
  display:none;
}
.board-lines{gap:15px}
.board-body:has(.plan-head) :is(.board-lines,.board-visual){
  justify-content:flex-start;
  gap:12px;
}
.board-visual,
.board-body:has(> .board-lines:empty) .board-visual{
  width:100%;max-width:100%;margin:0;
}
.board-visual svg,body.lesson .board-visual svg,
body.lesson .board-body:has(.plan-head) .board-visual svg{
  display:block;
  width:100%;
  height:auto;
  max-height:380px;
  margin-inline:auto;
}
.board-visual text,body.junior .board-visual text{font-family:var(--hand)}
.bl,body.lesson .bl,body.junior .bl{
  font:400 clamp(22px,2.1vw,29px)/1.45 var(--hand);
  overflow-wrap:anywhere;
}
.bl.now::before{left:-16px;width:7px;height:7px;margin-top:-3px}
.bl .ink{max-width:100%;vertical-align:top;overflow-x:auto}
.bl.math .katex,.bl.answer .katex{font-size:1.12em}
body.lesson .bl.math .katex{white-space:normal}
.bl.answer,body.junior .bl.answer{font-weight:700}
.bl.answer .ink{border-width:2px;border-radius:13px;padding:4px 12px}
.bl.hint .ink,body.junior .bl.hint .ink{
  font-size:.88em;line-height:1.5;transform:none;
  background:#FFF4C2;border-radius:10px;padding:6px 10px;
}
.bl.rule .ink{
  padding:8px 12px;border:2px solid #E4C260;
  border-bottom:4px solid #D9B248;border-radius:13px;
  background:#FFF1AA;color:var(--marker);
  box-shadow:var(--gloss);transform:none;
}
.katex-display{max-width:100%;overflow-x:auto;overflow-y:hidden;padding-block:4px}
.board-tray{
  height:11px;margin:0 28px;padding:2px 22px;
  border:1px solid #D0DAEA;border-top:0;
  background:linear-gradient(#EFF3FA,#DDE6F3);
  border-radius:0 0 10px 10px;box-shadow:0 5px 9px rgba(57,85,132,.06);
}
.board-tray i{height:6px}
.help-bar{gap:10px;margin-top:20px;padding-top:16px;border-color:#DCE5F1}
.fill-table{
  border:2px solid #C6D7EF;border-bottom:5px solid #B1C8EA;
  border-radius:16px;font-size:22px;box-shadow:var(--shadow-sm);
}
.fill-table th{background:#ECF3FF;color:var(--marker-blue)}
.fill-table td{background:#FFF;border-color:#DFE8F5}
.fill-table tr:nth-child(even) td{background:#F5F8FE}
.work-photo{border-radius:16px;border-color:#DCE5F1;box-shadow:var(--shadow-sm);transform:none}

/* ---------- Questions and white answer tiles ---------- */

.quiz{gap:14px;margin-top:18px}
.quiz-q,body.junior .quiz-q{
  font:700 clamp(23px,2.3vw,31px)/1.4 var(--hand);
}
.quiz-q .katex{font-size:1.08em}
.quiz-choices{grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.choice{
  --choice:var(--marker-blue);
  display:flex;align-items:center;gap:12px;min-width:0;
  min-height:76px;padding:12px 15px;
  border:2px solid var(--choice);
  border-bottom:6px solid var(--choice);
  border-radius:19px;background:#FFF;color:var(--choice);
  box-shadow:var(--gloss),var(--shadow-sm);
  font:700 clamp(22px,2vw,28px)/1.35 var(--hand);
  overflow-wrap:anywhere;
  transition:transform .18s var(--ease-game),box-shadow .18s ease;
}
body.junior .choice{font:700 24px/1.4 var(--hand)}
.choice.c0{--choice:#1F6FEB;color:var(--choice)}
.choice.c1{--choice:#D62839;color:var(--choice)}
.choice.c2{--choice:#A65C00;color:var(--choice)}
.choice.c3{--choice:#7651B5;color:var(--choice)}
.choice .letter{
  flex:0 0 40px;width:40px;height:40px;
  border:2px solid rgba(255,255,255,.8);
  border-radius:50%;background:var(--choice);color:#FFF;
  box-shadow:inset 0 2px 0 rgba(255,255,255,.3),0 3px 0 rgba(57,85,132,.12);
  font:700 20px var(--game-font);
}
.choice.c2 .letter{background:#A65C00}
.choice.c3 .letter{background:#7651B5}
.choice .katex{font-size:1em;white-space:normal}
.choice.right{
  --choice:var(--marker-green);
  background:#FFF;color:var(--marker-green);
  box-shadow:0 0 0 4px #E2F5E9,var(--shadow-sm);
}
.choice.right .letter{background:var(--marker-green)}
.choice.right::after{content:"✓";margin-left:auto;font-size:24px}
.choice.wrong{
  background:#FFF;color:var(--marker-red);
  border-color:var(--marker-red);opacity:1;
}
.choice.wrong::after{content:"↺";margin-left:auto;font-size:24px}
.choice.picked{outline:3px solid #8CB7F8;outline-offset:3px}
.choice.not-sure{
  --choice:#7485A0;
  min-height:50px;font-size:18px;color:#495B77;
  border-style:dashed;border-bottom-style:solid;background:#FFF;
}
.choice:disabled{opacity:1}
.choice:active:not(:disabled){transform:translateY(2px);box-shadow:var(--gloss)}
.quiz-feedback,body.junior .quiz-feedback{
  min-height:0;font:700 22px/1.4 var(--hand);
}
.quiz-feedback:empty{display:none}
.board:has(#quiz:not([hidden])) .board-body{min-height:0;margin-bottom:16px}
.board:has(#quiz:not([hidden])) .board-visual{max-width:360px;justify-self:center}
.board:has(#quiz:not([hidden])) .board-visual svg,
body.lesson .board:has(#quiz:not([hidden])) .board-visual svg{
  height:auto;max-height:230px;
}
.plot-grid{max-width:440px}
.quiz-choices .plot-btn.on{
  background:#EDF4FF;color:var(--game-blue);border-color:var(--game-blue);
}
.quiz-choices .plot-submit:not([disabled]){
  background:linear-gradient(#168451,#0C7447);
  color:#FFF;border-color:#0C7447;border-bottom-color:#075A36;
}
@media (hover:hover) and (pointer:fine){
  .choice:not(:disabled):hover{transform:translateY(-3px);box-shadow:var(--shadow-lift)}
}

/* ---------- Road, report and badge views are game pages ---------- */

body:is(.view-road,.view-report,.view-badges) .board{
  background:#FFF;border-color:#EDF2FA;border-bottom-color:#D6E1F2;
}
body:is(.view-road,.view-report,.view-badges) .board-title{
  font-family:var(--game-font);text-decoration:none;font-weight:700;
}
body:is(.view-road,.view-report,.view-badges) .board .board-body{
  display:block;min-height:0;
}
body:is(.view-road,.view-report,.view-badges) #boardLines{
  width:100%;gap:16px;justify-content:flex-start;
}
body:is(.view-road,.view-report,.view-badges) .board-tray{display:none}
.board-body.road-board{display:block}
.rw-bar{
  grid-template-columns:auto minmax(100px,1fr) auto;
  gap:18px;padding:16px 18px;
  border:1px solid #EBDCB2;border-bottom:6px solid #E5C675;
  border-radius:21px;
  background:linear-gradient(110deg,#FFFDF5,#FFF 55%,#F3F8FF);
  color:var(--marker);box-shadow:var(--gloss),var(--shadow-card);
}
.rw-level{min-width:0}
.rw-level b{font-size:19px;line-height:1.3}
.rw-level small{font-size:13px;color:var(--text-2);opacity:1}
.lv-num{
  flex-shrink:0;width:30px;height:30px;
  border:2px solid #FFEBA8;border-bottom:4px solid #D7A13C;
  border-radius:50%;
  background:radial-gradient(circle at 32% 22%,#FFF9D7,#FFD45E 60%,#F4B93B);
  color:var(--game-gold-ink);
  box-shadow:inset 0 2px 0 #FFF9DE,0 3px 8px rgba(185,127,24,.15);
}
.lv-num.big{width:50px;height:50px;font-size:24px;animation:none}
.rw-xp{
  height:14px;border:1px solid #E6DABB;
  background:#F4EEDD;box-shadow:inset 0 2px 3px rgba(151,114,40,.08);
}
.rw-xp i{background:linear-gradient(90deg,#FFD45E,#F5A329)}
.rw-badges{gap:8px}
.rw-b{
  display:inline-grid;place-items:center;width:34px;height:34px;
  border-radius:50%;border:2px solid #F0D081;
  background:radial-gradient(circle at 30% 20%,#FFFCE9,#FFE292);
  box-shadow:var(--gloss),0 3px 0 #E0B65B;filter:none;font-size:21px;
}
.rw-none{opacity:1;color:var(--text-2)}
.road-head{margin:20px 0 14px;gap:8px 14px}
.road-head b{font-size:23px}
.road-head span{color:var(--text-2);font-size:14px}
.road{
  grid-template-columns:repeat(auto-fit,minmax(min(100%,230px),1fr));
  gap:20px 14px;
}
.road-card{
  --edge:#BCD3F4;
  align-items:flex-start;gap:12px;
  min-width:0;min-height:132px;
  padding:18px 14px 45px;
  border:1px solid #D8E4F5;border-bottom:6px solid var(--edge);
  border-radius:21px;background:#FFF;
  box-shadow:var(--gloss),var(--shadow-sm);
}
.road-card:nth-child(4n+2){--edge:#CEBCF3}
.road-card:nth-child(4n+3){--edge:#A9D8BF}
.road-card:nth-child(4n+4){--edge:#EDCF95}
.pi-thumb{
  width:52px;height:52px;border-radius:15px;
  box-shadow:inset 0 2px 0 rgba(255,255,255,.5),0 4px 0 rgba(57,85,132,.12);
}
.rc-txt{min-width:0;padding-right:12px;gap:5px}
.rc-txt b{
  display:block;-webkit-line-clamp:unset;
  overflow:visible;font-size:17px;line-height:1.3;
  overflow-wrap:anywhere;
}
.rc-txt small{
  white-space:normal;overflow:visible;text-overflow:clip;
  font-size:12px;line-height:1.4;color:var(--text-2);
}
.road-card.next{
  --edge:#1F6FEB;
  border-color:#7FABED;border-bottom-color:var(--edge);
  background:linear-gradient(#FFF,#F5F9FF);
  animation:mm-next 3.4s ease-in-out infinite;
}
.road-card.doing{border-color:#86B0EC;border-bottom-color:#4B87DD;background:#F8FBFF}
.road-card.done{--edge:#98CDAE;border-color:#B5DCC5;border-bottom-color:var(--edge);background:#FAFFFC}
.road-card.locked{
  border-color:#D6DFED;border-bottom-color:#BCCADC;
  border-style:dashed;border-bottom-style:solid;background:#F8FAFE;
}
.road-card.locked .pi-thumb{filter:grayscale(.75);opacity:.8}
.road-card.locked .rc-txt b{color:#435570}
.road-card.boss,.road-card.tier-boss{
  --edge:#EDB4A4;
  border-color:#F0C7BD;border-bottom-color:var(--edge);
  background:linear-gradient(#FFF,#FFF7F4);
}
.road-card.tier-rare{--edge:#A6C6F4;border-bottom-color:var(--edge)}
.road-card.tier-epic{
  --edge:#C9B1EF;border-bottom-color:var(--edge);
  background:linear-gradient(#FFF,#FAF7FF);
}
.road-card.boss .pi-thumb,
.road-card.tier-epic:not(.locked) .pi-thumb,
.road-card.tier-boss:not(.locked) .pi-thumb{
  animation:none;box-shadow:var(--gloss),0 4px 0 rgba(118,81,215,.18);
}
.road-foot{gap:18px;margin-top:20px}
.road-foot .plan-side{gap:14px}
.road-btns{gap:10px}
.class-card,.test-card{padding:16px;border-radius:20px;gap:12px}
.class-card{--edge:#B6CFF2}
.test-card{--edge:#EBCB7C;background:linear-gradient(#FFF,#FFFBF0)}
.cc-txt b{font-size:18px;line-height:1.35;overflow-wrap:anywhere}
.cc-txt small,.cc-note{color:var(--text-2)}
.cc-ask .cc-btn{min-height:44px;padding:9px 13px}
.plan-side{gap:14px}
.plan-item button{padding:14px;min-height:72px}
.plan-item.done button{opacity:1}
.brief{padding:16px;gap:10px}
.brief-row{color:var(--marker)}
.brief .topics i{
  padding:5px 9px;border-width:1px;border-bottom-width:3px;
  border-radius:11px;white-space:normal;
}
@media (hover:hover) and (pointer:fine){
  .road-card:not(.locked):hover{
    animation:none;transform:translateY(-4px);
    box-shadow:var(--shadow-lift);
  }
  .road-card:hover .pi-thumb{animation:none}
}
.road-card:not(.locked):active{
  animation:none;transform:translateY(2px);box-shadow:var(--gloss);
}

/* ---------- Report: raised next-win dashboard ---------- */

.rp-report{background:transparent;font-family:var(--game-font)}
.rp-layout{grid-template-columns:minmax(0,1fr) 242px;gap:16px;align-items:start}
.rp-main,.rp-side{gap:14px}
.rp-snapshot{--edge:#BDD0ED;padding:17px;gap:16px;border-radius:21px}
.rp-score-number{font-size:56px;color:var(--marker-blue)}
.rp-small,.rp-step-meta,.rp-tower-note{color:var(--text-2)}
.rp-strength-list li{font-size:16px;line-height:1.4}
.rp-quest>h2{font-size:21px;margin-bottom:12px}
.rp-road{gap:12px}
.rp-step{--edge:#CCD9EE;padding:13px;border-radius:18px;gap:8px}
.rp-step-now{
  --edge:#75A5EC;
  border-color:#8EB4EE;border-bottom-color:var(--edge);
  background:linear-gradient(#FFF,#F2F7FF);
}
.rp-step-tag b{box-shadow:var(--gloss),0 2px 0 #D1DEEF}
.rp-step-name{font-size:17px;line-height:1.35}
.rp-step-pay{
  align-self:flex-start;margin-top:3px;padding:4px 8px;
  border:1px solid #E9CE83;border-bottom:3px solid #DDBB63;
  border-radius:10px;background:#FFF5D8;color:var(--game-gold-ink);
}
.rp-watch{
  --edge:#E9BDC5;
  padding:12px 14px;border-left:4px solid var(--marker-red);
  border-radius:17px;background:#FFF5F6;
}
.rp-watch ul{gap:6px;line-height:1.45}
.rp-grade-map{--edge:#C4D4EC;flex:0 0 auto;padding:16px;border-radius:21px}
.rp-floors{flex:0 0 auto;min-height:0;padding:10px 0;gap:7px}
.rp-floor{width:100%;grid-template-columns:54px minmax(0,1fr)}
.rp-floor-bar{width:100%;border-radius:7px;border-color:#C5D3E5}
.rp-legend{gap:7px;line-height:1.4}
.rp-reward{
  --edge:#E2C271;
  padding:15px;border-color:#EFDEB2;border-bottom-color:var(--edge);
  background:linear-gradient(#FFFDF6,#FFF7E0);border-radius:20px;
}
.rp-reward-head,.rp-level-note{color:var(--game-gold-ink)}
.rp-meter{height:12px;border-color:#E2D3A8;background:#FFF}
.rp-meter>span{background:linear-gradient(90deg,#FFD45E,#F5A329)}
.rp-actions{
  grid-template-columns:minmax(0,1fr) auto auto;
  gap:12px;margin-top:18px;padding-top:16px;border-color:#E2EAF5;
}
.rp-primary{padding:13px 18px;font-size:20px;border-radius:17px}
.rp-secondary,.rp-close{padding:11px 14px}
.rp-details>summary{
  min-height:46px;padding:10px 12px;
  border:1px solid #DAE5F4;border-bottom:4px solid #C7D8EF;
  border-radius:14px;background:#FFF;text-decoration:none;
  box-shadow:var(--gloss),var(--shadow-sm);
}
.rp-details[open]{grid-column:1/-1}
.rp-skill-panel{
  position:static;width:100%;max-height:min(420px,60vh);
  margin-top:12px;padding:16px;background:#FFF;
}
.rp-skill-body{min-width:0}
.rp-skill{padding-block:12px}
.rp-class-note{
  padding:13px;border:1px solid #C9DDF7;
  border-bottom:4px solid #B4CDF0;border-radius:15px;background:#F3F8FF;
}

/* ---------- Badge collection and gold medallions ---------- */

.badge-grid{
  grid-template-columns:repeat(auto-fit,minmax(min(100%,150px),1fr));
  gap:16px;margin-top:20px;
}
.badge-card{
  position:relative;gap:9px;padding:18px 12px;
  border:1px dashed #C8D4E5;border-bottom:5px solid #BDCCE0;
  border-radius:22px;background:#F7F9FD;color:var(--marker);
  opacity:1;filter:none;box-shadow:var(--gloss),var(--shadow-sm);
}
.badge-card .bc-ico{
  position:relative;display:grid;place-items:center;
  width:68px;height:68px;margin-bottom:3px;
  border:3px solid #D4DEED;border-bottom:5px solid #BBCADD;
  border-radius:50%;background:linear-gradient(#FFF,#E9EFF8);
  font-size:34px;filter:grayscale(1);
}
.badge-card:not(.got) .bc-ico::after{
  content:"🔒";position:absolute;right:-6px;bottom:-4px;
  display:grid;place-items:center;width:25px;height:25px;
  border:1px solid #C8D4E5;border-radius:50%;background:#FFF;font-size:13px;
}
.badge-card b{font-size:15px;line-height:1.4;color:var(--marker)}
.badge-card small{font-size:12px;line-height:1.5;color:var(--text-2)}
.badge-card.got{
  border:1px solid #ECD18A;border-bottom:6px solid #DEBA5B;
  background:linear-gradient(#FFF,#FFFCF1);
  box-shadow:var(--gloss),0 10px 24px rgba(185,127,24,.12);
}
.badge-card.got .bc-ico,.gm-flip{
  border:4px solid #FFEBA5;border-bottom:6px solid #D49A27;
  background:radial-gradient(circle at 32% 20%,#FFFCE4,#FFD45E 60%,#F3B83B);
  box-shadow:inset 0 2px 0 #FFFDEB,inset 0 0 0 3px rgba(255,255,255,.4),
             0 6px 12px rgba(185,127,24,.17);
  filter:none;
}
.badge-card.got .bc-ico::before{
  content:"";position:absolute;inset:5px 8px 50%;
  border-radius:50%;background:linear-gradient(rgba(255,255,255,.6),transparent);
  pointer-events:none;
}

/* ---------- White / frosted overlays only ---------- */

.overlay,.play-overlay,.celebrate,
.gm,.gm-mission,.gm-complete,.gm-level,.gm-badge{
  background:rgba(250,252,255,.9);
  backdrop-filter:blur(9px);
  -webkit-backdrop-filter:blur(9px);
}
.gm,.celebrate{
  isolation:isolate;
  display:flex;flex-direction:column;align-items:center;
  justify-content:flex-start;
  padding:28px 18px;
  overflow-y:auto;overflow-x:hidden;
  overscroll-behavior:contain;
}
.gm{cursor:default}
.gm-m-card,.gm-c-card,.gm-l-card,.gm-b-card,.cel-card{
  --edge:#BDD1F1;
  position:relative;flex:0 0 auto;
  width:min(480px,100%);max-width:100%;
  margin-block:auto;padding:28px;
  display:flex;flex-direction:column;align-items:center;gap:14px;
  border:2px solid #D7E4F7;border-bottom:8px solid var(--edge);
  border-radius:30px;background:#FFF;color:var(--marker);
  box-shadow:var(--gloss),var(--shadow-modal);
  font-family:var(--game-font);text-align:center;
  animation:mm-arrive .45s var(--ease-game) both;
}
.gm-m-card::before,.gm-c-card::before,
.gm-l-card::before,.gm-b-card::before{
  content:"";width:76px;height:6px;flex-shrink:0;border-radius:99px;
  background:linear-gradient(90deg,#64B5FF,#A58AF3,#FFD45E);
}
.gm-c-card{--edge:#A6D5BC;border-color:#C8E5D5;border-bottom-color:var(--edge)}
.gm-l-card{--edge:#D4B5EF;border-color:#E4D3F5;border-bottom-color:var(--edge)}
.gm-b-card{--edge:#E4C26B;border-color:#EFDFAB;border-bottom-color:var(--edge)}
.gm-m-card b,.gm-c-card b,.gm-l-card b,.gm-b-card b{
  max-width:100%;font-size:clamp(24px,4vw,31px);
  line-height:1.3;overflow-wrap:anywhere;
}
.gm-m-card small,.gm-c-card small,.gm-l-card small,.gm-b-card small{
  color:var(--text-2);opacity:1;font-size:16px;line-height:1.5;
}
.gm-tag{
  padding:5px 10px;border:1px solid #EDD9A2;border-bottom:3px solid #DFC27B;
  border-radius:999px;background:#FFF7DF;color:var(--game-gold-ink);
  font:700 12px/1.3 var(--game-font);letter-spacing:.07em;
}
.gm-prize{font:700 25px/1.4 var(--game-font);color:var(--marker)}
.gm-prize span{color:var(--game-gold-ink)}
.gm-prize em{color:#A2580A;font-size:16px}
.gm-stars{gap:10px}
.gm-star{font-size:54px;color:#DDE5F0;transform:none}
.gm-star.on{
  color:#F2B928;
  text-shadow:0 2px 0 #C48813,0 5px 14px rgba(220,164,38,.2);
}
.gm .primary{align-self:stretch;margin-top:8px;font:700 19px var(--game-font)}
.gm-cv{z-index:-1;opacity:.7}
.gm-rays{
  z-index:-1;opacity:.65;
  background:repeating-conic-gradient(
    from 0deg,rgba(245,190,61,.12) 0 8deg,transparent 8deg 22deg);
  animation:gm-spin 48s linear infinite;
  mask-image:radial-gradient(circle,#000 0,transparent 58%);
  -webkit-mask-image:radial-gradient(circle,#000 0,transparent 58%);
}
.gm-num{
  display:grid;place-items:center;
  width:132px;height:132px;
  border:5px solid #FFECA5;border-bottom:8px solid #D49A27;
  border-radius:50%;
  background:radial-gradient(circle at 32% 20%,#FFFCE2,#FFD45E 60%,#F3B83B);
  background-clip:border-box;-webkit-background-clip:border-box;
  color:#795000;-webkit-text-fill-color:currentColor;
  font:700 82px/1 var(--game-font);filter:none;
  box-shadow:inset 0 2px 0 #FFFDEB,inset 0 0 0 4px rgba(255,255,255,.45),
             0 10px 22px rgba(185,127,24,.17);
  animation:mm-arrive .6s var(--ease-game) both;
}
.gm-num::after{
  inset:9px 12px 54%;border-radius:50%;
  background:linear-gradient(rgba(255,255,255,.7),transparent);
  mix-blend-mode:normal;animation:none;pointer-events:none;
}
.gm-flip{width:120px;height:120px;font-size:62px;animation:mm-arrive .6s var(--ease-game) both}
.paper{
  max-width:100%;border:2px solid #DDE7F4;border-bottom:7px solid #C7D7EE;
  border-radius:24px;box-shadow:var(--shadow-modal);
}
.paper-actions{flex-wrap:wrap}
.wheel-card{padding:28px 22px}
.wheel{width:min(320px,100%)}
.wheel svg{box-shadow:0 8px 24px rgba(57,85,132,.14)}
.pointer{filter:drop-shadow(0 3px 2px rgba(57,85,132,.14))}
.play-overlay button{max-width:100%;text-align:center;box-shadow:var(--shadow-modal)}
.toast{
  width:max-content;max-width:calc(100% - 32px);
  padding:12px 18px;border:1px solid #D7E3F3;border-bottom:4px solid #BDCFEB;
  border-radius:18px;background:#FFF;color:var(--marker);
  box-shadow:var(--shadow-card);font-size:14px;text-align:center;
}
.credit-pop{
  max-width:calc(100% - 24px);
  border:2px solid #F4DA8F;border-bottom:5px solid #D8A54A;
  background:linear-gradient(#FFF6D5,#FFD975);color:#795000;
  box-shadow:var(--shadow-sm);text-align:center;
}
.gm-xp{color:#946000;text-shadow:0 2px 0 #FFF6D8,0 5px 14px rgba(185,127,24,.15)}

/* ---------- Exam / workbook content without giant voids ---------- */

body.lesson .board-body:has(.pp-q){
  justify-content:flex-start;
}
body.lesson .board-body:has(.pp-q) .board-lines{gap:18px}
body.lesson .pp-context{font-size:clamp(20px,2vw,25px);line-height:1.5}
body.lesson .pp-text,body.lesson .board-body.no-visual .pp-text{
  font-size:clamp(24px,2.6vw,34px);line-height:1.5;
}
body.lesson .board-body:has(.pp-q):not(.no-visual) .pp-context{font-size:20px}
body.lesson .board-body:has(.pp-q):not(.no-visual) .pp-text{font-size:26px}
.pp-fig,body.lesson .board-body:has(.pp-q):not(.no-visual) .pp-fig{
  max-height:420px;border-radius:16px;border-color:#DCE5F1;
}
.wb-pages{flex-wrap:wrap;gap:16px}
.wb-page{flex:1 1 240px;min-width:0;max-width:460px;border-radius:18px}
.wb-page img{max-height:70vh}
.wb-page figcaption{padding:10px 12px;background:#F5F8FD}
.pp-credit,.pp-fig-cap{color:var(--text-2)}

/* ---------- Motion: one obvious next action, not a moving page ---------- */

@keyframes mm-next{
  0%,100%{box-shadow:var(--gloss),var(--shadow-sm)}
  50%{box-shadow:var(--gloss),0 0 0 5px rgba(31,111,235,.08),
                0 12px 24px rgba(57,85,132,.1)}
}
@keyframes mm-arrive{
  from{opacity:0;transform:translateY(10px) scale(.96)}
  to{opacity:1;transform:none}
}
.stage.nudge,.plan-btn.pulse{animation:mm-next 3s ease-in-out 2}

/* ---------- Responsive header; never wraps ---------- */

@media (max-width:1250px){
  .top{gap:7px;padding-inline:10px}
  .top .talk-pill{display:none!important}
  .top .lesson-chip{flex-basis:150px;max-width:190px}
  .top :is(.pill,.plan-btn,.spin-open,.mic-pill,.ghost){padding-inline:8px}
  .brand-name{font-size:24px}
}
@media (max-width:1050px){
  .top .mic-pill{display:none!important}
  .top .level-chip .lv-txt{display:none}
  .top .lesson-chip{flex:1 1 110px;max-width:none}
  .top .spin-open{font-size:0;width:44px;padding:4px}
  .top .spin-open::before{content:"🎡";font-size:20px}
  .rp-layout{grid-template-columns:minmax(0,1fr) 220px}
  .rp-snapshot{grid-template-columns:125px minmax(0,1fr)}
  .rp-score-number{font-size:48px}
}
@media (max-width:900px){
  .layout{grid-template-columns:minmax(0,1fr)}
  .tutor-head{grid-template-columns:1fr auto}
  .actions{grid-template-columns:1fr 1fr}
  .rp-layout{grid-template-columns:minmax(0,1fr)}
  .rp-side{display:grid;grid-template-columns:1fr 1fr;align-items:start}
  .rp-grade-map{min-height:0}
}
@media (max-width:720px){
  .app,body.lesson .app{padding:12px 10px 24px}
  .top{min-height:60px;gap:6px;margin-bottom:14px;border-radius:18px}
  .top .lesson-chip,.top .spin-open,.top .streak-pill{display:none!important}
  .powered{display:none}
  .brand-name{font-size:20px}
  .top .score{margin-left:auto!important}
  .top .level-chip{padding:4px;width:42px;justify-content:center}
  .top .lv-num{width:28px;height:28px;font-size:14px}
  .top .plan-btn{font-size:0;width:44px;padding:4px}
  .top .plan-btn::before{content:"📋";font-size:19px}
  .top #exitBoard{width:44px;padding:4px}
  .top #exitBoard::before{content:"←";font-size:23px}
  .rp-actions{grid-template-columns:minmax(0,1fr) auto}
  .rp-primary{grid-column:1/-1}
}
@media (max-width:680px){
  .board,body.lesson .board{padding:18px;border-width:6px;border-bottom-width:8px;border-radius:23px}
  .board-body,body.lesson .board-body,
  body.lesson .board-body:has(.plan-head),
  body.lesson .board-body:has(.pp-q):not(.no-visual){
    grid-template-columns:minmax(0,1fr);gap:20px;
  }
  .board-visual{max-width:440px;justify-self:center}
  .board-visual svg,body.lesson .board-visual svg{max-height:320px}
  .board-title,body.junior .board-title{font-size:25px;margin-bottom:16px}
  .bl,body.lesson .bl,body.junior .bl{font-size:23px}
  .rw-bar{grid-template-columns:minmax(0,1fr) auto;gap:12px;padding:14px}
  .rw-xp{grid-column:1/-1;grid-row:2}
  .rw-badges{justify-content:flex-end}
  .rw-b{width:29px;height:29px;font-size:18px}
  .rw-level b{font-size:17px}
  .rw-level small{font-size:12px}
  .road{grid-template-columns:minmax(0,1fr)}
  .road-card{min-height:122px}
  .brief-row{grid-template-columns:minmax(0,1fr);gap:3px}
  .help-btn{flex:1 1 calc(50% - 10px);font-size:15px;padding:10px}
}
@media (max-width:520px){
  .top{padding:7px;gap:4px;flex-wrap:wrap}
  .top .score{gap:4px}
  .top .stars-pill{padding:6px;font-size:12px}
  .top .stars-pill b{font-size:14px}
  .top :is(button,.pill){min-height:44px}
  .brand-name{font-size:16px}
  .card{padding:16px;border-radius:21px}
  .picker{padding:0}
  .picker-inner{padding:16px}
  .tutor-head{grid-template-columns:minmax(0,1fr);gap:10px}
  .demo-btn{grid-column:1;grid-row:auto;justify-self:start;white-space:normal}
  .actions{grid-template-columns:minmax(0,1fr)}
  .how{grid-template-columns:minmax(0,1fr)}
  .how li{display:grid;grid-template-columns:38px minmax(0,1fr);gap:4px 10px}
  .how span{grid-column:1;grid-row:1/3}
  .how b,.how small{grid-column:2}
  .board,body.lesson .board{padding:14px}
  .board-title,body.junior .board-title{font-size:23px}
  .quiz-choices{grid-template-columns:minmax(0,1fr);gap:12px}
  .choice,body.junior .choice{font-size:23px;min-height:68px;padding:10px 12px}
  .quiz-q,body.junior .quiz-q{font-size:23px}
  .quiz-feedback,body.junior .quiz-feedback{font-size:20px}
  .rp-snapshot{grid-template-columns:100px minmax(0,1fr);padding:13px;gap:12px}
  .rp-score-box{padding-right:10px}
  .rp-score-number{font-size:42px}
  .rp-strength-list li{font-size:14px}
  .rp-road{grid-auto-flow:row;grid-template-columns:minmax(0,1fr)}
  .rp-side{grid-template-columns:minmax(0,1fr)}
  .rp-step{display:grid;grid-template-columns:52px minmax(0,1fr)}
  .rp-actions{display:flex;flex-direction:column;align-items:stretch}
  .rp-skill-list{grid-template-columns:minmax(0,1fr)}
  .badge-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,126px),1fr));gap:12px}
  .badge-card{padding:14px 9px;border-radius:18px}
  .badge-card .bc-ico{width:60px;height:60px;font-size:30px}
  .badge-card b{font-size:14px}
  .gm,.celebrate{padding:18px 12px}
  .gm-m-card,.gm-c-card,.gm-l-card,.gm-b-card,.cel-card{padding:23px 18px;border-radius:25px}
  .gm-star{font-size:45px}
  .paper{padding:22px 18px}
  .paper-actions>*{flex:1 1 auto}
  .play-overlay button{padding:22px;font-size:23px}
}
@media (max-width:380px){
  .app,body.lesson .app{padding-inline:8px}
  .brand-name{font-size:12px;letter-spacing:-.04em}
  .top .level-chip{width:40px}
  .top .plan-btn,.top #exitBoard{width:40px}
  .top .stars-pill{padding-inline:4px}
  .rw-bar{grid-template-columns:minmax(0,1fr)}
  .rw-badges{justify-content:flex-start}
  .rw-xp{grid-row:auto}
  .rp-snapshot{grid-template-columns:minmax(0,1fr)}
  .rp-score-box{padding:0 0 10px;border-right:0;border-bottom:1px solid #E1E8F2}
  .rp-score{display:inline-flex;margin-right:8px}
}

/* No animation may leave an instructional element invisible. */
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{
    animation:none!important;
    transition:none!important;
    scroll-behavior:auto!important;
  }
  .bl.on .ink{clip-path:none}
  .board-visual .draw{stroke-dashoffset:0}
  .board-visual .pop{opacity:1}
  .gm-star{transform:none}
  .gm-rays{display:none}
  .confetti,.gm-coin,.gm-xp,.credit-pop{display:none!important}
}
@media print{
  body.print-hw{background:#FFF}
  body.print-hw #homework{background:#FFF;backdrop-filter:none}
  body.print-hw .paper{border:0;box-shadow:none;max-height:none}
  .gm,.celebrate,.play-overlay,.toast,.confetti{display:none!important}
}

/* balanced road rows (no lonely last card) - after the theme so it wins */
.road{grid-template-columns:repeat(var(--cols,3),minmax(0,1fr))!important}
@media (max-width:900px){.road{grid-template-columns:repeat(2,minmax(0,1fr))!important}}
@media (max-width:640px){.road{grid-template-columns:1fr!important}}
