/* Flagfall. A sports-day look: sky, white cards with a firm navy line, flags for colour. */
@font-face { font-family: 'Barlow'; src: url('/fonts/barlow-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('/fonts/barlow-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; src: url('/fonts/barlow-condensed-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; src: url('/fonts/barlow-condensed-800.woff2') format('woff2'); font-weight: 800; font-display: swap; }

:root {
  --sky: #d5e9f8; --sky2: #c3def3; --paper: #fff; --ink: #0d2440; --ink2: #47607b; --ink3: #7f95ab; --line: #b9cfe2; --wash: #edf4fa;
  --blue: #1d5fd3; --red: #e5484d; --green: #12a063; --gold: #f1b70c; --silver: #a7b5c2; --bronze: #c98c4f; --violet: #6b4fd6; --teal: #0b9aa6;
  --k: var(--blue);
  --disp: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif; --text: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r: 18px; --edge: 2px solid var(--ink); --drop: 0 4px 0 var(--ink);
}
.k-reflex { --k: var(--red); } .k-estimate { --k: var(--violet); } .k-memory { --k: var(--blue); }
.k-perception { --k: var(--green); } .k-logic { --k: #d98f00; } .k-knowledge { --k: var(--teal); }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--sky); color: var(--ink); font: 500 16px/1.4 var(--text); -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
button:disabled { cursor: default; }
img { display: block; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.num { font-family: var(--disp); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .01em; }

/* ---- frame -------------------------------------------------------------------------------- */
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding: 0 14px calc(84px + env(safe-area-inset-bottom)); }
.top { display: flex; align-items: center; gap: 10px; padding: 12px 2px 8px; }
.mark { font: 800 30px/1 var(--disp); letter-spacing: .04em; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.mark i { width: 22px; height: 24px; border-left: 4px solid var(--ink); border-radius: 2px; position: relative; display: block; }
.mark i::after { content: ''; position: absolute; left: 0; top: 1px; width: 17px; height: 12px; background: var(--red); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.daychip { font: 800 15px/1 var(--disp); letter-spacing: .06em; text-transform: uppercase; background: var(--ink); color: #fff; padding: 6px 9px 5px; border-radius: 8px; }
.top .sp { flex: 1; }
.icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--paper); border: var(--edge); }
.icon svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.icon.off svg .wave { display: none; } .icon:not(.off) svg .x { display: none; }
.bunting { height: 18px; margin: 0 -14px 10px; background: repeating-linear-gradient(90deg, var(--red) 0 22px, var(--gold) 22px 44px, var(--blue) 44px 66px, var(--green) 66px 88px, var(--violet) 88px 110px); -webkit-mask: conic-gradient(from 330deg at 50% 100%, #000 60deg, #0000 0) 0 0 / 22px 100%; mask: conic-gradient(from 330deg at 50% 100%, #000 60deg, #0000 0) 0 0 / 22px 100%; opacity: .95; }
body.inplay .tabs { display: none; } body.inplay #app { padding-bottom: 20px; }
main { flex: 1; display: flex; flex-direction: column; gap: 14px; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: linear-gradient(#d5e9f800, var(--sky) 30%); pointer-events: none; }
.tabs div { pointer-events: auto; display: flex; gap: 4px; background: var(--ink); padding: 5px; border-radius: 18px; width: 100%; max-width: 420px; }
.tabs button { flex: 1; color: #b9cde0; font: 800 16px/1 var(--disp); letter-spacing: .06em; text-transform: uppercase; padding: 12px 4px 11px; border-radius: 13px; }
.tabs button.on { background: var(--paper); color: var(--ink); }

.card { background: var(--paper); border: var(--edge); border-radius: var(--r); box-shadow: var(--drop); padding: 16px; }
.btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 58px; padding: 10px 18px; border-radius: 16px; background: var(--blue); color: #fff; border: var(--edge); box-shadow: var(--drop); font: 800 24px/1 var(--disp); letter-spacing: .04em; text-transform: uppercase; transition: transform .06s, box-shadow .06s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn.alt { background: var(--paper); color: var(--ink); } .btn.small { min-height: 46px; font-size: 19px; width: auto; }
.btn img { width: 30px; height: 30px; }
.link { color: var(--blue); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.flag { width: 28px; height: 28px; flex: none; }
.muted { color: var(--ink2); } .tiny { font-size: 13px; color: var(--ink2); }

/* ---- cover -------------------------------------------------------------------------------- */
.hero { text-align: center; padding: 20px 16px 18px; display: flex; flex-direction: column; gap: 12px; align-items: center; background: var(--paper) repeating-linear-gradient(180deg, #0000 0 34px, #e6f0f8 34px 36px); }
.hero h1 { font: 800 clamp(34px, 10vw, 46px)/.95 var(--disp); letter-spacing: .01em; text-transform: uppercase; }
.hero h1 span { color: var(--blue); }
.hero .who { display: flex; align-items: center; gap: 10px; background: var(--paper); border: var(--edge); border-radius: 999px; padding: 5px 14px 5px 6px; font-weight: 700; }
.hero .who img { width: 34px; height: 34px; }
.hero .who small { display: block; font-size: 12px; font-weight: 500; color: var(--ink2); line-height: 1; }
.hero .who button { margin-left: 4px; font-size: 14px; }
.kinds { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.kinds span { font: 800 14px/1 var(--disp); letter-spacing: .08em; text-transform: uppercase; color: #fff; background: var(--k); padding: 6px 8px 5px; border-radius: 7px; }
.status { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.status .big { font: 800 22px/1.05 var(--disp); letter-spacing: .01em; }
.status .flag { width: 40px; height: 40px; }
.countdown { text-align: center; font: 600 17px/1 var(--disp); letter-spacing: .06em; text-transform: uppercase; color: var(--ink2); }
.note { background: #fff8dc; border: 2px solid var(--ink); border-radius: 12px; padding: 10px 12px; font-size: 14px; }

/* ---- board (rows of countries) -------------------------------------------------------------- */
.board { display: flex; flex-direction: column; gap: 0; }
.bhead { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.bhead h3 { font: 800 22px/1 var(--disp); letter-spacing: .03em; text-transform: uppercase; }
.bhead .live { margin-left: auto; font: 800 13px/1 var(--disp); letter-spacing: .1em; text-transform: uppercase; color: var(--green); display: flex; align-items: center; gap: 5px; }
.bhead .live::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.rows { display: flex; flex-direction: column; position: relative; }
.row { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 12px; min-height: 46px; width: 100%; text-align: left; position: relative; background: var(--paper); }
.row + .row { box-shadow: 0 -1px 0 var(--wash); }
.row .rk { width: 30px; text-align: right; font: 800 20px/1 var(--disp); color: var(--ink2); font-variant-numeric: tabular-nums; flex: none; }
.row .nm { flex: 1; min-width: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.15; }
.row .nm small { display: block; font-weight: 500; font-size: 12px; color: var(--ink3); }
.row .sc { font: 800 22px/1 var(--disp); font-variant-numeric: tabular-nums; text-align: right; min-width: 58px; }
.row .pt { font: 800 16px/1 var(--disp); color: var(--ink2); min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.row .pt b { color: var(--green); font-weight: 800; }
.row.est .nm, .row.est .sc { color: var(--ink3); } .row.est .flag { opacity: .45; filter: grayscale(.6); }
.row .tag { font: 800 11px/1 var(--disp); letter-spacing: .08em; text-transform: uppercase; color: var(--ink3); border: 1.5px solid var(--line); border-radius: 5px; padding: 2px 4px 1px; margin-left: 5px; vertical-align: 2px; }
.row.me { background: var(--ink); color: #fff; z-index: 2; box-shadow: none; }
.row.me .rk, .row.me .nm small, .row.me .pt { color: #b9cde0; } .row.me .sc { color: #fff; }
.row.rival .nm::after { content: 'rival'; font: 800 11px/1 var(--disp); letter-spacing: .08em; text-transform: uppercase; color: #fff; background: var(--red); border-radius: 5px; padding: 2px 5px 1px; margin-left: 6px; vertical-align: 2px; }
.row .medal, .medal { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--ink); flex: none; display: inline-block; }
.medal.m1 { background: var(--gold); } .medal.m2 { background: var(--silver); } .medal.m3 { background: var(--bronze); }
.row.up::before, .row.dn::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px; border-radius: 2px; background: var(--green); }
.row.dn::before { background: var(--red); }
.row.gap { justify-content: center; color: var(--ink3); min-height: 26px; padding: 0; font-weight: 700; letter-spacing: .2em; }
.row.bump .sc { animation: bump .5s; }
@keyframes bump { 30% { transform: scale(1.25); color: var(--green); } }
.legend { font-size: 12.5px; color: var(--ink2); margin-top: 10px; }
.ticker { font-size: 14px; font-weight: 700; color: var(--ink2); min-height: 20px; margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.ticker img { width: 20px; height: 20px; }
.seg { display: flex; background: var(--sky2); border: var(--edge); border-radius: 14px; padding: 3px; gap: 3px; }
.seg button { flex: 1; font: 800 16px/1 var(--disp); letter-spacing: .05em; text-transform: uppercase; padding: 10px 4px 9px; border-radius: 10px; color: var(--ink2); }
.seg button.on { background: var(--ink); color: #fff; }
.zone { font: 800 12px/1 var(--disp); letter-spacing: .1em; text-transform: uppercase; color: var(--ink3); display: flex; gap: 14px; margin-top: 8px; }
.zone i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; background: var(--green); } .zone i.d { background: var(--red); }
.cols { display: flex; justify-content: flex-end; gap: 9px; font: 800 12px/1 var(--disp); letter-spacing: .1em; text-transform: uppercase; color: var(--ink3); padding: 0 8px 4px; }
.cols span { min-width: 58px; text-align: right; } .cols span.p { min-width: 44px; }

/* ---- playing ------------------------------------------------------------------------------ */
.prog { display: flex; gap: 6px; }
.prog i { flex: 1; height: 34px; border-radius: 10px; border: var(--edge); background: var(--paper); display: grid; place-items: center; font: 800 18px/1 var(--disp); font-style: normal; color: var(--ink); }
.prog i.done { background: var(--k); color: #fff; } .prog i.now { background: var(--paper); box-shadow: inset 0 -5px 0 var(--k); }
.ehead { display: flex; flex-direction: column; gap: 4px; }
.ehead .kind { align-self: flex-start; font: 800 14px/1 var(--disp); letter-spacing: .1em; text-transform: uppercase; color: #fff; background: var(--k); padding: 6px 9px 5px; border-radius: 7px; }
.ehead h2 { font: 800 34px/1 var(--disp); letter-spacing: .01em; text-transform: uppercase; }
.ehead p { font-size: 17px; color: var(--ink2); min-height: 2.8em; }
.stage { position: relative; background: var(--paper); border: var(--edge); border-radius: var(--r); box-shadow: var(--drop); height: min(calc(100dvh - 330px), 480px); min-height: 330px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 22px 14px 14px; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.stage.idle { background: var(--paper) repeating-linear-gradient(180deg, #0000 0 34px, #e6f0f8 34px 36px); }
.stage .btn.go { width: auto; min-width: 180px; background: var(--k); }
.over { position: absolute; inset: 0; background: #fffffff2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 16px; animation: fade .25s; z-index: 5; }
@keyframes fade { from { opacity: 0; } }
.over .sc { font: 800 112px/.9 var(--disp); color: var(--k); font-variant-numeric: tabular-nums; }
.over .of { font: 600 18px/1 var(--disp); letter-spacing: .08em; text-transform: uppercase; color: var(--ink3); }
.over .vd { font: 800 30px/1 var(--disp); text-transform: uppercase; letter-spacing: .02em; margin-top: 6px; }
.over .nt { color: var(--ink2); text-align: center; }
.over .btn { margin-top: 14px; max-width: 300px; }

.pips { position: absolute; top: 14px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; pointer-events: none; }
.pips i { width: 22px; height: 6px; border-radius: 3px; background: var(--line); }
.pips i.now { background: var(--ink); } .pips i.ok { background: var(--green); } .pips i.no { background: var(--red); }
.clock { position: absolute; left: 0; right: 0; top: 0; height: 7px; background: var(--wash); }
.clock i { display: block; height: 100%; background: var(--k); transform-origin: left; }
.clock.low i { background: var(--red); } .clock.hit { animation: shake .25s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.fmsg { font: 800 24px/1.1 var(--disp); letter-spacing: .02em; text-transform: uppercase; min-height: 27px; text-align: center; color: var(--ink2); }
.fmsg.go { color: var(--k); } .fmsg.res { color: var(--ink); } .fmsg.bad { color: var(--red); }
.say { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); background: var(--ink); color: #fff; font: 800 20px/1.1 var(--disp); letter-spacing: .03em; text-transform: uppercase; padding: 10px 14px 9px; border-radius: 12px; white-space: nowrap; animation: fade .2s; z-index: 3; }
.ebtn { min-height: 52px; min-width: 150px; padding: 8px 20px; border-radius: 14px; background: var(--k); color: #fff; border: var(--edge); box-shadow: 0 3px 0 var(--ink); font: 800 22px/1 var(--disp); letter-spacing: .05em; text-transform: uppercase; }
.ebtn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); } .ebtn:disabled { opacity: .35; }
.ebtn.small { min-width: 52px; width: 52px; padding: 0; background: var(--paper); color: var(--ink); font-size: 30px; }
.eslider { -webkit-appearance: none; appearance: none; width: 100%; max-width: 360px; height: 44px; background: none; margin: 0; }
.eslider::-webkit-slider-runnable-track { height: 14px; border-radius: 7px; background: var(--wash); border: var(--edge); }
.eslider::-moz-range-track { height: 12px; border-radius: 7px; background: var(--wash); border: var(--edge); }
.eslider::-webkit-slider-thumb { -webkit-appearance: none; width: 36px; height: 36px; margin-top: -13px; border-radius: 50%; background: var(--k); border: var(--edge); box-shadow: 0 2px 0 var(--ink); }
.eslider::-moz-range-thumb { width: 32px; height: 32px; border-radius: 50%; background: var(--k); border: var(--edge); }
.eslider.hue::-webkit-slider-runnable-track { background: linear-gradient(90deg, hsl(0 72% 52%), hsl(60 72% 52%), hsl(120 72% 52%), hsl(180 72% 52%), hsl(240 72% 52%), hsl(300 72% 52%), hsl(360 72% 52%)); }
.eslider.hue::-moz-range-track { background: linear-gradient(90deg, hsl(0 72% 52%), hsl(60 72% 52%), hsl(120 72% 52%), hsl(180 72% 52%), hsl(240 72% 52%), hsl(300 72% 52%), hsl(360 72% 52%)); }
.eslider.hue::-webkit-slider-thumb { background: #fff; } .eslider.hue::-moz-range-thumb { background: #fff; }

/* reflex */
.fpole { position: relative; width: 150px; height: 62%; border-left: 7px solid var(--ink); border-radius: 4px; margin-left: 110px; }
.fpole::before { content: ''; position: absolute; left: -15px; top: -12px; width: 22px; height: 22px; border-radius: 50%; background: var(--gold); border: var(--edge); }
.fpole::after { content: ''; position: absolute; left: -60px; bottom: -4px; width: 120px; height: 8px; border-radius: 4px; background: var(--ink); }
.fcloth { position: absolute; left: -2px; top: 4%; width: 128px; height: 92px; overflow: hidden; transition: top .11s cubic-bezier(.6, 0, 1, .7); }
.fcloth img { width: 128px; height: 128px; margin-top: -18px; }
.fcloth.down { top: calc(100% - 96px); }
.strack { position: relative; width: 88%; height: 56px; border-radius: 28px; background: var(--wash); border: var(--edge); margin: 30px 0; }
.strack .sgoal { position: absolute; top: -14px; bottom: -14px; width: 5px; margin-left: -2.5px; background: var(--ink); border-radius: 3px; }
.strack .sdot { position: absolute; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; background: var(--k); border: var(--edge); }
.sdial { position: relative; width: min(62%, 240px); aspect-ratio: 1; border-radius: 50%; background: var(--wash); border: var(--edge); }
.sdial .sgoal, .sdial .sdot { position: absolute; inset: 0; }
.sdial .sgoal::before { content: ''; position: absolute; left: 50%; top: -12px; width: 5px; height: 34px; margin-left: -2.5px; background: var(--ink); border-radius: 3px; }
.sdial .sdot::before { content: ''; position: absolute; left: 50%; top: -6px; width: 30px; height: 30px; margin-left: -15px; border-radius: 50%; background: var(--k); border: var(--edge); }
.sdot.hit, .sdial .sdot.hit::before { background: var(--green); } .sdot.miss, .sdial .sdot.miss::before { background: var(--ink3); }
.sdial .sdot.hit, .sdial .sdot.miss { background: none; }
.hwant { font: 800 48px/1 var(--disp); text-transform: uppercase; }
.hbtn { width: 164px; height: 164px; border-radius: 50%; background: var(--k); color: #fff; border: var(--edge); box-shadow: 0 6px 0 var(--ink); font: 800 34px/1 var(--disp); letter-spacing: .04em; text-transform: uppercase; touch-action: none; }
.hbtn.down { transform: translateY(5px); box-shadow: 0 1px 0 var(--ink); filter: brightness(.86); } .hbtn.done { background: var(--paper); color: var(--ink); font-size: 46px; }
.bdrum { width: 150px; height: 150px; border-radius: 50%; background: var(--wash); border: var(--edge); display: grid; place-items: center; }
.bdrum i { width: 56%; height: 56%; border-radius: 50%; background: var(--line); }
.bdrum.hit i { animation: thump .22s; background: var(--k); } .bdrum.mine i { animation: thump .22s; background: var(--ink); }
@keyframes thump { 0% { transform: scale(1.75); } 100% { transform: scale(1); } }
.bdots { display: flex; gap: 7px; } .bdots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); }
.bdots i.on { background: var(--ink); } .bdots i.lead.on { background: var(--k); }

/* estimate */
.dfield { position: relative; width: 100%; max-width: 380px; aspect-ratio: 1 / .78; border-radius: 14px; background: var(--wash); border: var(--edge); }
.dfield i { position: absolute; aspect-ratio: 1; border-radius: 50%; background: var(--ink); transform: translate(-50%, -50%); }
.dfield.hid { background: repeating-linear-gradient(135deg, var(--wash) 0 10px, #dfeaf4 10px 20px); display: none; }
.dpanel { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.dq { font: 800 26px/1 var(--disp); text-transform: uppercase; }
.drow { display: flex; align-items: center; gap: 16px; } .dnum { font: 800 84px/.9 var(--disp); min-width: 130px; text-align: center; font-variant-numeric: tabular-nums; }
.psvg { width: min(88%, 340px); touch-action: none; cursor: ew-resize; flex: none; }
.psvg.tall { width: auto; height: 62%; cursor: ns-resize; }
.pblob { fill: #e3ecf5; stroke: var(--ink); stroke-width: .9; stroke-linejoin: round; } .pblob.part { fill: var(--k); }
.pcut { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2.5 2; }
.vliq { fill: var(--k); } .vout { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; }
.vtick { stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 3 2; opacity: 0; } .shown .vtick { opacity: 1; }
.vwant { font: 800 34px/1 var(--disp); text-transform: uppercase; }
.cfield { position: relative; width: 100%; max-width: 380px; aspect-ratio: 1 / .86; border-radius: 14px; background: var(--wash); border: var(--edge); touch-action: none; cursor: crosshair; }
.cdot { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--ink); pointer-events: none; }
.ccross { position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; pointer-events: none; background: linear-gradient(var(--k), var(--k)) 50% / 4px 100% no-repeat, linear-gradient(var(--k), var(--k)) 50% / 100% 4px no-repeat; }
.ctrue { position: absolute; width: 24px; height: 24px; margin: -12px 0 0 -12px; border-radius: 50%; border: 4px solid var(--green); pointer-events: none; animation: fade .3s; }

/* memory */
.mpads { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: min(74%, 290px); aspect-ratio: 1; }
.mpad { border-radius: 20px; border: var(--edge); opacity: .38; transition: opacity .08s, transform .08s; }
.mpad.p0 { background: var(--red); } .mpad.p1 { background: var(--blue); } .mpad.p2 { background: var(--gold); } .mpad.p3 { background: var(--green); }
.mpad.lit { opacity: 1; transform: scale(1.04); } .mpad.wrong { opacity: 1; background: var(--ink); }
.mpads.open .mpad { opacity: .6; }
.mboard { display: grid; gap: 6px; width: 100%; max-width: 370px; position: relative; }
.mboard.c4 { grid-template-columns: repeat(4, 1fr); max-width: 320px; } .mboard.c5 { grid-template-columns: repeat(5, 1fr); } .mboard.c6 { grid-template-columns: repeat(6, 1fr); max-width: 320px; gap: 4px; }
.mtile { aspect-ratio: 1 / .82; border-radius: 10px; background: var(--wash); border: var(--edge); font: 800 28px/1 var(--disp); display: grid; place-items: center; }
.sq .mtile { aspect-ratio: 1; } .nums .mtile { aspect-ratio: 1; font-size: 30px; }
.mtile.none { visibility: hidden; } .mtile.hid { background: var(--ink); color: transparent; }
.mtile.ok { background: var(--green); color: #fff; } .mtile.wrong { background: var(--red); color: #fff; animation: shake .25s; }
.mtile.lit { background: var(--k); } .mtile.missed { background: repeating-linear-gradient(135deg, var(--k) 0 5px, var(--wash) 5px 10px); }
.mtile.given { background: var(--ink); } .mtile.mine { background: #fff; } .mtile.on { background: var(--k); }
.mir::after { content: ''; position: absolute; background: var(--red); border-radius: 2px; }
.mir.v::after { left: 50%; top: -8px; bottom: -8px; width: 4px; margin-left: -2px; } .mir.h::after { top: 50%; left: -8px; right: -8px; height: 4px; margin-top: -2px; }
.kswatch { width: min(60%, 230px); aspect-ratio: 1.25; border-radius: 18px; border: var(--edge); display: flex; align-items: flex-end; justify-content: space-around; padding: 8px; }
.kswatch.gone { background: repeating-linear-gradient(135deg, var(--wash) 0 10px, #dfeaf4 10px 20px) !important; }
.kswatch span { background: var(--ink); color: #fff; font: 800 13px/1 var(--disp); letter-spacing: .08em; text-transform: uppercase; padding: 5px 7px 4px; border-radius: 6px; }
.kpanel { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; min-height: 116px; }

/* perception */
.oboard { display: grid; gap: 5px; width: min(92%, 340px); aspect-ratio: 1; }
.otile { border-radius: 9px; } .otile.wrong { animation: shake .25s; } .oboard.over .otile.show { outline: 4px solid var(--ink); outline-offset: -2px; }
.ctable { position: relative; width: 100%; max-width: 400px; height: 50%; border-bottom: 6px solid var(--ink); border-radius: 0 0 4px 4px; }
.cup { position: absolute; bottom: 0; aspect-ratio: 1 / 1.12; transform: translate(-50%, 0); transition: left linear, transform .15s; }
.cup.over { transform: translate(-50%, -22%); z-index: 2; } .cup.under { transform: translate(-50%, 0) scale(.94); }
.cbody { position: absolute; inset: 0; background: var(--k); border: var(--edge); border-radius: 42% 42% 10px 10px / 30% 30% 10px 10px; transition: transform .28s; }
.cbody::after { content: ''; position: absolute; left: 12%; right: 12%; bottom: 10%; height: 6px; border-radius: 3px; background: #ffffff66; }
.cup.up .cbody { transform: translateY(-62%); }
.cball { position: absolute; left: 50%; bottom: 3%; width: 38%; aspect-ratio: 1; margin-left: -19%; border-radius: 50%; background: var(--gold); border: var(--edge); }
.ctable.open .cup { cursor: pointer; }
.bfield { position: relative; width: 100%; max-width: 380px; aspect-ratio: 1 / .92; }
.bcirc { position: absolute; aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, -50%); border: var(--edge); }
.bcirc.right { outline: 5px solid var(--green); outline-offset: 3px; } .bcirc.wrong { outline: 5px solid var(--red); outline-offset: 3px; } .bcirc.dim { opacity: .3; }

/* quiz */
.qask { width: 100%; min-height: 34%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; }
.qask.big { font: 800 72px/1 var(--disp); min-height: 30%; }
.qopts { display: grid; gap: 10px; width: 100%; max-width: 420px; } .qopts.c2 { grid-template-columns: 1fr 1fr; }
.qopt { background: var(--paper); border: var(--edge); border-radius: 14px; box-shadow: 0 3px 0 var(--ink); min-height: 74px; padding: 8px; display: grid; place-items: center; }
.qopt:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.qopt.right { background: #c9f0dc; } .qopt.wrong { background: #ffd4d6; } .qopt.dim { opacity: .4; }
.nseq { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.nseq b { font: 800 34px/1 var(--disp); background: var(--wash); border: var(--edge); border-radius: 10px; padding: 10px 10px 8px; min-width: 50px; font-variant-numeric: tabular-nums; }
.nseq b.q { background: var(--k); color: #fff; }
.nopt { font: 800 34px/1 var(--disp); font-variant-numeric: tabular-nums; }
.rshape { width: 74%; max-width: 96px; } .rshape rect { fill: var(--ink); } .rshape.big { width: 34%; max-width: 130px; } .rshape.big rect { fill: var(--k); }
.kq { font: 800 30px/1.05 var(--disp); text-transform: uppercase; } .kq.small { font-size: 20px; color: var(--ink2); }
.kname { font: 800 40px/1 var(--disp); text-transform: uppercase; }
.kcard { display: flex; flex-direction: column; align-items: center; gap: 4px; } .kcard b { font-weight: 700; line-height: 1.1; text-align: center; }
.kpic { font-size: 50px; line-height: 1.1; font-style: normal; } .kdisc { width: 54px; height: 54px; border-radius: 50%; border: var(--edge); }
.kflag { width: 62px; height: 62px; } .kflag.big { width: 92px; height: 78px; object-fit: cover; }

/* ---- the result ----------------------------------------------------------------------------- */
.res { display: flex; flex-direction: column; gap: 14px; }
.tiles { display: flex; gap: 6px; }
.tile { flex: 1; border: var(--edge); border-radius: 12px; background: var(--k); color: #fff; padding: 8px 2px 6px; text-align: center; }
.tile small { display: block; font: 800 11px/1 var(--disp); letter-spacing: .08em; text-transform: uppercase; opacity: .9; }
.tile b { font: 800 30px/1 var(--disp); font-variant-numeric: tabular-nums; }
.tile.wait { opacity: 0; transform: translateY(10px); } .tile { transition: opacity .25s, transform .25s; }
.total { display: flex; align-items: center; justify-content: center; gap: 12px; position: relative; }
.total .n { font: 800 96px/.85 var(--disp); font-variant-numeric: tabular-nums; }
.total .side { text-align: left; font: 600 17px/1.15 var(--disp); letter-spacing: .06em; text-transform: uppercase; color: var(--ink2); }
.total .side b { display: flex; align-items: center; gap: 6px; font: 800 22px/1 var(--disp); color: var(--ink); letter-spacing: .02em; }
.total .side img { width: 26px; height: 26px; }
.puck { position: fixed; z-index: 50; display: flex; align-items: center; gap: 6px; background: var(--gold); border: var(--edge); border-radius: 999px; padding: 5px 12px 4px 6px; font: 800 24px/1 var(--disp); box-shadow: 0 4px 0 var(--ink); pointer-events: none; }
.puck img { width: 28px; height: 28px; }
.headline { font: 800 clamp(26px, 7.4vw, 34px)/1.02 var(--disp); text-transform: uppercase; letter-spacing: .01em; text-align: center; }
.headline em { font-style: normal; color: var(--green); } .headline.wait, .after.wait { opacity: 0; transform: translateY(8px); }
.headline, .after { transition: opacity .35s, transform .35s; }
.sub { text-align: center; color: var(--ink2); font-weight: 700; }
.delta { position: absolute; right: 8px; top: -14px; background: var(--green); color: #fff; font: 800 16px/1 var(--disp); padding: 4px 7px 3px; border-radius: 7px; border: var(--edge); animation: rise 1.6s forwards; z-index: 3; }
@keyframes rise { 0% { opacity: 0; transform: translateY(8px); } 15% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px); } }
.after { display: flex; flex-direction: column; gap: 14px; }
.rivalcard { display: flex; align-items: center; gap: 12px; }
.rivalcard img { width: 46px; height: 46px; } .rivalcard h4 { margin: 0; font: 800 13px/1 var(--disp); letter-spacing: .1em; text-transform: uppercase; color: var(--red); }
.rivalcard b { font: 800 22px/1.05 var(--disp); display: block; } .rivalcard span { font-size: 14px; color: var(--ink2); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fact { background: var(--paper); border: var(--edge); border-radius: 14px; padding: 10px 12px; }
.fact b { font: 800 30px/1 var(--disp); display: block; } .fact span { font-size: 13px; color: var(--ink2); line-height: 1.2; display: block; }
canvas.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }
.toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 700; z-index: 80; animation: fade .2s; white-space: nowrap; }

/* ---- map ------------------------------------------------------------------------------------ */
.mapbox { padding: 10px; } .mapbox canvas { width: 100%; display: block; border-radius: 10px; background: var(--wash); touch-action: manipulation; cursor: pointer; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; } .chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; font: 800 15px/1 var(--disp); letter-spacing: .05em; text-transform: uppercase; padding: 8px 10px 7px; border-radius: 9px; border: var(--edge); background: var(--paper); }
.chips button.on { background: var(--ink); color: #fff; }
.mlegend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--ink2); margin-top: 8px; }
.mlegend i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.mpick { display: flex; align-items: center; gap: 10px; min-height: 48px; margin-top: 8px; }
.mpick img { width: 36px; height: 36px; } .mpick b { font: 800 22px/1 var(--disp); } .mpick span { font-size: 13px; color: var(--ink2); display: block; }

/* ---- you ------------------------------------------------------------------------------------ */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats .fact b { font-size: 34px; }
.days { display: flex; flex-direction: column; }
.dayrow { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-top: 2px solid var(--wash); }
.dayrow .d { font: 800 16px/1 var(--disp); letter-spacing: .06em; text-transform: uppercase; color: var(--ink2); width: 62px; }
.dayrow .bars { display: flex; gap: 3px; align-items: flex-end; height: 26px; flex: 1; } .dayrow .bars i { width: 9px; background: var(--k); border-radius: 2px 2px 0 0; }
.dayrow .t { font: 800 24px/1 var(--disp); } .dayrow img { width: 22px; height: 22px; }
.setrow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 2px solid var(--wash); font-weight: 700; }
.setrow:first-child { border-top: 0; } .setrow .sp { flex: 1; } .setrow img { width: 30px; height: 30px; }
.games { display: grid; gap: 8px; } .games h3 { font: 800 18px/1 var(--disp); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 2px; }
.games a { display: flex; gap: 10px; align-items: center; text-decoration: none; color: inherit; padding: 6px; border-radius: 12px; background: var(--paper); border: 2px solid var(--line); }
.games img { border-radius: 9px; } .games small { display: block; font-weight: 700; font-size: 15px; } .games b { font-weight: 500; font-size: 13px; color: var(--ink2); }
.foot { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; font-size: 14px; padding: 6px 0 4px; } .foot a, .foot button { color: var(--ink2); text-decoration: underline; text-underline-offset: 3px; font-weight: 700; }
.foot small { width: 100%; text-align: center; color: var(--ink3); }

/* ---- sheets and dialogs --------------------------------------------------------------------- */
.shade { position: fixed; inset: 0; background: #0d244099; z-index: 100; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet { background: var(--paper); border: var(--edge); border-bottom: 0; border-radius: 22px 22px 0 0; width: 100%; max-width: 560px; max-height: 88dvh; overflow-y: auto; padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; animation: up .25s cubic-bezier(.2, .8, .2, 1); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet h2 { font: 800 30px/1 var(--disp); text-transform: uppercase; letter-spacing: .01em; display: flex; align-items: center; gap: 10px; }
.sheet h2 img { width: 44px; height: 44px; } .sheet h2 .x { margin-left: auto; }
.sheet h4 { margin: 4px 0 0; font: 800 14px/1 var(--disp); letter-spacing: .1em; text-transform: uppercase; color: var(--ink3); }
.sheet .big3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sheet .line { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-top: 2px solid var(--wash); } .sheet .line b { font: 800 20px/1 var(--disp); margin-left: auto; white-space: nowrap; }
.sheet .line span small { display: block; color: var(--ink2); font-size: 12.5px; line-height: 1.25; }
.help dt { font: 800 20px/1.1 var(--disp); text-transform: uppercase; margin-top: 10px; } .help dd { margin: 2px 0 0; color: var(--ink2); font-size: 15px; }
.sheet textarea, .sheet input[type=search] { width: 100%; font: 500 16px/1.4 var(--text); color: var(--ink); border: var(--edge); border-radius: 12px; padding: 10px 12px; background: var(--wash); outline: none; }
.sheet textarea { min-height: 120px; resize: vertical; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.picklist { display: flex; flex-direction: column; max-height: 50dvh; overflow-y: auto; margin: 0 -6px; }
.picklist button { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 10px; text-align: left; font-weight: 700; }
.picklist button.on { background: var(--ink); color: #fff; } .picklist small { margin-left: auto; font-weight: 500; color: var(--ink3); font-size: 12px; }
.err { color: var(--red); font-weight: 700; font-size: 14px; min-height: 18px; }

/* ---- wide screens: the live table sits beside the game ------------------------------------- */
#side { display: none; }
@media (min-width: 1020px) {
  body { display: grid; grid-template-columns: minmax(0, 560px) 380px; justify-content: center; gap: 28px; align-items: start; }
  #app { margin: 0; width: 100%; padding-bottom: 30px; }
  #side { display: block; position: sticky; top: 76px; margin-top: 76px; }
  .tabs { position: static; background: none; padding: 0; order: -1; margin: 4px 0 12px; } .tabs div { max-width: none; }
  .top { order: -2; } .bunting { order: -1; display: none; }
  .stage { height: 480px; }
  .shade { align-items: center; } .sheet { border-bottom: var(--edge); border-radius: 22px; max-width: 480px; box-shadow: 0 6px 0 var(--ink); }
  .toast { bottom: 30px; }
}
@media (max-height: 640px) { .ehead p { min-height: 0; } .ehead h2 { font-size: 28px; } .stage { min-height: 300px; height: calc(100dvh - 270px); } }
@media (prefers-reduced-motion: reduce) { .bhead .live::before { animation: none; } }
#moment { display: flex; flex-direction: column; gap: 14px; }
