@font-face{font-family:"Inter";font-style:normal;font-weight:400 700;font-display:swap;src:url(fonts/inter-latin.woff2) format("woff2")}
@font-face{font-family:"Cabin Sketch";font-style:normal;font-weight:700;font-display:swap;src:url(fonts/cabinsketch-700.woff2) format("woff2")}
:root{
  /* chalkboard palette */
  --board:#22322b; --board-d:#18241f; --board-l:#2b3e36;
  --chalk:#f3efe2; --chalk-2:rgba(243,239,226,.78); --chalk-3:rgba(243,239,226,.56); --chalk-line:rgba(243,239,226,.2); --chalk-edge:rgba(243,239,226,.42);
  --field:rgba(8,16,12,.3); --well:rgba(0,0,0,.16);
  --yellow:#f1d67e; --mint:#9fd8b9; --rose:#eea8a8;
  --wood:#8a5a33; --frame:6px;
  --bg:var(--board); --panel:transparent; --ink:var(--chalk); --muted:var(--chalk-2); --line:var(--chalk-line); --head:var(--board-d);
  --ui:var(--yellow); --ui-ink:#1d2a24; --focus:var(--yellow); --ok:var(--mint); --warn:var(--yellow); --bad:var(--rose);
  --accent:#1f4e79; --r:10px;
  --display:"Cabin Sketch","Chalkboard SE",Georgia,serif;
  --chalkglow:0 0 1px rgba(255,255,255,.45),0 0 6px rgba(255,255,255,.1);
  font-family:"Inter",system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%;overflow:hidden;background:var(--bg);color:var(--ink)}
body{height:100dvh;display:flex;flex-direction:column;font-size:14px;padding:var(--frame);position:relative;
  background-color:var(--board);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse 55% 38% at 18% 28%,rgba(243,239,226,.05),transparent 70%),
    radial-gradient(ellipse 45% 32% at 78% 72%,rgba(243,239,226,.04),transparent 70%),
    linear-gradient(115deg,transparent 30%,rgba(243,239,226,.025) 38%,transparent 46%,transparent 58%,rgba(243,239,226,.02) 66%,transparent 74%),
    radial-gradient(ellipse 120% 95% at 50% 45%,transparent 55%,rgba(0,0,0,.38));
  -webkit-font-smoothing:antialiased}
/* thin wooden frame */
body::after{content:"";position:fixed;inset:0;pointer-events:none;z-index:40;border:var(--frame) solid var(--wood);
  border-image:repeating-linear-gradient(92deg,#7a4c29 0 7px,#94603a 7px 15px,#83532f 15px 19px,#a06a40 19px 30px,#7d4e2b 30px 36px) 6;
  box-shadow:inset 0 0 0 1px rgba(0,0,0,.4),inset 0 0 26px 4px rgba(0,0,0,.35)}
button,input,select,textarea{font:inherit;color:inherit}
.sr-only{position:absolute!important;left:0;top:0;width:1px!important;height:1px!important;min-width:0!important;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;padding:0;margin:-1px}
:focus-visible{outline:2px solid var(--focus);outline-offset:2px}
::selection{background:rgba(241,214,126,.35)}

/* header */
.top{flex:0 0 auto;display:flex;align-items:center;gap:12px;padding:8px 14px;background:transparent;color:var(--chalk);min-height:54px;border-bottom:1px solid var(--chalk-line)}
.brand{display:flex;align-items:center;gap:10px;min-width:0}
.brand h1{font-family:var(--display);font-size:23px;margin:0;font-weight:700;letter-spacing:.4px;white-space:nowrap;color:var(--chalk);text-shadow:var(--chalkglow)}
.actions{margin-left:auto;display:flex;gap:6px}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;border:1.5px solid var(--chalk-edge);background:transparent;color:var(--chalk);border-radius:8px;padding:6px 11px;cursor:pointer;line-height:1.1;white-space:nowrap;font-weight:600;transition:background .15s,border-color .15s}
.btn:hover{border-color:var(--chalk);background:rgba(243,239,226,.08)}
.btn svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.top .btn{background:rgba(243,239,226,.04);border-color:var(--chalk-edge);color:var(--chalk)}
.top .btn:hover{background:rgba(243,239,226,.1)}
.top .btn.primary,.btn.primary{background:var(--yellow);border-color:var(--yellow);color:var(--ui-ink)}
.top .btn.primary:hover,.btn.primary:hover{filter:brightness(1.06);background:var(--yellow)}
.btn.small{padding:5px 9px;font-size:13px}
.btn.ghost{background:transparent}
.btn.danger{color:var(--rose);border-color:rgba(238,168,168,.5)}
.btn.danger:hover{border-color:var(--rose);background:rgba(238,168,168,.1)}
.btn[disabled]{opacity:.45;cursor:not-allowed}
.count{display:inline-block;min-width:18px;padding:1px 5px;border-radius:9px;background:rgba(159,216,185,.22);color:var(--mint);font-size:11px;font-weight:700;text-align:center}
.top .btn .count{background:rgba(243,239,226,.16);color:var(--chalk)}
[hidden]{display:none!important}
.f{display:flex;flex-direction:column;gap:4px;font-size:12px;font-weight:600;color:var(--chalk-2);min-width:0;letter-spacing:.15px}
.f input,.f select,select{border:1.5px solid var(--chalk-edge);border-radius:7px;padding:7px 9px;background:var(--field);color:var(--chalk);font-size:14px;font-weight:500;min-width:0;color-scheme:dark}
.f select{width:100%}
select:focus,input:focus{border-color:var(--yellow);outline:0;box-shadow:0 0 0 3px rgba(241,214,126,.28)}
select option{background:var(--board-d);color:var(--chalk)}
.hint{font-size:12px;color:var(--chalk-3);margin:0 0 8px;line-height:1.45}
.chk{display:flex;align-items:center;gap:8px;padding:5px 0;cursor:pointer}
.chk input{width:17px;height:17px;accent-color:var(--mint);flex:0 0 auto}

