/* Family Trivia — host is a 16:9 one-frame TV layout, phones are portrait. */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

/* ===== GLASS TOKEN SYSTEM ===== */
/* One recipe, three strengths. All values in custom properties so every surface changes together. */
/* Palette: deep navy #060a13, amber #fbbf24, cream #eef2ff */
:root {
  /* Base navy for dark-tinted fills over photos */
  --navy: 6, 10, 19; /* rgb(6,10,19) */

  /* Glass-light: landing hero panel (12-16px blur) */
  --glass-light-fill: rgba(255,255,255,0.08);
  --glass-light-border: rgba(255,255,255,0.18);
  --glass-light-blur: 14px;
  --glass-light-shadow: 0 12px 32px rgba(0,0,0,0.40),
                        inset 0 1px 0 rgba(255,255,255,0.18),
                        inset 0 -1px 0 rgba(0,0,0,0.18);
  --glass-light-radius: 20px;

  /* Glass: lobby/scoreboard panel, join-info card (16-18px blur) */
  --glass-fill: rgba(255,255,255,0.09);
  --glass-border: rgba(255,255,255,0.20);
  --glass-blur: 16px;
  --glass-shadow: 0 16px 40px rgba(0,0,0,0.45),
                  inset 0 1px 0 rgba(255,255,255,0.20),
                  inset 0 -1px 0 rgba(0,0,0,0.20);
  --glass-radius: 24px;

  /* Glass-strong: question card, modals, pause overlay (20px blur over photos) */
  --glass-strong-fill: rgba(255,255,255,0.06);
  --glass-strong-border: rgba(255,255,255,0.25);
  --glass-strong-blur: 20px;
  --glass-strong-shadow: 0 20px 48px rgba(0,0,0,0.50),
                         inset 0 1px 0 rgba(255,255,255,0.22),
                         inset 0 -1px 0 rgba(0,0,0,0.25);
  --glass-strong-radius: 24px;

  /* Glass pill: secondary pills (pause/exit/settings) */
  --glass-pill-fill: rgba(255,255,255,0.10);
  --glass-pill-border: rgba(255,255,255,0.25);
  --glass-pill-blur: 12px;
  --glass-pill-shadow: 0 8px 24px rgba(0,0,0,0.35),
                       inset 0 1px 0 rgba(255,255,255,0.18),
                       inset 0 -1px 0 rgba(0,0,0,0.15);
  --glass-pill-radius: 999px;

  /* Dark scrim for modals over glass */
  --scrim-dark: rgba(6,10,19,0.60);

  /* Amber accent (solid only) */
  --amber: #fbbf24;
  --amber-dark: #d97706;
  --amber-gradient: linear-gradient(160deg, #fbbf24, #d97706);

  /* Text colors */
  --text-cream: #eef2ff;
  --text-muted: #a5b4fc;
  --text-navy: #0b1026;

  /* Focus ring */
  --focus-ring: 2px solid var(--amber);
  --focus-offset: 2px;
}

/* Reusable glass utility classes (used on components) */
.glass-light {
  background: var(--glass-light-fill);
  border: 1px solid var(--glass-light-border);
  border-radius: var(--glass-light-radius);
  box-shadow: var(--glass-light-shadow);
  backdrop-filter: blur(var(--glass-light-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-light-blur)) saturate(140%);
}

.glass {
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  border-radius: var(--glass-radius);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
}

.glass-strong {
  background: var(--glass-strong-fill);
  border: 1px solid var(--glass-strong-border);
  border-radius: var(--glass-strong-radius);
  box-shadow: var(--glass-strong-shadow);
  backdrop-filter: blur(var(--glass-strong-blur)) saturate(150%) brightness(0.92);
  -webkit-backdrop-filter: blur(var(--glass-strong-blur)) saturate(150%) brightness(0.92);
}

.glass-pill {
  background: var(--glass-pill-fill);
  border: 1px solid var(--glass-pill-border);
  border-radius: var(--glass-pill-radius);
  box-shadow: var(--glass-pill-shadow);
  backdrop-filter: blur(var(--glass-pill-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-pill-blur)) saturate(140%);
}

/* Dark navy-tinted fill for glass over photos (question card) */
.glass-over-photo {
  background: linear-gradient(rgba(var(--navy),0.42), rgba(var(--navy),0.42)),
              var(--glass-strong-fill);
}

/* Flat translucent row (no backdrop-filter) for player lists inside glass panels */
.flat-row {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
}

/* Solid amber button (buzz/answer/CTA) */
.btn-amber {
  background: var(--amber-gradient);
  color: var(--text-navy);
  font-weight: 900;
  border: none;
}

/* Opaque-first fallback: solid navy panel by default, enhanced when backdrop-filter supported */
.panel { background: #121a2e; border: 1px solid #2b3a7e; border-radius: 20px; box-shadow: 0 16px 40px rgba(0,0,0,0.45); }
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .panel { background: transparent; border: none; box-shadow: none; }
}

/* Respect reduced transparency / motion */
@media (prefers-reduced-transparency: reduce) {
  .glass-light, .glass, .glass-strong, .glass-pill,
  .glass-over-photo, .join-card, .takeover-card, .lobby-join-card {
    background: #121a2e !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 1px solid #2b3a7e !important;
    box-shadow: 0 16px 40px rgba(0,0,0,0.45) !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  font-family: 'Trebuchet MS', 'Segoe UI', Verdana, sans-serif;
  background: #0b1026 radial-gradient(1200px 700px at 70% -10%, #1d2a5e 0%, #0b1026 60%);
  color: #eef2ff;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* Lobby backdrop: game-show photo behind the frosted glass (lobby phase only).
   Layer stack per the frosted-glass guide: photo -> navy dim -> glass -> text.
   Clearer-show version: dim 0.55 -> 0.35, panel blur 20/16px -> 8px, thinner
   fills, lighter navy tint — the set reads through the glass instead of just
   colours. Game, podium and landing keep the standard frosted values. */
body.lobby-phase {
  background:
    linear-gradient(rgba(6,10,19,0.35), rgba(6,10,19,0.35)),
    url("lobby-bg.webp") center / cover no-repeat,
    #0b1026;
}
body.lobby-phase .host-main,
body.lobby-phase .scoreboard {
  margin-top: 12vh;
  margin-bottom: 2vh;
}
body.lobby-phase .question-card {
  margin-left: 0;
  margin-right: 5%;
  background: linear-gradient(rgba(var(--navy),0.25), rgba(var(--navy),0.25)),
              rgba(255,255,255,0.05);
  backdrop-filter: blur(8px) saturate(150%) brightness(0.95);
  -webkit-backdrop-filter: blur(8px) saturate(150%) brightness(0.95);
}
body.lobby-phase .host {
  grid-template-columns: 1fr min(27vw, 387px);
}
body.lobby-phase .lobby-join-card .lobby-qr {
  width: 64px;
  flex: none;
}
body.lobby-phase .lobby-join-card .lobby-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: none;
  margin-right: 1rem;
}
body.lobby-phase .lobby-join-card .lobby-qr-wrap > span {
  font-size: 0.5rem;
  font-weight: 700;
  color: #eef2ff;
  text-align: center;
  white-space: nowrap;
}
body.lobby-phase .scoreboard,
body.lobby-phase .lobby-join-card {
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
}

/* Landing backdrop: spotlight-curtain photo behind the 3D lockup (landing only).
   The image's beams converge on the upper centre where the lockup sits, so the
   stage lights appear to shine on the sign. Dim 0.40 keeps the 'Waiting for
   players' text and the amber button readable. */
body.landing-phase {
  background:
    linear-gradient(rgba(6,10,19,0.40), rgba(6,10,19,0.40)),
    url("landing-bg.webp") center / cover no-repeat,
    #0b1026;
}

/* Podium backdrop (Rick 2026-11-24): option 5b stage photo (scoreboard off)
   behind the video confetti (podium phase only). No dim — the stage stays
   vivid like the approved composite; text reads via its shadows. */
body.podium-phase {
  background:
    url("podium-bg.webp") center / cover no-repeat,
    #0b1026;
}
#app { height: 100%; }
button { font-family: inherit; cursor: pointer; border: none; }
input { font-family: inherit; }
.hidden { display: none !important; }

/* ---------- shared bits ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 0.4em;
  padding: 0.25em 0.7em; border-radius: 999px;
  background: var(--glass-pill-fill);
  border: 1px solid var(--glass-pill-border);
  backdrop-filter: blur(var(--glass-pill-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-pill-blur)) saturate(140%);
  font-weight: 700;
}
.chip .dot { width: 0.8em; height: 0.8em; border-radius: 50%; }
.badge {
  padding: 0.22em 0.65em; border-radius: 8px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.75em;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
}
.badge.easy { color: #86efac; border-color: #86efac55; }
.badge.hard { color: #fca5a5; border-color: #fca5a555; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #b91c1c; color: #fff; padding: 0.7em 1.2em; border-radius: 12px;
  font-weight: 700; z-index: 99; animation: fadeout 2.4s forwards;
}
@keyframes fadeout { 0% {opacity: 0} 10% {opacity: 1} 80% {opacity: 1} 100% {opacity: 0} }

/* role select */
.role-wrap { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4vh; padding: 16px; text-align: center; }
.role-wrap h1 { font-size: clamp(2rem, 6vw, 4.2rem); letter-spacing: 0.02em; text-shadow: 0 4px 30px #6366f188; }
.role-cards { display: flex; gap: 4vw; flex-wrap: wrap; justify-content: center; }
.role-card {
  min-width: min(340px, 42vw); padding: 2.2rem 2.4rem; border-radius: 24px;
  background: var(--glass-light-fill);
  border: 1px solid var(--glass-light-border);
  border-radius: var(--glass-light-radius);
  box-shadow: var(--glass-light-shadow);
  backdrop-filter: blur(var(--glass-light-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-light-blur)) saturate(140%);
  color: #eef2ff;
  font-size: clamp(1.1rem, 2.2vw, 1.6rem); font-weight: 800;
  display: flex; flex-direction: column; gap: 0.5rem; align-items: center;
  transition: transform 0.12s, box-shadow 0.12s;
}
.role-card:hover { transform: translateY(-4px); box-shadow: 0 20px 50px rgba(0,0,0,0.55); }
.role-card .big { font-size: 2.6em; }
.role-card small { font-weight: 500; opacity: 0.75; font-size: 0.7em; }
.conn { opacity: 0.7; font-size: clamp(0.8rem, 1.6vw, 1rem); }
.conn.ok { color: #86efac; }

/* animated waiting states (CSS only, no assets) */
.host-wait { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2vh; position: relative; flex: 1; width: 100%; }
.host-wait .wait-title { font-size: clamp(1.4rem, 3vw, 2.4rem); font-weight: 800; color: #c7d2fe; }

/* landing page info button + join instructions overlay (frosted glass) */
.info-btn { margin-top: 0.5vh; padding: 1.4vh 2.2vw; font-size: clamp(1.1rem, 2.2vw, 1.8rem); font-weight: 900; border-radius: 999px; background: var(--amber-gradient); color: var(--text-navy); border: 2px solid var(--amber); cursor: pointer; }

/* "Tap for sound" hint on the landing page: shows only while audio is locked. */
.join-overlay { position: fixed; inset: 0; background: rgba(2, 6, 23, 0.72); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 24px; }
.join-card { position: relative; width: min(92vw, 640px); 
  background: var(--glass-strong-fill);
  border: 1px solid var(--glass-strong-border);
  border-radius: var(--glass-strong-radius);
  box-shadow: var(--glass-strong-shadow);
  backdrop-filter: blur(var(--glass-strong-blur)) saturate(150%) brightness(0.92);
  -webkit-backdrop-filter: blur(var(--glass-strong-blur)) saturate(150%) brightness(0.92);
  padding: 2.2rem 2.4rem; color: #eef2ff; text-align: left; }
.join-card h2 { font-size: clamp(1.6rem, 3.4vw, 2.6rem); font-weight: 900; color: #fbbf24; margin-bottom: 1rem; }
.join-card p { font-size: clamp(1.1rem, 2.2vw, 1.6rem); line-height: 1.5; margin: 0.7rem 0; color: #c7d2fe; }
.join-card code { background: #111a3f; padding: 0.15em 0.5em; border-radius: 8px; color: #e0e7ff; }
.join-close { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; border-radius: 12px; 
  background: var(--glass-pill-fill);
  border: 1px solid var(--glass-pill-border);
  backdrop-filter: blur(var(--glass-pill-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-pill-blur)) saturate(140%);
  color: #c7d2fe; font-size: 1.3rem; font-weight: 900; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.join-qr { position: absolute; top: 70px; right: 20px; width: 132px; background: #fff; border-radius: 12px; padding: 10px 10px 8px; text-align: center; box-shadow: 0 4px 16px #00000055; }
.join-qr svg { display: block; width: 100%; height: auto; }
.join-qr span { display: block; margin-top: 6px; font-size: 0.85rem; font-weight: 700; color: #1e293b; }
.join-card h2, .join-card p { padding-right: 160px; }
@media (max-width: 560px) {
  .join-qr { position: static; width: 132px; margin: 0.8rem auto 0; }
  .join-card h2, .join-card p { padding-right: 0; }
}
/* small lobby QR in the header, left of the Music/FX buttons: same join
   link as the landing QR, ~10% smaller, with a rounded outline matching
   the mute buttons so it reads as part of the header controls */
.lobby-qr { flex: none; width: 100px; background: #fff; border: 2px solid #31407f; border-radius: 10px; padding: 5px 5px 4px; text-align: center; box-shadow: 0 4px 16px #00000055; }
/* lobby header right group: spans the same width as the player box below,
   so the QR's left edge lines up with the player box's left margin while
   the Music/FX buttons stay at the right edge */
.lobby-head-right { margin-left: auto; width: min(30vw, 430px); display: flex; align-items: center; }
.lobby-qr svg { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; }
.lobby-qr span { display: block; margin-top: 4px; font-size: 0.65rem; font-weight: 700; color: #1e293b; white-space: nowrap; }
.dots { display: inline-flex; gap: 0.45em; font-size: clamp(1.2rem, 2.6vw, 2rem); color: #818cf8; }
.dots span { animation: dotblink 1.2s infinite; }
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotblink { 0%, 60%, 100% { opacity: 0.15; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-0.25em); } }

/* wait screen logo — drop shadow kept small, soft and light: the lockup sits
   in bright stage light, so a heavy shadow reads wrong and its hard edge
   pixelates when scaled up. (Rick 2026-11-16: thinner, softer, less on the
   lit side.) */
.wait-logo.lockup {
  width: min(50vw, 400px, 50vh);
  max-width: 90%;
  height: auto;
  filter: drop-shadow(0 2px 10px rgba(0,0,0,0.25));
  animation: logo-bob 4s ease-in-out infinite, logo-shimmer 8s ease-in-out infinite;
}
@keyframes logo-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes logo-shimmer { 0%, 100% { filter: drop-shadow(0 2px 10px rgba(0,0,0,0.25)); } 50% { filter: drop-shadow(0 2px 12px rgba(251,191,36,0.30)); } }

/* floating question marks background */
.host-wait::before,
.host-body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ctext x='10' y='20' font-size='18' fill='%236366f1' opacity='0.06'%3E%3F%3C/text%3E%3Ctext x='50' y='40' font-size='22' fill='%23fbbf24' opacity='0.05'%3E%3F%3C/text%3E%3Ctext x='80' y='70' font-size='16' fill='%23818cf8' opacity='0.04'%3E%3F%3C/text%3E%3Ctext x='20' y='80' font-size='20' fill='%23f472b6' opacity='0.05'%3E%3F%3C/text%3E%3C/svg%3E");
  background-size: 200px 200px;
  animation: bg-drift 60s linear infinite;
}
@keyframes bg-drift { 0% { background-position: 0 0; } 100% { background-position: 200px 200px; } }

/* Landing only: keep the floating question marks off the foreground curtains.
   The curtains live on the left/right edges of the photo; the marks stay on
   the stage backdrop in the middle. Both landing layers (body + host-wait)
   get the same mask. */
body.landing-phase .host-wait::before,
body.landing-phase::before {
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, transparent 12%, #000 20%, #000 80%, transparent 88%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0%, transparent 12%, #000 20%, #000 80%, transparent 88%, transparent 100%);
}

/* corner logo (emblem) */
.corner-logo.emblem {
  width: min(12vw, 140px);
  height: auto;
  filter: drop-shadow(0 2px 8px #00000088);
  animation: emblem-pulse 5s ease-in-out infinite;
}
@keyframes emblem-pulse { 0%, 100% { opacity: 0.95; transform: scale(1); } 50% { opacity: 1; transform: scale(1.03); } }

.host header, .phone-top { position: relative; z-index: 1; }
.host-body, .phone-body { position: relative; }

/* ---------- HOST: 16x9 single frame ---------- */
.host { height: 100vh; display: grid; grid-template-rows: auto 1fr; grid-template-columns: 1fr min(30vw, 430px); grid-template-areas: "head head" "main side"; gap: 1.2vh 1.2vw; padding: 1.6vh 1.6vw; }
.host header { grid-area: head; display: flex; align-items: center; gap: 1.2vw; }
.host header .qmeta { display: flex; align-items: center; gap: 0.8vw; flex-wrap: wrap; }
.host header .title { font-size: clamp(1.2rem, 2.4vw, 2rem); font-weight: 900; color: #c7d2fe; }
.timer { margin-left: auto; font-size: clamp(1.6rem, 3.6vw, 3rem); font-weight: 900; font-variant-numeric: tabular-nums; min-width: 2.2em; text-align: center; 
  background: var(--glass-pill-fill);
  border: 1px solid var(--glass-pill-border);
  border-radius: var(--glass-pill-radius);
  box-shadow: var(--glass-pill-shadow);
  backdrop-filter: blur(var(--glass-pill-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-pill-blur)) saturate(140%);
  padding: 0.1em 0.5em; }
.timer.low { color: #fca5a5; border-color: #ef4444; animation: pulse 0.8s infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.host-main { grid-area: main; display: flex; flex-direction: column; gap: 1.6vh; min-width: 0; }
.question-card { flex: 1; display: flex; flex-direction: column; gap: 2vh; justify-content: center; 
  background: linear-gradient(rgba(var(--navy),0.42), rgba(var(--navy),0.42)),
              var(--glass-strong-fill);
  border: 1px solid var(--glass-strong-border);
  border-radius: var(--glass-strong-radius);
  box-shadow: var(--glass-strong-shadow);
  backdrop-filter: blur(var(--glass-strong-blur)) saturate(150%) brightness(0.92);
  -webkit-backdrop-filter: blur(var(--glass-strong-blur)) saturate(150%) brightness(0.92);
  padding: 2.5vh 2.5vw; }
.question-text { font-size: clamp(1.4rem, 3.4vw, 2.9rem); font-weight: 800; line-height: 1.25; text-shadow: 0 2px 4px rgba(0,0,0,0.4); }
.options-grid { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 1.4vh 1vw; }
.option { text-align: left; font-size: clamp(0.95rem, 1.9vw, 1.5rem); font-weight: 700; padding: 1.6vh 1.2vw; border-radius: 14px; background: #182250; border: 2px solid #31407f; color: #dbe3ff; display: flex; gap: 0.6em; align-items: center; text-shadow: 0 1px 2px rgba(0,0,0,0.35); }
.option .key { font-weight: 900; opacity: 0.65; }
.option.correct { background: #14532d; border-color: #22c55e; color: #dcfce7; }
.option.wrong { background: #7f1d1d; border-color: #ef4444; color: #fecaca; opacity: 0.9; }
.buzz-banner { font-size: clamp(1.2rem, 2.6vw, 2.2rem); font-weight: 900; padding: 1.2vh 1.4vw; border-radius: 14px; background: #111a3f; border: 2px solid #3b4a9b; display: flex; align-items: center; gap: 0.6em; }
.buzz-banner .dot { width: 1em; height: 1em; border-radius: 50%; }
.scoreboard { grid-area: side; 
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  border-radius: var(--glass-radius);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  padding: 1.8vh 1vw; display: flex; flex-direction: column; gap: 1.1vh; overflow-y: auto; }
.scoreboard h2 { font-size: clamp(0.95rem, 1.7vw, 1.4rem); text-transform: uppercase; letter-spacing: 0.12em; color: #93a5e8; }
/* lobby Players header row: label left, Lobby pill right-justified, its right
   edge flush with the right edge of the player rows below */
.sb-head { display: flex; align-items: center; justify-content: space-between; }
.sb-head h2 { margin: 0; }
/* Lobby pill on the Players line: right edge lines up with the right edge of
   the red kick (X) button in the player rows below (the rows have 0.8vw right
   padding, so the pill is pulled left by that amount). INFUSED-GLASS look
   (Rick ~03:52): the pill should read as part of the glass, half see-through,
   with the word Lobby still readable. A solid white fill works against that —
   it makes the pill a separate solid object sitting on top of the glass. So
   the fill stays light and glassy (20% white) and the readability comes from
   a soft dark text-shadow behind the Lobby text, not from a solid fill. */
.sb-head .chip { margin-right: 0.8vw; background: rgba(255,255,255,0.20); text-shadow: 0 1px 4px rgba(0,0,0,0.55); }
.sb-row { display: flex; align-items: center; gap: 0.7vw; 
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px; 
  padding: 1.1vh 0.8vw; font-size: clamp(0.95rem, 1.8vw, 1.5rem); font-weight: 800; }
.sb-row .dot { width: 1em; height: 1em; border-radius: 50%; flex: none; }
.sb-row .pts { margin-left: auto; font-variant-numeric: tabular-nums; }
.sb-row.me { outline: 2px solid #ffffff55; }
.sb-row.off { opacity: 0.4; }
.sb-row .streak { font-size: 0.75em; }
.host-lobby, .host-podium { grid-area: main; }
.join-hint { font-size: clamp(1rem, 2vw, 1.6rem); color: #a5b4fc; }
.join-hint code { background: #111a3f; padding: 0.15em 0.5em; border-radius: 8px; color: #e0e7ff; font-size: 1em; }

/* lobby join card: frosted glass horizontal bar */
.lobby-join-card { display: flex; align-items: center; gap: 0.9rem; 
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  border-radius: var(--glass-radius);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  padding: 0.9rem 1.3rem; color: #c7d2fe; font-size: clamp(1rem, 1.9vw, 1.5rem); line-height: 1.45; text-align: left; }
.lobby-join-card code { background: #111a3f; padding: 0.15em 0.5em; border-radius: 8px; color: #e0e7ff; }
.lobby-join-ico { font-size: 1.4em; flex-shrink: 0; }
.length-row { display: flex; gap: 0.6vw; align-items: center; margin-top: 2.4vh; flex-wrap: nowrap; }
.length-row .lbl { font-size: clamp(0.9rem, 1.6vw, 1.25rem); font-weight: 800; color: #c7d2fe; flex-shrink: 0; }
.len-btn { padding: 1vh 1.1vw; font-size: clamp(0.9rem, 1.7vw, 1.3rem); font-weight: 900; border-radius: 12px; 
  background: var(--glass-pill-fill);
  border: 1px solid var(--glass-pill-border);
  backdrop-filter: blur(var(--glass-pill-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-pill-blur)) saturate(140%);
  color: #c7d2fe; flex-shrink: 1; min-width: 0; white-space: nowrap; }
.len-btn.active { background: #4f46e5; border-color: #818cf8; color: #fff; }
.start-btn { margin-top: 3vh; padding: 2.2vh 3vw; font-size: clamp(1.4rem, 2.8vw, 2.4rem); font-weight: 900; border-radius: 16px; background: linear-gradient(160deg, #22c55e, #15803d); color: #fff; border: none; }
.start-btn:disabled { background: #29335c; color: #64748b; cursor: not-allowed; }
.host-players { display: flex; gap: 1vw; flex-wrap: wrap; margin-top: 2.4vh; }

/* podium */
.podium { display: flex; flex-direction: column; height: 100%; justify-content: flex-end; gap: 2vh; position: relative; z-index: 2; 
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  border-radius: var(--glass-radius);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  padding: 2vh 2vw; }
.podium .win-name { font-size: clamp(2rem, 5vw, 4rem); font-weight: 900; text-align: center; text-shadow: 0 2px 4px rgba(0,0,0,0.4); }
.podium .win-sub { text-align: center; font-size: clamp(1rem, 2vw, 1.6rem); color: #c7d2fe; }
.pedestals { display: flex; align-items: flex-end; justify-content: center; gap: 2vw; }
.pedestal { display: flex; flex-direction: column; align-items: center; gap: 0.8vh; }
.pedestal .block { width: min(16vw, 220px); height: var(--bar-height, 100px); border-radius: 16px 16px 0 0; display: flex; align-items: flex-start; justify-content: center; font-size: clamp(1.6rem, 3.4vw, 3rem); font-weight: 900; padding-top: 1vh; 
  /* Solid metallic medals — no glass */
  background: linear-gradient(180deg, #37478f, #232e63); }
.pedestal:nth-child(2) .block { background: linear-gradient(180deg, #b8860b, #8b6914); } /* gold */
.pedestal:nth-child(1) .block { background: linear-gradient(180deg, #c0c0c0, #808080); } /* silver */
.pedestal:nth-child(3) .block { background: linear-gradient(180deg, #cd7f32, #8b5a2b); } /* bronze */
.pedestal .pname { font-size: clamp(1rem, 2vw, 1.7rem); font-weight: 800; display: flex; align-items: center; gap: 0.4em; }
.pedestal .dot { width: 0.9em; height: 0.9em; border-radius: 50%; }
.pedestal .ppts { color: #a5b4fc; font-weight: 700; }
.rematch-row { display: flex; justify-content: center; gap: 1.5vw; padding-bottom: 1vh; flex-wrap: wrap; }
.rematch-btn, .newgame-btn { padding: 1.6vh 2.6vw; font-size: clamp(1.1rem, 2.2vw, 1.9rem); font-weight: 900; border-radius: 14px; color: #fff; }
.rematch-btn { background: linear-gradient(160deg, #6366f1, #4338ca); }
.newgame-btn { background: linear-gradient(160deg, #22c55e, #15803d); }

/* podium phase (Rick 2026-11-17): the heavy 16px frost hid the fireworks and
   confetti behind the podium card, and both cards filled the whole page.
   TRANSPARENT-MONITOR look (Rick 2026-11-17 ~04:19): the 4px frost from the
   first fix still blurred the fireworks/confetti into colourless snowflakes —
   any real blur smears the small bright particles and mixes the navy page
   background across the card into a blue haze. So the card is now a nearly
   clear screen: blur down to 1px (just a whisper of diffusion, the colours
   stay vivid) and fill down to 2% white. The screen reads as a transparent
   monitor — thin border frame, content displayed on it, background showing
   through. Text readability now comes from shadows on the letters themselves
   (the winner name already had one), not from frosting the card. */
body.podium-phase .podium {
  background: rgba(8,12,30,0.35);
  backdrop-filter: blur(6px) saturate(140%);
  -webkit-backdrop-filter: blur(6px) saturate(140%);
}
body.podium-phase .podium .win-sub,
body.podium-phase .podium .pname,
body.podium-phase .podium .ppts { text-shadow: 0 1px 4px rgba(0,0,0,0.7); }
body.podium-phase .host-podium { margin: 2vh 3vw; }
/* Standings card (Rick 2026-11-17 ~04:27): the big Full Standings card gets
   the same clear-screen treatment as the left podium card — 1px blur, 2%
   fill — so the fireworks and confetti show through it too. The small
   individual player rows inside it are NOT changed (they keep their own
   subtle fill, which is what their text sits on). The "Full standings"
   heading gets a text-shadow so it reads over the fireworks. */
body.podium-phase .scoreboard {
  margin-top: 4vh; margin-bottom: 4vh;
  background: rgba(8,12,30,0.35);
  backdrop-filter: blur(6px) saturate(140%);
  -webkit-backdrop-filter: blur(6px) saturate(140%);
}
body.podium-phase .scoreboard h2 { text-shadow: 0 1px 4px rgba(0,0,0,0.7); }
/* Fused-in-the-glass content (Rick 2026-11-17 ~04:36): all the content on
   the podium page should read as part of the TV screen — integrated and
   fused in the glass, not solid objects sitting on top of it. Same recipe as
   the Lobby pill: translucent fills, readability from text-shadow. The
   pedestal bars become translucent coloured glass (fireworks show through
   them faintly); the Rematch/New Game buttons become glassy tinted buttons
   (keeping their purple/green so they still read as distinct actions); the
   player rows blend further into the card with a shadow on their text. */
body.podium-phase .pedestal .block { opacity: 0.65; }
body.podium-phase .rematch-btn {
  background: linear-gradient(160deg, rgba(99,102,241,0.45), rgba(67,56,202,0.45));
  border: 1px solid rgba(255,255,255,0.25);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  text-shadow: 0 1px 4px rgba(0,0,0,0.7);
}
body.podium-phase .newgame-btn {
  background: linear-gradient(160deg, rgba(34,197,94,0.45), rgba(21,128,61,0.45));
  border: 1px solid rgba(255,255,255,0.25);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  text-shadow: 0 1px 4px rgba(0,0,0,0.7);
}
body.podium-phase .sb-row {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.06);
  text-shadow: 0 1px 4px rgba(0,0,0,0.7);
}
/* Full-page canvas sits behind the content: raise the header and the
   standings panel above it so fireworks never draw over their text. */
body.podium-phase .host header,
body.podium-phase .host .scoreboard { position: relative; z-index: 1; }

/* Full-page fireworks/confetti (Rick 2026-11-17 ~04:22): the canvas was
   position:absolute inside .host-podium (the left grid column), so the
   fireworks and confetti only ever drew inside the left card. Now the canvas
   is fixed to the whole viewport, so they fall and burst across the entire
   page. z-index 0 puts it behind the content; the header and standings panel
   are raised to z-index 1 in podium phase so the fireworks never draw over
   their text (the podium card is already z-index 2 and transparent, so they
   show through it). pointer-events none so the canvas never blocks clicks. */
.victory-bg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 0;
  pointer-events: none;
}

/* ---------- PHONE ---------- */
.phone-shell { height: 100dvh; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; padding: max(10px, env(safe-area-inset-top)) 14px max(10px, env(safe-area-inset-bottom)); gap: 10px; }
.phone-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.phone-top .chip { font-size: 0.95rem; }
.mutes { margin-left: auto; display: flex; gap: 6px; }
.mute-btn { 
  background: var(--glass-pill-fill);
  border: 1px solid var(--glass-pill-border);
  border-radius: var(--glass-pill-radius);
  box-shadow: var(--glass-pill-shadow);
  backdrop-filter: blur(var(--glass-pill-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-pill-blur)) saturate(140%);
  color: #c7d2fe; padding: 6px 10px; font-size: 0.85rem; font-weight: 800; }
.mute-btn.off { opacity: 0.45; text-decoration: line-through; }

/* Landing page speaker icon - fixed to viewport top-right */
.host-wait > .mute-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-pill-fill);
  border: 1px solid var(--glass-pill-border);
  border-radius: var(--glass-pill-radius);
  box-shadow: var(--glass-pill-shadow);
  backdrop-filter: blur(var(--glass-pill-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-pill-blur)) saturate(140%);
}
.host-wait > .mute-btn .speaker-icon {
  color: #c7d2fe;
  transition: opacity 0.2s;
}
.host-wait > .mute-btn.off .speaker-icon {
  opacity: 0.5;
}
.phone-main { flex: 1; display: flex; flex-direction: column; min-height: 0; gap: 10px; overflow-y: auto; overflow-x: hidden; }


/* Phone join page (Rick 2026-11-24): spotlight podium background behind the
   join form. Light dim so the stage shows but the form stays readable. */
body.phone-body.join-phase {
  background:
    linear-gradient(rgba(6,10,19,0.25), rgba(6,10,19,0.25)),
    url("player-bg-join-spotlight.webp") center / cover no-repeat,
    #0b1026;
}

/* Join form as a floating glass card (Rick 2026-11-24): the title, name box,
   swatches, Join button and hint sit together on one semi-transparent card
   over the spotlight background, same dark-navy glass as the podium cards.
   The card sizes to its content (flex:none + margin:auto centres it in
   .phone-main), so it never overlaps itself the way the mockup did. */
body.phone-body.join-phase .join-form {
  flex: none;
  margin: auto;
  width: 100%;
  background: rgba(8,12,30,0.45);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 20px;
  padding: 22px 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
}

/* Extra breathing room between the "Join the game" title and the name field
   (Rick 2026-11-24). The form gap is 14px; this adds one more gap's worth. */
body.phone-body.join-phase .join-form h1 {
  margin-bottom: 14px;
}

/* phone join */
.join-form { display: flex; flex-direction: column; gap: 14px; justify-content: center; flex: 1; }
.join-form h1 { font-size: 2rem; text-align: center; }
.join-form label { font-weight: 800; color: #a5b4fc; font-size: 0.95rem; }
.join-form input[type="text"] { width: 100%; padding: 14px; border-radius: 12px; border: 2px solid #31407f; background: #111a3f; color: #fff; font-size: 1.3rem; font-weight: 700; }
.swatches { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 10px; }
.swatch { aspect-ratio: 2.4/1; border-radius: 12px; border: 3px solid transparent; font-weight: 900; color: #0b1026; font-size: 0.95rem; }
.swatch.sel { border-color: #fff; transform: scale(1.04); }
.swatch:disabled { opacity: 0.25; }
.join-btn { padding: 16px; font-size: 1.35rem; font-weight: 900; border-radius: 14px; background: var(--amber-gradient); color: var(--text-navy); }

.rejoin-option { 
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  border-radius: var(--glass-radius);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  padding: 14px; text-align: center; }
.rejoin-message { font-size: 1.1rem; color: #c7d2fe; margin-bottom: 10px; }
.rejoin-btn { padding: 12px 20px; font-size: 1.1rem; font-weight: 900; border-radius: 10px; background: var(--amber-gradient); color: var(--text-navy); margin-bottom: 8px; width: 100%; }
.not-me-btn { padding: 10px 20px; font-size: 0.95rem; font-weight: 800; border-radius: 10px; 
  background: var(--glass-pill-fill);
  border: 1px solid var(--glass-pill-border);
  backdrop-filter: blur(var(--glass-pill-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-pill-blur)) saturate(140%);
  color: #a5b4fc; width: 100%; }
.not-me-btn:active { background: #182250; }
.join-divider { border: none; border-top: 1px solid #31407f; margin: 4px 0 8px; }

/* phone lobby */
.waiting { text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; flex: 1; }
.waiting .big-emoji { font-size: 4rem; }
.waiting p { color: #a5b4fc; font-size: 1.05rem; }
.lobby-list { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.lobby-list .sb-row { 
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  font-size: 1.1rem; }

/* phone buzzer */
.q-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.q-head .cat { font-weight: 900; font-size: 1rem; }
.buzzer-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 0; }
.buzzer {
  width: min(74vw, 40vh); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f87171, #b91c1c 70%);
  border: 6px solid #7f1d1d; color: #fff; font-size: clamp(1.6rem, 8vw, 2.6rem); font-weight: 900;
  text-transform: uppercase; letter-spacing: 0.05em;
  box-shadow: 0 12px 40px #dc262655, inset 0 -10px 24px #00000055;
  transition: transform 0.06s;
  user-select: none; -webkit-user-select: none;
}
.buzzer:active { transform: scale(0.94); }
.buzzer.locked { background: radial-gradient(circle at 35% 30%, #475569, #1e293b 70%); border-color: #0f172a; color: #94a3b8; box-shadow: none; }
.buzz-hint { color: #a5b4fc; font-weight: 700; text-align: center; }
.answer-bar { height: 10px; border-radius: 999px; background: #1b2550; overflow: hidden; }
.answer-bar > div { height: 100%; background: linear-gradient(90deg, #22c55e, #facc15, #ef4444); }
.timer-num { font-weight: 900; font-size: 1.4rem; text-align: center; }
.timer-num.low { color: #fca5a5; }

/* phone answering options */
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt-btn { padding: 18px 14px; font-size: 1.2rem; font-weight: 800; border-radius: 14px; background: #182250; border: 2px solid #31407f; color: #dbe3ff; text-align: left; text-shadow: 0 1px 2px rgba(0,0,0,0.35); }
.opt-btn.correct { background: #14532d; border-color: #22c55e; color: #dcfce7; }
.opt-btn.wrong { background: #7f1d1d; border-color: #ef4444; color: #fecaca; }
.result-card { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; flex: 1; }
.result-card .res-big { font-size: 2rem; font-weight: 900; }
.result-card .res-big.good { color: #86efac; }
.result-card .res-big.bad { color: #fca5a5; }
.you-score { color: #a5b4fc; font-size: 1.1rem; }

/* phone podium */
.pod-list { display: flex; flex-direction: column; gap: 8px; }
.pod-row { display: flex; align-items: center; gap: 10px; 
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  padding: 12px; font-size: 1.2rem; font-weight: 800; }
.pod-row .rank { width: 1.6em; text-align: center; }
.pod-row.first { background: linear-gradient(160deg, #78350f, #b45309); outline: 2px solid #fbbf24; }
.pod-row .dot { width: 1em; height: 1em; border-radius: 50%; }
.pod-row .pts { margin-left: auto; }
.crown { font-size: 2.6rem; text-align: center; }
.win-title { text-align: center; font-size: 1.9rem; font-weight: 900; }

/* phone podium: frosted glass result card (matching join/waiting cards) */
body.phone-body.podium-phase .result-card {
  flex: none;
  margin: auto;
  width: 100%;
  max-width: 480px;
  background: rgba(8,12,30,0.45);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 20px;
  padding: 22px 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
}

/* phone podium: animated confetti falling inside the spotlight cone */
.podium-confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1; /* above background, below content */
  overflow: hidden;
}

.podium-confetti-piece {
  position: absolute;
  width: 6px;
  height: 6px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b, #d97706);
  border-radius: 2px;
  opacity: 0.9;
  will-change: transform, opacity;
  animation: confetti-fall linear infinite;
}

/* Cone-shaped mask to confine confetti to the spotlight beam */
.podium-confetti-layer::before {
  content: '';
  position: absolute;
  inset: 0;
  /* Cone: narrow at top (15% width), widening to 60% at bottom */
  clip-path: polygon(
    50% 0%,
    57% 0%,
    80% 100%,
    20% 100%,
    43% 0%
  );
  -webkit-clip-path: polygon(
    50% 0%,
    57% 0%,
    80% 100%,
    20% 100%,
    43% 0%
  );
  pointer-events: none;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-10vh) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.9;
  }
  90% {
    opacity: 0.9;
  }
  100% {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}

/* Reduced motion: disable confetti animation */
@media (prefers-reduced-motion: reduce) {
  .podium-confetti-piece {
    animation: none !important;
    display: none;
  }
}

/* connection strip on phones */
.reconnecting { position: fixed; top: 0; left: 0; right: 0; background: #b45309; color: #fff; text-align: center; font-weight: 800; padding: 6px; z-index: 50; }
.reconnecting.disconnected { background: #b91c1c; }

/* paused game banner */
.paused-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(90deg, #b45309, #d97706);
  color: #fff;
  text-align: center;
  font-weight: 800;
  padding: 8px 12px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.9rem;
}
.paused-banner .pause-countdown {
  font-variant-numeric: tabular-nums;
  font-size: 1.1em;
  background: rgba(0,0,0,0.2);
  padding: 2px 8px;
  border-radius: 999px;
}

/* choice state UI (host decision after player didn't reconnect) */
.choice-banner {
  background: linear-gradient(90deg, #b45309, #d97706);
  color: #fff;
  text-align: center;
  font-weight: 800;
  padding: 16px 12px;
  border-radius: 12px;
  margin-bottom: 16px;
}
.choice-message {
  font-size: 1.2rem;
  margin-bottom: 4px;
}
.choice-detail {
  font-size: 0.9rem;
  opacity: 0.9;
}
.choice-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.choice-btn {
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 800;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}
.choice-btn:active {
  transform: scale(0.98);
}
.choice-btn.continue {
  background: linear-gradient(160deg, #16a34a, #15803d);
  color: #fff;
  box-shadow: 0 4px 16px rgba(22, 163, 74, 0.4);
}
.choice-btn.continue:hover {
  box-shadow: 0 6px 20px rgba(22, 163, 74, 0.5);
}
.choice-btn.lobby {
  background: linear-gradient(160deg, #ef4444, #dc2626);
  color: #fff;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}
.choice-btn.lobby:hover {
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

/* ---------- game-start countdown ---------- */
.countdown-card { align-items: center; text-align: center; 
  background: var(--glass-strong-fill);
  border: 1px solid var(--glass-strong-border);
  border-radius: var(--glass-strong-radius);
  box-shadow: var(--glass-strong-shadow);
  backdrop-filter: blur(var(--glass-strong-blur)) saturate(150%) brightness(0.92);
  -webkit-backdrop-filter: blur(var(--glass-strong-blur)) saturate(150%) brightness(0.92);
  padding: 3vh 3vw; }
.countdown-label { font-size: clamp(1.4rem, 3vw, 2.6rem); font-weight: 800; color: #c7d2fe; letter-spacing: 0.04em; }
.countdown-num {
  font-size: clamp(4rem, 12vw, 10rem); font-weight: 900; color: #fbbf24;
  font-variant-numeric: tabular-nums; line-height: 1;
  text-shadow: 0 6px 40px #fbbf2455;
  animation: countdown-pop 1s ease-out infinite;
}
@keyframes countdown-pop { 0% { transform: scale(1.12); } 30% { transform: scale(1); } 100% { transform: scale(1); } }

/* kick button in scoreboard */
.kick-btn {
  margin-left: auto;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.18);
  border: 2px solid #ef444455;
  color: #fca5a5;
  font-size: 1rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, transform 0.06s;
}
.kick-btn:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}
.kick-btn:active { transform: scale(0.92); }

/* takeover host card */
.takeover-card {
  width: min(92vw, 500px);
  background: var(--glass-strong-fill);
  border: 1px solid var(--glass-strong-border);
  border-radius: var(--glass-strong-radius);
  box-shadow: var(--glass-strong-shadow);
  backdrop-filter: blur(var(--glass-strong-blur)) saturate(150%) brightness(0.92);
  -webkit-backdrop-filter: blur(var(--glass-strong-blur)) saturate(150%) brightness(0.92);
  padding: 2.5rem 2rem;
  color: #eef2ff;
  text-align: center;
}
.takeover-card .big { font-size: 3.5em; margin-bottom: 0.5rem; }
.takeover-card h2 { font-size: clamp(1.6rem, 3.4vw, 2.6rem); font-weight: 900; color: #fbbf24; margin-bottom: 1rem; }
.takeover-card p { font-size: clamp(1.1rem, 2.2vw, 1.6rem); line-height: 1.5; margin: 0.7rem 0; color: #c7d2fe; }
.takeover-card label { display: block; font-weight: 800; color: #a5b4fc; font-size: 0.95rem; margin-bottom: 0.5rem; text-align: left; }
.takeover-card input {
  width: 100%; padding: 14px; border-radius: 12px; border: 2px solid #31407f;
  background: #111a3f; color: #fff; font-size: 1.3rem; font-weight: 700;
  text-align: center; letter-spacing: 0.2em;
}
.takeover-actions { display: flex; gap: 1rem; margin-top: 1.5rem; }
.takeover-btn, .cancel-btn { flex: 1; padding: 16px; font-size: 1.2rem; font-weight: 900; border-radius: 14px; }
.takeover-btn { background: var(--amber-gradient); color: var(--text-navy); }
.cancel-btn { 
  background: var(--glass-pill-fill);
  border: 1px solid var(--glass-pill-border);
  backdrop-filter: blur(var(--glass-pill-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-pill-blur)) saturate(140%);
  color: #fde68a; 
}

/* kicked message */
.kicked-message {
  background: #7f1d1d;
  border: 2px solid #ef4444;
  color: #fecaca;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  font-size: clamp(1.1rem, 2.2vw, 1.6rem);
  font-weight: 800;
  text-align: center;
  margin-bottom: 1.5rem;
  animation: shake 0.5s ease-in-out;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
.pause-btn {
  padding: 1.2vh 1.9vw; font-size: clamp(0.95rem, 1.9vw, 1.5rem); font-weight: 900;
  border-radius: 999px; color: #fde68a;
  background: var(--glass-pill-fill);
  border: 1px solid var(--glass-pill-border);
  backdrop-filter: blur(var(--glass-pill-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-pill-blur)) saturate(140%);
  box-shadow: var(--glass-pill-shadow);
  transition: transform 0.1s, box-shadow 0.1s, filter 0.1s;
}
.pause-btn:hover { filter: brightness(1.18); }
.pause-btn:active { transform: scale(0.96); }
.pause-btn.resumed {
  color: #0b1026;
  background: var(--amber-gradient);
  border-color: var(--amber);
  box-shadow: 0 4px 18px #d9770666;
}

/* Exit button: same navy/amber pill theme as the Pause button beside it. */
.exit-btn {
  padding: 1.2vh 1.9vw; font-size: clamp(0.95rem, 1.9vw, 1.5rem); font-weight: 900;
  border-radius: 999px; color: #fde68a;
  background: var(--glass-pill-fill);
  border: 1px solid var(--glass-pill-border);
  backdrop-filter: blur(var(--glass-pill-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-pill-blur)) saturate(140%);
  box-shadow: var(--glass-pill-shadow);
  transition: transform 0.1s, box-shadow 0.1s, filter 0.1s;
}
.exit-btn:hover { filter: brightness(1.18); }
.exit-btn:active { transform: scale(0.96); }

/* paused overlay - full screen glass-strong over dark scrim */
.paused-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--scrim-dark);
  z-index: 40;
  font-size: clamp(2rem, 6vw, 4.5rem);
  font-weight: 900;
  color: #fbbf24;
  text-shadow: 0 4px 32px #fbbf2488;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* host-players container (if used) - glass panel with flat rows */
.host-players {
  display: flex; gap: 1vw; flex-wrap: wrap; margin-top: 2.4vh;
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  border-radius: var(--glass-radius);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  padding: 1.2vh 1.2vw;
}
.host-players > * { /* flat row items inside */
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  padding: 0.8vh 1vw;
}

/* Landing video background: the looping MP4 sits behind the landing content.
   The still photo (body.landing-phase background) shows behind it as a
   fallback while the video loads. */
body.landing-phase video.landing-video {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  pointer-events: none;
}
/* Landing content sits above the video. */
body.landing-phase .host-wait { z-index: 1; }

/* Podium confetti video (Rick 2026-11-24): the approved glitter loop,
   screen-blended over the 5b stage so only the gold confetti shows.
   Same layer as the victory canvas (z-index 0, behind the podium
   content); the nearly-clear podium cards let it show through. */
body.podium-phase video.podium-confetti {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  pointer-events: none;
  mix-blend-mode: screen;
}

/* ---------- TV (16:9) lobby tightening — 2026-11-24 ----------
   TV is the primary display. On 16:9 the lobby background shows its full
   height, so the baked-in QUIZ SHOW sign sits right under the header
   (on the 21:9 ultrawide the cover crop pushes it out of the way) — the
   header title + Lobby pill collide with it. And the lobby type uses
   clamp(min-rem, vw, max-rem) whose rem caps bind on both screens, so on
   the smaller TV viewport the text stays the same absolute size while the
   spacing shrinks: the cards go fat and fill the whole screen with no
   breathing room. This query restores the ultrawide proportions on 16:9
   only (the ultrawide keeps its current look): more air around the frame,
   a compact header clear of the sign, and slightly smaller lobby type.
   Scoped to body.lobby-phase so the game and podium phases are untouched.
   The 12vh top margin on the lobby cards is a settled fix and is NOT
   changed here.
   Threshold is 2/1, NOT 16/9 (v3, 2026-11-24): 16/9 is razor-thin — a
   1366x768 viewport is 1.7786, just above 16/9 (1.7778), so the query
   never matched and v2's rules did nothing at 100% zoom. The threshold
   also toggles as zoom/scrollbars shift the ratio, which is why the QR
   jumped around at 80/67/40% zoom. 2/1 covers every 16:9 variant and
   still excludes the 21:9 ultrawide (2.33). */
@media (max-aspect-ratio: 2/1) {
  body.lobby-phase .host {
    padding: 3vh 3vw;
    gap: 1.8vh 1.5vw;
  }
  /* header: compact left group, clear of the background sign */
  body.lobby-phase .corner-logo.emblem { width: min(7vw, 80px); }
  body.lobby-phase .host header .title { font-size: clamp(1rem, 1.6vw, 1.3rem); }
  /* Header chip hidden on 16:9: the title + Lobby pill ran onto the sign's
     top-left corner (sign starts ~26% of screen width). The PLAYERS card
     already carries its own Lobby pill, so the state is still shown. */
  body.lobby-phase .host header .chip { display: none; }
  /* QR label fix (v6): keep the card at 64px — the card size was fine.
     Shrink the text to fit it instead. Border-box, so the label has
     54px with 3px padding; "Scan to join" at 0.5rem is ~45px and fits
     on one line. Wrapping allowed as a safety net so it can never hang
     off the card. */
  body.lobby-phase .lobby-qr { width: 64px; padding: 3px 3px 3px; }
  body.lobby-phase .lobby-qr span { font-size: 0.5rem; white-space: normal; line-height: 1.2; }
  /* QR fix v4: the sign is wider than the first photo suggested. The
     background is 2240x1120 (aspect 2.0); on 16:9 cover crops the sides,
     so the sign's right edge lands at ~71% of screen width, not 66%.
     v3's group (~285px of content) put the QR's left edge right on that
     boundary, so it still touched the sign's edge/glow. Shrink the whole
     group: QR 64px and compact Music/FX buttons, so the QR sits solidly
     right of the sign at any 16:9 viewport width. */
  body.lobby-phase .lobby-head-right { width: auto; gap: 10px; }
  body.lobby-phase .mute-btn { font-size: 0.75rem; padding: 4px 8px; }
  /* lobby cards: less padding, slightly smaller type, tighter stacks */
  body.lobby-phase .question-card { padding: 2vh 2vw; gap: 1.5vh; }
  body.lobby-phase .lobby-join-card { font-size: clamp(0.9rem, 1.6vw, 1.25rem); padding: 0.8rem 1.1rem; }
  body.lobby-phase .length-row { margin-top: 1.8vh; }
  body.lobby-phase .len-btn { font-size: clamp(0.85rem, 1.5vw, 1.15rem); }
  body.lobby-phase .start-btn { font-size: clamp(1.2rem, 2.4vw, 2rem); padding: 1.8vh 2.5vw; margin-top: 2.2vh; }
  body.lobby-phase .scoreboard { padding: 1.4vh 1vw; }
  /* Cards sit too close under the sign: raise the lobby top margin from
     12vh to 14vh (both cards, so they stay level). In the grid this moves
     each card's top down 2vh and makes the card 2vh shorter, with the
     bottom staying put — more air between the sign's bottom edge and the
     cards' tops, without pushing anything off the bottom of the screen. */
  body.lobby-phase .host-main,
  body.lobby-phase .scoreboard { margin-top: 14vh; }
  body.lobby-phase .scoreboard h2 { font-size: clamp(0.9rem, 1.5vw, 1.2rem); }
  body.lobby-phase .sb-row { font-size: clamp(0.9rem, 1.6vw, 1.3rem); padding: 0.9vh 0.8vw; }
}

/* Phone waiting page (Rick 2026-11-24): the "STARTING SOON" stage behind the
   waiting card. Light dim so the scoreboard and podium stay visible. */
body.phone-body.waiting-phase {
  background:
    linear-gradient(rgba(6,10,19,0.25), rgba(6,10,19,0.25)),
    url("player-bg-waiting-v3.webp") center / cover no-repeat,
    #0b1026;
}

/* Waiting card as a floating glass card (Rick 2026-11-24): sits in the clear
   hazy middle of the stage, clear of the scoreboard above and the podium
   below. Same dark-navy glass as the join card; the player list scrolls
   inside it if it grows tall. */
body.phone-body.waiting-phase .waiting-card {
  margin: auto;
  width: 100%;
  max-height: 46vh;
  overflow-y: auto;
  background: rgba(8,12,30,0.45);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 20px;
  padding: 34px 18px 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* Phone game page (Rick 2026-11-24): the contestant-podium view behind the
   question and buzzer. Light dim so the stage shows but text stays readable. */
body.phone-body.game-phase {
  background:
    linear-gradient(rgba(6,10,19,0.25), rgba(6,10,19,0.25)),
    url("player-bg-game-no-dome.webp") center / cover no-repeat,
    #0b1026;
}

body.phone-body.podium-phase {
  background:
    linear-gradient(rgba(6,10,19,0.25), rgba(6,10,19,0.25)),
    url("player-bg-podium.webp") center / cover no-repeat,
    #0b1026;
}

/* The buzzer is a virtual button sitting ON the podium in the background.
   The background is a first-person view looking down at the podium, so the
   disc reads as a wide ellipse — a flat circle would break the perspective.
   Squash the round buzzer to the same ellipse and centre it on the disc.
   Rick's rule (2026-11-25): the button and the gold frame must be the SAME
   SHAPE, or it can never fit — one can't be oval and the other a circle.
   Measured by radial scan from the disc centre on the background image:
   the dark disc is 778x570px and the gold ring 860x630px — both 1.37:1,
   so scaleY 0.73 matches the frame exactly (0.54 and 0.65 were both too
   flat and left gaps top and bottom). The disc is 65.7% of the displayed
   background width, and `cover` makes that width max(vw, 0.565*vh) — so
   the button uses max(65vw, 37vh), ~99% of the disc, its edge touching
   the ring's inside edge all around, in portrait AND landscape. The wrap's
   top is dynamic too: in landscape the disc centre drops, so the button
   was riding high and covering the question; max(58%, 53% + 8.85vw)
   follows it down. */
body.phone-body.game-phase .phone-shell {
  position: relative;
}
body.phone-body.game-phase .buzzer-wrap {
  position: absolute;
  left: 0;
  right: 0;
  /* Disc centre is at 55% of the frame in portrait (measured off the
     background image). In landscape `cover` scales the image to the width,
     so the disc centre drops below 55% — to 50% + 8.85vw. The max() tracks
     it in both orientations (it switches at the image ratio, same as
     `cover`). The hint line under the button pushes the button up, so the
     wrap sits 3% below the disc centre (58% in portrait). */
  top: max(58%, calc(53% + 8.85vw));
  transform: translateY(-50%);
  flex: none;
  min-height: 0;
}
body.phone-body.game-phase .buzzer {
  transform: scaleY(0.73);
  width: max(65vw, 37vh);
  touch-action: manipulation;
  transition: transform 0.06s, filter 0.08s, box-shadow 0.08s;
}
/* Press feedback (Rick 2026-11-24): the button LIGHTS UP while held — much
   brighter with a red glow — so the tap is unmistakable on a phone. */
body.phone-body.game-phase .buzzer:active {
  transform: scaleY(0.73) scale(0.92);
  filter: brightness(1.45) saturate(1.25);
  box-shadow: 0 0 46px rgba(248,113,113,0.95), 0 0 90px rgba(220,38,38,0.55), inset 0 -10px 24px #00000055;
}
body.phone-body.game-phase .buzzer.locked {
  transform: scaleY(0.73);
}
