/* SAM/25 — poured concrete, ink, one hazard orange. Zero radius, hard shadows, visible grid. */
:root {
  --concrete: #bcb8b0;
  --mid: #8e8a82;
  --ink: #111110;
  --paper: #f1efe9;
  --hazard: #ff5a00;
  --grid: rgba(17, 17, 16, .07);
  --display: "Unbounded", "Arial Black", Impact, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --b: 4px;
  --sh: 6px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background-color: var(--concrete);
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='.35'/></svg>"),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 220px 220px, 48px 48px, 48px 48px;
  color: var(--ink);
  font: 500 16px/1.35 var(--mono);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--hazard); outline-offset: 3px; }

.av { display: block; width: 100%; height: auto; background: var(--paper); }

.caps { text-transform: uppercase; letter-spacing: .08em; }
.disp { font-family: var(--display); font-weight: 900; text-transform: uppercase; letter-spacing: -.02em; line-height: .92; text-wrap: balance; }
.num { font-variant-numeric: tabular-nums; }
.slab { background: var(--paper); border: var(--b) solid var(--ink); box-shadow: var(--sh) var(--sh) 0 var(--ink); }
.ink { background: var(--ink); color: var(--paper); }
.hz { background: var(--hazard); color: var(--ink); }
.stripes { background: repeating-linear-gradient(-45deg, var(--hazard) 0 14px, var(--ink) 14px 28px); }
.err { color: var(--paper); background: var(--ink); padding: 8px 10px; font-weight: 700; }
.err:empty { display: none; }
.conn { position: fixed; right: 0; bottom: 0; z-index: 9; padding: 6px 10px; font: 700 12px var(--mono); }

.btn {
  display: flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 56px; padding: 12px 18px; width: 100%;
  background: var(--paper); border: var(--b) solid var(--ink); box-shadow: var(--sh) var(--sh) 0 var(--ink);
  font: 700 18px/1.1 var(--display); text-transform: uppercase; letter-spacing: .02em;
  transition: transform .06s, box-shadow .06s;
}
.btn:active:not(:disabled) { transform: translate(var(--sh), var(--sh)); box-shadow: 0 0 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.go { background: var(--hazard); }
.btn.dark { background: var(--ink); color: var(--paper); box-shadow: var(--sh) var(--sh) 0 var(--hazard); }
.btn.sm { min-height: 40px; padding: 6px 10px; font-size: 13px; box-shadow: 3px 3px 0 var(--ink); border-width: 3px; width: auto; }
.btn.sm:active { transform: translate(3px, 3px); }
.btn.on { background: var(--ink); color: var(--paper); }

.field {
  width: 100%; min-height: 60px; padding: 10px 14px;
  background: var(--paper); border: var(--b) solid var(--ink); border-radius: 0;
  font: 700 22px var(--mono); text-transform: uppercase;
  -webkit-appearance: none; appearance: none;
}
.field:focus { outline: none; box-shadow: var(--sh) var(--sh) 0 var(--hazard); }

/* ───────────── PHONE (player + host) ───────────── */
.phone { max-width: 520px; margin: 0 auto; padding: 16px 16px 40px; display: flex; flex-direction: column; gap: 18px; min-height: 100%; }
.bar { display: flex; justify-content: space-between; align-items: stretch; border: var(--b) solid var(--ink); background: var(--ink); color: var(--paper); }
.bar > * { padding: 8px 10px; font: 700 13px var(--mono); text-transform: uppercase; letter-spacing: .08em; display: flex; align-items: center; }
.bar .logo { font: 900 15px var(--display); letter-spacing: -.01em; }
.bar .hz { color: var(--ink); }
.label { font: 700 12px var(--mono); text-transform: uppercase; letter-spacing: .12em; }
.big { font-size: clamp(40px, 13vw, 64px); }
.mid { font-size: clamp(26px, 8vw, 38px); }

.join-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.pick { position: relative; padding: 0; border: 3px solid var(--ink); background: var(--paper); box-shadow: 3px 3px 0 var(--ink); }
.pick .nm { display: block; font: 700 9px var(--mono); letter-spacing: .06em; padding: 3px 0; border-top: 3px solid var(--ink); background: var(--paper); }
.pick[aria-pressed="true"] { box-shadow: 3px 3px 0 var(--hazard); outline: 4px solid var(--hazard); outline-offset: 0; }
.pick[aria-pressed="true"] .nm { background: var(--hazard); }
.pick:disabled { opacity: .35; box-shadow: none; }
.pick:disabled::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top right, transparent calc(50% - 2px), var(--ink) calc(50% - 2px) calc(50% + 2px), transparent calc(50% + 2px)); }