/* ===== header ===== */
.brand img{flex:0 0 auto}
.modes{display:flex;gap:2px;margin-left:18px;min-width:0}
.modes button{border:0;background:transparent;color:var(--chalk-2);font-weight:600;padding:7px 11px;border-radius:8px;cursor:pointer;position:relative;white-space:nowrap}
.modes button:hover{color:var(--chalk);background:rgba(243,239,226,.06)}
.modes button[aria-current=page]{color:var(--chalk)}
.modes button[aria-current=page]::after{content:"";position:absolute;left:10px;right:10px;bottom:1px;height:3px;border-radius:3px;background:var(--yellow);opacity:.85;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 3' preserveAspectRatio='none'%3E%3Cpath d='M0 1.6 Q10 .4 20 1.5 T40 1.2 V3 H0Z'/%3E%3C/svg%3E") 0 0/100% 100%}
.tools{margin-left:auto;display:flex;gap:6px}
.btn.icon{padding:6px 8px}
#btnSound[aria-pressed=true] .mute,#btnSound[aria-pressed=false] .wave{display:none}

/* ===== layout ===== */
.app{flex:1 1 auto;min-height:0;display:grid;grid-template-columns:minmax(0,1fr) minmax(360px,470px);gap:18px;padding:12px 20px 14px}
.clock-col{min-width:0;min-height:0;display:flex;flex-direction:column;align-items:center;gap:8px}
.clock-holder{position:relative;flex:1 1 auto;min-height:0;width:100%}
#clock{position:absolute;inset:0;width:100%;height:100%;overflow:visible;touch-action:none;user-select:none;-webkit-user-select:none}
.clock-opts{display:flex;gap:6px;flex:0 0 auto}
.chip{border:1.5px solid var(--chalk-line);background:transparent;color:var(--chalk-2);border-radius:999px;padding:4px 11px;font-size:12.5px;font-weight:600;cursor:pointer;white-space:nowrap}
.chip:hover{border-color:var(--chalk-edge);color:var(--chalk)}
.chip[aria-pressed=true],.chip[aria-checked=true]{border-color:var(--mint);color:var(--board-d);background:var(--mint)}
.panel{min-width:0;min-height:0;display:flex;flex-direction:column;background:rgba(0,0,0,.13);border:1px solid var(--chalk-line);border-radius:14px;padding:16px 18px;overflow:auto;outline:0}
.view{display:flex;flex-direction:column;gap:12px;min-height:0;flex:1 1 auto}
#vExplore,#vQuizStart{justify-content:center}

/* ===== clock svg ===== */
#face .rim{fill:none;stroke:var(--chalk);stroke-width:2.6;stroke-linecap:round;opacity:.95}
#face .rim2{fill:none;stroke:var(--chalk);stroke-width:1;opacity:.45}
#face .disc{fill:rgba(0,0,0,.14);stroke:none}
#face .tick{stroke:var(--chalk);stroke-width:1.1;stroke-linecap:round;opacity:.7}
#face .tick.big{stroke-width:2.4;opacity:.95}
#face .num{fill:var(--chalk);font-family:var(--display);font-weight:700;font-size:17px;text-anchor:middle;dominant-baseline:central}
.minnums text{fill:var(--mint);font-family:"Inter",sans-serif;font-weight:700;font-size:7.6px;text-anchor:middle;dominant-baseline:central;opacity:.95}
.minnums,.zones{transition:opacity .3s}
body:not(.show-minnums) .minnums,body:not(.show-zones) .zones{opacity:0;pointer-events:none}
.zones .past{fill:rgba(159,216,185,.13)}
.zones .to{fill:rgba(238,168,168,.12)}
.zones .split{stroke:rgba(243,239,226,.35);stroke-width:.8;stroke-dasharray:3 3}
.zones text{font-family:var(--display);font-weight:700;font-size:7.4px;text-anchor:middle;dominant-baseline:central}
.zones .lp{fill:var(--mint)} .zones .lt{fill:var(--rose)} .zones .lq{fill:var(--chalk-2);font-family:"Inter",sans-serif;font-size:5.6px;font-weight:600}
.hand{transform-box:view-box;transform-origin:0 0;transition:transform .55s cubic-bezier(.3,1.35,.5,1)}
#clock.dragging .hand,#clock.live .hand{transition:none}
#clock.live .hand.sec{transition:transform .18s cubic-bezier(.4,2.2,.5,1)}
.hand .hit{stroke:transparent;stroke-width:16;stroke-linecap:round}
.hand.hour .shape{fill:var(--yellow);stroke:var(--yellow);stroke-width:1.4;stroke-linejoin:round}
.hand.min .shape{fill:var(--mint);stroke:var(--mint);stroke-width:1;stroke-linejoin:round}
.hand.sec line{stroke:var(--rose);stroke-width:1.2;stroke-linecap:round}
body:not(.show-secs) .hand.sec{display:none}
.pin{fill:var(--chalk);stroke:var(--board-d);stroke-width:1.4}
#clock.interactive .hand{cursor:grab}
#clock.interactive.dragging,#clock.interactive.dragging .hand{cursor:grabbing}
#clock.interactive .hand:focus{outline:none}
#clock.interactive .hand:focus-visible .shape{stroke:#fff;stroke-width:2.6}
#clock.interactive .hand.active .shape{filter:drop-shadow(0 0 4px rgba(255,255,255,.55))}
.ghost{opacity:0;transition:opacity .35s;pointer-events:none}
.ghost.on{opacity:1}
.ghost line{stroke:var(--chalk);stroke-linecap:round;stroke-dasharray:4 4;fill:none;transform-box:view-box;transform-origin:0 0}
.ghost .g-hour{stroke-width:5;stroke:rgba(241,214,126,.8)}
.ghost .g-min{stroke-width:3;stroke:rgba(159,216,185,.85)}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.35}}
#clock.pulse #hands{animation:pulse .7s ease-in-out 3}
.clock-holder.idle-hint #clock{cursor:default}

