/* Wireframe look on purpose: greys, boxes, placeholders. The visual design comes later. */
:root { --bg:#f2f2f2; --panel:#fff; --line:#bdbdbd; --ink:#1a1a1a; --mid:#6b6b6b; --fill:#d9d9d9; --dark:#3d3d3d; --gold:#e8c76a; }
* { box-sizing:border-box; }
html, body { margin:0; }
body { background:var(--bg); color:var(--ink); font:16px/1.35 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
body.offline::before { content:"Reconnecting…"; position:fixed; z-index:9; top:0; left:0; right:0; padding:.4em; background:var(--dark); color:#fff; text-align:center; font-size:14px; }
h1,h2,h3,h4,p { margin:0; }
h4 { font-size:.75em; color:var(--mid); letter-spacing:.02em; margin:.9em 0 .3em; }
small, .muted { color:var(--mid); }
small { display:block; font-size:.8em; }
em { font-style:normal; color:var(--mid); }
button { font:inherit; color:inherit; cursor:pointer; }
button:disabled { cursor:default; }
.panel { background:var(--panel); border-radius:1em; padding:1.25em; min-width:0; }
.grow { flex:1; min-width:0; }
.err { color:#a40000; min-height:1.3em; font-size:.9em; }

.btn { display:block; width:100%; padding:.85em 1em; border:1px solid var(--dark); border-radius:.6em; background:var(--panel); font-weight:700; text-align:center; text-decoration:none; color:var(--ink); }
.btn.primary { background:var(--dark); color:#fff; }
.btn.small { display:inline-block; width:auto; padding:.45em .8em; font-size:.85em; }
.btn:disabled { opacity:.4; }
.link { border:0; background:none; text-decoration:underline; color:var(--mid); padding:0; }
input[type=email], input[type=password], select { font:inherit; width:100%; padding:.8em; border:1px solid var(--line); border-radius:.6em; background:var(--panel); }

.face { background:var(--fill); border-radius:.75em; display:flex; align-items:center; justify-content:center; color:var(--mid); font-size:.8em; font-weight:500; width:7em; height:7em; flex:none; overflow:hidden; text-align:center; }
.face.sm { width:2.75em; height:2.75em; border-radius:50%; font-size:1em; }
.face.sm span, .face.xs span { display:none; }
.face.xs { width:2.25em; height:2.25em; border-radius:50%; font-size:1em; }
.face.off { background:var(--bg); border:1px dashed var(--line); }
.face.hl { outline:.4em solid var(--ink); color:var(--ink); font-weight:700; }
.face.dim { opacity:.35; }
.thumb { background:var(--fill); border-radius:.4em; width:4em; height:4em; flex:none; display:flex; align-items:center; justify-content:center; color:var(--mid); font-size:.7em; }
.thumb.sm { width:2.75em; height:2.75em; font-size:1em; }
.thumb.sm span { font-size:.6em; }
.thumb.gold { background:var(--gold); color:var(--ink); font-weight:700; border:2px solid var(--dark); font-size:1.2em; }
.thumb.gold.sm { font-size:1em; }
.thumb.empty { background:none; border:1px dashed var(--line); }
.photo { background:var(--fill); border-radius:.8em; display:flex; align-items:center; justify-content:center; color:var(--mid); aspect-ratio:1; width:100%; }
.photo.gold { background:var(--gold); color:var(--ink); border:3px solid var(--dark); }
.q { font-size:5em; font-weight:700; }
.tag { background:var(--dark); color:#fff; font-size:.65em; font-weight:700; padding:.35em .8em; border-radius:2em; flex:none; }
.pips { display:inline-flex; gap:.35em; width:3.4em; justify-content:center; flex:none; }
.pips i { width:.85em; height:.85em; border-radius:50%; border:1px solid var(--dark); background:var(--panel); }
.pips i.on { background:var(--dark); }

.rows { display:flex; flex-direction:column; }
.rows.cards { display:grid; grid-template-columns:repeat(3,1fr); gap:.75em; }
.rows.cards .row { background:var(--bg); border-radius:.6em; padding:.7em; }
.row { display:flex; align-items:center; gap:.75em; padding:.45em 0; min-width:0; }
.row.now { outline:3px solid var(--ink); outline-offset:2px; border-radius:.5em; }
.row b, .row small { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block; }
.chips { display:flex; flex-wrap:wrap; gap:.4em; }
.pile { display:flex; flex-wrap:wrap; gap:.6em; }
.box { width:4.2em; height:4.2em; border:2px solid var(--dark); border-radius:.5em; background:var(--fill); font-weight:700; font-size:1em; color:var(--dark); }
.box.gold { background:var(--gold); font-size:1.4em; width:3em; height:3em; color:var(--ink); }
.box.taken { background:none; border:1px dashed var(--line); }
.box.sel { outline:4px solid var(--ink); outline-offset:1px; }
.mystery { display:flex; gap:1em; align-items:center; background:var(--bg); border-radius:.75em; padding:.9em; margin-top:1em; }
.mystery p { font-size:.85em; color:var(--mid); }
.mystery b { color:var(--ink); }
.clock { font-weight:700; font-variant-numeric:tabular-nums; }
.spot .clock[data-paused] { font-size:3em; line-height:2.3; }
.banner .clock[data-paused] { font-size:1.8em; line-height:1.9; }
.mystery .pile { flex-wrap:nowrap; flex:none; }
.bar { height:.6em; background:var(--fill); border-radius:.3em; overflow:hidden; }
.bar i { display:block; height:100%; background:var(--dark); width:100%; transition:width .2s linear; }
.banner { background:var(--dark); color:#fff; border-radius:.8em; padding:.8em; text-align:center; }
.banner small { color:#fff; font-weight:700; font-size:.8em; }
.banner .clock { font-size:3.2em; line-height:1.05; display:block; }
.status { display:flex; justify-content:space-between; gap:1em; background:var(--panel); border-radius:.6em; padding:.75em; font-weight:700; }
.status .clock { color:var(--mid); }

/* ---------- player ---------- */
.player { max-width:1280px; margin:0 auto; padding:1em; display:flex; flex-direction:column; gap:1em; min-height:100vh; }
.player header { display:flex; justify-content:space-between; align-items:center; font-size:.9em; }
.center { flex:1; display:flex; flex-direction:column; justify-content:center; align-items:center; gap:1.1em; text-align:center; max-width:24em; margin:0 auto; width:100%; }
.center form { width:100%; display:flex; flex-direction:column; gap:.8em; }
.card { display:flex; align-items:center; gap:.75em; background:var(--panel); border-radius:.6em; padding:.75em; text-align:left; width:100%; }
.tabs { display:flex; background:var(--fill); border-radius:.6em; padding:.25em; }
.tabs button { flex:1; border:0; background:none; padding:.6em; border-radius:.5em; font-weight:700; }
.tabs button.on { background:var(--panel); }
.panels { display:grid; gap:1em; }
.steal .row { background:var(--panel); border-radius:.6em; padding:.6em; margin-bottom:.6em; }
.steal .row .thumb { order:-1; }
.steal .row .face { display:none; }
.sheet { background:var(--panel); border:2px solid var(--dark); border-radius:.9em; padding:1em; display:flex; flex-direction:column; gap:.7em; position:sticky; bottom:1em; }
.sheet div { display:flex; gap:.6em; }
.stack { display:flex; flex-direction:column; gap:.8em; }
.dev { display:flex; flex-wrap:wrap; gap:.4em; justify-content:center; }
@media (max-width:899px) { .tab-pile .p-reg, .tab-reg .p-pile { display:none; } }
@media (min-width:900px) {
  .tabs { display:none; }
  .panels.two { grid-template-columns:1fr 1fr; }
  .turn { display:grid; grid-template-columns:20em 1fr; gap:1em; align-items:start; }
}

/* ---------- board: sized off the window so it fills any shared screen ---------- */
body.board { font-size:calc(100vw / 120); overflow:hidden; }
.stage { width:100vw; height:100vh; padding:2.5em; display:flex; gap:2em; }
.stage.col { flex-direction:column; align-items:center; justify-content:center; text-align:center; }
.stage h1 { font-size:4em; line-height:1.05; }
.stage h2 { font-size:1.75em; }
.spot { width:25em; flex:none; display:flex; flex-direction:column; align-items:center; gap:1.1em; text-align:center; }
.spot .face { width:18em; height:18em; font-size:1em; }
.spot .name { font-size:4em; font-weight:700; line-height:1; }
.spot .clockbox { background:var(--bg); border-radius:.75em; padding:1.2em; width:100%; }
.spot .clock { font-size:7em; line-height:1; display:block; }
.board .panel { display:flex; flex-direction:column; }
.board .pile .box { width:6em; height:6em; font-size:1em; }
.board .pile .box.gold { width:6.5em; height:6.5em; font-size:1em; }
.board .pile .box.gold { font-weight:700; }
.board .mystery { margin-top:auto; }
.board .mystery p { font-size:1em; }
.grid { display:flex; flex-wrap:wrap; gap:1em; justify-content:center; }
.grid .face { width:9em; height:9em; font-size:1em; }
.landed { display:flex; align-items:center; gap:2.5em; text-align:left; }
.landed .face { width:16em; height:16em; font-size:1em; }
.landed .name { font-size:8.5em; font-weight:700; line-height:1; }
.reveal { align-items:center; gap:4.5em; padding:5em; }
.reveal .photo { width:46em; flex:none; }
.reveal .title { font-size:5.5em; font-weight:700; line-height:1.05; }
.swap { display:flex; align-items:center; gap:3.5em; }
.swap .side { display:flex; flex-direction:column; align-items:center; gap:.6em; }
.swap .side .face { width:18em; height:18em; font-size:1em; }
.swap .side b { font-size:3.5em; line-height:1; }
.swap .mid { display:flex; flex-direction:column; align-items:center; gap:1em; }
.swap .mid .photo { width:18em; }
.zone { border:1px dashed var(--mid); border-radius:.5em; padding:2em 3em; color:var(--mid); }
.final { display:grid; grid-template-columns:repeat(3,1fr); gap:.2em 1.5em; }
.paused-flag { position:fixed; top:1em; right:1em; background:var(--dark); color:#fff; padding:.5em 1em; border-radius:.5em; font-weight:700; }
.url { font-size:2.75em; font-weight:700; }
.qr { width:20em; height:20em; background:var(--fill); border-radius:.5em; display:flex; align-items:center; justify-content:center; color:var(--mid); flex:none; }

/* ---------- host ---------- */
.host { display:grid; grid-template-columns:22em 1fr 22em; gap:1.5em; padding:1.5em; min-height:100vh; align-items:start; }
.host .panel { display:flex; flex-direction:column; gap:.7em; }
.host table { border-collapse:collapse; width:100%; font-size:.9em; }
.host th { text-align:left; font-size:.8em; color:var(--mid); padding:.4em .5em; }
.host td { padding:.5em; border-top:1px solid var(--bg); }
.host .log p { font-size:.85em; padding:.2em 0; }
.seg { display:flex; gap:.5em; align-items:center; flex-wrap:wrap; }
@media (max-width:1100px) { .host { grid-template-columns:1fr; } }

/* =====================================================================
   8-bit holiday theme. Everything above is layout; this block is the look.
   Night sky, snow, string lights, wrapped boxes, pixel type.
   ===================================================================== */
@font-face { font-family:"Pixelify Sans"; src:url(/fonts/pixelify-sans-700.woff2) format("woff2"); font-weight:700; font-display:swap; }
@font-face { font-family:"Space Mono"; src:url(/fonts/space-mono-400.woff2) format("woff2"); font-weight:400; font-display:swap; }
@font-face { font-family:"Space Mono"; src:url(/fonts/space-mono-700.woff2) format("woff2"); font-weight:700; font-display:swap; }
:root { --bg:#0b1026; --panel:#141b3c; --line:#3b4a8c; --ink:#f7f3e8; --mid:#9fb0e8; --fill:#242e5c; --dark:#6f7fc0; --gold:#ffc93c; --red:#d7263d; --green:#1fa055; --blue:#3b6fd9; --edge:#2e3a78; }
* { border-radius:0 !important; }
body { font-family:"Space Mono", ui-monospace, Menlo, monospace; }
h1, h2, h3, .name, .clock, .title, .btn, .url, .box, .tag, .tabs button, .swap .side b, .q, .host th { font-family:"Pixelify Sans", "Space Mono", monospace; font-weight:700; letter-spacing:.03em; }
h1 { text-shadow:.07em .07em 0 var(--red); }
h4 { letter-spacing:.08em; }
a { color:var(--gold); }
.err { color:#ff8a8a; }
.panel { border:4px solid var(--edge); }
.status, .card { border:3px solid var(--edge); }

.btn { background:var(--panel); border:3px solid var(--ink); color:var(--ink); box-shadow:4px 4px 0 #000; }
.btn.primary { background:var(--green); color:#fff; }
.btn:not(:disabled):active { transform:translate(2px,2px); box-shadow:2px 2px 0 #000; }
.steal .btn.primary, .sheet .btn.primary { background:var(--red); }
.btn.small { box-shadow:3px 3px 0 #000; border-width:2px; }
input[type=email], input[type=password], select { background:var(--bg); color:var(--ink); border:3px solid var(--line); font-family:inherit; }
::placeholder { color:var(--dark); }
.tabs button { color:var(--mid); }
.tabs button.on { background:var(--green); color:#fff; }

.banner { background:var(--red); border:4px solid var(--ink); box-shadow:6px 6px 0 #000; }
.tag { background:var(--red); border:2px solid var(--ink); }
.pips i { border:2px solid var(--gold); background:transparent; }
.pips i.on { background:var(--gold); }
.bar i { background:var(--gold); }
.spot .clockbox { border:3px solid var(--edge); }
.spot .clock, .status .clock { color:var(--gold); }
.row.now { outline:3px solid var(--gold); }
.rows.cards .row { border:2px solid var(--edge); }
.sheet { border:4px solid var(--gold); box-shadow:6px 6px 0 #000; }
.mystery { border:3px dashed var(--gold); }
.zone { border:2px dashed var(--mid); }
.paused-flag, body.offline::before { background:var(--red); font-family:"Pixelify Sans", monospace; z-index:20; }
.qr { background:var(--ink); color:var(--bg); }
.host td { border-top:1px solid var(--edge); }

/* portraits */
.face { position:relative; color:var(--ink); border:3px solid var(--edge); }
.face svg { position:absolute; inset:0; width:100%; height:100%; }
.face span { position:absolute; left:0; right:0; bottom:0; background:rgba(11,16,38,.88); padding:.1em 0; font-weight:700; }
.face.sm, .face.xs { border-width:2px; }
.face.off { filter:grayscale(1) brightness(.45); border-style:dashed; }
.face.hl { outline:.45em solid var(--gold); z-index:2; }
.face.dim { opacity:.22; }

/* wrapped boxes: paper, a ribbon cross, a number */
.box { --wrap:var(--red); --rib:var(--gold); color:#fff; border:3px solid var(--ink); text-shadow:2px 2px 0 #000, -1px -1px 0 #000; box-shadow:4px 4px 0 #000;
  background:linear-gradient(var(--rib),var(--rib)) center/20% 100% no-repeat, linear-gradient(var(--rib),var(--rib)) center/100% 20% no-repeat, var(--wrap); }
.pile .box:nth-child(3n+2) { --wrap:var(--green); --rib:var(--red); }
.pile .box:nth-child(3n) { --wrap:var(--blue); --rib:var(--ink); }
.box.gold, .thumb.gold, .photo.gold { --wrap:var(--gold); --rib:#fff; color:#3a2500; text-shadow:none; border-color:var(--ink);
  background:linear-gradient(var(--rib),var(--rib)) center/16% 100% no-repeat, linear-gradient(var(--rib),var(--rib)) center/100% 16% no-repeat, var(--wrap); }
.box.taken { background:none; border:2px dashed var(--line); box-shadow:none; }
.box.sel { outline:4px solid var(--gold); outline-offset:3px; transform:translateY(-4px); }
.box:not(:disabled):hover { transform:translateY(-3px); }
.thumb { border:2px solid var(--edge); }
.photo { border:4px solid var(--edge); }
.q { text-shadow:.06em .06em 0 #fff; }

/* string lights along the top */
body::after { content:""; position:fixed; top:0; left:0; right:0; height:10px; z-index:15; pointer-events:none;
  background:repeating-linear-gradient(90deg, var(--red) 0 10px, transparent 10px 34px, var(--gold) 34px 44px, transparent 44px 68px, var(--green) 68px 78px, transparent 78px 102px, var(--blue) 102px 112px, transparent 112px 136px);
  animation:twinkle 1.6s steps(2) infinite; }
body.board::after { height:.8em; background-size:auto; }
@keyframes twinkle { 50% { filter:brightness(.55) hue-rotate(40deg); } }

/* pixel snow on the main screen */
.stage > * { position:relative; z-index:1; }
.stage::before { content:""; position:fixed; top:0; left:0; width:.35em; height:.35em; background:#fff; opacity:.55; pointer-events:none; z-index:0;
  box-shadow:6vw 8vh #fff,14vw 52vh #fff,21vw 23vh #fff,29vw 77vh #fff,36vw 12vh #fff,43vw 61vh #fff,51vw 34vh #fff,58vw 88vh #fff,66vw 5vh #fff,73vw 47vh #fff,81vw 70vh #fff,88vw 19vh #fff,95vw 58vh #fff,10vw 93vh #fff,47vw 97vh #fff,77vw 30vh #fff,
    6vw 108vh #fff,14vw 152vh #fff,21vw 123vh #fff,29vw 177vh #fff,36vw 112vh #fff,43vw 161vh #fff,51vw 134vh #fff,58vw 188vh #fff,66vw 105vh #fff,73vw 147vh #fff,81vw 170vh #fff,88vw 119vh #fff,95vw 158vh #fff,10vw 193vh #fff,47vw 197vh #fff,77vw 130vh #fff;
  animation:snow 14s steps(70) infinite; }
@keyframes snow { from { transform:translateY(-100vh); } to { transform:translateY(0); } }
@media (prefers-reduced-motion: reduce) { body::after, .stage::before { animation:none; } }
.box b { background:var(--bg); border:2px solid var(--ink); padding:0 .3em; text-shadow:none; font-size:.85em; }
.box.gold { font-size:1.6em; }
@media (max-width:899px) { .mystery { flex-direction:column; align-items:flex-start; } }
.panel .swap .side b { font-size:1.6em; }
