:root {
    --bg: #0a0a12;
    --panel: #14141f;
    --panel-2: #1c1c2b;
    --line: #2a2a3d;
    --text: #f2f2f7;
    --muted: #8a8aa3;
    --brand: #7c5cff;
    --brand-2: #00e0c6;
    --good: #1fd17a;
    --bad: #ff4d6d;
    --gold: #ffc857;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    background: radial-gradient(1200px 600px at 50% -10%, #1a1730 0%, var(--bg) 60%);
    color: var(--text);
    min-height: 100vh;
}

#arena { max-width: 720px; margin: 0 auto; padding: 20px 18px 60px; }

.arena-top {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 0 22px; border-bottom: 1px solid var(--line); margin-bottom: 28px;
}
.brand { font-weight: 800; letter-spacing: 1px; font-size: 20px; }
.brand span { color: var(--brand); }
.top-right { display: flex; align-items: center; gap: 12px; }
.pot { text-align: right; }
/* Header sound toggle. Shows 🔊 by default; flips to 🔇 (dimmed) when muted. */
.sound-toggle {
    flex: 0 0 auto; width: 34px; height: 34px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 16px; line-height: 1; cursor: pointer;
    background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px;
    transition: border-color .15s ease, opacity .15s ease;
}
.sound-toggle:hover { border-color: var(--brand); }
.sound-toggle .snd-off { display: none; }
.sound-toggle.muted .snd-on { display: none; }
.sound-toggle.muted .snd-off { display: inline; }
.sound-toggle.muted { opacity: .6; }
.pot-label { display: block; font-size: 10px; letter-spacing: 2px; color: var(--muted); }
.pot-value { font-family: 'Space Mono', monospace; font-weight: 700; color: var(--gold); font-size: 18px; }

.screen { animation: fade .25s ease; }
.hidden { display: none !important; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.headline { font-size: 34px; font-weight: 800; line-height: 1.1; margin-bottom: 10px; }
.sub { color: var(--muted); font-size: 16px; margin-bottom: 24px; }
.fineprint { color: var(--muted); font-size: 12px; margin-top: 14px; }

.lobby-card, .spec-card, .done-card {
    background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 30px 26px;
}

.lobby-stats { display: flex; gap: 14px; margin: 22px 0; }
.stat {
    flex: 1; background: var(--panel-2); border: 1px solid var(--line);
    border-radius: 14px; padding: 16px; text-align: center;
}
.stat-num { font-family: 'Space Mono', monospace; font-size: 30px; font-weight: 700; color: var(--brand-2); }
.stat-label { font-size: 11px; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }

#joinForm input {
    width: 100%; padding: 14px 16px; margin-bottom: 12px; border-radius: 12px;
    border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
    font-family: inherit; font-size: 15px;
}
#joinForm input:focus { outline: none; border-color: var(--brand); }

