/* ── Google Fonts ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;700;800;900&family=Press+Start+2P&family=VT323&display=swap');

/* ── CSS Variables ───────────────────────────────────────────────────────── */
:root {
  --bg:         #1a1a2e;
  --bg2:        #16213e;
  --bg3:        #0f3460;
  --text:       #f0f0f0;
  --text-dim:   #a0a0b0;
  --accent:     #e94560;
  --blue:       #3B79B8;
  --blue-light: #6fa8dc;
  --orange:     #F9C35E;
  --orange-dark:#F6A43F;
  --pink:       #AB4A6F;
  --green:      #3BA065;
  --purple:     #7B5EA7;
  --border:     4px;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'VT323', monospace;
  font-size: 20px;
  min-height: 100vh;
}

/* ── Pixel Box ───────────────────────────────────────────────────────────── */
.pixel-box {
  background: var(--bg2);
  box-shadow: 4px 0 0 0 var(--text), -4px 0 0 0 var(--text),
    0 4px 0 0 var(--text), 0 -4px 0 0 var(--text),
    4px 4px 0 0 #000, -4px -4px 0 0 #000;
}
.pixel-box-blue {
  background: rgba(59,121,184,0.12);
  box-shadow: 4px 0 0 0 var(--blue), -4px 0 0 0 var(--blue),
    0 4px 0 0 var(--blue), 0 -4px 0 0 var(--blue);
}
.pixel-box-orange {
  background: rgba(249,195,94,0.12);
  box-shadow: 4px 0 0 0 var(--orange), -4px 0 0 0 var(--orange),
    0 4px 0 0 var(--orange), 0 -4px 0 0 var(--orange);
}