/* big chalk tick/cross over the clock */
.mark{position:absolute;left:50%;top:50%;width:min(36%,190px);aspect-ratio:1;transform:translate(-50%,-50%);pointer-events:none;opacity:0;transition:opacity .25s}
.mark.on{opacity:1}
.mark svg{width:100%;height:100%;overflow:visible}
.mark path{fill:none;stroke-width:13;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:240;stroke-dashoffset:240;filter:drop-shadow(0 0 3px rgba(0,0,0,.6))}
.mark.on path{animation:draw .45s ease-out forwards}
.mark.on path+path{animation-delay:.2s}
.mark.ok path{stroke:var(--mint)} .mark.bad path{stroke:var(--rose)}
@keyframes draw{to{stroke-dashoffset:0}}

/* ===== home ===== */
.hello{font-family:var(--display);font-size:30px;margin:0;line-height:1.05;text-shadow:var(--chalkglow);color:var(--chalk)}
.levels{display:flex;flex-wrap:wrap;gap:6px}
.levels .chip{font-size:13px;padding:5px 12px}
.levels .chip[aria-checked=true]{background:var(--yellow);border-color:var(--yellow)}
.cards{display:grid;grid-template-columns:1fr 1fr;gap:9px}
.card{display:flex;flex-direction:column;align-items:flex-start;text-align:left;gap:3px;border:1.5px solid var(--chalk-line);border-radius:12px;background:rgba(243,239,226,.03);color:var(--chalk);padding:10px 12px;cursor:pointer;transition:border-color .15s,background .15s,transform .15s}
.card:hover{border-color:var(--chalk-edge);background:rgba(243,239,226,.07);transform:translateY(-1px)}
.card b{font-family:var(--display);font-size:19px;font-weight:700;letter-spacing:.3px}
.card span{font-size:12.5px;color:var(--chalk-2);line-height:1.3}
.card.hi{border-color:rgba(241,214,126,.6)} .card.hi b{color:var(--yellow)}
.card:last-child:nth-child(odd){grid-column:1/-1}
.progress-box h3,.missed-h{margin:0 0 6px;font-size:12px;font-weight:700;letter-spacing:.6px;text-transform:uppercase;color:var(--chalk-2)}
.ptable{width:100%;border-collapse:collapse;font-size:13px}
.ptable th{font-size:11px;color:var(--chalk-3);font-weight:600;text-align:left;padding:3px 6px;border-bottom:1px solid var(--chalk-line)}
.ptable td{padding:4px 6px;border-bottom:1px dashed rgba(243,239,226,.1)}
.ptable tr.cur td:first-child{color:var(--yellow);font-weight:700}
.ptable .bar{display:inline-block;width:52px;height:6px;border-radius:3px;background:rgba(243,239,226,.12);margin-right:6px;vertical-align:middle;overflow:hidden}
.ptable .bar i{display:block;height:100%;background:var(--mint)}
.dim{color:var(--chalk-3)}

