/* SpotiDuel — record-sleeve poster aesthetic: ink black, cream paper, one hot accent. */
:root {
  --ink: #0f0e0c;
  --ink-2: #1a1815;
  --ink-3: #26231f;
  --paper: #f4eddf;
  --paper-2: #cfc5b0;
  --mute: #7f776a;
  --accent: #ff4d1c;
  --accent-2: #ff7a4d;
  --acid: #d9ff3f;
  --danger: #ff3b3b;
  --display: 'Bricolage Grotesque', 'Archivo Black', Impact, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--display);
  font-optical-sizing: auto;
  line-height: 1.25;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  background-image:
    radial-gradient(1200px 600px at 80% -10%, rgba(255, 77, 28, .22), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(217, 255, 63, .10), transparent 60%);
  background-attachment: fixed;
}
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .07; mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
#app { position: relative; z-index: 1; min-height: 100%; display: flex; flex-direction: column; }

/* ---- chrome ---- */
.top { display: flex; align-items: center; justify-content: space-between; height: 52px; padding: 0 24px; border-bottom: 1px solid var(--ink-3); }
.brand { font-weight: 800; font-size: 22px; letter-spacing: .04em; color: var(--paper); text-decoration: none; }
.brand span { color: var(--accent); }
#me { font-family: var(--mono); font-size: 12px; color: var(--paper-2); display: flex; align-items: center; gap: 10px; }
#me img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; border: 1px solid var(--ink-3); }
#me .dot { width: 8px; height: 8px; border-radius: 50%; background: #1db954; box-shadow: 0 0 10px #1db954; }
#me button { background: none; border: 0; color: var(--mute); font-family: var(--mono); font-size: 12px; cursor: pointer; text-decoration: underline; }
.view { flex: 1; width: min(1100px, 100%); margin: 0 auto; padding: 22px 24px 40px; }
.foot { font-family: var(--mono); font-size: 11px; color: var(--mute); text-align: center; padding: 18px; letter-spacing: .06em; text-transform: uppercase; }
body.with-chat .foot { display: none; }   /* in a room the emote bar lives down there */