.me { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center; }
.me .av { border: var(--b) solid var(--ink); box-shadow: var(--sh) var(--sh) 0 var(--ink); }
.me .disp { font-size: 26px; word-break: break-word; }

.qtext { font: 700 21px/1.25 var(--mono); }
.opts { display: flex; flex-direction: column; gap: 12px; }
.opt { display: grid; grid-template-columns: 52px 1fr; align-items: stretch; padding: 0; text-align: left; border: var(--b) solid var(--ink); background: var(--paper); box-shadow: var(--sh) var(--sh) 0 var(--ink); min-height: 64px; transition: transform .06s, box-shadow .06s; }
.opt .k { display: flex; align-items: center; justify-content: center; font: 900 24px var(--display); background: var(--ink); color: var(--paper); }
.opt .t { padding: 10px 12px; font: 700 17px/1.2 var(--mono); display: flex; align-items: center; }
.opt:active:not(:disabled) { transform: translate(var(--sh), var(--sh)); box-shadow: none; }
.opt[aria-pressed="true"] { background: var(--hazard); }
.opt[aria-pressed="true"] .k { background: var(--ink); color: var(--hazard); }
.opt:disabled:not([aria-pressed="true"]) { opacity: .5; }

.timer-row { display: grid; grid-template-columns: 1fr auto; border: var(--b) solid var(--ink); background: var(--paper); }
.timer-row .track { position: relative; overflow: hidden; }
.timer-row .fill { position: absolute; inset: 0 auto 0 0; background: var(--ink); }
.timer-row .fill.low { background: var(--hazard); }
.timer-row .sec { min-width: 74px; padding: 6px 10px; text-align: right; font: 900 26px var(--display); border-left: var(--b) solid var(--ink); }

.verdict { padding: 22px 18px; border: var(--b) solid var(--ink); box-shadow: var(--sh) var(--sh) 0 var(--ink); display: flex; flex-direction: column; gap: 8px; }
.verdict .disp { font-size: clamp(64px, 24vw, 120px); }
.kv { display: grid; grid-template-columns: auto 1fr; border: var(--b) solid var(--ink); background: var(--paper); }
.kv > * { padding: 10px 12px; border-bottom: 2px solid var(--ink); }
.kv > :nth-last-child(-n+2) { border-bottom: 0; }
.kv dt { font: 700 12px var(--mono); text-transform: uppercase; letter-spacing: .1em; border-right: 2px solid var(--ink); background: var(--concrete); }
.kv dd { margin: 0; font-weight: 700; word-break: break-word; }