/* ===== explore ===== */
.tip{margin:0;color:var(--chalk-2);line-height:1.45}
.c-min{color:var(--mint)} .c-hour{color:var(--yellow)}
.readout{text-align:center;padding:10px 6px 4px;border-top:1px dashed var(--chalk-line);border-bottom:1px dashed var(--chalk-line)}
.digi{font-family:var(--display);font-size:68px;line-height:1;font-weight:700;color:var(--chalk);text-shadow:var(--chalkglow);font-variant-numeric:tabular-nums}
.sub{font-size:13px;color:var(--chalk-3);min-height:1.2em;margin-top:2px}
.words{font-family:var(--display);font-size:25px;color:var(--yellow);margin:6px 0 4px;min-height:1.2em;line-height:1.15}
.btnrow{display:flex;flex-wrap:wrap;gap:8px;justify-content:center}
.btnrow.nudge{gap:5px}
.btnrow.nudge .btn{min-width:54px}
.btn.big{font-size:17px;padding:11px 26px}

/* ===== questions ===== */
.qbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.lv{display:flex;align-items:center;gap:6px;font-size:12px;font-weight:600;color:var(--chalk-2)}
.lv select{padding:5px 7px;font-size:13px}
.seg{display:inline-flex;border:1.5px solid var(--chalk-edge);border-radius:8px;overflow:hidden}
.seg button{border:0;background:transparent;color:var(--chalk-2);padding:5px 10px;font-size:13px;font-weight:600;cursor:pointer}
.seg button+button{border-left:1px solid var(--chalk-line)}
.seg button[aria-checked=true]{background:var(--chalk);color:var(--board-d)}
.tally{margin-left:auto;font-size:13px;color:var(--chalk-2);font-weight:600}
.qbar.quiz{display:grid;grid-template-columns:1fr auto;row-gap:6px}
.marks{display:flex;flex-wrap:wrap;gap:3px;align-items:center}
.marks i{width:15px;height:15px;border-radius:50%;border:1.5px solid var(--chalk-line);display:grid;place-items:center;font-style:normal;font-size:11px;font-weight:800;line-height:1}
.marks i.now{border-color:var(--yellow)}
.marks i.ok{border-color:var(--mint);color:var(--mint)} .marks i.bad{border-color:var(--rose);color:var(--rose)}
.qstats{display:flex;gap:12px;font-size:13px;color:var(--chalk-2);font-weight:600;white-space:nowrap}
.qstats b{color:var(--chalk)}
#qTimeWrap b{color:var(--yellow);font-variant-numeric:tabular-nums}
.tbar{grid-column:1/-1;height:4px;border-radius:2px;background:rgba(243,239,226,.1);overflow:hidden}
.tbar i{display:block;height:100%;width:100%;background:var(--yellow);transform-origin:0 50%}
.tbar.low i{background:var(--rose)}
.qbody{display:flex;flex-direction:column;gap:12px;flex:1 1 auto;min-height:0;justify-content:center}
.qkind{margin:0;font-size:12px;font-weight:700;letter-spacing:.6px;text-transform:uppercase;color:var(--mint)}
.prompt{font-family:var(--display);font-size:29px;line-height:1.15;margin:-4px 0 0;color:var(--chalk);text-shadow:var(--chalkglow)}
.prompt .t{color:var(--yellow);white-space:nowrap}
#aMc{display:grid;grid-template-columns:1fr 1fr;gap:9px}
.opt{display:flex;align-items:center;gap:10px;border:1.5px solid var(--chalk-edge);border-radius:11px;background:rgba(243,239,226,.04);color:var(--chalk);padding:9px 12px;cursor:pointer;text-align:left;min-height:52px;transition:border-color .15s,background .15s}
.opt:hover:not([disabled]){border-color:var(--chalk);background:rgba(243,239,226,.09)}
.opt .k{flex:0 0 auto;width:20px;height:20px;border-radius:5px;border:1px solid var(--chalk-line);display:grid;place-items:center;font-size:11px;color:var(--chalk-3);font-weight:700}
.opt .tx{display:flex;flex-direction:column;min-width:0}
.opt .d{font-family:var(--display);font-size:24px;line-height:1;font-weight:700;font-variant-numeric:tabular-nums}
.opt .w{font-size:11.5px;color:var(--chalk-3);margin-top:2px;line-height:1.2}
.opt[disabled]{cursor:default;opacity:.55}
.opt.right{opacity:1;border-color:var(--mint);background:rgba(159,216,185,.16)}
.opt.wrong{opacity:1;border-color:var(--rose);background:rgba(238,168,168,.14)}
#aType,#aPick{display:flex;gap:8px;align-items:flex-end;flex-wrap:wrap}
#typeIn{font-family:var(--display);font-size:30px;font-weight:700;width:170px;padding:6px 12px;border:1.5px solid var(--chalk-edge);border-radius:10px;background:var(--field);color:var(--chalk);text-align:center;letter-spacing:1px}
#typeIn::placeholder{color:rgba(243,239,226,.25)}
#aPick label{display:flex;flex-direction:column;gap:4px;font-size:12px;font-weight:600;color:var(--chalk-2)}
#aPick select{font-family:var(--display);font-size:26px;font-weight:700;padding:4px 8px;min-width:84px}
#aPick .colon{font-family:var(--display);font-size:30px;padding-bottom:6px}
#aType .btn,#aPick .btn,#aSet .btn{padding:10px 18px;font-size:15px}
#aSet{display:flex;flex-direction:column;align-items:flex-start;gap:6px}
#aSet .hint{margin:0}
.feedback{min-height:44px;font-size:14px;line-height:1.45;color:var(--chalk-2)}
.feedback:empty{min-height:0}
.feedback .fb-h{font-family:var(--display);font-size:22px;display:block;margin-bottom:2px}
.feedback.ok .fb-h{color:var(--mint)} .feedback.bad .fb-h{color:var(--rose)}
.feedback .say{color:var(--yellow)}
.next-row{justify-content:flex-start}
.next-row:has(> [hidden]:only-child){display:none}

