/* The teacher's board (/host/, made for a projector at 1280×720 to 1920×1080) and the pupil page (/join/, phones from 360 px
   and Chromebooks). Calm on purpose: no confetti, no sounds, no speed points, the leaderboard hidden unless the teacher
   shows it. Answer colours always come with a letter and a shape. */
body.app{min-height:100vh;min-height:100dvh;display:flex;flex-direction:column}
body.app main{flex:1;display:flex;flex-direction:column}
.apptop{background:var(--hero-bg);color:var(--hero-ink)}
.apptop .wrap{max-width:1760px;padding-inline:clamp(16px,3vw,40px)}
.apptop .top-in{min-height:56px;gap:8px;flex-wrap:wrap}
.apptop .brand{font-size:1.02rem}
.pillbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.pill{display:inline-flex;align-items:center;gap:6px;min-height:40px;padding:6px 12px;border-radius:999px;background:rgba(255,255,255,.12);color:var(--hero-ink);font-weight:600;font-size:.95rem;border:0}
.pill .lbl{color:var(--hero-ink-2);font-weight:600}
.pill b{letter-spacing:.08em}
button.pill{cursor:pointer;font-family:inherit}
button.pill:hover{background:rgba(255,255,255,.2)}
button.pill[aria-pressed="true"]{background:var(--sun);color:#231A2E}
button.pill svg{width:18px;height:18px}
.menu{position:relative}
.menu > summary{list-style:none;cursor:pointer}
.menu > summary::-webkit-details-marker{display:none}
.menu-panel{position:absolute;right:0;top:calc(100% + 8px);z-index:30;width:min(340px,92vw);background:var(--surface);color:var(--ink);border:1px solid var(--line);border-radius:16px;padding:10px;box-shadow:0 18px 40px rgba(20,14,28,.22);display:grid;gap:4px}
.menu-panel button{justify-content:flex-start;width:100%;min-height:44px;border-radius:10px;border:0;background:transparent;font:600 1rem var(--font);color:var(--ink);padding:8px 10px;text-align:left;cursor:pointer}
.menu-panel button:hover{background:var(--mist)}
.menu-panel button[aria-pressed="true"]{background:var(--accent-soft)}
.menu-panel .grp{display:flex;gap:4px;align-items:center;padding:4px 6px;flex-wrap:wrap}
.menu-panel .grp span{font-weight:700;margin-right:auto;font-size:.95rem}
.menu-panel .grp button{width:auto;padding:6px 10px;border:1px solid var(--line)}
.menu-panel hr{border:0;border-top:1px solid var(--line);margin:4px 0;width:100%}
.menu-panel .rec{padding:6px 10px;font-size:.92rem}
.rec-code{font-size:1.5rem;font-weight:800;letter-spacing:.12em;margin:4px 0}
#crConn{position:fixed;left:50%;top:10px;transform:translateX(-50%);z-index:50;background:var(--ink);color:var(--paper);padding:8px 16px;border-radius:999px;font-weight:700}
#crToast{position:fixed;left:50%;bottom:96px;transform:translateX(-50%);z-index:50;background:var(--ink);color:var(--paper);padding:10px 18px;border-radius:12px;font-weight:600;max-width:90vw}
.startbox{max-width:620px;margin:40px auto;display:grid;gap:16px;padding-inline:var(--gutter)}
.startbox h1{font-size:clamp(1.8rem,4vw,2.6rem)}
.startbox form{display:grid;gap:10px;background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:16px}
.startbox details{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:6px 16px}
.startbox summary{cursor:pointer;font-weight:700;min-height:44px;padding:10px 0}

/* ---------- board: shared ---------- */
#hostRoom{flex:1;display:flex;flex-direction:column}
.bmain{flex:1;width:100%;max-width:1760px;margin:0 auto;padding:18px clamp(16px,3vw,40px) 12px}
#hBanner:not(:empty){max-width:1760px;margin:10px auto 0;padding:0 clamp(16px,3vw,40px);width:100%;display:grid;gap:8px}
.dock{position:sticky;bottom:0;z-index:20;background:var(--surface);border-top:1px solid var(--line)}
.dock-in{max-width:1760px;margin:0 auto;padding:10px clamp(16px,3vw,40px);display:flex;align-items:center;gap:10px;flex-wrap:wrap;min-height:72px}
.dock .hint{color:var(--ink-2);font-weight:600}
.kick{font-weight:700;color:var(--ink-2);letter-spacing:.01em}
.tag{display:inline-flex;align-items:center;padding:4px 12px;border-radius:999px;font-weight:700;background:var(--mist);color:var(--ink)}
.tag.pause{background:#FFF1C2;color:#3D2E00}
.tag.done{background:var(--accent-soft)}

/* ---------- board: lobby ---------- */
.lobby{display:grid;gap:24px}
@media (min-width:1000px){.lobby{grid-template-columns:minmax(0,1fr) minmax(0,1.15fr);align-items:start}}
.joinpanel{background:var(--surface);border:1px solid var(--line);border-radius:22px;padding:clamp(18px,2.4vw,32px);display:grid;gap:8px;position:relative}
.joinpanel h2{font-size:clamp(1.5rem,2.4vw,2.2rem);margin-bottom:6px}
.step{display:flex;align-items:center;gap:12px;font-size:clamp(1.1rem,1.7vw,1.5rem);font-weight:600}
.step span{display:grid;place-items:center;flex:none;width:36px;height:36px;border-radius:50%;background:var(--accent);color:var(--on-accent);font-weight:800;font-size:1.05rem}
.step .addr{font-weight:800;color:var(--accent-ink)}
.bigcode{font-size:clamp(2.8rem,5.4vw,6.4rem);font-weight:900;letter-spacing:.08em;line-height:1;margin:4px 0 8px 48px;white-space:nowrap;font-variant-numeric:tabular-nums}
.qrrow{display:flex;align-items:center;justify-content:space-between;gap:14px}
.qrbox{display:grid;justify-items:center;gap:4px;flex:none}
.qrbox svg.qr{width:clamp(108px,11vw,210px);height:auto;border-radius:10px;border:1px solid var(--line)}
.qrbox small{color:var(--ink-2);font-weight:600}
.setup{display:grid;gap:16px}
fieldset{border:0;margin:0;padding:0;min-width:0}
legend{font-weight:800;font-size:1.05rem;margin-bottom:8px;padding:0}
.deckgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:8px}
.deck{position:relative;display:grid;gap:2px;padding:12px 14px;border-radius:14px;border:2px solid var(--line);background:var(--surface);cursor:pointer;font-weight:500}
.deck input{position:absolute;opacity:0;width:1px;height:1px}
.deck .dt{font-weight:800}
.deck .dm{font-size:.86rem;color:var(--ink-2)}
.deck.on,.deck:has(input:checked){border-color:var(--accent);background:var(--accent-soft)}
.deck:has(input:focus-visible){outline:3px solid var(--focus);outline-offset:2px}
.row2{display:flex;flex-wrap:wrap;gap:18px 28px}
.seg{display:flex;flex-wrap:wrap;gap:6px}
.seg legend{width:100%}
.seg label{position:relative}
.seg input{position:absolute;opacity:0;width:1px;height:1px}
.seg span{display:inline-flex;align-items:center;min-height:44px;padding:8px 16px;border-radius:999px;border:2px solid var(--line-2);background:var(--surface);font-weight:700;cursor:pointer}
.seg input:checked + span{background:var(--accent);border-color:var(--accent);color:var(--on-accent)}
.seg input:focus-visible + span{outline:3px solid var(--focus);outline-offset:2px}
.deckblurb{color:var(--ink-2)}
#hRoster h3{font-size:1.15rem;margin-bottom:8px}
#hRoster h3 small{font-weight:600;color:var(--ink-2);font-size:.85rem}
.roster{display:flex;flex-wrap:wrap;gap:8px}
.chip{min-height:40px;padding:6px 14px;border-radius:999px;border:1px solid var(--line-2);background:var(--surface);color:var(--ink);font:700 1rem var(--font);cursor:pointer}
.chip:hover{border-color:var(--ink-2)}
.chip.off{opacity:.55;border-style:dashed}

/* ---------- board: question and results ---------- */
.qview{display:grid;gap:12px}
.qhead{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.prompt{font-size:clamp(1.7rem,3.3vw,3.2rem);line-height:1.12}
body[data-phase="results"] .qview .prompt{font-size:clamp(1.4rem,2.4vw,2.4rem)}
.qbody{display:grid;gap:18px}
@media (min-width:1000px){.qbody{grid-template-columns:minmax(0,1fr) clamp(240px,20vw,340px);align-items:start}}
.qmain{display:grid;gap:14px;min-width:0}
.timer{display:inline-grid;place-items:center;min-width:64px;height:64px;padding:0 12px;border-radius:999px;background:var(--accent);color:var(--on-accent);font-weight:900;font-size:1.9rem;font-variant-numeric:tabular-nums}
.timer.low{background:#9A3412;color:#fff}
.timer.off,.timer.paused{font-size:1rem;height:40px;background:var(--mist);color:var(--ink);font-weight:700}
.tbar{height:8px;border-radius:999px;background:var(--mist);overflow:hidden}
.tbar i{display:block;height:100%;background:var(--accent);transform-origin:left}
.flagwrap{display:flex;justify-content:center}
.flagwrap .pic.flag{display:block;width:clamp(160px,calc((100vh - 500px) * 1.333),560px);max-width:100%}
.flagwrap.small .pic.flag{width:min(26vh,280px)}
.pic svg{width:100%;height:auto}
.pic.flag svg{border-radius:8px;box-shadow:0 0 0 1px var(--line-2),0 6px 18px rgba(20,14,28,.14)}
.opts{display:grid;gap:12px}
.opts.n4,.opts.duel{grid-template-columns:repeat(2,minmax(0,1fr))}
.op{min-width:0;display:flex;align-items:center;gap:14px;padding:14px 18px;border-radius:18px;background:var(--o);color:var(--on-o);min-height:84px;position:relative}
.op.o0{--o:var(--o0)}.op.o1{--o:var(--o1)}.op.o2{--o:var(--o2)}.op.o3{--o:var(--o3)}
.opts.duel .op.o0{--o:var(--d0)}.opts.duel .op.o1{--o:var(--d1)}
.op .lt{display:grid;place-items:center;flex:none;width:52px;height:52px;border-radius:14px;background:rgba(255,255,255,.18)}
.op .lt b{font-size:1.25rem;line-height:1}
.op .lt .shp{width:18px;height:18px;fill:currentColor;opacity:.9}
.op .tx{display:grid;gap:2px;min-width:0;flex:1}
.op .nm{font-size:clamp(1.25rem,2.1vw,2rem);font-weight:800;line-height:1.15;overflow-wrap:break-word}
.op .sub{font-size:clamp(.9rem,1.1vw,1.1rem);opacity:.92}
.op .val{font-size:clamp(1.05rem,1.5vw,1.45rem);font-weight:800;margin-top:2px}
.op .opic{flex:none;width:clamp(64px,7vw,110px);color:#fff;display:grid;place-items:center}
.op .opic svg{max-height:clamp(56px,8vh,96px);fill:currentColor}
/* while a duel is asked, its two cards are the picture: tall, a large silhouette, glyph or flag over the name; at the
   results they shrink to name and value, and the drawing to scale takes the room */
body[data-phase="question"] .opts.duel .op{flex-direction:column;align-items:stretch;justify-content:space-between;min-height:clamp(200px,42vh,560px);padding:18px 22px;gap:12px}
body[data-phase="question"] .opts.duel .op .lt{position:absolute;top:16px;left:16px}
body[data-phase="question"] .opts.duel .op .opic{align-self:center;width:min(72%,380px);flex:1;display:grid;place-items:center}
body[data-phase="question"] .opts.duel .op .opic svg{max-height:clamp(90px,24vh,300px);width:100%}
body[data-phase="question"] .opts.duel .op .tx{text-align:center}
body[data-phase="question"] .opts.duel .op .nm{font-size:clamp(1.5rem,2.8vw,2.8rem)}
body[data-phase="question"] .opts.duel .op .sub{font-size:clamp(1rem,1.4vw,1.4rem)}
body[data-phase="results"] .opts.duel .op .opic{display:none}
.op .opic .h{fill:var(--o)}
.op .ct{display:flex;align-items:center;gap:8px;flex:none;font-size:1.5rem;font-weight:900}
.op .ct .bar{width:clamp(60px,8vw,140px);height:12px;border-radius:999px;background:rgba(255,255,255,.25);overflow:hidden}
.op .ct .bar i{display:block;height:100%;background:#fff}
.op .tick{position:absolute;top:-14px;right:14px;width:40px;height:40px;border-radius:50%;background:var(--surface);color:var(--good);display:grid;place-items:center;font-weight:900;font-size:1.4rem;box-shadow:0 0 0 3px var(--good)}
.opts.res .op.dim{background:color-mix(in srgb,var(--o) 22%,var(--surface));color:var(--ink)}
.opts.res .op.dim .lt{background:color-mix(in srgb,var(--o) 30%,var(--surface))}
.opts.res .op.dim .ct .bar{background:color-mix(in srgb,var(--ink) 14%,transparent)}
.opts.res .op.dim .ct .bar i{background:var(--ink-2)}
.opts.res .op.right{box-shadow:0 0 0 4px var(--surface),0 0 0 8px var(--good)}
.reveal{display:grid;gap:8px}
.drawing{background:var(--surface);border:1px solid var(--line);border-radius:18px;padding:10px 12px}
.drawing .pic svg{max-height:clamp(150px,calc(100vh - 500px),460px);width:100%}
.drawing figcaption{font-size:.95rem;color:var(--ink-2);margin-top:4px}
.reveal{background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:14px}
.reveal .note{font-size:clamp(1.05rem,1.35vw,1.35rem);font-weight:600}
.reveal .credit{font-size:.9rem;color:var(--ink-2)}
.side{display:grid;gap:12px;align-content:start}
.stat{font-size:1.2rem;font-weight:600}
.stat b{font-size:2.6rem;font-weight:900;display:block;line-height:1}
.stat small{display:block;font-size:.95rem;color:var(--ink-2);font-weight:600;margin-top:4px}
.stat.big b{display:inline;font-size:3rem}
.meter{height:12px;border-radius:999px;background:var(--mist);overflow:hidden}
.meter i{display:block;height:100%;background:var(--accent)}
.joinline{font-size:.95rem;color:var(--ink-2)}
.leader{background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:14px}
.leader h2{font-size:1.15rem;margin-bottom:8px}
.leader ol{display:grid;gap:4px}
.leader li{display:flex;align-items:center;gap:10px;font-weight:600;padding:4px 6px;border-radius:8px}
.leader li:nth-child(odd){background:var(--mist)}
.leader .rk{width:2.2em;color:var(--ink-2);font-variant-numeric:tabular-nums}
.leader .nm{flex:1;overflow-wrap:anywhere}
.leader.hidden p{color:var(--ink-2)}

/* the Size Duel reveal drawings (classes from apps/sizeduel/src/reveal.mjs + draw.mjs) */
svg.scale{width:100%;height:auto;display:block}
.scale .a{fill:var(--da);color:var(--da)}.scale .b{fill:var(--db);color:var(--db)}.scale .r{fill:var(--dr)}
.scale .h{fill:var(--surface)}
.scale .ground,.scale .ruler{stroke:var(--line-2);stroke-width:2}
.scale .tick{stroke:var(--ink-2);stroke-width:1.5}
.scale .stem{stroke-width:2;fill:none}.scale .stem.a{stroke:var(--da)}.scale .stem.b{stroke:var(--db)}
.scale .gap{stroke:var(--ink);stroke-width:2;stroke-dasharray:4 3}
.scale .sbar line{stroke:var(--ink);stroke-width:2}
.scale .lbl{fill:var(--ink-2);font:600 14px var(--font);paint-order:stroke;stroke:var(--surface);stroke-width:4px;stroke-linejoin:round}
.scale .lbl.strong{fill:var(--ink);font-weight:800;font-size:15px}
.scale .gaplbl{fill:var(--ink);font-weight:800}
.scale .inset{fill:var(--mist);stroke:var(--ink-2);stroke-width:1.5;stroke-dasharray:3 3}
.scale .mark{stroke:var(--surface);stroke-width:1}
.scale .lbl.small{font-size:12px;font-weight:600}
.scale.pop .figs.a{fill:var(--da)}.scale.pop .figs.b{fill:var(--db)}.scale .ghost{opacity:.22}
.scale .globe{fill:var(--mist);stroke:var(--ink-2);stroke-width:1.5}.scale .grat{stroke:var(--line);stroke-width:1}.scale .equator{stroke:var(--ink-2);stroke-width:1.2;stroke-dasharray:4 3}
.scale .latline{stroke-width:2.5}.scale .latline.a{stroke:var(--da)}.scale .latline.b{stroke:var(--db)}.scale circle.back{fill:var(--surface);stroke-width:2.5}.scale circle.back.a{stroke:var(--da)}.scale circle.back.b{stroke:var(--db)}
.glyph{fill:currentColor}

/* ---------- board: summary ---------- */
.summary h1{font-size:clamp(2rem,3.6vw,3.2rem);margin:6px 0 16px}
.sumgrid{display:grid;gap:24px}
@media (min-width:1000px){.sumgrid{grid-template-columns:minmax(0,1.4fr) minmax(0,1fr)}}
.qlist{display:grid;gap:6px;margin-top:14px}
.qlist li{display:grid;grid-template-columns:2.2em minmax(0,1fr) 9em;gap:10px;align-items:center;padding:8px 10px;border-radius:12px;background:var(--surface);border:1px solid var(--line)}
.qlist .n{font-weight:900;color:var(--ink-2)}
.qlist .qt{font-weight:500}
.qlist .pc{display:flex;align-items:center;gap:8px;font-weight:800;font-variant-numeric:tabular-nums}
.qlist .bar{flex:1;height:10px;border-radius:999px;background:var(--mist);overflow:hidden}
.qlist .bar i{display:block;height:100%;background:var(--accent)}
.printout{display:none}

/* ---------- dialog ---------- */
dialog{border:0;border-radius:18px;padding:20px;width:min(420px,92vw);background:var(--surface);color:var(--ink);box-shadow:0 24px 60px rgba(20,14,28,.3)}
dialog::backdrop{background:rgba(17,12,24,.5)}
dialog form{display:grid;gap:10px}
dialog h2{font-size:1.3rem}
dialog .row{display:flex;flex-wrap:wrap;gap:8px;margin-top:6px}

/* ---------- pupil page ---------- */
.ppl{flex:1;width:100%;max-width:640px;margin:0 auto;padding:16px var(--gutter) 28px;display:grid;align-content:start;gap:14px}
.joinbox{display:grid;gap:14px}
.joinbox h1{font-size:clamp(1.7rem,6vw,2.3rem)}
.joinbox form{display:grid;gap:8px;background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:16px}
.joinbox .code{text-transform:uppercase;letter-spacing:.18em;font-weight:800;font-size:1.5rem;text-align:center}
.joinbox .btn{margin-top:8px}
.joinbox .hint{font-size:.92rem;color:var(--ink-2);font-weight:500}
.pv{display:grid;gap:12px}
.pv h1{font-size:clamp(1.5rem,6vw,2.1rem)}
.pv .prompt{font-size:clamp(1.3rem,5.4vw,1.9rem)}
.pv h1.good{color:var(--good)}.pv h1.bad{color:var(--bad)}
.pv .qhead .timer{min-width:52px;height:52px;font-size:1.5rem}
.pv .qhead .timer.off,.pv .qhead .timer.paused{min-width:0;height:36px;font-size:.95rem}
.ans{display:grid;gap:10px}
@media (min-width:430px){.ans.n4{grid-template-columns:1fr 1fr}}
.ab{display:flex;align-items:center;gap:12px;width:100%;min-height:72px;padding:12px 16px;border-radius:18px;border:0;background:var(--o);color:var(--on-o);font:800 1.2rem/1.2 var(--font);text-align:left;cursor:pointer;touch-action:manipulation}
.ab.o0{--o:var(--o0)}.ab.o1{--o:var(--o1)}.ab.o2{--o:var(--o2)}.ab.o3{--o:var(--o3)}
.ab.duel.o0{--o:var(--d0)}.ab.duel.o1{--o:var(--d1)}
.ab .lt{display:grid;place-items:center;flex:none;width:44px;height:48px;border-radius:12px;background:rgba(255,255,255,.2);gap:2px;align-content:center}
.ab .lt b{font-size:1.1rem;line-height:1}
.ab .shp{width:14px;height:14px;fill:currentColor;opacity:.9}
.ab span{display:grid;gap:2px;min-width:0;overflow-wrap:anywhere}
.ab small{font-size:.86rem;font-weight:600;opacity:.92}
.ab .opic{flex:none;width:56px;color:#fff}
.ab .opic svg{max-height:48px;fill:currentColor}
.ab .opic .h{fill:var(--o)}
.ab:disabled{cursor:default}
.ans .ab:disabled:not(.picked){opacity:.55}
.ab.picked{box-shadow:0 0 0 4px var(--paper),0 0 0 7px var(--ink)}
.ab.right{box-shadow:0 0 0 4px var(--paper),0 0 0 7px var(--good)}
.ans.timeup .ab{opacity:.45}
.ans.one .ab{cursor:default}
.keys{font-size:.88rem;color:var(--ink-2)}
@media (hover:none){.keys{display:none}}
kbd{font:inherit;font-weight:700;border:1px solid var(--line-2);border-bottom-width:2px;border-radius:6px;padding:0 6px;background:var(--surface)}
.you-score{font-weight:600;font-size:1.1rem}
.you-score b{font-size:1.4rem}
.yours{font-weight:600}
.pv .note{font-size:1.05rem}
.rename{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:4px 14px}
.rename summary{cursor:pointer;font-weight:700;min-height:44px;padding:10px 0}
.rename form{display:grid;gap:8px;padding-bottom:12px}
.pv .flagwrap .pic.flag{width:min(64vw,300px)}
.jcode{font-weight:800;letter-spacing:.08em}
body[data-view="join"]:not(.in-room) #jCodePill{display:none}

@media (prefers-reduced-motion:no-preference){
  .tbar i,.meter i,.op .ct .bar i,.qlist .bar i{transition:width .5s ease,transform .25s linear}
}

/* ---------- printing the summary: only the table, black on white ---------- */
@media print{
  @page{margin:14mm}
  body,body.app{background:#fff;color:#000;display:block}
  body.app > *:not(main),.apptop,.dock,#hBanner,.summary,#crConn,#crToast,.idn-footer{display:none!important}
  main > *:not(#hostRoom),#hostRoom > *:not(.bmain){display:none!important}
  .printout{display:block!important;font:11pt/1.4 var(--font);color:#000}
  .printout h1{font-size:18pt;margin-bottom:4pt}
  .printout table{border-collapse:collapse;width:100%;margin:10pt 0;font-size:10pt}
  .printout th,.printout td{border:1px solid #999;padding:3pt 5pt;text-align:center}
  .printout tbody th,.printout tfoot th{text-align:left}
  .printout .pq{list-style:decimal;padding-left:18pt;margin:8pt 0;font-size:10pt}
  .printout .fine{color:#333;font-size:9pt}
}