.btn-primary {
    width: 100%; padding: 16px; border: none; border-radius: 12px; cursor: pointer;
    background: linear-gradient(90deg, var(--brand), #9b7bff); color: #fff;
    font-family: inherit; font-weight: 700; font-size: 16px; letter-spacing: .5px;
    transition: transform .08s ease, filter .15s ease;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: scale(.99); }
.btn-primary:disabled { filter: grayscale(.6) brightness(.7); cursor: not-allowed; }

/* Secondary, low-emphasis action under the primary CTA (e.g. Watch live). */
.btn-ghost {
    width: 100%; margin-top: 10px; padding: 13px; cursor: pointer;
    background: transparent; border: 1px solid var(--line); border-radius: 12px;
    color: var(--muted); font-family: inherit; font-weight: 600; font-size: 14px;
    transition: border-color .15s ease, color .15s ease;
}
.btn-ghost:hover { border-color: var(--brand-2); color: var(--brand-2); }

.joined { background: rgba(31,209,122,.1); border: 1px solid var(--good); color: var(--good); padding: 16px; border-radius: 12px; }
/* Jurisdiction / sanctions block — player can neither enter nor watch. */
.geo-blocked {
    background: rgba(255,200,0,.06); border: 1px solid rgba(255,200,0,.35);
    color: var(--fg, #e8e8e8);
    padding: 20px 24px; border-radius: 12px; line-height: 1.65; font-size: 0.88rem;
}
.geo-blocked p { margin: 0 0 10px; }
.geo-blocked p:last-child { margin-bottom: 0; }
.geo-blocked__heading {
    font-weight: 700; font-size: 1rem; color: rgba(255,200,0,.9);
    margin-bottom: 12px !important;
}
.geo-blocked__link { color: rgba(255,200,0,.85); text-decoration: underline; }
.geo-blocked__link:hover { color: rgba(255,200,0,1); }
/* Watch-only badge — uses the secondary brand colour to read "observing", not "in". */
.joined.watching { background: rgba(0,224,198,.08); border-color: var(--brand-2); color: var(--brand-2); }

.lobby-invite { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.btn-invite {
    width: 100%; padding: 13px; border-radius: 12px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
    font-family: inherit; font-weight: 700; font-size: 13px; letter-spacing: .5px;
    transition: border-color .12s ease, color .12s ease, background .12s ease, transform .08s ease;
}
.btn-invite svg { flex-shrink: 0; }
.btn-invite:hover { border-color: var(--brand); color: #fff; }
.btn-invite:active { transform: scale(.99); }
.btn-invite.copied { border-color: var(--good); color: var(--good); background: rgba(31,209,122,.1); }
.invite-note { color: var(--muted); font-size: 12px; line-height: 1.5; margin-top: 10px; }

.q-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
#qProgress { font-family: 'Space Mono', monospace; font-weight: 700; color: var(--text); }
/* The category is the player's at-a-glance signal for what the question is about,
   so it's the loudest thing in the meta row: bigger, teal, bold, and glowing. */
.q-cat {
    display: inline-flex; align-items: center; gap: 7px;
    background: linear-gradient(135deg, rgba(0,224,198,.18), rgba(124,92,255,.16));
    border: 1px solid var(--brand-2);
    color: var(--brand-2);
    padding: 7px 16px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 0 16px rgba(0,224,198,.35);
}
.q-cat.pop { animation: q-cat-pop .45s cubic-bezier(.2,1.4,.4,1); }
@keyframes q-cat-pop {
    0%   { transform: scale(.8); opacity: 0; }
    60%  { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); }
}
.q-surv { margin-left: auto; color: var(--brand-2); font-weight: 600; }

@media (max-width: 480px) {
    .q-cat { font-size: 13px; padding: 6px 13px; letter-spacing: 1px; }
    .q-meta { gap: 8px; }
}

.timer-wrap { height: 8px; background: var(--panel-2); border-radius: 999px; overflow: hidden; margin-bottom: 22px; }
.timer-bar { height: 100%; width: 100%; background: linear-gradient(90deg, var(--brand-2), var(--brand)); transition: width .1s linear; }
.timer-bar.danger { background: linear-gradient(90deg, var(--bad), #ff8a5c); }

.question { font-size: 24px; font-weight: 700; line-height: 1.25; margin-bottom: 22px; min-height: 60px; }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice {
    display: flex; align-items: center; gap: 12px; text-align: left;
    background: var(--panel); border: 1.5px solid var(--line); color: var(--text);
    border-radius: 14px; padding: 16px; cursor: pointer; font-family: inherit; font-size: 15px;
    transition: border-color .12s ease, background .12s ease, transform .08s ease;
}
.choice:hover:not(:disabled) { border-color: var(--brand); }
.choice:active:not(:disabled) { transform: scale(.99); }
.choice:disabled { cursor: default; }
.choice .letter {
    width: 30px; height: 30px; flex: 0 0 30px; border-radius: 8px; background: var(--panel-2);
    display: grid; place-items: center; font-weight: 700; font-family: 'Space Mono', monospace;
}
.choice.selected { border-color: var(--brand); background: rgba(124,92,255,.14); }
.choice.correct { border-color: var(--good); background: rgba(31,209,122,.16); }
.choice.correct .letter { background: var(--good); color: #04210f; }
.choice.wrong { border-color: var(--bad); background: rgba(255,77,109,.14); }
.choice.wrong .letter { background: var(--bad); color: #2a0009; }

.answer-status { margin-top: 18px; text-align: center; font-weight: 600; min-height: 24px; }
.answer-status.locked { color: var(--brand-2); }
.answer-status.good { color: var(--good); }
.answer-status.bad { color: var(--bad); }
.answer-status.watching { color: var(--brand-2); letter-spacing: .5px; }

/* Spectator's read-only choices: visible but clearly non-interactive. */
.choice.watch-only { cursor: default; opacity: .9; }
.choice.watch-only:hover { border-color: var(--line); }

.spec-card { text-align: center; }
.spec-x { font-size: 46px; color: var(--bad); margin-bottom: 8px; }
.spec-card .stat { display: inline-block; min-width: 140px; margin-top: 12px; }

.done-card { text-align: center; }
#winnersBox { margin: 22px 0; }
.winner-row {
    background: var(--panel-2); border: 1px solid var(--gold); border-radius: 12px;
    padding: 14px; margin-bottom: 10px; font-weight: 700;
}
.winner-row .amt { color: var(--gold); font-family: 'Space Mono', monospace; }
.winner-row .tx-link { color: var(--good); text-decoration: none; font-weight: 700; margin-left: 8px; }
.winner-row .tx-link:hover { text-decoration: underline; }
.rollover { color: var(--gold); font-weight: 700; font-size: 18px; }

/* ───────────────────────────────────────────────────────────────────────────
   Animated backdrop — drifting aurora glows + moving grid + floating glyphs.
   Pure CSS/SVG (no images), GPU-friendly (transform/opacity only).
   ─────────────────────────────────────────────────────────────────────────── */
#arena { position: relative; z-index: 1; }

.arena-bg {
    position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
}

/* Faint perspective grid that slowly scrolls, masked so it fades out at edges. */
.arena-bg::before {
    content: ''; position: absolute; inset: -2px;
    background-image:
        linear-gradient(rgba(124, 92, 255, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(124, 92, 255, 0.07) 1px, transparent 1px);
    background-size: 46px 46px;
    -webkit-mask-image: radial-gradient(circle at 50% 28%, #000 0%, transparent 72%);
    mask-image: radial-gradient(circle at 50% 28%, #000 0%, transparent 72%);
    animation: gridmove 26s linear infinite;
}
@keyframes gridmove { to { background-position: 46px 46px; } }

.orb {
    position: absolute; border-radius: 50%; filter: blur(70px);
    will-change: transform; opacity: 0.5;
}
.orb-1 {
    width: 440px; height: 440px; top: -140px; left: -110px;
    background: radial-gradient(circle, var(--brand) 0%, transparent 70%);
    animation: drift1 19s ease-in-out infinite;
}
.orb-2 {
    width: 380px; height: 380px; bottom: -150px; right: -90px;
    background: radial-gradient(circle, var(--brand-2) 0%, transparent 70%);
    animation: drift2 23s ease-in-out infinite;
}
.orb-3 {
    width: 320px; height: 320px; top: 42%; left: 52%; opacity: 0.33;
    background: radial-gradient(circle, #ff4d8d 0%, transparent 70%);
    animation: drift3 28s ease-in-out infinite;
}
@keyframes drift1 { 50% { transform: translate(90px, 70px) scale(1.12); } }
@keyframes drift2 { 50% { transform: translate(-80px, -55px) scale(1.16); } }
@keyframes drift3 { 50% { transform: translate(-70px, 45px) scale(0.9); } }

/* Floating A / B / C / D / ? glyphs — the multiple-choice motif, drifting up. */
.glyphs { position: absolute; inset: 0; }
.glyph {
    position: absolute; bottom: -40px;
    font-family: 'Space Mono', monospace; font-weight: 700;
    color: rgba(124, 92, 255, 0.12); user-select: none;
    animation: floatUp linear infinite;
}
@keyframes floatUp {
    0%   { transform: translateY(0) rotate(0deg); opacity: 0; }
    12%  { opacity: 1; }
    88%  { opacity: 1; }
    100% { transform: translateY(-112vh) rotate(10deg); opacity: 0; }
}

/* Header LIVE pulse + animated ARENA gradient. */
.live {
    display: inline-flex; align-items: center; gap: 6px; vertical-align: middle;
    margin-left: 10px; font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
    color: var(--bad);
}
.live-dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--bad);
    box-shadow: 0 0 0 0 rgba(255, 77, 109, 0.6);
    animation: livepulse 1.6s ease-out infinite;
}
@keyframes livepulse {
    0%   { box-shadow: 0 0 0 0 rgba(255, 77, 109, 0.6); }
    100% { box-shadow: 0 0 0 10px rgba(255, 77, 109, 0); }
}
.brand-left { display: flex; align-items: center; }
.brand .arena-word {
    background: linear-gradient(90deg, var(--brand), var(--brand-2), var(--brand));
    background-size: 200% auto;
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
    animation: brandshift 6s linear infinite;
}
@keyframes brandshift { to { background-position: 200% center; } }

/* Custom arena emblem on the lobby (inline SVG). */
.emblem { display: block; width: 96px; height: 96px; margin: 0 auto 18px; }
.emblem .ring-rot { transform-origin: 50% 50%; animation: spin 9s linear infinite; }
.emblem .ring-rot-rev { transform-origin: 50% 50%; animation: spin 14s linear infinite reverse; }
.emblem .core { transform-origin: 50% 50%; animation: corepulse 2.4s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes corepulse { 0%, 100% { transform: scale(0.82); opacity: 0.75; } 50% { transform: scale(1.08); opacity: 1; } }

.lobby-card { text-align: center; }
.lobby-card #joinForm input { text-align: left; }

/* CTA glow. */
.btn-primary { box-shadow: 0 6px 22px rgba(124, 92, 255, 0.28); }
.btn-primary:not(:disabled) { animation: btnglow 3s ease-in-out infinite; }
@keyframes btnglow {
    0%, 100% { box-shadow: 0 6px 22px rgba(124, 92, 255, 0.28); }
    50%      { box-shadow: 0 10px 34px rgba(124, 92, 255, 0.5); }
}

.headline { text-shadow: 0 0 28px rgba(124, 92, 255, 0.25); }

@media (prefers-reduced-motion: reduce) {
    .arena-bg::before, .orb, .glyph, .live-dot, .brand span, .emblem .ring-rot,
    .emblem .ring-rot-rev, .emblem .core, .btn-primary:not(:disabled) {
        animation: none !important;
    }
}

@media (max-width: 520px) {
    .headline { font-size: 27px; }
    .question { font-size: 20px; }
    .choices { grid-template-columns: 1fr; }
    .orb { filter: blur(50px); }
}

/* ── LEADERBOARD ── */
.arena-leaderboard {
    margin: 18px auto 0; max-width: 460px;
    background: var(--panel); border: 1px solid var(--line);
    border-radius: 18px; padding: 18px 20px; text-align: left;
}
.lb-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.lb-head h3 {
    margin: 0; font-size: 13px; font-weight: 700; letter-spacing: 1.5px;
    text-transform: uppercase; color: var(--muted);
}
.lb-tabs { display: flex; gap: 6px; }
.lb-tab {
    background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
    font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
    cursor: pointer; transition: all .15s ease;
}
.lb-tab.is-active { border-color: var(--brand); color: var(--text); background: rgba(124,92,255,.14); }
.lb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.lb-empty { color: var(--muted); font-size: 13px; padding: 10px 4px; text-align: center; }
.lb-row {
    display: grid; grid-template-columns: 26px 1fr auto auto; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid transparent;
}
.lb-row:nth-child(-n+3) { border-color: var(--line); }
.lb-rank {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 6px; font-size: 12px; font-weight: 700;
    background: var(--panel); color: var(--muted);
}
.lb-rank-1 { background: var(--gold); color: #2a1d00; }
.lb-rank-2 { background: #c9d1e0; color: #1a1f2a; }
.lb-rank-3 { background: #d08b52; color: #2a1500; }
.lb-name {
    font-weight: 600; font-size: 14px; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lb-stat { font-family: 'Space Mono', monospace; font-size: 13px; font-weight: 700; min-width: 34px; text-align: right; }
.lb-stat small { font-size: 9px; color: var(--muted); margin-left: 2px; font-weight: 400; }
/* Scribbz Coins is the headline score: gold, a touch larger than other stats. */
.lb-coins { color: var(--gold); font-size: 15px; min-width: 52px; }
.lb-coins small { color: var(--gold); opacity: .8; }
.lb-wins { color: var(--muted); }
.lb-correct { color: var(--brand-2); }
.lb-note { color: var(--muted); font-size: 11px; margin: 12px 0 0; text-align: center; line-height: 1.5; }
.lb-name .lb-sub { font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 6px; }

/* Players | Teams scope toggle, sitting alongside the board title. */
.lb-scope {
    background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
    font-size: 11px; font-weight: 600; padding: 4px 12px; border-radius: 999px;
    cursor: pointer; transition: all .15s ease;
}
.lb-scope.is-active { border-color: var(--brand-2); color: var(--text); background: rgba(0,224,198,.14); }
.lb-windows { display: flex; gap: 6px; margin-bottom: 12px; }

/* ── TEAMS / SQUADS ── */
.lobby-teams {
    margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line);
    text-align: left;
}
.lobby-teams-label {
    display: block; font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
    text-transform: uppercase; color: var(--muted); margin-bottom: 8px;
}
.lobby-teams-list { display: flex; flex-wrap: wrap; gap: 8px; }
.team-pill {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
    font-size: 12px; font-weight: 700; letter-spacing: .5px;
    padding: 5px 10px; border-radius: 999px;
}
.team-pill small {
    font-family: 'Space Mono', monospace; font-weight: 700; font-size: 11px;
    color: var(--muted);
    background: var(--panel); border-radius: 999px; padding: 1px 7px;
}
.team-pill.mine { border-color: var(--brand-2); color: var(--brand-2); }
.team-pill.mine small { color: var(--brand-2); }

/* Live squad standings under the question/reveal. */
.team-standings {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    margin-top: 16px; justify-content: center;
}
.ts-label {
    font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
    text-transform: uppercase; color: var(--muted);
}
.ts-team {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
    font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}
.ts-team small {
    font-family: 'Space Mono', monospace; font-weight: 700; font-size: 11px; color: var(--muted);
}
.ts-team.mine { border-color: var(--brand-2); color: var(--brand-2); }
.ts-team.mine small { color: var(--brand-2); }
.ts-team.out { opacity: .45; text-decoration: line-through; }

/* ── Wager / non-elimination mode (5b.23) ───────────────────────────────────── */
.mode-badge {
    margin: 10px auto 0; max-width: 420px; text-align: center;
    font-size: 12px; font-weight: 700; line-height: 1.4; letter-spacing: .3px;
    color: var(--gold); background: rgba(255,200,87,.08);
    border: 1px solid rgba(255,200,87,.35); border-radius: 999px; padding: 7px 14px;
}

/* Stake selector + bank, shown above the choices in wager mode. */
.wager-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    flex-wrap: wrap; margin: 4px 0 14px; padding: 10px 12px;
    background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
}
.wager-bar.final { border-color: var(--gold); background: rgba(255,200,87,.07); }
.wager-balance { font-size: 13px; color: var(--muted); font-weight: 600; }
.wager-balance strong {
    font-family: 'Space Mono', monospace; font-size: 18px; color: var(--text); margin-left: 4px;
}
.wager-pick { display: inline-flex; align-items: center; gap: 6px; }
.wager-pick-label {
    font-size: 11px; font-weight: 700; letter-spacing: 1px;
    text-transform: uppercase; color: var(--muted); margin-right: 2px;
}
.wager-opt {
    min-width: 42px; padding: 7px 10px; border-radius: 9px; cursor: pointer;
    background: var(--panel); border: 1px solid var(--line); color: var(--text);
    font-family: 'Space Mono', monospace; font-weight: 700; font-size: 14px;
    transition: border-color .12s ease, color .12s ease, background .12s ease, transform .08s ease;
}
.wager-opt:hover:not(:disabled) { border-color: var(--brand); }
.wager-opt:active:not(:disabled) { transform: scale(.96); }
.wager-opt.is-active { border-color: var(--brand); color: #fff; background: rgba(124,92,255,.18); }
.wager-opt:disabled { opacity: .5; cursor: default; }
.wager-bar.final .wager-opt.is-active { border-color: var(--gold); background: rgba(255,200,87,.18); color: var(--gold); }

/* Live + final standings (the comeback leaderboard). */
.standings-box { margin-top: 18px; }
.standings-inner {
    background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
    padding: 12px 14px; max-width: 460px; margin: 0 auto;
}
.standings-title {
    font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
    color: var(--muted); margin-bottom: 8px; text-align: left;
}
.standings-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.standings-row {
    display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px;
    padding: 6px 8px; border-radius: 8px;
}
.standings-row.me { background: rgba(124,92,255,.12); }
.st-rank {
    font-family: 'Space Mono', monospace; font-weight: 700; font-size: 13px;
    color: var(--muted); text-align: center;
}
.st-rank-1 { color: var(--gold); }
.st-rank-2 { color: #c9d1e0; }
.st-rank-3 { color: #cd8d54; }
.st-name { font-weight: 600; font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-score { font-family: 'Space Mono', monospace; font-weight: 700; font-size: 15px; color: var(--brand-2); }

.winning-team {
    font-weight: 800; font-size: 16px; color: var(--brand-2);
    margin: 6px 0 2px; letter-spacing: .5px;
}
.winner-coins {
    font-family: 'Space Mono', monospace; font-weight: 700; font-size: 18px;
    color: var(--gold); margin: 8px 0 2px;
}

/* ── Team setup (create / join / solo) ── */
.team-setup {
    text-align: left; margin: 4px 0 12px;
    border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--panel-2);
}
.team-mode-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.team-mode {
    flex: 1; padding: 9px 8px; border-radius: 10px; cursor: pointer;
    background: var(--panel); border: 1px solid var(--line); color: var(--muted);
    font-family: inherit; font-weight: 700; font-size: 12px; letter-spacing: .3px;
    transition: color .12s ease, border-color .12s ease, background .12s ease;
}
.team-mode:hover { color: var(--text); }
.team-mode.is-active { color: #fff; border-color: var(--brand); background: rgba(124,92,255,.16); }
.team-hint { color: var(--muted); font-size: 13px; line-height: 1.5; }
.team-pane input[type="text"] {
    width: 100%; padding: 12px 14px; margin-bottom: 10px; border-radius: 10px;
    border: 1px solid var(--line); background: var(--panel); color: var(--text);
    font-family: inherit; font-size: 14px;
}
.team-pane input[type="text"]:focus { outline: none; border-color: var(--brand); }
.team-wallet-opt {
    display: flex; align-items: flex-start; gap: 8px; cursor: pointer;
    color: var(--muted); font-size: 12px; line-height: 1.4; margin-bottom: 10px;
}
.team-wallet-opt input { margin-top: 2px; accent-color: var(--brand); }
.btn-secondary {
    width: 100%; padding: 12px; border-radius: 10px; cursor: pointer;
    background: var(--panel); border: 1px solid var(--brand); color: #fff;
    font-family: inherit; font-weight: 700; font-size: 13px; letter-spacing: .5px;
    transition: filter .12s ease, transform .08s ease;
}
.btn-secondary:hover { filter: brightness(1.15); }
.btn-secondary:active { transform: scale(.99); }
.btn-secondary:disabled { filter: grayscale(.6) brightness(.7); cursor: not-allowed; }
.team-msg { font-size: 12px; margin-top: 8px; color: var(--muted); min-height: 0; }
.team-msg.good { color: var(--good); }
.team-msg.bad { color: var(--bad); }

.team-active {
    text-align: left; margin: 4px 0 12px;
    border: 1px solid var(--brand); border-radius: 14px; padding: 14px;
    background: rgba(124,92,255,.10);
}
.team-active-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.team-active-label {
    font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
    text-transform: uppercase; color: var(--muted);
}
.team-active-name { font-size: 18px; font-weight: 800; color: var(--brand-2); letter-spacing: .5px; }
.team-active-actions { display: flex; gap: 8px; }
.team-active-actions .btn-invite { width: auto; flex: 1; padding: 10px; }
.team-leave {
    padding: 10px 14px; border-radius: 10px; cursor: pointer;
    background: transparent; border: 1px solid var(--line); color: var(--muted);
    font-family: inherit; font-weight: 700; font-size: 12px;
    transition: color .12s ease, border-color .12s ease;
}
.team-leave:hover { color: var(--bad); border-color: var(--bad); }

/* ── Wallet picker modal (arena uses its own copy of these styles) ── */
.wp-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.7);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999; backdrop-filter: blur(4px); padding: 16px;
}
.wp-card {
    background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
    width: 100%; max-width: 360px; overflow: hidden;
}
.wp-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px 14px; border-bottom: 1px solid var(--line);
    font-size: 14px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--muted);
}
.wp-close {
    background: none; border: none; color: var(--muted); cursor: pointer;
    padding: 4px; display: flex; align-items: center; transition: color .15s;
}
.wp-close:hover { color: var(--text); }
.wp-list { padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.wp-wallet-btn {
    display: flex; align-items: center; gap: 14px; padding: 13px 16px;
    background: transparent; border: 1px solid var(--line); border-radius: 12px;
    color: var(--text); font-family: inherit; font-size: 14px; font-weight: 600;
    cursor: pointer; text-align: left; text-decoration: none; width: 100%;
    transition: background .15s, border-color .15s;
}
.wp-wallet-btn:hover { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.14); }
.wp-icon {
    width: 32px; height: 32px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px; overflow: hidden;
}
.wp-icon svg, .wp-icon img { width: 32px; height: 32px; }
.wp-install { opacity: .55; }
.wp-install:hover { opacity: .85; }
.wp-sep {
    padding: 8px 8px 4px; font-size: 10px; font-weight: 700; letter-spacing: .1em;
    text-transform: uppercase; color: var(--muted); margin: 4px 0 0;
}

/* ── Attrition spectacle + near-miss (5b.19 / 5b.20) ── */
/* The survivor count flips red and throbs on a SAVAGE round. */
.q-surv.savage { color: var(--bad); animation: survPulse .6s ease-in-out 2; }
@keyframes survPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.18); }
}

.attrition-banner {
    margin: 14px auto 0; max-width: 420px; text-align: center;
    font-family: 'Space Mono', monospace; font-weight: 700; font-size: 14px;
    letter-spacing: .04em; color: var(--bad);
    background: rgba(255,77,109,.12); border: 1px solid var(--bad);
    border-radius: 10px; padding: 9px 14px;
}
.attrition-banner.show { animation: savagePop .45s cubic-bezier(.18,.89,.32,1.28); }
@keyframes savagePop {
    0%   { opacity: 0; transform: scale(.7) translateY(6px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* Near-miss nudge on the complete screen, sitting beside the play-again CTA. */
.near-miss {
    margin: 14px 0 4px; font-weight: 700; font-size: 15px; color: var(--gold);
}

/* ── Live crowd presence (5b.21): reactions + milestone callouts ── */
/* Full-viewport, non-interactive layer the tapped emoji float up through. */
.reaction-layer {
    position: fixed; inset: 0; z-index: 50; pointer-events: none; overflow: hidden;
}
.react-float {
    position: absolute; bottom: 70px;
    font-size: 30px; line-height: 1; will-change: transform, opacity;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .45));
    animation: reactFloat linear forwards;
}
@keyframes reactFloat {
    0%   { opacity: 0; transform: translateY(0) translateX(0) scale(var(--scale, 1)); }
    12%  { opacity: 1; }
    78%  { opacity: 1; }
    100% { opacity: 0; transform: translateY(-46vh) translateX(var(--drift, 0)) scale(calc(var(--scale, 1) * 1.12)); }
}

/* Bottom-centred emoji dock; only shown on the live question + spectator screens. */
.reaction-dock {
    position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
    z-index: 60; display: flex; gap: 6px; padding: 7px 9px;
    background: rgba(20, 20, 31, .82); border: 1px solid var(--line);
    border-radius: 999px; backdrop-filter: blur(8px);
    box-shadow: 0 8px 26px rgba(0, 0, 0, .4);
}
.react-btn {
    width: 40px; height: 40px; padding: 0; border-radius: 50%; cursor: pointer;
    background: transparent; border: none; font-size: 21px; line-height: 1;
    transition: transform .1s ease, background .12s ease;
}
.react-btn:hover { background: rgba(255, 255, 255, .08); }
.react-btn:active { transform: scale(1.32); }

/* Crowd-wide milestone toast — slides in from the top, colour-coded by kind. */
.callout-toast {
    position: fixed; left: 50%; top: 70px;
    transform: translateX(-50%) translateY(-8px);
    z-index: 70; pointer-events: none; opacity: 0;
    font-family: 'Space Mono', monospace; font-weight: 700; font-size: 14px;
    letter-spacing: .04em; color: var(--text); white-space: nowrap;
    background: rgba(20, 20, 31, .92); border: 1px solid var(--line);
    border-radius: 999px; padding: 9px 18px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
    transition: opacity .25s ease, transform .25s ease;
}
.callout-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.callout-toast.kind-savage    { border-color: var(--bad); color: var(--bad); }
.callout-toast.kind-final     { border-color: var(--gold); color: var(--gold); }
.callout-toast.kind-attrition { border-color: var(--brand-2); color: var(--brand-2); }
/* Coin credit toast — sits below the callout so both can show at once */
.coin-toast {
    top: 116px;
    border-color: var(--good, #1fd17a); color: var(--good, #1fd17a);
    font-size: 13px;
}
/* Referral count line on spectator + complete screens */
.referral-count {
    font-size: 13px; color: var(--good, #1fd17a); margin: 8px 0 0;
    font-family: 'Space Mono', monospace; letter-spacing: .02em;
}

@media (prefers-reduced-motion: reduce) {
    .react-float { animation-duration: 1ms !important; opacity: 0 !important; }
}
@media (max-width: 480px) {
    .reaction-dock { bottom: 10px; gap: 3px; padding: 6px; }
    .react-btn { width: 36px; height: 36px; font-size: 19px; }
}

/* ── Scheduled slots (5b.4): next-game surfaces ── */
.next-game-line {
    margin: 14px 0 2px; text-align: center;
    font-family: 'Space Mono', monospace; font-weight: 700; font-size: 13px;
    letter-spacing: .04em; color: var(--brand-2);
}
.next-game-countdown {
    margin: 6px 0 14px; font-weight: 700; font-size: 15px; color: var(--brand-2);
}

/* Referral-revive CTA (5b.22): the viral "bring a friend, you both play" hook. */
.revive-btn { margin-top: 16px; border-color: var(--brand); color: #fff; }
.revive-btn:hover { background: rgba(124,92,255,.12); }
.spec-card .revive-btn { margin-top: 18px; }
.done-card .revive-btn { margin-top: 4px; margin-bottom: 12px; }

/* ── Private group lobby ── */
.group-entry-wrap { margin-top: 12px; }

.btn-group-entry {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 18px; border-radius: 8px; cursor: pointer;
    font-family: 'Space Mono', monospace; font-weight: 700; font-size: 12px;
    letter-spacing: .06em; border: 1px solid rgba(124,92,255,.4);
    background: rgba(124,92,255,.07); color: var(--brand);
    transition: background .15s, border-color .15s;
}
.btn-group-entry:hover { background: rgba(124,92,255,.15); border-color: var(--brand); }

.group-entry-panel {
    margin-top: 12px; padding: 16px; border-radius: 10px;
    background: rgba(20,12,40,.55); border: 1px solid rgba(124,92,255,.25);
}
.group-entry-cols {
    display: flex; gap: 16px; flex-wrap: wrap;
}
.group-entry-col {
    flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 7px;
}
.group-entry-heading {
    font-size: 11px; font-family: 'Space Mono', monospace; letter-spacing: .05em;
    color: rgba(255,255,255,.5); text-transform: uppercase; margin: 0;
}
.group-entry-divider {
    display: flex; align-items: center; color: rgba(255,255,255,.25);
    font-size: 12px; padding: 0 4px;
}
.group-input {
    padding: 7px 10px; border-radius: 6px; border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.05); color: #fff; font-size: 13px;
    font-family: 'Space Grotesk', sans-serif;
}
.group-input:focus { outline: none; border-color: var(--brand); }
.group-code-input { text-transform: uppercase; letter-spacing: .12em; }
.group-entry-msg {
    margin: 10px 0 0; font-size: 12px; color: var(--bad, #ff4f5e);
    font-family: 'Space Mono', monospace;
}

/* Group lobby screen */
#screen-group { padding: 0 12px 32px; }

.group-lobby-card {
    max-width: 460px; margin: 0 auto; padding: 24px;
    border-radius: 12px; background: rgba(20,12,40,.7);
    border: 1px solid rgba(124,92,255,.25);
}
.group-lobby-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 12px; margin-bottom: 18px; flex-wrap: wrap;
}
.group-lobby-title {
    font-family: 'Space Mono', monospace; font-size: 18px;
    font-weight: 700; color: #fff; margin: 0;
}
.group-lobby-hint {
    font-size: 12px; color: rgba(255,255,255,.45); margin: 4px 0 0;
    font-family: 'Space Grotesk', sans-serif;
}

.group-code-badge {
    display: flex; align-items: center; gap: 8px;
    background: rgba(124,92,255,.12); border: 1px solid rgba(124,92,255,.3);
    border-radius: 8px; padding: 6px 12px; flex-shrink: 0;
}
.group-code-text {
    font-family: 'Space Mono', monospace; font-size: 20px; font-weight: 700;
    letter-spacing: .14em; color: var(--brand);
}
.group-code-copy {
    font-family: 'Space Mono', monospace; font-size: 10px; font-weight: 700;
    letter-spacing: .05em; padding: 3px 8px; border-radius: 5px;
    border: 1px solid rgba(124,92,255,.4); background: transparent;
    color: rgba(255,255,255,.65); cursor: pointer;
    transition: background .12s, color .12s;
}
.group-code-copy:hover { background: rgba(124,92,255,.25); color: #fff; }

.group-player-list {
    display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px;
    max-height: 220px; overflow-y: auto;
}
.group-player-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 7px 10px; border-radius: 7px; background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.06);
}
.group-player-name { font-size: 14px; color: rgba(255,255,255,.88); }
.group-host-badge {
    font-family: 'Space Mono', monospace; font-size: 9px; font-weight: 700;
    letter-spacing: .07em; color: var(--brand); border: 1px solid rgba(124,92,255,.4);
    border-radius: 4px; padding: 2px 6px;
}

.group-lobby-actions {
    display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px;
}
.group-leave-btn { font-size: 12px; padding: 8px 14px; }

.btn-invite {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 14px; border-radius: 8px; cursor: pointer;
    font-family: 'Space Mono', monospace; font-weight: 700; font-size: 11px;
    letter-spacing: .05em; border: 1px solid rgba(255,255,255,.15);
    background: transparent; color: rgba(255,255,255,.6);
    transition: background .12s, color .12s;
}
.btn-invite:hover { background: rgba(255,255,255,.07); color: #fff; }

.group-start-hint, .group-host-only {
    font-size: 12px; color: rgba(255,255,255,.4);
    font-family: 'Space Mono', monospace; margin: 6px 0 0;
}
.group-lobby-msg {
    font-size: 12px; color: rgba(255,255,255,.5); margin: 8px 0 0;
}
.group-lobby-msg.error { color: var(--bad, #ff4f5e); }

/* Group complete card */
.group-complete-card {
    max-width: 420px; margin: 32px auto 0; text-align: center;
    padding: 28px; border-radius: 12px;
    background: rgba(20,12,40,.7); border: 1px solid rgba(124,92,255,.25);
}
.group-complete-title {
    font-family: 'Space Mono', monospace; font-size: 22px; font-weight: 700;
    color: #fff; margin: 0 0 16px;
}
.group-winners { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.group-winners .winner-row {
    padding: 8px 14px; border-radius: 7px;
    background: rgba(124,92,255,.12); color: #fff; font-size: 14px;
}
.group-winners .rollover { background: rgba(255,79,94,.08); color: rgba(255,255,255,.55); }
.group-complete-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* Survivor count on question screen during group game */
.group-survivors {
    margin: 6px 0 0; font-size: 12px; color: rgba(255,255,255,.45);
    font-family: 'Space Mono', monospace;
}

@media (max-width: 480px) {
    .group-entry-cols { flex-direction: column; }
    .group-lobby-card, .group-complete-card { padding: 16px; }
    .group-code-text { font-size: 17px; }
}

/* ── Group mode toggle (create form) ── */
.group-mode-toggle {
    display: flex; gap: 4px; margin: 2px 0;
}
.group-mode-btn {
    flex: 1; padding: 6px 10px; border-radius: 6px; cursor: pointer;
    font-family: 'Space Mono', monospace; font-weight: 700; font-size: 11px;
    letter-spacing: .05em; border: 1px solid rgba(255,255,255,.12);
    background: transparent; color: rgba(255,255,255,.45);
    transition: background .12s, color .12s, border-color .12s;
}
.group-mode-btn.is-active {
    background: rgba(124,92,255,.18); color: #fff; border-color: var(--brand);
}
.group-mode-btn:hover:not(.is-active) { color: rgba(255,255,255,.7); }

/* Mode badge in lobby header */
.group-mode-badge {
    display: inline-block; margin-top: 4px;
    font-family: 'Space Mono', monospace; font-size: 9px; font-weight: 700;
    letter-spacing: .07em; padding: 2px 7px; border-radius: 4px;
    border: 1px solid rgba(124,92,255,.4); color: var(--brand);
    background: rgba(124,92,255,.08);
}
.group-mode-badge.score {
    border-color: rgba(255,198,10,.4); color: #ffc60a;
    background: rgba(255,198,10,.07);
}

/* Score Attack leaderboard on complete screen */
.group-scoreboard {
    list-style: none; padding: 0; margin: 0 0 20px;
    display: flex; flex-direction: column; gap: 6px;
}
.group-score-row {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 8px;
    background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06);
}
.group-score-row.first {
    background: rgba(255,198,10,.08); border-color: rgba(255,198,10,.25);
}
.score-rank {
    font-family: 'Space Mono', monospace; font-size: 11px; font-weight: 700;
    color: rgba(255,255,255,.35); min-width: 18px;
}
.group-score-row.first .score-rank { color: #ffc60a; }
.score-name {
    flex: 1; font-size: 14px; color: rgba(255,255,255,.88);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.score-pts {
    font-family: 'Space Mono', monospace; font-size: 13px; font-weight: 700;
    color: var(--brand);
}
.group-score-row.first .score-pts { color: #ffc60a; }

/* ── Rematch vote overlay ───────────────────────────────────────────────────── */
.rematch-overlay {
    position: fixed; inset: 0; z-index: 900;
    background: rgba(10,10,18,.88);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.rematch-overlay.hidden { display: none; }
.rematch-card {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: 20px; padding: 36px 28px; max-width: 380px; width: 100%;
    text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.rematch-host-line {
    font-size: 13px; color: rgba(255,255,255,.5); margin: 0 0 6px;
    text-transform: uppercase; letter-spacing: .06em;
}
.rematch-title {
    font-family: 'Space Grotesk', sans-serif; font-size: 24px; font-weight: 800;
    color: #fff; margin: 0 0 16px;
}
.rematch-countdown {
    font-family: 'Space Mono', monospace; font-size: 42px; font-weight: 700;
    color: var(--brand); margin: 0 0 8px; letter-spacing: -.02em;
}
.rematch-sub {
    font-size: 12px; color: rgba(255,255,255,.4); margin: 0 0 24px;
}
.rematch-actions { display: flex; flex-direction: column; gap: 10px; }
.rematch-waiting {
    font-size: 13px; color: rgba(255,255,255,.45); margin: 16px 0 0;
    font-style: italic;
}