.sent { padding: 10px 12px; border: 3px dashed var(--ink); font-weight: 700; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .btn { flex: 1 1 0; }

/* host */
.h-team { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; padding: 8px; border: 3px solid var(--ink); background: var(--paper); }
.h-team .av { border: 2px solid var(--ink); }
.h-team .nm { font-weight: 700; min-width: 0; word-break: break-word; }
.h-team .ans { font-size: 13px; opacity: .85; }
.h-team.ok { background: var(--hazard); }
.h-team .ctl { display: flex; gap: 6px; }
details.slab > summary { list-style: none; padding: 12px 14px; font: 900 15px var(--display); text-transform: uppercase; cursor: pointer; display: flex; justify-content: space-between; }
details.slab > summary::after { content: "+"; }
details.slab[open] > summary::after { content: "−"; }
details.slab > div { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.step { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 2px solid var(--ink); background: var(--paper); text-align: left; font: 600 13px var(--mono); }
.step.cur { background: var(--hazard); font-weight: 700; }
.step.done { opacity: .5; }

/* ───────────── TV ───────────── */
.tv { height: 100%; overflow: hidden; font-size: min(1.04vw, 1.85vh); }
.tv .screen { height: 100%; padding: 2.4em 3em; display: flex; flex-direction: column; gap: 1.8em; }
.tv .top { display: flex; border: .3em solid var(--ink); background: var(--ink); color: var(--paper); font: 700 1.3em var(--mono); text-transform: uppercase; letter-spacing: .1em; }
.tv .top > * { padding: .55em 1em; display: flex; align-items: center; }
.tv .top .logo { font: 900 1.2em var(--display); letter-spacing: -.01em; background: var(--hazard); color: var(--ink); }
.tv .top > :nth-child(2) { flex: 1; }
.tv .top .r { justify-content: flex-end; }
.tv .slab { border-width: .3em; box-shadow: .5em .5em 0 var(--ink); }

.tv-lobby { flex: 1; display: grid; grid-template-columns: 1fr 1.25fr; gap: 3em; min-height: 0; }
.tv-lobby .left { display: flex; flex-direction: column; gap: 1.6em; min-height: 0; }
.tv-title { font-size: 11em; }
.tv-title .o { color: var(--hazard); -webkit-text-stroke: .025em var(--ink); }
.qr { display: grid; grid-template-columns: 21em 1fr; gap: 1.6em; align-items: center; padding: 1.4em; }
.qr svg { width: 100%; height: auto; display: block; }
.qr .how { display: flex; flex-direction: column; gap: .7em; font: 700 1.35em/1.25 var(--mono); }
.qr .url { font: 700 1.1em var(--mono); background: var(--ink); color: var(--paper); padding: .35em .6em; word-break: break-all; }
.tv-teams { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1em; align-content: start; }
.tv-team { display: flex; flex-direction: column; background: var(--paper); border: .25em solid var(--ink); box-shadow: .35em .35em 0 var(--ink); }
.tv-team .av { border-bottom: .25em solid var(--ink); }
.tv-team .nm { padding: .45em .55em; font: 700 1.05em/1.15 var(--mono); text-transform: uppercase; overflow-wrap: break-word; hyphens: auto; }
.tv-team.empty { border-style: dashed; box-shadow: none; background: transparent; aspect-ratio: 1 / 1.22; }
.count-head { display: flex; justify-content: space-between; align-items: end; border-bottom: .3em solid var(--ink); padding-bottom: .4em; }
.count-head .n { font: 900 4.5em/1 var(--display); }

.tv-round { flex: 1; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 3em; }
.tv-round .no { font: 900 34em/.8 var(--display); letter-spacing: -.06em; -webkit-text-stroke: .012em var(--ink); color: var(--hazard); }
.tv-round .meta { display: flex; flex-direction: column; gap: 1.2em; }
.tv-round .meta .disp { font-size: 7em; }

.tv-q { font: 900 3.6em/1.08 var(--display); text-transform: uppercase; letter-spacing: -.02em; text-wrap: balance; max-width: 30em; }
.tv-q.long { font-size: 2.9em; }
.tv-timer { min-width: 3.2em; justify-content: center; font: 900 1.8em var(--display); }
.tv-timer.low { background: var(--hazard); color: var(--ink); }
.tv-track { height: 1.1em; border: .3em solid var(--ink); background: var(--paper); position: relative; }
.tv-track .fill { position: absolute; inset: 0 auto 0 0; background: var(--ink); }
.tv-track .fill.low { background: var(--hazard); }
.tv-opts { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 1.6em; min-height: 0; align-content: start; }
.tv-opt { display: grid; grid-template-columns: 4.4em 1fr; background: var(--paper); border: .3em solid var(--ink); box-shadow: .5em .5em 0 var(--ink); min-height: 6.4em; }
.tv-opt .k { display: flex; align-items: center; justify-content: center; background: var(--ink); color: var(--paper); font: 900 2.8em var(--display); }
.tv-opt .body { padding: .8em 1.1em; display: flex; flex-direction: column; justify-content: center; gap: .6em; min-width: 0; }
.tv-opt .t { font: 700 2em/1.15 var(--mono); }
.tv-opt.right { background: var(--hazard); }
.tv-opt.right .k { color: var(--hazard); }
.tv-opt.wrong { background: var(--concrete); box-shadow: none; }
.tv-opt.wrong .t, .tv-opt.wrong .k { opacity: .45; }
.tv-opt .votes .chip { font-size: 1.35em; }
.tv-opt .votes { display: flex; flex-wrap: wrap; gap: .5em; }
.chip { display: inline-flex; align-items: center; gap: .4em; background: var(--paper); border: .18em solid var(--ink); padding: .15em .45em .15em .15em; font: 700 1em var(--mono); text-transform: uppercase; }
.chip .av { width: 1.8em; }
.stamp { display: inline-block; padding: .2em .6em; font: 900 1.2em var(--display); text-transform: uppercase; border: .2em solid var(--ink); }

.tv-type { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 1.2em; }
.tv-type .box { padding: 1.6em 2em; font: 900 3.4em/1 var(--display); text-transform: uppercase; }
.tv-type .hint { font: 700 1.6em var(--mono); text-transform: uppercase; letter-spacing: .08em; }

.tv-foot { display: flex; gap: .8em; flex-wrap: wrap; align-items: center; border-top: .3em solid var(--ink); padding-top: 1em; }
.tv-foot .chip { font-size: 1.25em; }
.tv-foot .cnt { font: 900 2.2em var(--display); margin-right: .4em; }
.tv-foot .chip.wait { border-style: dashed; background: transparent; opacity: .55; }
.tv-foot .chip.in { background: var(--ink); color: var(--paper); }
.tv-foot .chip.in .av { outline: .12em solid var(--paper); }

.tv-answer { display: grid; grid-template-columns: auto 1fr; gap: 2em; align-items: stretch; }
.tv-answer .lbl { writing-mode: vertical-rl; transform: rotate(180deg); font: 700 1.2em var(--mono); text-transform: uppercase; letter-spacing: .2em; padding: .6em .3em; }
.tv-answer .val { padding: .5em .7em; font: 900 5em/1 var(--display); text-transform: uppercase; overflow-wrap: anywhere; }
.tv-list { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: .8em 1.6em; align-content: start; min-height: 0; }
.tv-row { display: grid; grid-template-columns: 3.4em 1fr auto auto; gap: 1em; align-items: center; padding: .5em .8em .5em .5em; background: var(--paper); border: .25em solid var(--ink); }
.tv-row .av { border: .15em solid var(--ink); }
.tv-row .nm { font: 700 1.3em var(--mono); text-transform: uppercase; min-width: 0; overflow-wrap: anywhere; }
.tv-row .v { font: 700 1.5em var(--mono); text-align: right; overflow-wrap: anywhere; max-width: 14em; }
.tv-row .p { font: 900 1.6em var(--display); min-width: 2.2em; text-align: right; }
.tv-row.ok { background: var(--hazard); box-shadow: .35em .35em 0 var(--ink); }
.tv-row.no { opacity: .55; }

.tv-board { flex: 1; display: grid; grid-auto-flow: column; grid-template-rows: repeat(var(--rows), auto); grid-template-columns: repeat(var(--cols), 1fr); gap: .9em 2em; align-content: start; }
.tv-rank { display: grid; grid-template-columns: 3.8em 4.6em 1fr 5em; align-items: center; background: var(--paper); border: .3em solid var(--ink); box-shadow: .4em .4em 0 var(--ink); min-height: 5.4em; }
.tv-rank .pl { align-self: stretch; display: flex; align-items: center; justify-content: center; background: var(--ink); color: var(--paper); font: 900 2em var(--display); }
.tv-rank .av { margin: .4em; width: calc(100% - .8em); border: .15em solid var(--ink); }
.tv-rank .mid2 { padding: 0 .8em; display: flex; flex-direction: column; gap: .35em; min-width: 0; }
.tv-rank .nm { font: 700 1.7em/1.1 var(--mono); text-transform: uppercase; overflow-wrap: anywhere; }
.tv-rank .meter { height: .7em; background: var(--concrete); border: .12em solid var(--ink); }
.tv-rank .meter i { display: block; height: 100%; background: var(--ink); }
.tv-rank .sc { font: 900 2.8em var(--display); text-align: center; }
.tv-rank.first { background: var(--hazard); }
.tv-rank.first .pl { color: var(--hazard); }

.tv-final { flex: 1; display: grid; grid-template-columns: 1fr 1.1fr; gap: 3em; align-items: center; min-height: 0; }
.tv-final .who { min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 1.2em; }
.tv-final .who .disp { font-size: 6em; overflow-wrap: anywhere; }
.tv-final .faces { display: flex; gap: 1.4em; }
.tv-final .faces .av { width: 22em; max-width: 100%; border: .4em solid var(--ink); box-shadow: 1em 1em 0 var(--ink); }
.tv-final .faces.many .av { width: 13em; }
.tv-final .rest { display: flex; flex-direction: column; gap: .8em; }
.tape { height: 2.6em; flex: none; border-block: .3em solid var(--ink); }

@keyframes slam { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }
.enter > * { animation: slam .28s cubic-bezier(.2, .9, .3, 1.2) both; }
.enter > :nth-child(2) { animation-delay: .05s; }
.enter > :nth-child(3) { animation-delay: .1s; }
.enter > :nth-child(4) { animation-delay: .15s; }
@media (prefers-reduced-motion: reduce) { .enter > * { animation: none; } .btn, .opt { transition: none; } }
