/* Class Live (live.html, live.js). One dark look, made for a projector and for phones.
   Answer colours reuse the four game colours: Classic blue, Match green, Crane purple, Number Pair amber. */
:root { --page:#07060e; --stage:#100e22; --panel:#1a1834; --panel2:#24224a; --line:#ffffff17; --text:#f4f3ff; --sub:#a6a5c9; --gold:#f5b82e; --good:#34d399; --goodlip:#047857; --bad:#fda4af;
  --c0:#2f6fed; --c1:#16a36a; --c2:#8b5cf6; --c3:#e08a12; color-scheme:dark; }
* { box-sizing:border-box; touch-action:manipulation; }
html, body { margin:0; min-height:100%; }
body { background:radial-gradient(120% 90% at 85% -10%, #2b2360 0%, var(--stage) 55%); background-attachment:fixed; color:var(--text); font-family:'Nunito','Segoe UI',system-ui,sans-serif; }
button, select { font:inherit; color:inherit; }
button { cursor:pointer; }
button:focus-visible, select:focus-visible, a:focus-visible { outline:3px solid #7dd3fc; outline-offset:2px; }

.stage { max-width:1180px; min-height:100vh; margin:0 auto; padding:18px 20px; display:flex; flex-direction:column; gap:14px; }
.bar { display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap; }
.brand { font-weight:900; display:flex; align-items:center; gap:9px; }
.brand i { width:30px; height:30px; border-radius:9px; background:linear-gradient(135deg,#8b5cf6,#2563eb); display:grid; place-items:center; font-style:normal; font-size:.9rem; }
.chip { background:#ffffff12; border-radius:999px; padding:5px 12px; font-size:.8rem; font-weight:800; color:#d8d7f0; font-variant-numeric:tabular-nums; white-space:nowrap; }
.steps { display:flex; gap:4px; flex-wrap:wrap; }
.steps i { width:30px; height:6px; border-radius:99px; background:#ffffff1c; }
.steps i.done { background:var(--good); } .steps i.now { background:var(--gold); }
.spacer { flex:1; }
.tbtn { border:none; border-radius:13px; padding:13px 22px; font-weight:900; background:var(--good); color:#03261a; box-shadow:0 4px 0 var(--goodlip); }
.tbtn:active { transform:translateY(3px); box-shadow:0 1px 0 var(--goodlip); }
.tbtn:disabled { opacity:.5; cursor:default; }
.gbtn { border:1.5px solid #ffffff2b; background:transparent; border-radius:13px; padding:11px 15px; font-weight:800; text-decoration:none; color:var(--text); display:inline-block; }
.acts { display:flex; gap:9px; justify-content:flex-end; flex-wrap:wrap; align-items:center; }
.endbtn { color:var(--bad); border-color:rgba(253,164,175,.35); }
.dbtn { border:none; border-radius:13px; padding:13px 20px; font-weight:900; background:#e11d48; color:#fff; }
.endask span { font-weight:800; margin-right:auto; }

/* lobby */
.lobby { display:grid; grid-template-columns:minmax(0,1.05fr) minmax(0,1fr); gap:16px; flex:1; min-width:0; }
@media (max-width:760px) { .lobby { grid-template-columns:minmax(0,1fr); } }
.joinbox { background:#ffffff0c; border:1px solid var(--line); border-radius:18px; padding:18px; display:grid; gap:8px; align-content:center; text-align:center; }
.joinbox small { color:var(--sub); font-weight:700; line-height:1.4; }
.joinbox .code { font-size:clamp(2.6rem,7vw,5rem); font-weight:900; letter-spacing:.1em; color:var(--gold); line-height:1.05; }
.setrow { display:grid; grid-template-columns:repeat(auto-fit,minmax(112px,1fr)); gap:8px; margin-top:8px; text-align:left; }
.setrow label { display:grid; gap:3px; font-size:.72rem; font-weight:900; color:var(--sub); }
.setrow select { background:var(--panel2); border:1px solid var(--line); border-radius:10px; padding:8px; font-weight:800; color:var(--text); }
.people { background:#ffffff08; border:1px solid var(--line); border-radius:18px; padding:14px; display:flex; flex-direction:column; gap:10px; min-width:0; }
.people h3 { margin:0; font-size:.95rem; font-weight:900; display:flex; justify-content:space-between; }
.people p { margin:0; color:var(--sub); font-size:.78rem; font-weight:700; }
.chips { display:flex; flex-wrap:wrap; gap:6px; align-content:flex-start; }
.chips button { border:none; background:var(--panel2); border-radius:10px; padding:6px 9px; font-size:.84rem; font-weight:800; }
.chips button:hover { background:#4a2730; }

/* question */
.qwrap { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:18px; align-items:center; }
.qtxt { font-size:clamp(2.8rem,8vw,5.4rem); font-weight:900; line-height:1.05; font-variant-numeric:tabular-nums; }
.qtxt small { display:block; font-size:.85rem; font-weight:800; color:var(--sub); letter-spacing:.04em; margin-bottom:6px; }
.ring { --p:100; width:112px; height:112px; border-radius:50%; background:conic-gradient(var(--gold) calc(var(--p)*1%), #ffffff14 0); display:grid; place-items:center; flex:none; }
.ring span { width:88px; height:88px; border-radius:50%; background:var(--stage); display:grid; place-items:center; font-size:2.1rem; font-weight:900; font-variant-numeric:tabular-nums; }
.opts { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.opt { background:var(--c); border-radius:15px; padding:15px 17px; display:flex; align-items:center; gap:12px; font-size:clamp(1.4rem,3.4vw,2.1rem); font-weight:900; font-variant-numeric:tabular-nums; }
.opt em { font-style:normal; width:34px; height:34px; border-radius:9px; background:#00000038; display:grid; place-items:center; font-size:.95rem; flex:none; }
.live { display:grid; gap:6px; }
.live .row { display:flex; justify-content:space-between; font-weight:800; font-size:.9rem; color:#d8d7f0; }
.track { height:11px; border-radius:99px; background:#ffffff14; overflow:hidden; }
.track i { display:block; height:100%; background:var(--good); transition:width .25s; }

/* after each question */
.reveal { display:grid; grid-template-columns:minmax(0,1.5fr) minmax(0,1fr); gap:16px; flex:1; min-width:0; align-items:start; }
@media (max-width:760px) { .reveal { grid-template-columns:minmax(0,1fr); } }
.card { background:#ffffff0a; border:1px solid var(--line); border-radius:16px; padding:14px; display:flex; flex-direction:column; gap:10px; min-width:0; }
.card h3 { margin:0; font-size:.8rem; font-weight:900; color:var(--sub); letter-spacing:.05em; text-transform:uppercase; }
.ans { font-size:clamp(1.6rem,4vw,2.5rem); font-weight:900; font-variant-numeric:tabular-nums; }
.ans b { color:var(--good); }
.drow { display:grid; grid-template-columns:30px 64px minmax(0,1fr) 92px; gap:9px; align-items:center; font-weight:900; font-size:1.05rem; font-variant-numeric:tabular-nums; }
.drow em { font-style:normal; width:30px; height:30px; border-radius:8px; background:var(--c); display:grid; place-items:center; font-size:.84rem; }
.drow .b { height:26px; background:#ffffff0f; border-radius:7px; overflow:hidden; }
.drow .b i { display:block; height:100%; border-radius:7px; background:var(--c); opacity:.42; transition:width .5s ease-out; min-width:2px; }
.drow.ok .b i { opacity:1; }
.drow .n { font-size:.84rem; color:var(--sub); text-align:right; font-weight:800; }
.drow.ok .n, .drow.ok span { color:#a7f3d0; }
.tip { border-radius:13px; padding:11px 13px; font-size:.92rem; font-weight:700; line-height:1.4; background:rgba(245,184,46,.11); border:1px solid rgba(245,184,46,.3); }
.tip b { color:var(--gold); font-weight:900; }
.tip.fine { background:rgba(52,211,153,.1); border-color:rgba(52,211,153,.3); }
.tip.fine b { color:var(--good); }
.lrow { display:grid; grid-template-columns:22px minmax(0,1fr) auto 22px; gap:8px; align-items:center; font-weight:800; font-size:.95rem; font-variant-numeric:tabular-nums; padding:4px 0; }
.lrow .r { color:var(--sub); } .lrow .nm { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.up { color:var(--good); font-size:.72rem; text-align:center; } .dn { color:var(--bad); font-size:.72rem; text-align:center; } .sm { color:var(--sub); font-size:.72rem; text-align:center; }

/* final */
.tablewrap { overflow:auto; max-height:52vh; border:1px solid var(--line); border-radius:13px; }
table { border-collapse:collapse; width:100%; font-size:.86rem; font-weight:800; font-variant-numeric:tabular-nums; }
th { position:sticky; top:0; background:#201e40; color:var(--sub); font-size:.72rem; text-align:center; padding:7px 6px; }
th:nth-child(2), td:nth-child(2) { text-align:left; }
td { padding:6px; text-align:center; border-top:1px solid var(--line); }
.yes { color:var(--good); } .no { color:var(--bad); }
.tabs { display:flex; gap:6px; flex-wrap:wrap; }
.tabs button { border:none; border-radius:10px; padding:8px 13px; background:#ffffff10; font-weight:900; font-size:.86rem; color:#d8d7f0; }
.tabs button.on { background:var(--gold); color:#2a1d00; }
.podium { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; align-items:end; max-width:620px; width:100%; margin:0 auto; }
.podium div { border-radius:14px 14px 0 0; text-align:center; font-weight:900; padding:12px 4px; background:var(--panel2); overflow-wrap:anywhere; }
.podium small { display:block; font-weight:800; color:var(--sub); font-variant-numeric:tabular-nums; }
.podium .p1 { background:linear-gradient(#6a4e0c,#3c2d09); padding-block:46px 18px; font-size:1.15rem; } .podium .p2 { padding-block:28px 12px; }
.stats { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; }
.stat { background:#ffffff0a; border:1px solid var(--line); border-radius:13px; padding:12px; text-align:center; }
.stat b { display:block; font-size:1.7rem; font-weight:900; font-variant-numeric:tabular-nums; } .stat small { color:var(--sub); font-weight:700; font-size:.78rem; }
.qbars { display:grid; gap:7px; }
.qbar { display:grid; grid-template-columns:34px minmax(0,1fr) 92px 48px; gap:8px; align-items:center; font-size:.88rem; font-weight:800; font-variant-numeric:tabular-nums; }
.qbar .b { height:14px; border-radius:99px; background:#ffffff12; overflow:hidden; }
.qbar .b i { display:block; height:100%; background:var(--good); }
.qbar.hard .b i { background:var(--gold); }
.qbar span:last-child { text-align:right; }

/* question popup from the Every student table */
.qhead { background:rgba(245,184,46,.14); border:1px solid rgba(245,184,46,.4); border-radius:7px; padding:3px 8px; color:var(--gold); font-weight:900; font-size:.74rem; }
.qhead:hover { background:rgba(245,184,46,.28); }
.popbg { position:fixed; inset:0; z-index:50; background:rgba(5,4,14,.72); display:grid; place-items:center; padding:16px; overflow:auto; }
.popup { width:100%; max-width:620px; max-height:calc(100vh - 32px); overflow:auto; background:var(--panel); border:1px solid #39375f; border-radius:18px; padding:16px 18px 18px; display:grid; gap:12px; }
.pophead { display:flex; justify-content:space-between; align-items:center; gap:10px; }
.popx { width:40px; height:40px; border-radius:50%; border:1.5px solid #ffffff2b; background:transparent; font-size:1.05rem; font-weight:900; }
.popx:hover { background:#ffffff14; }
.popans { display:grid; gap:4px; }
.popnames { margin:0 0 0 39px; color:#d8d7f0; font-size:.84rem; font-weight:700; line-height:1.4; overflow-wrap:anywhere; }
.popnone { margin:0; font-size:.86rem; font-weight:900; color:var(--sub); }
.popans > .popnone + .popnames { margin-left:0; }

/* student */
.phone { max-width:480px; min-height:100vh; margin:0 auto; padding:16px 14px; display:flex; flex-direction:column; gap:12px; text-align:center; }
.who { display:flex; justify-content:space-between; align-items:center; gap:6px; }
.who span.me { font-size:.9rem; font-weight:900; }
.ava { width:96px; height:96px; font-size:3.2rem; border-radius:50%; display:grid; place-items:center; background:#00000040; box-shadow:0 0 0 3px var(--gold); margin:0 auto; }
.ph { margin:0; font-size:1.35rem; font-weight:900; }
.pm { margin:0; font-weight:700; color:var(--sub); font-size:.92rem; line-height:1.4; }
.pm.bad { color:var(--bad); }
.pq { font-size:2.3rem; font-weight:900; font-variant-numeric:tabular-nums; }
.pans { display:grid; grid-template-columns:1fr; gap:10px; flex:1; align-content:center; }
.pans button { background:var(--c); border:none; border-radius:15px; min-height:74px; display:flex; align-items:center; gap:12px; padding:0 15px; font-size:1.7rem; font-weight:900; color:#fff; box-shadow:0 4px 0 #00000055; font-variant-numeric:tabular-nums; }
.pans button:active { transform:translateY(3px); box-shadow:0 1px 0 #00000055; }
.pans em { font-style:normal; width:34px; height:34px; border-radius:9px; background:#00000038; display:grid; place-items:center; font-size:.95rem; }
.result { border-radius:18px; padding:22px 10px; display:grid; gap:6px; }
.result.ok { background:rgba(52,211,153,.15); } .result.no { background:rgba(253,164,175,.12); }
.result b { font-size:1.5rem; font-weight:900; }
.mini { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.mini div { background:#ffffff0c; border-radius:13px; padding:12px 4px; }
.mini b { display:block; font-size:1.3rem; font-weight:900; font-variant-numeric:tabular-nums; } .mini small { color:var(--sub); font-size:.76rem; font-weight:700; }
.dots { display:flex; gap:6px; justify-content:center; flex-wrap:wrap; }
.dots i { width:32px; height:32px; border-radius:9px; display:grid; place-items:center; font-style:normal; font-size:.82rem; font-weight:900; background:#ffffff12; }
.dots i.y { background:rgba(52,211,153,.25); color:#a7f3d0; } .dots i.n { background:rgba(253,164,175,.2); color:var(--bad); }
.note { margin:0; min-height:1.2em; font-size:.82rem; font-weight:800; color:var(--gold); text-align:center; }
.center { flex:1; display:grid; gap:12px; align-content:center; text-align:center; max-width:480px; margin:0 auto; padding:24px; }
@media (prefers-reduced-motion:reduce) { .track i, .drow .b i { transition:none; } }
.qtxt.long { font-size:clamp(1.5rem,3.6vw,2.6rem); line-height:1.25; text-wrap:balance; }
.pq.long { font-size:1.25rem; line-height:1.35; }
/* Drawn questions (shapes.js), the same marks as Classic's in style.css. */
.qfig { width:100%; max-width:340px; height:auto; display:block; margin:0 auto 8px; }
.pq .qfig { max-width:250px; }
.qfig text { fill:var(--text, #f1f5f9); font-family:inherit; font-weight:900; font-size:15px; text-anchor:middle; dominant-baseline:middle; }
.qfig .qfig-dim { fill:var(--sub, #94a3b8); }
.qfig .qfig-q { fill:#f5b82e; font-size:18px; }
.qfig-shape { fill:rgba(56,189,248,.16); stroke:#38bdf8; stroke-width:3; stroke-linejoin:round; }
.qfig-mark { fill:none; stroke:#38bdf8; stroke-width:2; }
.qfig-height { stroke:var(--sub, #94a3b8); stroke-width:2; stroke-dasharray:5 4; }
.qfig-radius { stroke:var(--text, #f1f5f9); stroke-width:2.5; }
.qfig-dot { fill:var(--text, #f1f5f9); }
.qfig-line { stroke:#38bdf8; stroke-width:3; stroke-linecap:round; }
.qfig-known { fill:none; stroke:#f472b6; stroke-width:2.5; }
.qfig-miss  { fill:none; stroke:#f5b82e; stroke-width:2.5; }
.qfig text.qfig-known-t { fill:#f472b6; font-size:14px; }
.qfig text.qfig-miss-t  { fill:#f5b82e; font-size:19px; }
.qfig text.qfig-note    { fill:var(--sub, #94a3b8); font-size:11px; font-weight:700; }

/* Student Top 5 and answer review */
.sboard { background:#ffffff0a; border:1px solid var(--line); border-radius:14px; padding:10px 12px 6px; text-align:left; }
.sboard h3, .rcard h3, .rtop h3 { margin:0; font-size:.74rem; font-weight:900; color:var(--sub); letter-spacing:.06em; text-transform:uppercase; }
.sboard h3 { margin-bottom:4px; }
.srow { display:grid; grid-template-columns:24px minmax(0,1fr) auto; gap:8px; align-items:center; padding:6px 8px; margin:0 -8px; border-radius:9px; font-weight:800; font-size:.92rem; font-variant-numeric:tabular-nums; }
.srow .r { color:var(--sub); font-weight:900; }
.srow .nm { overflow-wrap:anywhere; }
.srow .s { font-weight:900; }
.srow.me { background:rgba(139,92,246,.3); }
.sgap { text-align:center; color:var(--sub); font-weight:900; line-height:1; }
.rtop { display:flex; justify-content:space-between; align-items:center; gap:8px; }
.rmark { width:28px; height:28px; border-radius:50%; display:grid; place-items:center; font-weight:900; font-size:.86rem; flex:none; }
.rmark.y { background:var(--good); color:#03261a; } .rmark.n { background:#e11d48; color:#fff; }
.rcard { background:#ffffff0a; border:1px solid var(--line); border-radius:14px; padding:14px; display:grid; gap:11px; text-align:left; }
.rq { font-size:1.2rem; font-weight:900; line-height:1.35; overflow-wrap:anywhere; }
.rq .qfig { max-width:250px; }
.rpair { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.rpair div { background:#00000030; border-radius:11px; padding:8px 10px; min-width:0; }
.rpair small { display:block; color:var(--sub); font-size:.72rem; font-weight:800; }
.rpair b { font-size:1.1rem; font-weight:900; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.rpair .bad b { color:var(--bad); } .rpair .good b { color:var(--good); }
.rsteps { margin:0; padding-left:22px; display:grid; gap:6px; font-weight:700; line-height:1.4; }
.rnav { display:grid; grid-template-columns:1fr 1fr; gap:8px; }

/* Homework (homework.html): the card at the top, and the clock that runs down */
.hwcard { background:linear-gradient(135deg, rgba(124,58,237,.32), rgba(37,99,235,.22)); border:1px solid #5b47c9; border-radius:16px; padding:14px; display:grid; gap:8px; text-align:left; }
.hwt { margin:0; font-size:1.3rem; font-weight:900; }
.hwchips { display:flex; flex-wrap:wrap; gap:6px; }
.hwdue { margin:0; color:var(--gold); font-weight:800; font-size:.9rem; }
.hwclock { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px; align-items:center; }
.hwclock .track i { background:var(--gold); transition:width .25s linear; }
.hwclock b { min-width:2ch; font-weight:900; font-variant-numeric:tabular-nums; }
.phone.hw .tbtn, .phone.hw .gbtn { width:100%; }
@media (prefers-reduced-motion:reduce) { .hwclock .track i { transition:none; } }
/* Class Live lobby: which class the game is for. Gold until one is picked. */
.setrow .classpick { grid-column:1 / -1; }
.setrow select.need { border-color:var(--gold); box-shadow:0 0 0 2px rgba(245,184,46,.25); }
.needclass { grid-column:1 / -1; margin:0; color:var(--gold); font-weight:800; font-size:.86rem; }
/* Show code: the lobby-size code over the game, for students who join late. */
.codebg { z-index:60; background:rgba(5,4,14,.88); }
.bigcode { width:100%; max-width:760px; background:var(--panel); border:1px solid #39375f; border-radius:22px; padding:28px 24px; display:grid; gap:12px; justify-items:center; text-align:center; }
.bigcode small { color:var(--sub); font-weight:700; font-size:1.05rem; line-height:1.4; }
.bigcode .code { font-size:clamp(3.4rem,12vw,8rem); font-weight:900; letter-spacing:.12em; color:var(--gold); line-height:1; }
.bigcode .joined { font-weight:800; color:var(--good); }
/* Music (music.js): the teacher's Music button, mute, and the side panel with every track. */
.mctl { display:flex; gap:8px; align-items:center; }
.mchip { display:flex; align-items:center; gap:6px; border:1.5px solid #ffffff2b; background:#ffffff0d; border-radius:999px; padding:6px 13px; font-size:.82rem; font-weight:800; white-space:nowrap; }
.mute { width:40px; height:34px; padding:0; border-radius:999px; border:1.5px solid #ffffff2b; background:#ffffff0d; font-size:1rem; display:grid; place-items:center; }
.mute.off { border-color:rgba(253,164,175,.5); }
.musicpick { grid-column:1 / -1; display:grid; gap:3px; font-size:.72rem; font-weight:900; color:var(--sub); }
.mbtn { display:flex; align-items:center; gap:8px; width:100%; border:1px solid var(--line); background:var(--panel2); border-radius:10px; padding:8px 10px; font-weight:800; font-size:.9rem; color:var(--text); text-align:left; }
.mbtn em { margin-left:auto; font-style:normal; color:var(--gold); font-size:.8rem; }
.musicbg { z-index:55; }
.mpanel { position:fixed; top:0; right:0; bottom:0; z-index:56; width:min(400px,100%); background:var(--panel); border-left:1px solid #39375f; padding:16px; display:flex; flex-direction:column; gap:10px; box-shadow:-14px 0 40px #0008; overflow:auto; }
.mpanel .pophead b { font-size:1.2rem; font-weight:900; }
.mrowon { display:flex; align-items:center; justify-content:space-between; gap:8px; background:#ffffff0a; border-radius:12px; padding:8px 10px; font-weight:800; }
.mtiles { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
.mtile { display:grid; gap:2px; text-align:left; border:1.5px solid var(--line); background:var(--panel2); border-radius:12px; padding:8px 10px; }
.mtile b { font-size:.9rem; font-weight:900; display:flex; justify-content:space-between; align-items:center; gap:6px; }
.mtile small { font-size:.72rem; font-weight:700; color:var(--sub); }
.mtile .pl { font-size:.72rem; color:var(--sub); }
.mtile.sel { border-color:var(--gold); background:#3a2f17; }
.eq { display:inline-flex; gap:2px; align-items:flex-end; height:12px; }
.eq i { width:3px; border-radius:2px; background:var(--gold); animation:eq .8s ease-in-out infinite alternate; }
.eq i:nth-child(2) { animation-delay:-.3s; } .eq i:nth-child(3) { animation-delay:-.55s; }
@keyframes eq { from { height:3px; } to { height:12px; } }
@media (prefers-reduced-motion:reduce) { .eq i { animation:none; height:9px; } }