/* ── Typography ──────────────────────────────────────────────────────────── */
.font-pixel { font-family: 'Press Start 2P', monospace; }
.font-vt    { font-family: 'VT323', monospace; }
h1, h2, h3  { font-family: 'Press Start 2P', monospace; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  padding: 12px 20px;
  background: var(--text);
  color: var(--bg);
  border: none;
  cursor: pointer;
  display: inline-block;
  box-shadow: 6px 6px 0 #000;
  transition: box-shadow 0.05s, transform 0.05s;
  text-transform: uppercase;
  letter-spacing: 1px;
  user-select: none;
  -webkit-user-select: none;
}
.btn:active { transform: translate(4px,4px); box-shadow: 2px 2px 0 #000; }
.btn-blue   { background: var(--blue); color: #fff; box-shadow: 6px 6px 0 #1a3a5c; }
.btn-blue:active { box-shadow: 2px 2px 0 #1a3a5c; }
.btn-orange { background: var(--orange); color: var(--bg); box-shadow: 6px 6px 0 #8a6000; }
.btn-orange:active { box-shadow: 2px 2px 0 #8a6000; }
.btn-red    { background: var(--accent); color: #fff; box-shadow: 6px 6px 0 #7a0020; }
.btn-red:active { box-shadow: 2px 2px 0 #7a0020; }
.btn-green  { background: var(--green); color: #fff; box-shadow: 6px 6px 0 #1a4a30; }
.btn-green:active { box-shadow: 2px 2px 0 #1a4a30; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ── Text Input ──────────────────────────────────────────────────────────── */
.pixel-input {
  font-family: 'VT323', monospace;
  font-size: 22px;
  background: var(--bg);
  color: var(--text);
  border: none;
  box-shadow: 4px 0 0 0 var(--text-dim), -4px 0 0 0 var(--text-dim),
    0 4px 0 0 var(--text-dim), 0 -4px 0 0 var(--text-dim);
  padding: 8px 12px;
  width: 100%;
  outline: none;
}
.pixel-input:focus {
  box-shadow: 4px 0 0 0 var(--text), -4px 0 0 0 var(--text),
    0 4px 0 0 var(--text), 0 -4px 0 0 var(--text);
}

/* ── Score Bar (phone) ───────────────────────────────────────────────────── */
.score-bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; }
.score-team { font-family: 'Press Start 2P', monospace; font-size: 14px; }
.score-blue  { color: var(--blue-light); }
.score-orange{ color: var(--orange); }

/* ── Canvas ──────────────────────────────────────────────────────────────── */
canvas { image-rendering: pixelated; image-rendering: crisp-edges; display: block; }

/* ── Team bg colors ──────────────────────────────────────────────────────── */
.team-blue   { background: linear-gradient(160deg, #0d1a2e 0%, #1a2e4a 100%) !important; }
.team-orange { background: linear-gradient(160deg, #2e1a0d 0%, #4a2e1a 100%) !important; }

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes bounce     { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes pulse-glow { 0%,100% { text-shadow: 0 0 8px currentColor; } 50% { text-shadow: 0 0 24px currentColor, 0 0 48px currentColor; } }
@keyframes shake      { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-4px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@keyframes slide-in   { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes winner-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.anim-bounce     { animation: bounce 0.6s ease; }
.anim-pulse-glow { animation: pulse-glow 1.5s infinite; }
.anim-slide-in   { animation: slide-in 0.3s ease forwards; }
.anim-winner     { animation: winner-pulse 1s infinite; }

/* ── Utility ─────────────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.mt-1 { margin-top: 4px; }  .mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; } .mt-4 { margin-top: 24px; } .mt-6 { margin-top: 32px; }
.p-2  { padding: 8px; }     .p-4  { padding: 16px; }
.gap-2 { gap: 8px; }        .gap-4 { gap: 16px; }
.flex { display: flex; }    .flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }    .hidden { display: none !important; }

/* ══════════════════════════════════════════════════════════════════════════ */
/*  PHONE STYLES                                                             */
/* ══════════════════════════════════════════════════════════════════════════ */

body.phone-body {
  height: 100dvh; overflow: hidden; display: flex; flex-direction: column;
  touch-action: manipulation;
  background: #0A0818; color: #fff; font-family: 'Nunito', sans-serif;

  --ph-blue:    #38BDF8;
  --ph-orange:  #FB923C;
  --ph-green:   #4ADE80;
  --ph-red:     #F87171;
  --ph-yellow:  #FDE047;
  --ph-surface: rgba(255,255,255,0.06);
  --ph-border:  rgba(255,255,255,0.1);
  --ph-dim:     rgba(255,255,255,0.5);
}

/* Team tinting on body */
body.phone-body.team-blue {
  background:
    radial-gradient(ellipse 120% 40% at 50% -5%, rgba(56,189,248,0.13) 0%, transparent 100%),
    #0A0818;
}
body.phone-body.team-orange {
  background:
    radial-gradient(ellipse 120% 40% at 50% -5%, rgba(251,146,60,0.13) 0%, transparent 100%),
    #0A0818;
}

#ctrl-root {
  display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  gap: 14px; max-width: 480px; margin: 0 auto; width: 100%;
}

/* ── Phone buttons ───────────────────────────────────────────────────────── */
body.phone-body .btn {
  font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 19px;
  padding: 14px 24px; border-radius: 50px;
  box-shadow: none; letter-spacing: 0.3px; text-transform: uppercase;
  transition: transform 0.1s, opacity 0.1s;
}
body.phone-body .btn:active { transform: scale(0.96); box-shadow: none; }
body.phone-body .btn-green  { background: var(--ph-green); color: #0A0818; box-shadow: none; }
body.phone-body .btn-green:active { box-shadow: none; }
body.phone-body .btn-orange { background: var(--ph-orange); color: #0A0818; box-shadow: none; }
body.phone-body .btn-orange:active { box-shadow: none; }
body.phone-body .btn-blue   { background: var(--ph-blue); color: #0A0818; box-shadow: none; }
body.phone-body .btn-blue:active { box-shadow: none; }
body.phone-body .btn-red    { background: var(--ph-red); color: #0A0818; box-shadow: none; }
body.phone-body .btn:disabled { opacity: 0.35; transform: none; }

/* ── Phone input ─────────────────────────────────────────────────────────── */
body.phone-body .pixel-input {
  font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 22px;
  background: var(--ph-surface); color: white;
  border: 1.5px solid var(--ph-border); border-radius: 50px;
  padding: 12px 20px; box-shadow: none; outline: none; width: 100%;
}
body.phone-body .pixel-input:focus { border-color: rgba(255,255,255,0.28); box-shadow: none; }
body.phone-body .pixel-input::placeholder { color: rgba(255,255,255,0.3); }

/* ── Phone color palette ─────────────────────────────────────────────────── */
.palette { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.palette-swatch {
  width: 44px; height: 44px; cursor: pointer; border: none;
  border-radius: 50%; transition: transform 0.1s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.palette-swatch.selected {
  transform: scale(1.25);
  box-shadow: 0 0 0 3px white, 0 0 12px rgba(255,255,255,0.25);
}

/* ── Phone layout primitives ─────────────────────────────────────────────── */
.ph-card {
  background: var(--ph-surface);
  border: 1.5px solid var(--ph-border);
  border-radius: 20px; padding: 20px; width: 100%;
}
.ph-logo {
  font-family: 'Fredoka One', sans-serif; font-size: 38px; line-height: 1;
  background: linear-gradient(120deg, var(--ph-blue) 0%, #a78bfa 45%, var(--ph-orange) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  text-align: center; filter: drop-shadow(0 2px 8px rgba(167,139,250,0.4));
}
.ph-eyebrow {
  font-family: 'Nunito', sans-serif; font-weight: 900;
  font-size: 13px; letter-spacing: 3px; text-transform: uppercase; color: var(--ph-dim);
}
.ph-heading {
  font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 28px; color: white;
}
.ph-body {
  font-family: 'Nunito', sans-serif; font-weight: 700;
  font-size: 20px; color: rgba(255,255,255,0.75);
}
.ph-note {
  font-family: 'Nunito', sans-serif; font-weight: 700;
  font-size: 19px; color: var(--ph-dim); text-align: center;
}

/* ── Phone word display (drawer) ─────────────────────────────────────────── */
.ph-word-display {
  background: rgba(74,222,128,0.08);
  border: 2px solid rgba(74,222,128,0.35);
  border-radius: 20px; padding: 18px; text-align: center; width: 100%;
}
.ph-word-eyebrow {
  font-family: 'Nunito', sans-serif; font-weight: 900;
  font-size: 13px; letter-spacing: 3px; text-transform: uppercase;
  color: rgba(74,222,128,0.6); margin-bottom: 8px;
}
.ph-word-text {
  font-family: 'Fredoka One', sans-serif; font-size: 46px;
  color: var(--ph-green); line-height: 1;
  animation: tv-pulse-scale 2s ease-in-out infinite;
}

/* ── Phone canvas wrapper ────────────────────────────────────────────────── */
.ph-canvas-wrap {
  background: var(--ph-surface); border: 1.5px solid var(--ph-border);
  border-radius: 20px; padding: 10px;
  display: flex; align-items: center; justify-content: center; width: 100%;
  flex: 1; min-height: 0;
}
.ph-canvas-wrap canvas { border-radius: 8px; image-rendering: pixelated; image-rendering: crisp-edges; }

/* ── Phone timer ─────────────────────────────────────────────────────────── */
.ph-timer {
  font-family: 'Fredoka One', sans-serif; font-size: 72px; line-height: 1;
  color: var(--ph-green); text-align: center;
  text-shadow: 0 0 30px rgba(74,222,128,0.3);
}
.ph-timer-warning { color: var(--ph-red); text-shadow: 0 0 30px rgba(248,113,113,0.4); animation: tv-shake 0.4s infinite; }

/* ── Phone team badge ────────────────────────────────────────────────────── */
.ph-team-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 24px; border-radius: 50px;
  font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 22px;
}
.ph-team-badge-blue   { background: rgba(56,189,248,0.15); border: 1.5px solid rgba(56,189,248,0.4); color: var(--ph-blue); }
.ph-team-badge-orange { background: rgba(251,146,60,0.15);  border: 1.5px solid rgba(251,146,60,0.4); color: var(--ph-orange); }

/* ── Phone score cards ───────────────────────────────────────────────────── */
.ph-scores-row { display: flex; gap: 14px; width: 100%; }
.ph-score-card {
  flex: 1; padding: 16px 12px; border-radius: 18px;
  text-align: center; display: flex; flex-direction: column; gap: 4px;
}
.ph-score-card-blue   { background: rgba(56,189,248,0.12); border: 1.5px solid rgba(56,189,248,0.35); }
.ph-score-card-orange { background: rgba(251,146,60,0.12);  border: 1.5px solid rgba(251,146,60,0.35); }
.ph-score-label {
  font-family: 'Nunito', sans-serif; font-weight: 900;
  font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--ph-dim);
}
.ph-score-num { font-family: 'Fredoka One', sans-serif; font-size: 52px; line-height: 1; }
.ph-score-card-blue   .ph-score-num { color: var(--ph-blue); }
.ph-score-card-orange .ph-score-num { color: var(--ph-orange); }

/* ── Phone player chips ──────────────────────────────────────────────────── */
.ph-player-chip {
  font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 20px;
  padding: 6px 16px; background: var(--ph-surface);
  border: 1.5px solid var(--ph-border); border-radius: 50px;
}
.ph-player-chip-host {
  border-color: rgba(253,224,71,0.4); background: rgba(253,224,71,0.08); color: var(--ph-yellow);
}

/* ── Phone guess result toast ────────────────────────────────────────────── */
.ph-guess-result {
  background: rgba(74,222,128,0.1); border: 1.5px solid rgba(74,222,128,0.4);
  border-radius: 16px; padding: 16px; text-align: center;
  font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 22px;
  color: var(--ph-green);
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  background: #4ADE80; color: #0A0818;
  font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 16px;
  padding: 10px 22px; border-radius: 50px;
  box-shadow: 0 4px 20px rgba(74,222,128,0.3); z-index: 10000;
  animation: slide-in 0.3s ease forwards; pointer-events: none;
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════════════════ */
/*  TV STYLES                                                                */
/* ══════════════════════════════════════════════════════════════════════════ */

body.tv-body {
  overflow: hidden;
  height: 100vh;
  font-family: 'Nunito', sans-serif;
  font-size: 20px;
  color: #fff;
  background:
    radial-gradient(ellipse 70% 90% at 0% 50%,   rgba(56,189,248,0.07)  0%, transparent 100%),
    radial-gradient(ellipse 70% 90% at 100% 50%,  rgba(251,146,60,0.07)  0%, transparent 100%),
    radial-gradient(ellipse 100% 50% at 50% 110%, rgba(139,92,246,0.09)  0%, transparent 100%),
    #0A0818;

  --tv-blue:          #38BDF8;
  --tv-blue-dim:      rgba(56,189,248,0.12);
  --tv-blue-glow:     rgba(56,189,248,0.4);
  --tv-blue-border:   rgba(56,189,248,0.4);
  --tv-orange:        #FB923C;
  --tv-orange-dim:    rgba(251,146,60,0.12);
  --tv-orange-glow:   rgba(251,146,60,0.4);
  --tv-orange-border: rgba(251,146,60,0.4);
  --tv-green:         #4ADE80;
  --tv-red:           #F87171;
  --tv-yellow:        #FDE047;
  --tv-surface:       rgba(255,255,255,0.05);
  --tv-surface2:      rgba(255,255,255,0.08);
  --tv-border:        rgba(255,255,255,0.1);
  --tv-dim:           rgba(255,255,255,0.5);
}

/* Scanlines — very subtle */
#scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  background: repeating-linear-gradient(
    to bottom, transparent 0px, transparent 5px,
    rgba(0,0,0,0.03) 5px, rgba(0,0,0,0.03) 6px
  );
}

/* Root container */
#tv-root { display: flex; flex-direction: column; height: 100vh; padding: 16px 20px; gap: 10px; }

/* ── TV Shared Keyframes ─────────────────────────────────────────────────── */
@keyframes tv-shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}
@keyframes tv-pulse-scale {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}
@keyframes tv-popin {
  from { opacity: 0; transform: scale(0.5) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes tv-winner-bounce {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}

/* ══════════════════════════════════════════════════════════════════════════ */
/*  GAMEPLAY TURN                                                            */
/* ══════════════════════════════════════════════════════════════════════════ */

.tv-game-layout { display: flex; flex-direction: column; height: 100%; gap: 10px; }

/* Header bar */
.tv-game-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-shrink: 0; height: 96px;
}

.tv-round-badge {
  font-family: 'Nunito', sans-serif; font-weight: 900;
  font-size: 20px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--tv-dim); padding: 10px 22px;
  border: 1.5px solid var(--tv-border); border-radius: 40px;
  background: var(--tv-surface); white-space: nowrap;
  flex-shrink: 0;
}
.tv-round-badge b { color: white; font-size: 26px; }

/* Giant timer */
.tv-timer {
  font-family: 'Fredoka One', sans-serif;
  font-size: 88px; line-height: 1;
  color: var(--tv-green);
  text-align: center; min-width: 130px;
  text-shadow: 0 0 40px rgba(74,222,128,0.35);
  transition: color 0.3s, text-shadow 0.3s;
  flex-shrink: 0;
}
.tv-timer-warning {
  color: var(--tv-red) !important;
  text-shadow: 0 0 40px rgba(248,113,113,0.5) !important;
  animation: tv-shake 0.35s infinite;
}

/* Drawer info (right side of header) */
.tv-drawer-info {
  display: flex; align-items: center; gap: 12px;
  justify-content: flex-end; flex-wrap: nowrap;
  overflow: hidden;
}
.tv-drawer-name {
  font-family: 'Nunito', sans-serif; font-weight: 900;
  font-size: 34px; color: white; white-space: nowrap;
}
.tv-drawer-label {
  font-family: 'Nunito', sans-serif; font-weight: 700;
  font-size: 26px; color: var(--tv-dim); white-space: nowrap;
}
.tv-words-badge {
  background: rgba(253,224,71,0.15);
  border: 1.5px solid rgba(253,224,71,0.4);
  color: var(--tv-yellow);
  padding: 6px 18px; border-radius: 30px;
  font-family: 'Nunito', sans-serif; font-weight: 900; font-size: 24px;
  white-space: nowrap; flex-shrink: 0;
}

/* Main row: canvas + sidebar */
.tv-game-main { flex: 1; min-height: 0; display: flex; gap: 16px; }

/* Canvas area */
.tv-canvas-area {
  flex: 1; min-width: 0; min-height: 0;
  display: flex; align-items: center; justify-content: center;
}
.tv-canvas-inner {
  aspect-ratio: 1 / 1;
  max-width: 100%; max-height: 100%;
  width: auto; height: 100%;
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.1), 0 20px 80px rgba(0,0,0,0.5);
  background: #f0f0f0;
}
.tv-canvas-inner canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; image-rendering: crisp-edges; }

/* Scores sidebar */
.tv-scores-sidebar {
  width: 210px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 12px;
}
.tv-score-panel {
  flex: 1; border-radius: 18px; padding: 18px 16px;
  display: flex; flex-direction: column; gap: 8px;
  align-items: center; justify-content: center; text-align: center;
}
.tv-score-panel-blue   { background: var(--tv-blue-dim);   border: 2px solid var(--tv-blue-border); }
.tv-score-panel-orange { background: var(--tv-orange-dim);  border: 2px solid var(--tv-orange-border); }
.tv-score-panel-blue   .tv-score-number { color: var(--tv-blue);   text-shadow: 0 0 24px var(--tv-blue-glow); }
.tv-score-panel-orange .tv-score-number { color: var(--tv-orange); text-shadow: 0 0 24px var(--tv-orange-glow); }

.tv-score-team-label {
  font-family: 'Nunito', sans-serif; font-weight: 900;
  font-size: 13px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--tv-dim);
}
.tv-score-number { font-family: 'Fredoka One', sans-serif; font-size: 72px; line-height: 1; }

.tv-score-players { margin-top: 8px; display: flex; flex-direction: column; gap: 3px; }
.tv-player-row {
  font-family: 'Nunito', sans-serif; font-size: 18px; font-weight: 700;
  color: rgba(255,255,255,0.4);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tv-player-row-drawing { color: rgba(255,255,255,0.95); font-weight: 900; font-size: 20px; }

/* ══════════════════════════════════════════════════════════════════════════ */
/*  LOBBY                                                                    */
/* ══════════════════════════════════════════════════════════════════════════ */

.tv-lobby { height: 100%; display: flex; flex-direction: column; gap: 18px; }

.tv-lobby-header {
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.tv-logo {
  font-family: 'Fredoka One', sans-serif; font-size: 56px; line-height: 1;
  background: linear-gradient(120deg, var(--tv-blue) 0%, #a78bfa 45%, var(--tv-orange) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  filter: drop-shadow(0 2px 12px rgba(167,139,250,0.5));
}
.tv-lobby-count {
  font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 28px; color: var(--tv-dim);
}
.tv-lobby-count span { color: white; font-size: 38px; }

.tv-lobby-body { flex: 1; min-height: 0; display: flex; gap: 24px; align-items: stretch; }

/* QR panel */
.tv-qr-panel {
  flex-shrink: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  padding: 28px 32px;
  background: var(--tv-surface); border: 1.5px solid var(--tv-border); border-radius: 24px;
}
.tv-qr-eyebrow {
  font-family: 'Nunito', sans-serif; font-weight: 900;
  font-size: 16px; letter-spacing: 3px; text-transform: uppercase; color: var(--tv-dim);
}
.tv-qr-img {
  width: 200px; height: 200px; border-radius: 12px; display: block;
  box-shadow: 0 0 0 5px white, 0 8px 30px rgba(0,0,0,0.4);
}
.tv-qr-url {
  font-family: 'Nunito', sans-serif; font-weight: 900;
  font-size: 22px; color: white; text-align: center;
}

/* Players panel */
.tv-players-panel {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px;
  padding: 24px 28px;
  background: var(--tv-surface); border: 1.5px solid var(--tv-border); border-radius: 24px;
}
.tv-players-eyebrow {
  font-family: 'Nunito', sans-serif; font-weight: 900;
  font-size: 15px; letter-spacing: 3px; text-transform: uppercase; color: var(--tv-dim);
  flex-shrink: 0;
}
.tv-players-grid {
  display: flex; flex-wrap: wrap; gap: 12px;
  align-content: flex-start; flex: 1; overflow: hidden;
}
.tv-player-chip {
  font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 30px;
  padding: 8px 22px;
  background: var(--tv-surface2); border: 1.5px solid var(--tv-border); border-radius: 50px;
  animation: tv-popin 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.tv-player-chip-host {
  border-color: rgba(253,224,71,0.5); background: rgba(253,224,71,0.1); color: var(--tv-yellow);
}

/* Lobby footer */
.tv-lobby-footer {
  display: flex; justify-content: space-between; align-items: center; flex-shrink: 0;
}
.tv-need-players {
  font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 28px; color: var(--tv-yellow);
}
.tv-ready-text {
  font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 28px; color: var(--tv-green);
}
.tv-waiting-text {
  font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 24px; color: var(--tv-dim);
}

/* ══════════════════════════════════════════════════════════════════════════ */
/*  INTERSTITIAL / RESULT SCREENS                                           */
/* ══════════════════════════════════════════════════════════════════════════ */

.tv-center-screen {
  height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 24px; text-align: center;
}
.tv-eyebrow {
  font-family: 'Nunito', sans-serif; font-weight: 900;
  font-size: 20px; letter-spacing: 4px; text-transform: uppercase; color: var(--tv-dim);
}
.tv-hero-number {
  font-family: 'Fredoka One', sans-serif; font-size: 180px; line-height: 1;
  color: var(--tv-yellow); text-shadow: 0 0 80px rgba(253,224,71,0.25);
  animation: tv-pulse-scale 2s ease-in-out infinite;
}
.tv-hero-text {
  font-family: 'Fredoka One', sans-serif; font-size: 68px; line-height: 1;
}
.tv-gameover-title {
  font-family: 'Fredoka One', sans-serif; font-size: 110px; line-height: 1;
  background: linear-gradient(120deg, var(--tv-blue) 0%, #a78bfa 50%, var(--tv-orange) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  animation: tv-pulse-scale 2s ease-in-out infinite;
}
.tv-subtitle {
  font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 36px;
  color: rgba(255,255,255,0.8);
}
.tv-note {
  font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 28px; color: var(--tv-dim);
}

/* Score cards row (result screens) */
.tv-scores-row { display: flex; gap: 28px; align-items: stretch; }
.tv-score-card {
  min-width: 190px; padding: 26px 36px; border-radius: 22px;
  text-align: center; display: flex; flex-direction: column; gap: 8px;
}
.tv-score-card-blue   { background: var(--tv-blue-dim);   border: 2px solid var(--tv-blue-border); }
.tv-score-card-orange { background: var(--tv-orange-dim);  border: 2px solid var(--tv-orange-border); }
.tv-score-card-blue   .tv-score-card-num { color: var(--tv-blue);   text-shadow: 0 0 30px var(--tv-blue-glow); }
.tv-score-card-orange .tv-score-card-num { color: var(--tv-orange); text-shadow: 0 0 30px var(--tv-orange-glow); }
.tv-score-card-label {
  font-family: 'Nunito', sans-serif; font-weight: 900;
  font-size: 14px; letter-spacing: 3px; text-transform: uppercase; color: var(--tv-dim);
}
.tv-score-card-num { font-family: 'Fredoka One', sans-serif; font-size: 88px; line-height: 1; }
.tv-winner-glow { animation: tv-winner-bounce 0.8s ease-in-out infinite; }

/* ── GOT IT overlay ──────────────────────────────────────────────────────────── */
@keyframes tv-got-it-bg {
  0%   { opacity: 0; }
  15%  { opacity: 1; }
  65%  { opacity: 0.85; }
  100% { opacity: 0; }
}
@keyframes tv-got-it-bang {
  0%   { opacity: 0; transform: scale(0.2) translateY(30px); letter-spacing: -4px; }
  30%  { opacity: 1; transform: scale(1.2) translateY(-8px); letter-spacing: 6px; }
  55%  { transform: scale(0.96) translateY(0); letter-spacing: 3px; }
  75%  { opacity: 1; transform: scale(1.02); }
  100% { opacity: 0; transform: scale(1.08); }
}
@keyframes tv-score-pop {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.5); }
  60%  { transform: scale(0.86); }
  80%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.tv-got-it-overlay {
  position: fixed; inset: 0; pointer-events: none; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.tv-got-it-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 70% 60% at 50% 50%, rgba(74,222,128,0.28) 0%, transparent 70%);
  animation: tv-got-it-bg 1.4s ease-out forwards;
}
.tv-got-it-text {
  font-family: 'Fredoka One', sans-serif; font-size: 160px; line-height: 1;
  color: #4ADE80;
  text-shadow:
    0 0 40px rgba(74,222,128,1),
    0 0 100px rgba(74,222,128,0.6),
    0 6px 0 rgba(0,0,0,0.5);
  animation: tv-got-it-bang 1.4s cubic-bezier(0.34,1.56,0.64,1) forwards;
  position: relative; z-index: 1; letter-spacing: 3px;
}
.tv-score-pop { animation: tv-score-pop 0.55s cubic-bezier(0.34,1.56,0.64,1) forwards; }

/* team-score-big still needed for any fallback */
.team-score-big { font-family: 'Fredoka One', sans-serif; font-size: 48px; }