/* ===== quiz start / results ===== */
.qs-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px 14px;align-items:end}
.qs-grid .chk{grid-column:1/-1}
.qs-grid .seg{align-self:flex-start}
.qs-grid .seg button{padding:7px 18px;font-size:14px}
.best{font-size:13px;color:var(--chalk-2);min-height:1.2em}
.best b{color:var(--yellow)}
.res-top{display:flex;align-items:center;gap:16px}
.grade{flex:0 0 auto;width:150px;height:auto}
.grade text{font-family:var(--display);font-weight:700;font-size:96px;fill:var(--yellow);stroke:var(--yellow);stroke-width:1.6;stroke-dasharray:420;stroke-dashoffset:420;fill-opacity:0}
.grade.small text{font-size:44px}
.grade.go text{animation:write 1.3s ease-out forwards,fillin .5s 1s ease-out forwards}
@keyframes write{to{stroke-dashoffset:0}}
@keyframes fillin{to{fill-opacity:1}}
.res-sum h2{font-family:var(--display);font-size:28px;margin:0 0 4px;text-shadow:var(--chalkglow)}
.res-sum p{margin:0;color:var(--chalk-2);line-height:1.4}
.newbest{color:var(--mint)!important;font-weight:700;margin-top:4px!important}
.missed{list-style:none;margin:0;padding:0;overflow:auto;min-height:0;flex:1 1 auto;border:1px solid var(--chalk-line);border-radius:10px}
.missed:empty{display:none}
.missed li+li{border-top:1px dashed var(--chalk-line)}
.missed button{display:flex;gap:10px;align-items:baseline;width:100%;text-align:left;border:0;background:transparent;color:var(--chalk);padding:7px 10px;cursor:pointer;font-size:13px;line-height:1.35}
.missed button:hover,.missed button[aria-pressed=true]{background:rgba(243,239,226,.07)}
.missed .qn{color:var(--chalk-3);font-weight:700;flex:0 0 auto;min-width:24px}
.missed .ans{color:var(--mint);font-weight:700}
.missed .you{color:var(--rose)}
.allright{margin:0;color:var(--mint);font-family:var(--display);font-size:22px}

/* ===== dialog ===== */
dialog{border:1.5px solid var(--chalk-edge);border-radius:12px;padding:0;background:var(--board-d);color:var(--chalk);width:min(500px,calc(100vw - 24px));max-height:calc(100dvh - 24px);box-shadow:0 18px 60px rgba(0,0,0,.6)}
dialog[open]{display:flex;flex-direction:column}
dialog::backdrop{background:rgba(6,12,9,.62);backdrop-filter:blur(2px)}
.dlg-head{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid var(--chalk-line)}
.dlg-head h2{margin:0;font-family:var(--display);font-size:22px;text-shadow:var(--chalkglow)}
.dlg-body{padding:14px 16px;overflow:auto;min-height:0;flex:1 1 auto}
fieldset{border:1px solid var(--chalk-line);border-radius:9px;margin:0 0 12px;padding:8px 12px 10px}
legend{font-weight:700;font-size:12px;letter-spacing:.6px;text-transform:uppercase;color:var(--chalk-2);padding:0 6px}