/* ---- primitives ---- */
.btn {
  font-family: var(--display); font-weight: 700; font-size: 16px; letter-spacing: .01em;
  background: var(--paper); color: var(--ink); border: 2px solid var(--paper); border-radius: 999px;
  padding: 12px 22px; cursor: pointer; transition: transform .12s ease, background .15s, color .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.btn-ghost { background: transparent; color: var(--paper); border-color: var(--ink-3); }
.btn-ghost:hover { border-color: var(--paper-2); }
.btn-spotify { background: #1db954; border-color: #1db954; color: #07130a; }
.btn-yt { background: #ff0033; border-color: #ff0033; color: #fff; }
.cbtn { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; transition: transform .12s; }
.cbtn:hover { transform: translateY(-2px); }
.cbtn .ti { width: 17px; height: 17px; margin: 0; vertical-align: 0; display: block; }
.cbtn .ti svg { fill: #fff; }
.cb-sp { background: #1db954; }
.cb-yt { background: #ff0033; }
.yt-chip { font-family: var(--mono); font-size: 12px; color: var(--paper-2); }
.btn-big { font-size: 20px; padding: 16px 30px; }
.btn-sm { font-size: 13px; padding: 8px 14px; }
.input {
  font-family: var(--mono); font-size: 15px; background: var(--ink-2); color: var(--paper);
  border: 2px solid var(--ink-3); border-radius: 12px; padding: 13px 16px; width: 100%; outline: none;
  transition: border-color .15s;
}
.input:focus { border-color: var(--accent); }
.input.code { text-transform: uppercase; letter-spacing: .35em; font-size: 24px; text-align: center; font-weight: 600; }
.label { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--mute); margin-bottom: 8px; display: block; }
.card { background: var(--ink-2); border: 1px solid var(--ink-3); border-radius: var(--radius); padding: 22px; }
.row { display: flex; gap: 10px; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.muted { color: var(--mute); }
.mono { font-family: var(--mono); }
.err { color: var(--danger); font-family: var(--mono); font-size: 13px; min-height: 1.2em; }

/* ---- landing ---- */
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: center; padding: 28px 0 30px; }
.hero h1 {
  font-size: clamp(56px, 9vw, 124px); line-height: .9; letter-spacing: -.03em; font-weight: 800; margin: 0;
  font-variation-settings: 'opsz' 96;
}
.hero h1 em { font-style: normal; color: var(--accent); display: block; }
.hero h1 small { display: block; font-size: .28em; letter-spacing: .02em; color: var(--paper-2); font-weight: 400; margin-top: 18px; max-width: 26ch; line-height: 1.3; }
.hero .rules { font-family: var(--mono); font-size: 12px; color: var(--mute); margin-top: 26px; display: flex; gap: 18px; flex-wrap: wrap; }
.hero .rules b { color: var(--acid); font-weight: 600; }
.entry { display: grid; gap: 14px; }
.entry .card h2 { margin: 0 0 4px; font-size: 22px; font-weight: 800; }
.entry .card p { margin: 0 0 14px; color: var(--mute); font-size: 14px; }
.or { text-align: center; font-family: var(--mono); font-size: 11px; color: var(--mute); letter-spacing: .2em; }

/* staggered reveal */
.reveal-in > * { animation: rise .6s cubic-bezier(.2,.8,.2,1) both; }
.reveal-in > *:nth-child(2) { animation-delay: .08s; }
.reveal-in > *:nth-child(3) { animation-delay: .16s; }
.reveal-in > *:nth-child(4) { animation-delay: .24s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---- lobby ---- */
.lobby { display: grid; grid-template-columns: 340px 1fr; gap: 24px; align-items: start; }
.code-card { text-align: center; position: relative; overflow: hidden; }
.code-card::before { content: ''; position: absolute; inset: -40% -20%; background: repeating-linear-gradient(-35deg, transparent 0 14px, rgba(255,255,255,.025) 14px 16px); pointer-events: none; }
.code-big { font-family: var(--mono); font-size: 64px; font-weight: 600; letter-spacing: .25em; margin: 6px 0 2px; padding-left: .25em; color: var(--acid); }
.code-card .hint { font-family: var(--mono); font-size: 12px; color: var(--mute); }
.players { display: grid; gap: 10px; margin-top: 18px; }
.player {
  display: flex; align-items: center; gap: 12px; background: var(--ink); border: 1px dashed var(--ink-3);
  border-radius: 12px; padding: 12px 14px; font-weight: 700; min-height: 56px;
}
.player.filled { border-style: solid; }
.player .avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-family: var(--mono); font-size: 13px; background: var(--accent); color: var(--paper); }
.player.p2 .avatar { background: var(--acid); color: var(--ink); }
.player .tag { margin-left: auto; font-family: var(--mono); font-size: 10px; letter-spacing: .15em; text-transform: uppercase; color: var(--mute); }
.player .tag.off { color: var(--danger); }
.player.empty { color: var(--mute); font-weight: 400; }
.player.empty .avatar { background: var(--ink-3); color: var(--mute); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.blend { font-family: var(--mono); font-size: 12px; color: var(--paper-2); background: var(--ink); border: 1px solid var(--ink-3); border-radius: 10px; padding: 10px 12px; margin-bottom: 16px; line-height: 1.5; }
.blend.on { border-color: var(--acid); color: var(--paper); }
.blend b { color: var(--acid); }
.player .pinfo { display: flex; flex-direction: column; line-height: 1.2; }
.player .pinfo small { font-family: var(--mono); font-size: 10px; font-weight: 400; color: var(--mute); margin-top: 2px; }
.source-chip > div { flex: 1; min-width: 0; }
.source-chip .tab { flex: none; }
.reveal-track em { display: block; font-style: normal; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--acid); margin-top: 6px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab {
  font-family: var(--mono); font-size: 12px; letter-spacing: .06em; background: transparent; color: var(--paper-2);
  border: 1px solid var(--ink-3); border-radius: 999px; padding: 8px 14px; cursor: pointer;
}
.tab.active { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.ti { display: inline-block; width: 13px; height: 13px; margin-right: 6px; vertical-align: -2px; }
.ti svg { width: 100%; height: 100%; display: block; }
.ti-sp svg { fill: #1db954; }
.ti-yt svg { fill: #ff0033; }
.src-brand .ti { width: 10px; height: 10px; margin-right: 4px; vertical-align: -1px; }
.src-brand { font-style: normal; font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; border-radius: 4px; padding: 2px 5px; margin-left: 6px; vertical-align: 2px; }
.src-brand.b-sp { background: rgba(29,185,84,.18); color: #1db954; }
.src-brand.b-yt { background: rgba(255,0,51,.16); color: #ff5c73; }
.src-brand.b-dz { background: rgba(160,80,255,.16); color: #c08bff; }
.tab:disabled { opacity: .4; cursor: not-allowed; }
.pl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; max-height: 360px; overflow: auto; padding-right: 4px; }
.pl-grid .gh { grid-column: 1 / -1; font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--mute); margin-top: 6px; padding-bottom: 2px; border-bottom: 1px solid var(--ink-3); }
.pl-grid .gh:first-child { margin-top: 0; }
.pl {
  display: flex; gap: 10px; align-items: center; background: var(--ink); border: 1px solid var(--ink-3); border-radius: 12px;
  padding: 8px; cursor: pointer; text-align: left; color: var(--paper); font-family: var(--display); transition: border-color .15s, transform .12s;
}
.pl:hover { border-color: var(--accent); transform: translateY(-1px); }
.pl.selected { border-color: var(--acid); box-shadow: inset 0 0 0 1px var(--acid); }
.pl img, .pl .ph { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--ink-3); flex: none; }
.pl b { display: block; font-size: 14px; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pl small { font-family: var(--mono); font-size: 10px; color: var(--mute); }
/* multi-select picks */
.picks-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.picks-list .label { margin-bottom: 2px; }
.picks-list .source-chip { margin-top: 0; }
.source-chip {
  display: flex; gap: 12px; align-items: center; background: var(--ink); border: 1px solid var(--acid); border-radius: 12px; padding: 10px 12px; margin-top: 14px;
}
.source-chip img, .source-chip .ph { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--ink-3); }
.source-chip b { display: block; }
.source-chip small { font-family: var(--mono); font-size: 11px; color: var(--mute); }
.rounds { display: flex; gap: 6px; flex-wrap: wrap; }
.rounds button { font-family: var(--mono); font-weight: 600; font-size: 14px; width: 52px; height: 40px; border-radius: 10px; background: var(--ink); color: var(--paper-2); border: 1px solid var(--ink-3); cursor: pointer; }
.rounds button.active { background: var(--acid); color: var(--ink); border-color: var(--acid); }
.rounds button:disabled { cursor: default; }
.opts-row { display: flex; gap: 26px; margin-top: 18px; flex-wrap: wrap; }
.host-summary { margin-top: 18px; font-size: 13px; color: var(--paper-2); }
.host-summary .label { margin-bottom: 6px; }
.host-summary em { font-style: normal; color: var(--mute); }
.pick-hint { font-family: var(--mono); font-size: 10px; letter-spacing: 0; text-transform: none; color: var(--acid); margin-left: 6px; }
.start-row { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.rounds.diff button { width: auto; padding: 0 14px; }

/* ---- loading ---- */
.loading { text-align: center; padding: 80px 0; }
.loading .vinyl { margin: 0 auto 24px; }
.loading h2 { font-size: 34px; margin: 0 0 6px; font-weight: 800; }
.bar { height: 6px; background: var(--ink-3); border-radius: 99px; overflow: hidden; width: min(360px, 80%); margin: 20px auto 0; }
.bar i { display: block; height: 100%; background: var(--acid); width: 0; transition: width .3s; }

/* ---- player colours ---- */
:root { --c1: #4fd1ff; --c2: #c08bff; --c3: #ffb454; --c4: #ff6fb5; --c5: #3ee6e6; --c6: #8f9bff; --c7: #e8d3a2; --c8: #ff9d6f; }
.c1 { --pc: var(--c1); } .c2 { --pc: var(--c2); } .c3 { --pc: var(--c3); } .c4 { --pc: var(--c4); } .c5 { --pc: var(--c5); } .c6 { --pc: var(--c6); } .c7 { --pc: var(--c7); } .c8 { --pc: var(--c8); }
.player .avatar { background: var(--pc, var(--accent)); color: var(--ink); }

/* ---- game ---- */
/* desktop: center the stage in the space above the emote bar and let it scale with viewport height (52px top bar + 62px .view padding + ~80px emote clearance) */
.game { display: grid; gap: clamp(20px, 3vh, 34px); min-height: calc(100dvh - 52px - 62px - 80px); align-content: center; }
.stage { display: flex; flex-direction: column; align-items: center; }
/* scoreboard = one fused HUD strip, visually distinct from the answer cards */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; background: var(--ink); border: 1px solid var(--ink-3); border-radius: 10px; overflow: hidden; }
.pcard { background: transparent; border: 0; border-left: 1px solid var(--ink-3); border-top: 1px solid var(--ink-3); margin-top: -1px; border-radius: 0; padding: 10px 16px 12px; position: relative; min-width: 0; }
.pcard:first-child { border-left: 0; }
/* solo: compact centered scorecard instead of a full-width strip */
.board.n1 { max-width: 320px; margin-left: auto; margin-right: auto; }
.board.n1 .pcard { text-align: center; }
.board.n1 .pcard .name { justify-content: center; }
.board.n1 .delta { right: 14px; }
.pcard.me::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--pc); }
.pcard .name { font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .sw { width: 10px; height: 10px; border-radius: 2px; background: var(--pc); flex: none; }
.pcard .score { font-family: var(--mono); font-weight: 600; font-size: clamp(28px, 4vw, 42px); line-height: 1.1; letter-spacing: -.02em; }
.pcard .status { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--mute); min-height: 1.4em; margin-top: 2px; }
.pcard .status.locked { color: var(--pc); }
.pcard .rst { font-weight: 600; }
.pcard .rst.ok { color: var(--acid); }
.pcard .rst.no { color: var(--danger); }
.pcard .rst.none { color: var(--mute); }
.delta { position: absolute; right: 12px; top: 10px; font-family: var(--mono); font-weight: 600; color: var(--acid); font-size: 18px; animation: floatUp 1.6s ease-out both; }
.delta.zero { color: var(--mute); }
@keyframes floatUp { 0% { opacity: 0; transform: translateY(10px); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(-22px); } }

.vinyl-wrap { position: relative; width: clamp(150px, min(24vw, 30vh), 320px); aspect-ratio: 1; display: grid; place-items: center; }
.ring { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(var(--acid) calc(var(--p, 1) * 1turn), var(--ink-3) 0); -webkit-mask: radial-gradient(circle, transparent 64%, #000 65%); mask: radial-gradient(circle, transparent 64%, #000 65%); transition: background .1s linear; }
.ring.warn { background: conic-gradient(var(--accent) calc(var(--p, 1) * 1turn), var(--ink-3) 0); }
.vinyl {
  width: 76%; aspect-ratio: 1; border-radius: 50%; position: relative; overflow: hidden;
  background:
    radial-gradient(circle, var(--ink-2) 0 14%, transparent 14.5%),
    repeating-radial-gradient(circle, #141310 0 1.5px, #1f1c18 1.5px 3px);
  box-shadow: 0 10px 40px rgba(0,0,0,.6), inset 0 0 0 1px rgba(255,255,255,.04);
}
.vinyl.spinning { animation: spin 1.8s linear infinite; }
.vinyl::after { content: ''; position: absolute; inset: 0; background: linear-gradient(120deg, transparent 40%, rgba(255,255,255,.07) 50%, transparent 60%); }
.vinyl .lab { position: absolute; inset: 31%; border-radius: 50%; background: var(--accent); display: grid; place-items: center; overflow: hidden; }
.vinyl .lab img { width: 100%; height: 100%; object-fit: cover; }
.vinyl .lab::after { content: ''; position: absolute; width: 10%; height: 10%; border-radius: 50%; background: var(--ink); }
@keyframes spin { to { transform: rotate(1turn); } }
.clock { position: absolute; bottom: -1.4em; left: 50%; transform: translateX(-50%); font-family: var(--mono); font-weight: 600; font-size: clamp(20px, 2.2vh, 26px); color: var(--paper); white-space: nowrap; }
.clock.pre { color: var(--acid); font-size: clamp(30px, 3.2vh, 38px); animation: pop .4s ease; }
@keyframes pop { from { transform: translateX(-50%) scale(.6); opacity: .3; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
.clock.warn { color: var(--accent); }
.round-no { font-family: var(--mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--mute); text-align: center; margin-top: clamp(40px, 4.5vh, 54px); }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(12px, 1.5vh, 18px); margin-top: 10px; }
.opt {
  display: flex; align-items: center; gap: 14px; text-align: left; background: var(--ink-2); color: var(--paper);
  border: 2px solid var(--ink-3); border-radius: var(--radius); padding: clamp(16px, 2vh, 22px) clamp(18px, 2vw, 26px); cursor: pointer; font-family: var(--display);
  transition: transform .12s ease, border-color .15s, background .15s; min-height: clamp(78px, 11vh, 124px); animation: rise .45s both;
}
.opt:nth-child(2) { animation-delay: .05s; } .opt:nth-child(3) { animation-delay: .1s; } .opt:nth-child(4) { animation-delay: .15s; }
.opt .k { font-family: var(--mono); font-weight: 600; font-size: clamp(13px, 1.3vh, 15px); width: clamp(30px, 3.2vh, 38px); height: clamp(30px, 3.2vh, 38px); border-radius: 8px; display: grid; place-items: center; background: var(--ink-3); color: var(--paper-2); flex: none; }
.opt b { display: block; font-size: clamp(17px, 2vh, 23px); font-weight: 700; line-height: 1.15; }
.opt small { font-family: var(--mono); font-size: clamp(11px, 1.1vh, 13px); color: var(--mute); }
.opt:not(:disabled):hover { border-color: var(--paper-2); transform: translateY(-2px); }
.opt.picked { background: rgba(255,255,255,.05); }
.opt.picked.pc1 { border-color: var(--c1); } .opt.picked.pc2 { border-color: var(--c2); } .opt.picked.pc3 { border-color: var(--c3); } .opt.picked.pc4 { border-color: var(--c4); }
.opt.picked.pc1 .k { background: var(--c1); color: var(--ink); } .opt.picked.pc2 .k { background: var(--c2); color: var(--ink); } .opt.picked.pc3 .k { background: var(--c3); color: var(--ink); } .opt.picked.pc4 .k { background: var(--c4); color: var(--ink); }
.opt.correct { border-color: var(--acid); background: rgba(217,255,63,.12); }
.opt.correct .k { background: var(--acid); color: var(--ink); }
.opt.wrong { border-color: var(--danger); background: rgba(255,59,59,.10); opacity: .85; }
.opt.wrong .k { background: var(--danger); color: var(--paper); }
.opt:disabled { cursor: default; }
.opt:disabled:not(.picked):not(.correct):not(.wrong) { opacity: .45; }
.opt .olabel { min-width: 0; }
.opt .who { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; flex: none; }
.opt .chip { font-family: var(--mono); font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; color: var(--ink); background: var(--pc, var(--paper)); white-space: nowrap; }
.opt .chip.c1 { background: var(--c1); } .opt .chip.c2 { background: var(--c2); } .opt .chip.c3 { background: var(--c3); } .opt .chip.c4 { background: var(--c4); } .opt .chip.c5 { background: var(--c5); } .opt .chip.c6 { background: var(--c6); } .opt .chip.c7 { background: var(--c7); } .opt .chip.c8 { background: var(--c8); }
.opt .obadge { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .04em; }
.opt .obadge.ok { color: var(--acid); }
.opt .obadge.no { color: var(--danger); }
.opt.mypick { box-shadow: inset 0 0 0 2px var(--paper); }
.opt.correct.mypick { box-shadow: inset 0 0 0 2px var(--acid); }
.opt.wrong.mypick { box-shadow: inset 0 0 0 2px var(--danger); }

/* leave/quit during a game: small corner ✕, away from tap zones */
.game { position: relative; }
.game-quit { position: absolute; top: 0; right: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--ink-2);
  border: 1px solid var(--ink-3); color: var(--mute); font-size: 14px; cursor: pointer; z-index: 5; transition: color .15s, border-color .15s; }
.game-quit:hover { color: var(--danger); border-color: var(--danger); }

.reveal-track { text-align: center; margin-top: 6px; animation: rise .4s both; }
.reveal-track b { font-size: 24px; font-weight: 800; display: block; }
.reveal-track span { font-family: var(--mono); font-size: 13px; color: var(--paper-2); }

/* ---- over ---- */
.over { text-align: center; padding-top: 20px; padding-bottom: 48px; } /* clears the fixed emote bar when the screen scrolls */
.over .verdict { font-size: clamp(48px, 9vw, 110px); font-weight: 800; letter-spacing: -.03em; line-height: .95; margin: 0; }
.over .verdict em { font-style: normal; color: var(--acid); }
.over .verdict.lost em { color: var(--accent); }
.podium { list-style: none; padding: 0; margin: 26px auto; width: min(460px, 100%); display: grid; gap: 8px; }
.podium li { display: flex; align-items: center; gap: 12px; background: var(--ink-2); border: 1px solid var(--ink-3); border-radius: 12px; padding: 12px 16px; font-family: var(--mono); text-align: left; }
.podium li.me { border-color: var(--pc); }
.podium li:first-child { border-color: var(--acid); background: rgba(217,255,63,.06); }
.podium .rank { color: var(--mute); font-size: 12px; width: 28px; }
.podium .sw { width: 10px; height: 10px; border-radius: 2px; background: var(--pc); }
.podium .n { flex: 1; font-family: var(--display); font-weight: 700; font-size: 16px; }
.podium .s { font-weight: 600; font-size: 24px; }
.tbl-wrap { overflow-x: auto; margin-bottom: 24px; }
.over:not(.stats-open) .stats-body { display: none; }
.breakdown.wide { width: 100%; font-size: 12px; }
.breakdown.wide th, .breakdown.wide td { padding: 7px 6px; }
.breakdown.wide td.t b { font-size: 13px; }
.breakdown { width: min(720px, 100%); margin: 0 auto; border-collapse: collapse; font-family: var(--mono); font-size: 13px; text-align: left; }
.breakdown th { font-weight: 500; color: var(--mute); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; padding: 8px 10px; border-bottom: 1px solid var(--ink-3); }
.breakdown td { padding: 9px 10px; border-bottom: 1px solid var(--ink-2); vertical-align: middle; }
.breakdown td.t { font-family: var(--display); }
.breakdown td.t b { display: block; font-size: 14px; }
.breakdown td.t small { color: var(--mute); font-family: var(--mono); font-size: 11px; }
.breakdown td.pts { text-align: right; color: var(--paper-2); white-space: nowrap; }
.breakdown td.pts.hit { color: var(--acid); }
.breakdown img { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; vertical-align: middle; }

/* ---- overlays ---- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--paper); color: var(--ink); font-family: var(--mono); font-size: 13px; padding: 12px 18px; border-radius: 10px;
  transition: .25s; z-index: 50; max-width: min(90vw, 520px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--danger); color: var(--paper); }
.unlock { position: fixed; inset: 0; background: rgba(15,14,12,.85); display: grid; place-items: center; z-index: 40; backdrop-filter: blur(4px); }
.unlock[hidden] { display: none; }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 20px; padding-top: 10px; }
  .lobby { grid-template-columns: 1fr; }
  .board { grid-template-columns: 1fr 1fr; }
  .game { gap: 10px; min-height: 0; }
  .vinyl-wrap { width: 104px; }
  .clock { bottom: -24px; font-size: 15px; }
  .clock.pre { font-size: 22px; }
  .round-no { margin-top: 28px; }
  .reveal-track b { font-size: 17px; }
  .reveal-track { margin-top: 0; }
  .pcard { padding: 8px 12px 10px; }
  .pcard .score { font-size: 24px; }
  .pcard .name { font-size: 13px; }
  .opt { min-height: 50px; padding: 9px 12px; }
  .opt b { font-size: 15px; }
  .opt .k { width: 26px; height: 26px; font-size: 12px; }
  .view { padding-top: 12px; }
  /* 5+ players on a phone: ultra-compact 4-col scoreboard so answers stay on screen */
  .board.mini { grid-template-columns: repeat(4, 1fr); }
  .board.mini.n2 { grid-template-columns: repeat(2, 1fr); }
  .board.mini.n3 { grid-template-columns: repeat(3, 1fr); }
  .board.mini .pcard{ padding: 6px 8px 7px; }
  .board.mini .pcard .name{ font-size: 10px; gap: 4px; }
  .board.mini .pcard .name .muted{ display: none; }
  .board.mini .pcard .sw{ width: 7px; height: 7px; }
  .board.mini .pcard .score{ font-size: 16px; }
  .board.mini .sbar{ display: none; }
  .board.mini .streak{ display: none; }
  .board.mini .delta{ font-size: 12px; right: 6px; top: 4px; }
  .board.mini .status{ font-size: 0; height: 7px; min-height: 0; margin-top: 3px; }
  .board.mini .status::before{
    content: ''; display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
  .board.mini .status.locked::before{ background: var(--pc); }
  .options { grid-template-columns: 1fr; }
  .opt { min-height: 64px; padding: 12px 14px; }
  .view { padding: 0 14px 30px; }
  .code-big { font-size: 48px; }
}
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---- join (invite) screen ---- */
.joinview { display: grid; place-items: center; padding: 6vh 0; }
.join-card { width: min(440px, 100%); text-align: center; }
.join-card .code-big { font-size: 56px; }
.join-status { min-height: 1.4em; margin-top: 4px; font-family: var(--mono); font-size: 13px; }
.join-status .j-ok { color: var(--acid); }
.join-status .j-bad { color: var(--danger); }
.join-sp { display: block; margin-top: 16px; font-family: var(--mono); font-size: 13px; color: var(--paper-2); text-decoration: none; border: 1px solid var(--ink-3); border-radius: 12px; padding: 12px; transition: border-color .15s; }
a.join-sp:hover { border-color: #1db954; color: var(--paper); }
.join-sp.on { border-color: #1db954; color: var(--paper); }
.join-alt { margin-top: 16px; font-family: var(--mono); font-size: 12px; }
.join-alt a { color: var(--mute); }

/* ---- chat (persistent right sidebar, Watch2Gether style) ---- */
.chat { position: fixed; top: 0; right: 0; bottom: 0; width: 320px; z-index: 30;
  background: var(--ink-2); border-left: 1px solid var(--ink-3); display: flex; flex-direction: column; }
.chat[hidden] { display: none; }
#app { transition: padding .18s ease; }
body.with-chat #app { padding-right: 320px; }
.chat-head { height: 52px; padding: 0 18px; border-bottom: 1px solid var(--ink-3); display: flex; align-items: center; justify-content: space-between; box-sizing: border-box; }
.chat-h-right { display: flex; align-items: center; gap: 8px; }
.chat-unread { background: var(--accent); color: var(--paper); font-family: var(--mono); font-size: 11px; font-weight: 600; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; }
.chat-unread[hidden] { display: none; }
.chat-chevron { display: none; color: var(--mute); font-size: 14px; transition: transform .2s; }
.chat-head .chat-h-label { font-family: var(--display); font-weight: 800; font-size: 16px; color: var(--paper); }
.chat-log { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 9px; }
.cmsg { font-size: 14px; line-height: 1.4; word-break: break-word; }
.cmsg .cname { font-family: var(--mono); font-size: 12px; font-weight: 600; margin-right: 6px; }
.cmsg .cname.c1 { color: var(--c1); } .cmsg .cname.c2 { color: var(--c2); } .cmsg .cname.c3 { color: var(--c3); } .cmsg .cname.c4 { color: var(--c4); } .cmsg .cname.c5 { color: var(--c5); } .cmsg .cname.c6 { color: var(--c6); } .cmsg .cname.c7 { color: var(--c7); } .cmsg .cname.c8 { color: var(--c8); }
.cmsg .ctext { color: var(--paper); }
.cmsg .ctime { font-family: var(--mono); font-size: 9px; color: var(--mute); margin-left: 6px; }
.cmsg.sys { color: var(--mute); font-style: italic; font-size: 13px; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--ink-3); }
.chat-form input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 14px; background: var(--ink); color: var(--paper); border: 1px solid var(--ink-3); border-radius: 10px; padding: 11px 13px; outline: none; }
.chat-form input:focus { border-color: var(--accent); }
.chat-form button { background: var(--accent); color: var(--paper); border: 0; border-radius: 10px; width: 46px; font-size: 16px; cursor: pointer; }
@media (max-width: 900px) {
  .chat { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 62vh; border-left: 0; border-top: 1px solid var(--ink-3); border-radius: 16px 16px 0 0; box-shadow: 0 -12px 34px rgba(0,0,0,.45); }
  .chat-head { cursor: pointer; }
  .chat-chevron { display: inline; }
  .chat.collapsed { height: auto; }
  .chat.collapsed .chat-chevron { transform: rotate(180deg); }
  .chat.collapsed .chat-log, .chat.collapsed .chat-form { display: none; }
  body.with-chat #app { padding-right: 0; padding-bottom: 122px; }
  .foot { display: none; }
}

/* ---- emotes + confetti ---- */
.emotes { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 35;
  display: flex; gap: 2px; background: var(--ink-2); border: 1px solid var(--ink-3); border-radius: 999px; padding: 5px 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.emotes[hidden] { display: none; }
.emotes .em-row { display: flex; gap: 2px; }
.emotes .em-toggle { display: none; }
body.with-chat .emotes { left: calc(50% - 160px); }
.emotes button { background: none; border: 0; font-size: 21px; line-height: 1; padding: 5px 6px; cursor: pointer; border-radius: 50%; transition: transform .1s; }
.emotes button:hover { transform: translateY(-4px) scale(1.25); }
.fly-emote { position: fixed; z-index: 60; pointer-events: none; text-align: center; animation: flyup 2.6s ease-out forwards; }
.fly-emote .e { font-size: 36px; display: block; filter: drop-shadow(0 4px 10px rgba(0,0,0,.5)); }
.fly-emote .who { font-family: var(--mono); font-size: 10px; font-weight: 600; display: block; margin-top: 2px; }
.fly-emote .who.c1 { color: var(--c1); } .fly-emote .who.c2 { color: var(--c2); } .fly-emote .who.c3 { color: var(--c3); } .fly-emote .who.c4 { color: var(--c4); } .fly-emote .who.c5 { color: var(--c5); } .fly-emote .who.c6 { color: var(--c6); } .fly-emote .who.c7 { color: var(--c7); } .fly-emote .who.c8 { color: var(--c8); }
@keyframes flyup {
  0% { opacity: 0; transform: translate(0, 0) scale(.5); }
  12% { opacity: 1; transform: translate(0, -14px) scale(1.1); }
  100% { opacity: 0; transform: translate(var(--dx, 0), -240px) scale(1) rotate(var(--rot, 0deg)); }
}
.confetti { position: fixed; z-index: 55; width: 9px; height: 14px; pointer-events: none; border-radius: 2px;
  animation: confetti-fall 1.7s cubic-bezier(.2,.7,.3,1) forwards; }
@keyframes confetti-fall {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  100% { opacity: 0; transform: translate(var(--cx, 0), var(--cy, 200px)) rotate(var(--crot, 180deg)); }
}
@media (max-width: 900px) {
  .emotes, body.with-chat .emotes { left: auto; right: 10px; bottom: 66px; transform: none; background: transparent; border: 0; box-shadow: none; padding: 0; }
  .emotes .em-toggle { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
    background: var(--ink-2); border: 1px solid var(--ink-3); font-size: 20px; cursor: pointer; box-shadow: 0 8px 24px rgba(0,0,0,.45); }
  .emotes .em-row { display: none; }
  .emotes.open .em-row { display: flex; position: absolute; bottom: 48px; right: 0;
    background: var(--ink-2); border: 1px solid var(--ink-3); border-radius: 999px; padding: 5px 8px; box-shadow: 0 10px 30px rgba(0,0,0,.45); }
  .emotes .em-row button { font-size: 18px; padding: 4px 5px; }
}

/* ---- score race, streaks, urgency, series ---- */
.pcard .sbar { height: 5px; background: var(--ink); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.pcard .sbar i { display: block; height: 100%; background: var(--pc, var(--paper)); border-radius: 99px; transition: width .9s cubic-bezier(.2,.8,.2,1); }
.streak { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--accent-2); background: rgba(255,77,28,.14); border-radius: 999px; padding: 2px 7px; margin-left: 6px; animation: streakpop .35s ease; }
@keyframes streakpop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.ring.warn { animation: ringpulse .5s ease-in-out infinite alternate; }
@keyframes ringpulse { from { transform: scale(1); } to { transform: scale(1.035); } }
.series { margin: 6px auto 22px; width: 100%; max-width: 640px; text-align: center; }
.series-tally { font-family: var(--mono); font-size: 14px; font-weight: 600; color: var(--acid); letter-spacing: .04em; }
.series-stats { display: none; margin-top: 10px; gap: 10px 16px; justify-content: center; flex-wrap: wrap; font-family: var(--mono); font-size: 12px; color: var(--paper-2); animation: rise .25s ease; }
.series.open .series-stats { display: flex; }
.series-btn { margin-left: 10px; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); background: transparent; border: 1px solid var(--ink-3); border-radius: 999px; padding: 3px 10px; cursor: pointer; vertical-align: middle; transition: color .15s, border-color .15s; }
.series-btn:hover, .series.open .series-btn { color: var(--paper); border-color: var(--mute); }
.series-stats b { color: var(--paper); }
.c1-t { color: var(--c1); } .c2-t { color: var(--c2); } .c3-t { color: var(--c3); } .c4-t { color: var(--c4); } .c5-t { color: var(--c5); } .c6-t { color: var(--c6); } .c7-t { color: var(--c7); } .c8-t { color: var(--c8); }

/* 5+ players on desktop: compact the stage so all options stay above the fold */
@media (min-width: 821px) {
  .game.crowd { gap: clamp(14px, 2vh, 22px); }
  .game.crowd .vinyl-wrap { width: clamp(130px, min(18vw, 22vh), 240px); }
  /* balanced rows instead of a lopsided 6+2 / 6+1 wrap */
  .board.n7, .board.n8 { grid-template-columns: repeat(4, 1fr); }
}

.mode-hint { display: block; margin-top: 6px; font-family: var(--mono); font-size: 11px; color: var(--mute); line-height: 1.4; }
.pl.nofilm { opacity: .38; }
.pl.nofilm.selected { opacity: .7; }
.pl .anime-ph { display: grid; place-items: center; font-size: 20px; }
.vid-wrap { position: relative; width: min(640px, 100%); }
.opvid { display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px 12px 0 0; background: #000; box-shadow: 0 18px 50px rgba(0,0,0,.5); }
.vid-wrap.broken .opvid { display: none; }
.vbar { height: 8px; background: var(--ink-3); border-radius: 0 0 12px 12px; overflow: hidden; }
.vbar i { display: block; height: 100%; width: 100%; background: var(--acid); transition: width .12s linear; }
.vbar i.warn { background: var(--accent); }
.vid-wrap .vclock { position: absolute; left: 10px; top: 10px; bottom: auto; right: auto; transform: none; font-size: 15px; padding: 3px 9px; background: rgba(0,0,0,.55); border-radius: 999px; backdrop-filter: blur(4px); }
.vid-wrap .vclock.pre { font-size: 22px; }
.rounds .sep { width: 1px; height: 22px; background: var(--ink-3); margin: 0 6px; align-self: center; }

.src-brand.b-an { color: #ff9fd0; }
.source-chip .anime-ph { display: grid; place-items: center; font-size: 18px; }
@media (max-width: 820px) {
  /* video mode on phones: cap the player so the 4 answers stay above the fold on small screens */
  .vid-wrap { width: 100%; }
  .opvid { max-height: 18vh; object-fit: cover; }
  .game.video { gap: 8px; }
  .game.video .round-no { display: none; }
  .game.video .opt > span { min-width: 0; }
  .game.video .opt b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .vid-wrap .vclock { font-size: 13px; padding: 2px 8px; }
  .vid-wrap .vclock.pre { font-size: 18px; }
}

/* ---- lobby settings panel ---- */
.settings-panel { display: grid; gap: 12px; margin-top: 18px; }
.sgroup { border: 1px solid var(--ink-3); border-radius: 12px; padding: 12px 14px 14px; background: rgba(0,0,0,.14); }
.sgroup h4 { margin: 0 0 10px; font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--acid); }
.sfields { display: flex; gap: 10px 26px; flex-wrap: wrap; }
.sfield .label { margin-bottom: 6px; }
.sfield .mode-hint { max-width: 520px; }
@media (max-width: 820px) { .sgroup { padding: 10px 12px 12px; } .sfields { gap: 10px 18px; } }

/* Music / Anime room mode switch (top of Your picks) */
.mode-switch { display: inline-flex; gap: 0; margin-bottom: 12px; border: 1px solid var(--ink-3); border-radius: 999px; padding: 3px; background: var(--ink); }
.mode-switch button { font-family: var(--mono); font-weight: 600; font-size: 13px; padding: 7px 16px; border-radius: 999px; background: transparent; color: var(--paper-2); border: 0; cursor: pointer; transition: background .15s, color .15s; }
.mode-switch button.active { background: var(--paper); color: var(--ink); }
.tabs.single { display: none; }