/* ===== responsive ===== */
@media (max-height:800px) and (min-width:701px){
  .hello{font-size:26px}
  .view{gap:10px}
  .card{padding:8px 11px} .card b{font-size:17px} .card span{font-size:12px}
  .ptable td{padding:3px 6px}
  .digi{font-size:58px} .words{font-size:22px}
}
@media (max-width:1100px) and (min-width:701px){
  .modes{margin-left:8px} .modes button{padding:7px 8px}
}
@media (max-width:860px) and (min-width:701px){
  .brand h1{display:none}
}
/* phones, portrait */
@media (max-width:700px){
  body{font-size:13.5px}
  .top{flex-wrap:wrap;gap:6px 8px;padding:6px 10px 0;min-height:0}
  .brand h1{font-size:21px}
  .modes{order:3;flex:1 0 100%;margin:0 -4px;justify-content:space-between}
  .modes button{padding:7px 6px 8px;font-size:13px}
  .modes button[aria-current=page]::after{left:5px;right:5px}
  .app{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,50fr) minmax(0,50fr);gap:8px;padding:8px 10px 10px}
  body[data-view=home] .app{grid-template-rows:minmax(0,32fr) minmax(0,68fr)}
  body[data-view=explore] .app,body[data-view=quizStart] .app{grid-template-rows:minmax(0,52fr) minmax(0,48fr)}
  .clock-col{flex-direction:row;gap:4px;align-items:stretch}
  .clock-opts{flex-direction:column;justify-content:center;flex:0 0 auto}
  .chip{font-size:11.5px;padding:4px 9px}
  .panel{padding:12px}
  .view{gap:9px}
  .hello{font-size:24px}
  .card{padding:7px 10px} .card b{font-size:16px} .card span{font-size:11.5px}
  .ptable{font-size:12px} .ptable td{padding:3px 5px} .ptable .bar{width:34px}
  .digi{font-size:50px} .words{font-size:21px} .tip{font-size:13px}
  .prompt{font-size:23px}
  .opt{min-height:46px;padding:7px 10px} .opt .d{font-size:21px}
  .qbody{gap:9px;justify-content:flex-start}
  .feedback{font-size:13px} .feedback .fb-h{font-size:19px}
  .qstats{gap:8px;font-size:12px}
  .marks i{width:13px;height:13px;font-size:9px}
  .grade{width:110px}
  .res-sum h2{font-size:23px}
  .qs-grid{gap:10px}
  .kbd-hint{display:none}
  #vQ.done #aMc .opt:not(.right):not(.wrong){display:none}
}
@media (max-width:370px){ .brand h1{font-size:18px} .modes button{font-size:12px;padding:7px 3px 8px} }
/* short landscape (phones on their side) */
@media (max-height:520px) and (min-width:560px){
  body{font-size:13px}
  .top{min-height:0;padding:4px 10px;gap:8px}
  .brand h1{display:none}
  .modes{margin-left:0}
  .modes button{padding:6px 8px;font-size:13px}
  .btn.icon{padding:4px 6px}
  .app{grid-template-columns:minmax(0,40fr) minmax(0,60fr);grid-template-rows:minmax(0,1fr);gap:10px;padding:6px 12px 8px}
  .clock-col{flex-direction:row;gap:4px;align-items:stretch}
  .clock-opts{flex-direction:column;justify-content:center;flex:0 0 auto}
  .chip{font-size:11px;padding:3px 8px}
  .panel{padding:9px 12px}
  .view{gap:7px}
  .hello{font-size:21px}
  .levels .chip{font-size:11.5px;padding:3px 9px}
  .cards{grid-template-columns:1fr 1fr 1fr;gap:6px}
  .card{padding:6px 9px} .card b{font-size:15px} .card span{font-size:11px}
  .card:last-child:nth-child(odd){grid-column:auto}
  .progress-box{display:none}
  .tip{font-size:12.5px}
  .readout{padding:4px}
  .digi{font-size:40px} .words{font-size:18px;margin:3px 0 2px} .sub{font-size:11.5px}
  .kbd-hint{display:none}
  .btnrow{gap:6px}
  .btnrow .btn{padding:5px 9px;font-size:12.5px}
  .btnrow.nudge .btn{min-width:0}
  .qbody{gap:6px;justify-content:flex-start}
  .qkind{font-size:11px}
  .prompt{font-size:20px;margin:0}
  #aMc{gap:6px}
  .opt{min-height:38px;padding:5px 9px} .opt .d{font-size:18px} .opt .w{font-size:10.5px}
  #typeIn{font-size:22px;width:130px;padding:4px 8px}
  #aPick select{font-size:20px;padding:2px 6px;min-width:66px}
  #aType .btn,#aPick .btn,#aSet .btn{padding:7px 14px;font-size:14px}
  .feedback{min-height:0;font-size:12.5px;line-height:1.35} .feedback .fb-h{font-size:17px}
  .qstats{gap:8px;font-size:12px}
  .marks i{width:12px;height:12px;font-size:8px}
  .grade{width:96px}
  .res-sum h2{font-size:20px}
  .res-sum p{font-size:12.5px}
  .missed button{padding:4px 8px;font-size:12px}
  .qs-grid{gap:8px 12px}
  .tip+.qs-grid{margin-top:-2px}
  .btn.big{font-size:15px;padding:8px 20px}
  .hello+.tip{display:none}
}
@media (prefers-reduced-motion:reduce){
  .hand,.ghost,.mark,.minnums,.zones,.card{transition:none!important}
  .mark.on path,.grade.go text{animation:none!important;stroke-dashoffset:0!important;fill-opacity:1!important}
  #clock.pulse #hands{animation:none}
}

@media (max-height:520px) and (min-width:560px){ #vQ.done #aMc .opt:not(.right):not(.wrong){display:none} }

/* ===================================================================
   fit-to-screen pass: no page or panel scrolling, text >= 13px
   =================================================================== */
.f,.hint,.lv,#aPick label,legend,.progress-box h3,.missed-h,.qkind{font-size:13px}
.chip,.levels .chip{font-size:13px}
.card span{font-size:13px}
.ptable,.ptable th{font-size:13px}
.opt .k{font-size:13px;width:22px;height:22px}
.opt .w{font-size:13px}
.qstats,.tally,.best,.sub{font-size:13px}
.marks i{width:18px;height:18px;font-size:13px}
.missed button{font-size:13px}
.dlg-head .btn{min-width:34px;min-height:34px}
.htabs{display:none}
.missed-detail{display:none;margin:0;font-size:13px;line-height:1.4;color:var(--chalk-2);min-height:2.8em}
.missed-detail b{color:var(--chalk-3)}
/* compact missed list: numbered chips, details in one line below */
.missed.compact{display:flex;flex-wrap:wrap;gap:6px;border:0;border-radius:0;overflow:visible;flex:0 0 auto}
.missed.compact li+li{border-top:0}
.missed.compact button{width:auto;min-width:42px;min-height:36px;justify-content:center;align-items:center;padding:4px 8px;border:1.5px solid rgba(238,168,168,.55);border-radius:9px}
.missed.compact button>span:not(.qn){display:none}
.missed.compact .qn{min-width:0;color:var(--chalk)}
.missed.compact button[aria-pressed=true]{border-color:var(--yellow);background:rgba(241,214,126,.14)}
.missed.compact~.missed-detail{display:block}
@media (max-height:800px) and (min-width:701px){ .card span{font-size:13px} }

/* phones, portrait: clock takes whatever height the activity leaves */
@media (max-width:700px){
  body{font-size:14px}
  body[data-view] .app{grid-template-rows:minmax(130px,1fr) auto;gap:8px;padding:8px 10px 10px}
  .panel{padding:11px 12px}
  .modes button{flex:1 1 auto;font-size:13px;padding:8px 4px}
  .btn.icon{min-width:36px;min-height:34px}
  .chip{font-size:13px;padding:6px 10px;min-height:32px}
  .levels{gap:5px}
  .levels .chip{font-size:13px;padding:5px 10px;min-height:32px}
  .card{padding:7px 10px;min-height:48px} .card b{font-size:16px} .card span{font-size:13px;line-height:1.25}
  .ptable,.ptable th{font-size:13px}
  /* home: Activities / Progress tabs */
  .htabs{display:flex;gap:0;border-bottom:1px solid var(--chalk-line)}
  .htabs button{flex:1;border:0;background:transparent;color:var(--chalk-2);font-weight:600;font-size:13px;padding:8px 6px;min-height:36px;cursor:pointer;border-bottom:3px solid transparent;margin-bottom:-1px}
  .htabs button[aria-selected=true]{color:var(--chalk);border-bottom-color:var(--yellow)}
  #vHome:not([data-ht=progress]) .progress-box{display:none}
  #vHome[data-ht=progress] .cards{display:none}
  .progress-box h3{display:none}
  /* explore */
  .tip{font-size:13px}
  .readout{padding:6px 4px 2px}
  .digi{font-size:46px} .words{font-size:20px;margin:4px 0 2px}
  .btn{min-height:36px}
  .btn.small{min-height:34px;font-size:13px}
  .btnrow.nudge{flex-wrap:nowrap;gap:4px}
  .btnrow.nudge .btn{min-width:0;flex:1 1 0;padding:5px 2px}
  /* questions */
  .qbar{gap:8px}
  .lv{font-size:0;gap:0}
  .lv select{font-size:13px;padding:6px 6px;min-height:34px}
  .seg button{font-size:13px;padding:6px 10px;min-height:34px}
  .tally{font-size:13px}
  .qbody{display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:10px;row-gap:8px;align-content:start}
  .qbody>*{grid-column:1/-1;min-width:0}
  .qbody>.feedback{grid-column:1}
  .qbody>.next-row{grid-column:2;align-self:start}
  .prompt{font-size:22px;margin:0}
  .opt{min-height:46px;padding:6px 9px;gap:8px} .opt .d{font-size:20px} .opt .w{font-size:13px}
  .opt .k{display:none}
  #vQ.done #aType,#vQ.done #aPick,#vQ.done #aSet{display:none}
  #aSet{flex-direction:row;align-items:center;justify-content:space-between;gap:10px}
  #aSet .hint{display:none}
  #typeIn{font-size:26px;width:140px;padding:5px 10px}
  #aPick select{font-size:22px;min-width:74px}
  #aType .btn,#aPick .btn,#aSet .btn{padding:8px 16px;font-size:15px}
  .feedback{font-size:13px;line-height:1.38;min-height:0} .feedback .fb-h{font-size:18px}
  .next-row .btn{padding:8px 14px}
  .qbar.quiz{row-gap:4px;column-gap:8px}
  .qstats{gap:8px;font-size:13px}
  .marks{gap:3px}
  .marks i{width:12px;height:12px;font-size:0;border-width:1.5px}
  .marks i.ok{background:var(--mint)} .marks i.bad{background:var(--rose);border-radius:2px}
  /* quiz start */
  .qs-grid{gap:8px 12px}
  .qs-grid .seg button{padding:6px 16px;min-height:36px}
  .f select{min-height:36px}
  .hello+.tip{display:none}
  #vQuizStart .hello{font-size:22px}
  .btn.big{font-size:16px;padding:9px 24px}
  /* results */
  .res-top{gap:12px}
  .grade{width:96px}
  .res-sum h2{font-size:21px}
  .res-sum p{font-size:13px}
  .missed-h{margin:0}
  .chk{padding:7px 0}
}
@media (max-width:370px){ .brand h1{font-size:19px} .modes button{font-size:13px;padding:8px 2px} .opt .w{display:none} .opt{min-height:42px} }
@media (max-width:700px) and (max-height:700px){
  .tip{display:none}
  .readout{border-top:0}
  .hello{font-size:22px}
  .card{min-height:44px;padding:5px 10px}
  .grade{width:80px}
  .view{gap:8px}
}

/* short landscape (phones on their side) */
@media (max-height:520px) and (min-width:560px){
  body{font-size:13px}
  .chip,.levels .chip{font-size:13px}
  .card span,.tip,.sub,.opt .w,.res-sum p,.missed button,.qkind,.qstats,.btnrow .btn{font-size:13px}
  .opt .k{display:none}
  .htabs{display:flex;gap:0;border-bottom:1px solid var(--chalk-line)}
  .htabs button{flex:1;border:0;background:transparent;color:var(--chalk-2);font-weight:600;font-size:13px;padding:5px 6px;min-height:32px;cursor:pointer;border-bottom:3px solid transparent;margin-bottom:-1px}
  .htabs button[aria-selected=true]{color:var(--chalk);border-bottom-color:var(--yellow)}
  .progress-box{display:block}
  #vHome:not([data-ht=progress]) .progress-box{display:none}
  #vHome[data-ht=progress] .cards{display:none}
  .progress-box h3{display:none}
  .card span{display:none}
  .cards{grid-template-columns:1fr 1fr 1fr}
  .marks i{width:12px;height:12px;font-size:0}
  .marks i.ok{background:var(--mint)} .marks i.bad{background:var(--rose);border-radius:2px}
  #vQ.done #aType,#vQ.done #aPick,#vQ.done #aSet{display:none}
  .feedback{font-size:13px}
  dialog{width:min(760px,calc(100vw - 24px))}
  .dlg-head{padding:6px 14px}
  .dlg-body{display:grid;grid-template-columns:1fr 1fr;gap:0 12px;padding:8px 14px}
  fieldset{margin:0 0 8px;padding:4px 10px 6px}
  .chk{padding:3px 0}
  .btn.icon{min-width:34px;min-height:32px}
  .chip{min-height:30px}
  .next-row .btn,.btnrow .btn{min-height:32px}
}
@media (max-height:420px) and (min-width:560px){
  #vResults{gap:6px}
  #vResults .grade{width:64px}
  #btnReset{min-height:30px}
}
