/* ============================================================
   Bible Trivia Challenge — Live multiplayer app
   Design language ported from compellingtruth.org Bible-trivia.html
   ============================================================ */

/* Poppins is self-hosted: no third-party requests, works offline,
   and keeps the Play Store "no data collected" claim airtight. */
@font-face {
  font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/poppins-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/fonts/poppins-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('/fonts/poppins-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins'; font-style: normal; font-weight: 800; font-display: swap;
  src: url('/fonts/poppins-800.woff2') format('woff2');
}

:root {
  --teal: #244C4F;
  --teal-rgb: 36, 76, 79;
  --orange: #EC7140;
  --orange-rgb: 236, 113, 64;
  --orange-ink: #B0531F;   /* orange text on white (AA) */
  --orange-glow: #F7A070;  /* orange text on the dark stage (AA) */
  --dark: #0F272F;
  --cream: #FAF8F5;
  --success: #2E7D5B;
  --success-rgb: 46, 125, 91;
  --success-ink: #24664A;  /* green text on light tints (AA) */
  --error: #B33A3A;
  --error-rgb: 179, 58, 58;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --radius: 18px;
  --pill: 999px;
  --shadow-sm: 0 2px 10px rgba(15, 39, 47, 0.08);
  --shadow-md: 0 8px 28px rgba(15, 39, 47, 0.12);
  --shadow-lg: 0 18px 50px rgba(15, 39, 47, 0.18);
  /* medal metals — the same values the website uses */
  --gold: #E8B54D;   --gold-hi: #FFE3A3;   --gold-lo: #B98A2C;
  --silver: #C9CED4; --silver-hi: #F2F4F6; --silver-lo: #8D949C;
  --bronze: #D09A6A; --bronze-hi: #F0CDA9; --bronze-lo: #9A6A40;
}

* , *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Poppins', Verdana, sans-serif;
  color: var(--dark);
  background: var(--cream);
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overscroll-behavior-y: contain; /* an accidental pull-down must not reload the game mid-question */
}
[hidden] { display: none !important; }
.srOnly { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; } /* never display:none — the gradients would break */

.view {
  max-width: 560px;
  margin: 0 auto;
  padding: 1.1rem 1rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  animation: viewIn 0.35s var(--ease) both;
}
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.viewCenter { min-height: 80dvh; align-items: center; justify-content: center; }

/* metals — set --m / --mhi / --mlo on any element */
.m1 { --m: var(--gold);   --mhi: var(--gold-hi);   --mlo: var(--gold-lo); }
.m2 { --m: var(--silver); --mhi: var(--silver-hi); --mlo: var(--silver-lo); }
.m3 { --m: var(--bronze); --mhi: var(--bronze-hi); --mlo: var(--bronze-lo); }
.m0 { --m: rgba(255, 255, 255, 0.55); --mhi: rgba(255, 255, 255, 0.9); --mlo: rgba(255, 255, 255, 0.3); }

/* ---- primitives ---- */
.card {
  background: #fff;
  border: 1px solid rgba(var(--teal-rgb), 0.10);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: clamp(1.1rem, 4vw, 1.6rem);
}
.eyebrow {
  display: inline-block; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--orange-ink); margin-bottom: 0.55rem;
}
.btn {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: 0.95rem; font-weight: 600; border: none;
  border-radius: var(--pill); padding: 13px 26px; cursor: pointer; min-height: 48px;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 18px; height: 18px; flex: 0 0 auto; }
.btnPrimary {
  background: linear-gradient(135deg, #EC7140 0%, #d4582e 100%);
  color: #fff; box-shadow: 0 6px 18px rgba(var(--orange-rgb), 0.32);
}
.btnPrimary::after { /* shine sweep on hover / press */
  content: ""; position: absolute; z-index: -1; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%) no-repeat;
  background-size: 220% 100%; background-position: 160% 0; transition: background-position 0.7s var(--ease);
}
.btnPrimary:hover:not(:disabled)::after, .btnPrimary:focus-visible::after { background-position: -60% 0; }
.btnPrimary:active { transform: scale(0.98); }
.btnPrimary:disabled { background: #d8d8d8; box-shadow: none; cursor: not-allowed; }
.btnGhost {
  background: transparent; color: var(--teal);
  border: 1.5px solid rgba(var(--teal-rgb), 0.25);
}
.btnGhost:active { background: rgba(var(--teal-rgb), 0.06); }
.btnBlock { width: 100%; }
.btnLg { padding: 16px; font-size: 1.05rem; }
.btnSm { min-height: 40px; padding: 8px 18px; font-size: 0.85rem; }

.spinner {
  width: 38px; height: 38px; margin: 0 auto 1rem;
  border: 3px solid rgba(var(--teal-rgb), 0.15); border-top-color: var(--orange);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loadingText { color: rgba(var(--teal-rgb), 0.7); }

.toast {
  position: fixed; left: 50%; bottom: max(1.4rem, env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--dark); color: #fff; font-size: 0.88rem; font-weight: 600;
  padding: 0.7rem 1.2rem; border-radius: var(--pill); box-shadow: var(--shadow-lg);
  z-index: 60; max-width: 92vw; text-align: center; animation: viewIn 0.3s var(--ease) both;
}
.connBanner {
  /* floats over the page: pushing the answers down would move them under a tapping finger */
  position: fixed; top: max(0.1rem, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 50;
  pointer-events: none; /* it must never swallow a tap meant for what's under it */
  background: var(--error); color: #fff; font-size: 0.78rem; font-weight: 700; white-space: nowrap;
  padding: 0.25rem 0.8rem; border-radius: var(--pill); box-shadow: var(--shadow-lg);
}
.view:focus { outline: none; }

/* Player identity: initial-letter avatar on a per-player accent color.
   The pc-* index is assigned by the server and stays stable for the game. */
.pc-0 { --pc: #EC7140; --pc-rgb: 236, 113, 64; }
.pc-1 { --pc: #2E7D8C; --pc-rgb: 46, 125, 140; }
.pc-2 { --pc: #7C5CBF; --pc-rgb: 124, 92, 191; }
.pc-3 { --pc: #2E7D5B; --pc-rgb: 46, 125, 91; }
.pc-4 { --pc: #C0862E; --pc-rgb: 192, 134, 46; }
.pc-5 { --pc: #B34A6B; --pc-rgb: 179, 74, 107; }
.playerAvatar {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--pc, var(--teal)); color: #fff;
  font-size: 0.95rem; font-weight: 800; line-height: 1;
  box-shadow: inset 0 -2px 0 rgba(15, 39, 47, 0.18);
}
.playerAvatar.avatarSm { width: 28px; height: 28px; font-size: 0.78rem; }

/* Place disc: small metal coin with the rank numeral (dark ink on metal = AA) */
.placeDisc {
  --s: 32px; width: var(--s); height: var(--s); flex: 0 0 auto; border-radius: 50%;
  display: inline-grid; place-items: center; font-weight: 800; font-size: calc(var(--s) * 0.44); line-height: 1;
  color: var(--dark); font-variant-numeric: tabular-nums;
  background: radial-gradient(circle at 35% 30%, var(--mhi), var(--m) 55%, var(--mlo));
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(15, 39, 47, 0.18);
}
.placeDisc.m0 { background: rgba(var(--teal-rgb), 0.10); color: var(--teal); box-shadow: none; }
.arena .placeDisc.m0 { background: rgba(255, 255, 255, 0.16); color: #fff; }

/* ---- home ---- */
/* language switch: small, top right, tucked into the hero's top padding */
.langSwitch { align-self: flex-end; display: inline-flex; align-items: center; margin: -0.5rem -0.35rem -1.6rem 0; position: relative; z-index: 1; font-size: 0.8rem; }
.langBtn {
  font-family: inherit; font-size: inherit; font-weight: 600; color: rgba(var(--teal-rgb), 0.8);
  background: none; border: 0; border-radius: var(--pill); padding: 0.5rem 0.45rem; min-height: 44px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.langBtn[aria-pressed="true"] { color: var(--teal); font-weight: 700; text-decoration: underline; text-decoration-color: var(--orange); text-decoration-thickness: 2px; text-underline-offset: 5px; }
.langSep { color: rgba(var(--teal-rgb), 0.45); }
.homeHero { text-align: center; padding: clamp(1.2rem, 6vw, 2.2rem) 0 0.4rem; }
.homeLogo { border-radius: 22px; box-shadow: var(--shadow-md); }
.homeTitle { font-size: clamp(1.9rem, 8vw, 2.5rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; margin: 0.9rem 0 0.5rem; color: var(--teal); text-wrap: balance; }
.homeSub { color: rgba(var(--teal-rgb), 0.85); font-size: 0.98rem; margin: 0 auto; max-width: 26rem; }
.homeCard { display: flex; flex-direction: column; gap: 1rem; }
.orDivider { display: flex; align-items: center; gap: 0.8rem; color: rgba(var(--teal-rgb), 0.6); font-size: 0.8rem; font-weight: 600; }
.orDivider::before, .orDivider::after { content: ""; flex: 1; height: 1px; background: rgba(var(--teal-rgb), 0.14); }
.joinRow { display: flex; gap: 0.7rem; }
.joinRow .btn { flex: 0 0 auto; padding-left: 22px; padding-right: 22px; } /* "Unirme" is wider than "Join": leave the code its room */
.codeInput {
  flex: 1; min-width: 0; font-family: inherit; font-size: 1.5rem; font-weight: 800; letter-spacing: 0.35em;
  text-align: center; text-transform: uppercase; color: var(--dark);
  padding: 0.55rem 0.5rem 0.55rem 0.85rem; border: 1.5px solid rgba(var(--teal-rgb), 0.18);
  border-radius: 14px; background: #fff;
}
.codeInput:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(var(--orange-rgb), 0.18); }
.homeField { text-align: left; }
.textInput {
  width: 100%; font-family: inherit; font-size: 1rem; font-weight: 600; color: var(--dark);
  padding: 0.8rem 1rem; border: 1.5px solid rgba(var(--teal-rgb), 0.18);
  border-radius: 12px; background: #fff;
}
.textInput::placeholder { color: rgba(var(--teal-rgb), 0.45); font-weight: 400; }
.textInput:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(var(--orange-rgb), 0.18); }
.homeFoot { text-align: center; font-size: 0.8rem; color: rgba(var(--teal-rgb), 0.75); line-height: 1.6; }
.homeFoot strong { color: var(--teal); }
.homeFoot a { color: var(--teal); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; display: inline-block; padding: 0.5rem 0.25rem; }

/* ---- privacy policy page ---- */
.legalBack { align-self: flex-start; text-decoration: none; }
.legal h1 { font-size: 1.5rem; font-weight: 800; color: var(--teal); margin: 0 0 0.2rem; }
.legal h2 { font-size: 1rem; font-weight: 700; color: var(--teal); margin: 1.4rem 0 0.35rem; }
.legal p, .legal li { font-size: 0.92rem; line-height: 1.65; margin: 0 0 0.6rem; }
.legal ul { padding-left: 1.2rem; margin: 0; }
.legal .legalDate { font-size: 0.8rem; color: rgba(var(--teal-rgb), 0.75); }
.legal .card a { color: var(--orange-ink); font-weight: 600; }

/* ---- lobby ---- */
.lobbyCodeCard { text-align: center; }
.lobbyCode { display: flex; justify-content: center; gap: 0.5rem; margin: 0.35rem 0 1rem; min-height: 64px; }
.codeTile {
  width: 56px; height: 64px; border-radius: 14px; display: grid; place-items: center;
  font-size: 2rem; font-weight: 800; line-height: 1; color: #fff;
  background: linear-gradient(160deg, #2f6064 0%, #244C4F 45%, #0F272F 100%);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 8px 18px rgba(15, 39, 47, 0.22);
}
.codeTile:nth-child(2n) { transform: translateY(-3px); }
.lobbyShareRow { display: flex; gap: 0.7rem; justify-content: center; flex-wrap: wrap; }
/* the room's questions are in another language than the screen */
.langNote {
  display: flex; align-items: flex-start; gap: 0.55rem; margin: 0; padding: 0.7rem 0.95rem;
  border-radius: 14px; background: rgba(var(--teal-rgb), 0.07); border: 1px solid rgba(var(--teal-rgb), 0.14);
  color: var(--teal); font-size: 0.86rem; font-weight: 600; line-height: 1.4;
}
.langNote svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px; color: var(--orange-ink); }
.lobbySectionHead { display: flex; align-items: baseline; justify-content: space-between; }
.playerCount { font-size: 0.82rem; font-weight: 700; color: rgba(var(--teal-rgb), 0.75); }
.playerList { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.playerRow {
  display: flex; align-items: center; gap: 0.8rem; padding: 0.65rem 0.9rem;
  border: 1.5px solid rgba(var(--teal-rgb), 0.14); border-radius: 14px; background: #fff;
}
.playerRow.isMe { border-color: var(--orange); background: linear-gradient(90deg, rgba(var(--orange-rgb), 0.08), rgba(var(--orange-rgb), 0.02)); cursor: pointer; }
.playerRow.isOff { opacity: 0.45; }
.playerRow.isEmpty { border-style: dashed; background: transparent; color: rgba(var(--teal-rgb), 0.8); }
.playerRow.isEmpty .playerAvatar { background: transparent; border: 1.5px dashed rgba(var(--teal-rgb), 0.3); color: rgba(var(--teal-rgb), 0.5); box-shadow: none; }
.playerRow.isEmpty .playerName { font-weight: 600; font-size: 0.88rem; }
.playerName { flex: 1; font-weight: 700; font-size: 0.98rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.playerBadge {
  font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 0.25rem 0.6rem; border-radius: var(--pill);
  background: rgba(var(--teal-rgb), 0.10); color: var(--teal);
}
.playerBadge.isHost { background: rgba(var(--orange-rgb), 0.16); color: var(--orange-ink); }
.editIcon { color: rgba(var(--teal-rgb), 0.5); }
.editIcon svg { width: 16px; height: 16px; display: block; }
.nameEdit {
  flex: 1; min-width: 0; font-family: inherit; font-size: 16px; font-weight: 700; color: var(--dark);
  padding: 0.3rem 0.6rem; border: 1.5px solid var(--orange); border-radius: 9px; background: #fff;
}
.nameEdit:focus { outline: none; box-shadow: 0 0 0 3px rgba(var(--orange-rgb), 0.18); }

.field { margin-top: 1.1rem; }
.fieldLabel { display: block; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--teal); margin-bottom: 0.55rem; }
.fieldHint { font-size: 0.8rem; color: rgba(var(--teal-rgb), 0.78); margin: 0.55rem 0 0; }
.centerHint { text-align: center; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 56px;
  font-family: inherit; font-size: 0.9rem; font-weight: 600; color: var(--teal);
  padding: 0.5rem 1.1rem; border-radius: var(--pill); cursor: pointer;
  background: #fff; border: 1.5px solid rgba(var(--teal-rgb), 0.18);
  transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.chip.is-active { background: var(--teal); border-color: var(--teal); color: #fff; box-shadow: 0 4px 12px rgba(var(--teal-rgb), 0.22); }
.chip:disabled { opacity: 0.4; cursor: not-allowed; }
.selectWrap { position: relative; }
.selectWrap::after {
  content: ""; position: absolute; right: 1rem; top: 50%; width: 10px; height: 10px;
  transform: translateY(-65%) rotate(45deg); border-right: 2px solid var(--teal);
  border-bottom: 2px solid var(--teal); pointer-events: none;
}
.select {
  width: 100%; font-family: inherit; font-size: 16px; font-weight: 600; color: var(--dark);
  padding: 0.8rem 2.5rem 0.8rem 1rem; border: 1.5px solid rgba(var(--teal-rgb), 0.18);
  border-radius: 12px; background: #fff; cursor: pointer; appearance: none; -webkit-appearance: none;
}
#settingsCard.isLocked .chip, #settingsCard.isLocked .select { pointer-events: none; opacity: 0.75; }
.stickyActions { display: flex; flex-direction: column; gap: 0.6rem; }

/* ---- question ---- */
.quizTop { display: flex; align-items: center; justify-content: space-between; gap: 0.7rem; min-height: 34px; }
.quizTopLeft { display: flex; align-items: center; gap: 0.6rem; min-width: 0; flex: 1 1 auto; }
.roomTag { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.18em; color: rgba(var(--teal-rgb), 0.62); min-width: 0; overflow: hidden; white-space: nowrap; }
.scorePill {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.26rem 0.3rem 0.26rem 0.75rem; border-radius: var(--pill);
  font-size: 0.78rem; font-weight: 700; color: #fff; white-space: nowrap;
  background: linear-gradient(135deg, #C2532A 0%, var(--orange-ink) 100%); box-shadow: 0 4px 12px rgba(var(--orange-rgb), 0.28);
  flex: 0 0 auto;
}
.scorePill:empty { display: none; }
.scorePill.isRank { padding-left: 0.3rem; }
.scorePill .placeDisc { --s: 22px; }
.scorePill .placeDisc.m0 { background: #fff; color: var(--dark); }
.scoreNum { background: rgba(15, 39, 47, 0.28); border-radius: var(--pill); padding: 0.08rem 0.5rem; min-width: 1.6rem; text-align: center; font-variant-numeric: tabular-nums; }
.answeredChips { display: flex; gap: 0.35rem; flex: 0 0 auto; }
.answeredChip {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-size: 0.85rem; font-weight: 800; line-height: 1; color: var(--pc, var(--teal));
  background: #fff; border: 1.5px solid rgba(var(--teal-rgb), 0.18);
  position: relative; opacity: 0.55; transition: all 0.25s var(--ease);
}
.answeredChip.is-in { opacity: 1; color: #fff; background: var(--pc, var(--teal)); border-color: transparent; transform: scale(1.05); }
.answeredChip.is-in::after {
  content: ""; position: absolute; right: -4px; bottom: -4px; width: 16px; height: 16px;
  border-radius: 50%; border: 2px solid var(--cream);
  background: var(--success) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") center / 8px 8px no-repeat;
}
.progressTop { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.45rem; gap: 0.8rem; }
.progressLabel { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--orange-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progressCount { font-size: 0.8rem; font-weight: 600; color: rgba(var(--teal-rgb), 0.82); flex: 0 0 auto; }
/* one segment per question; misses are hatched (texture, not just color) */
.segs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; height: 8px; }
.seg { border-radius: var(--pill); background: rgba(var(--teal-rgb), 0.10); transition: background 0.3s var(--ease); }
.seg.is-right { background: linear-gradient(90deg, #ec8a5a, #d4582e); }
.seg.is-wrong { background: repeating-linear-gradient(135deg, rgba(var(--teal-rgb), 0.55) 0 3px, rgba(var(--teal-rgb), 0.16) 3px 6px); }
.seg.is-done { background: rgba(var(--teal-rgb), 0.38); } /* played, result unknown (rejoined mid-game) */
.seg.is-now { box-shadow: 0 0 0 2px var(--cream), 0 0 0 4px rgba(var(--orange-rgb), 0.45); }

.timer { height: 8px; border-radius: var(--pill); background: rgba(var(--teal-rgb), 0.10); overflow: hidden; }
.timerFill { height: 100%; width: 100%; border-radius: var(--pill); background: var(--success); will-change: transform; }
.timerFill.is-low { background: var(--error); }

.qMeta { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.8rem; }
.diffBadge { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 0.3rem 0.7rem 0.3rem 0.55rem; border-radius: var(--pill); }
.diffBadge svg { width: 13px; height: 13px; flex: 0 0 auto; }
.diffBadge[data-diff="Easy"] { background: rgba(var(--success-rgb), 0.12); color: var(--success-ink); }
.diffBadge[data-diff="Medium"] { background: rgba(var(--orange-rgb), 0.16); color: #9c4717; }
.diffBadge[data-diff="Hard"] { background: rgba(var(--error-rgb), 0.12); color: var(--error); }
.timeLeft { font-size: 0.95rem; font-weight: 800; color: var(--teal); font-variant-numeric: tabular-nums; }
.timeLeft.is-low { color: var(--error); }
.question { font-size: clamp(1.15rem, 5vw, 1.4rem); font-weight: 700; line-height: 1.35; letter-spacing: -0.01em; margin: 0 0 1.1rem; }
.questionSm { font-size: 1.05rem; margin-bottom: 0.9rem; }

.options { display: flex; flex-direction: column; gap: 0.65rem; }
.option {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: left;
  padding: 13px 15px; background: #fff; border: 1.5px solid rgba(var(--teal-rgb), 0.16);
  border-radius: 16px; cursor: pointer; font-family: inherit; color: var(--dark); min-height: 54px;
  box-shadow: 0 2px 0 rgba(var(--teal-rgb), 0.06);
  transition: transform 0.18s var(--ease), background 0.25s var(--ease), border-color 0.25s var(--ease), opacity 0.25s, box-shadow 0.25s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.option:active:not(:disabled) { transform: scale(0.985); }
.option:disabled { cursor: default; }
.option.is-picked { border-color: var(--orange); background: rgba(var(--orange-rgb), 0.08); box-shadow: 0 0 0 3px rgba(var(--orange-rgb), 0.14); }
.option.is-picked .optLetter { background: var(--orange); color: #fff; }
.option.is-correct { background: rgba(var(--success-rgb), 0.09); border-color: var(--success); box-shadow: 0 0 0 3px rgba(var(--success-rgb), 0.12); }
.option.is-correct .optLetter { background: var(--success); color: #fff; }
.option.is-correct::after { /* one-time shine sweep (runs under .is-live) */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.75) 50%, transparent 65%) no-repeat;
  background-size: 240% 100%; background-position: 150% 0;
}
.option.is-incorrect { background: rgba(var(--error-rgb), 0.06); border-color: var(--error); }
.option.is-incorrect .optLetter { background: var(--error); color: #fff; }
.option.is-dim { opacity: 0.5; box-shadow: none; }
.optLetter {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(var(--teal-rgb), 0.10); color: var(--teal); font-weight: 700; font-size: 0.9rem;
  transition: background 0.25s, color 0.25s;
}
.optText { flex: 1 1 auto; font-size: 0.95rem; line-height: 1.4; min-width: 0; }
.optWho { display: flex; gap: 4px; flex: 0 0 auto; }
.optWho:empty { display: none; }
.optSide { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: 0 0 auto; }
.optionsReveal .option { flex-wrap: wrap; row-gap: 8px; }
.optionsReveal .optText { flex: 1 1 8rem; overflow-wrap: anywhere; }
.optMark { flex: 0 0 auto; display: inline-flex; }
.optMark:empty { display: none; }
.optTag { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.6rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; line-height: 1; padding: 0.3rem 0.5rem; border-radius: var(--pill); color: #fff; white-space: nowrap; }
.optTag svg { width: 12px; height: 12px; flex: 0 0 auto; }
.is-correct .optTag { background: var(--success); }
.is-incorrect .optTag { background: var(--error); }
.miniAvatar {
  width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--pc, var(--teal)); color: #fff; font-size: 0.62rem; font-weight: 800; line-height: 1;
}

/* ---- reveal ---- */
.verdictBar { display: flex; align-items: center; gap: 0.85rem; padding: 0.8rem 1rem; border-radius: 16px; }
.verdictBar.is-correct { background: linear-gradient(135deg, rgba(var(--success-rgb), 0.14), rgba(var(--success-rgb), 0.04)); border: 1px solid rgba(var(--success-rgb), 0.3); }
.verdictBar.is-incorrect { background: linear-gradient(135deg, rgba(var(--error-rgb), 0.11), rgba(var(--error-rgb), 0.03)); border: 1px solid rgba(var(--error-rgb), 0.26); }
.verdictIcon { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.verdictIcon svg { width: 21px; height: 21px; display: block; }
.is-correct .verdictIcon { background: linear-gradient(135deg, #3C9A72 0%, var(--success) 100%); box-shadow: 0 0 0 5px rgba(var(--success-rgb), 0.15); }
.is-incorrect .verdictIcon { background: linear-gradient(135deg, #C95252 0%, var(--error) 100%); box-shadow: 0 0 0 5px rgba(var(--error-rgb), 0.13); }
.verdictText { flex: 1 1 auto; min-width: 0; line-height: 1.35; }
.verdictText strong { display: block; font-size: 1.08rem; font-weight: 800; }
.is-correct .verdictText strong { color: var(--success-ink); }
.is-incorrect .verdictText strong { color: var(--error); }
.verdictText span { display: block; font-size: 0.86rem; color: rgba(var(--teal-rgb), 0.92); overflow-wrap: anywhere; }
.verdictPts { flex: 0 0 auto; font-size: 1.3rem; font-weight: 800; color: var(--success-ink); font-variant-numeric: tabular-nums; }

.sourceCard { padding: 0; overflow: hidden; background: linear-gradient(180deg, #fff 0%, var(--cream) 100%); }
.sourceMedia { position: relative; width: 100%; aspect-ratio: 1200 / 630; background: var(--dark); }
.sourceMedia img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sourceMedia::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(15, 39, 47, 0) 55%, rgba(15, 39, 47, 0.18) 100%); pointer-events: none; }
.sourceBody { padding: 1.1rem 1.25rem 1.25rem; }
.sourceTitle { font-size: 1.15rem; font-weight: 700; line-height: 1.26; letter-spacing: -0.01em; margin: 0.15rem 0 0.6rem; color: var(--teal); }
.sourceText { font-size: 0.92rem; line-height: 1.6; color: rgba(var(--teal-rgb), 0.92); margin: 0 0 0.9rem; }
.sourceLink {
  display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; font-weight: 700; text-decoration: none;
  color: #fff; background: var(--teal); padding: 0.65rem 1.25rem; border-radius: var(--pill);
  box-shadow: 0 5px 16px rgba(var(--teal-rgb), 0.30);
}
.sourceLink svg { width: 15px; height: 15px; }

/* Standings: the 7-second scoreboard between questions */
.stand { --rowH: 56px; --gap: 6px; padding: 0.85rem 0.8rem 0.95rem; background: #fff; border: 1px solid rgba(var(--teal-rgb), 0.10); border-radius: var(--radius); box-shadow: var(--shadow-md); }
.standHead { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.65rem; flex-wrap: wrap; }
.standTitle { display: flex; align-items: center; gap: 0.45rem; margin: 0; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--orange-ink); }
.standTitle svg { width: 16px; height: 16px; flex: 0 0 auto; }
.standTitle span { color: rgba(var(--teal-rgb), 0.85); letter-spacing: 0.04em; text-transform: none; font-weight: 600; }
.standNext { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.78rem; font-weight: 600; color: rgba(var(--teal-rgb), 0.9); font-variant-numeric: tabular-nums; }
.standClock { width: 20px; height: 20px; transform: rotate(-90deg); flex: 0 0 auto; }
.standClock circle { fill: none; stroke-width: 3; }
.clockTrack { stroke: rgba(var(--teal-rgb), 0.12); }
.clockFill { stroke: var(--orange); stroke-linecap: round; stroke-dasharray: 50.27; stroke-dashoffset: 0; }
.standList { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--gap); }
.standRow { position: relative; isolation: isolate; overflow: hidden; height: var(--rowH); display: flex; align-items: center; gap: 0.5rem; padding: 0 0.7rem 0 0.45rem; border-radius: 12px; background: rgba(var(--teal-rgb), 0.03); border: 1.5px solid transparent; }
.standRow::before { content: ""; position: absolute; z-index: -1; inset: 0; border-radius: inherit; transform-origin: left; transform: scaleX(var(--w, 1)); background: linear-gradient(90deg, rgba(var(--pc-rgb), 0.17), rgba(var(--pc-rgb), 0.06)); }
.standRow.isMe { border-color: rgba(var(--orange-rgb), 0.6); }
.standRow.isOff, .boardRow.isOff { border-style: dashed; border-color: rgba(var(--teal-rgb), 0.25); }
.standRow.isOff::before, .boardRow.isOff::before { opacity: 0.5; }
.standRow.isOff .playerAvatar, .standRow.isOff .placeDisc,
.boardRow.isOff .playerAvatar, .boardRow.isOff .placeDisc { filter: grayscale(0.85); opacity: 0.6; }
.standRank { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 28px; }
.standRank .placeDisc { --s: 26px; }
.move { display: inline-flex; align-items: center; gap: 1px; font-size: 0.6rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.move svg { width: 9px; height: 9px; }
.move.is-up { color: var(--success-ink); }
.move.is-down { color: var(--error); }
.move.is-same { color: rgba(var(--teal-rgb), 0.85); }
.standWho { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.standName { min-width: 0; display: flex; align-items: center; gap: 0.4rem; font-weight: 700; font-size: 0.9rem; }
.standNameText { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.standStatus { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.7rem; font-weight: 600; color: rgba(var(--teal-rgb), 0.85); }
.standStatus svg { width: 11px; height: 11px; flex: 0 0 auto; }
.standStatus.is-right { color: var(--success-ink); }
.standStatus.is-wrong { color: var(--error); }
.standGain { flex: 0 0 auto; display: inline-flex; align-items: center; padding: 0.2rem 0.5rem; border-radius: var(--pill); font-size: 0.76rem; font-weight: 800; font-variant-numeric: tabular-nums; background: rgba(var(--success-rgb), 0.12); color: var(--success-ink); }
.standGain.isZero { background: rgba(var(--teal-rgb), 0.07); color: rgba(var(--teal-rgb), 0.85); }
.standScore { flex: 0 0 auto; min-width: 3.4ch; text-align: right; font-weight: 800; font-size: 1rem; color: var(--teal); font-variant-numeric: tabular-nums; }
.tagYou { flex: 0 0 auto; font-size: 0.56rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; line-height: 1; padding: 0.22rem 0.42rem; border-radius: var(--pill); background: var(--orange); color: var(--dark); }
.tagTie { flex: 0 0 auto; font-size: 0.56rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; line-height: 1; padding: 0.22rem 0.42rem; border-radius: var(--pill); background: rgba(var(--teal-rgb), 0.12); color: var(--teal); }
.tagOff { flex: 0 0 auto; font-size: 0.56rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(var(--teal-rgb), 0.85); }

/* ============ RESULTS — the dark "arena" stage ============ */
.arena {
  position: relative; isolation: isolate; overflow: hidden;
  text-align: center; color: #fff;
  border-radius: var(--radius);
  padding: 1.6rem 0.9rem 1.3rem;
  background: linear-gradient(150deg, #244C4F 0%, #0F272F 100%);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.arena::before { /* orange glow */
  content: ""; position: absolute; z-index: -3; top: -38%; right: -16%;
  width: 380px; height: 380px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(var(--orange-rgb), 0.30) 0%, rgba(var(--orange-rgb), 0) 68%);
}
.arena::after { /* faint dot-grid stage backdrop */
  content: ""; position: absolute; z-index: -3; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.10) 1px, transparent 1.5px);
  background-size: 18px 18px;
  -webkit-mask-image: radial-gradient(120% 70% at 50% 0%, #000 0%, transparent 72%);
          mask-image: radial-gradient(120% 70% at 50% 0%, #000 0%, transparent 72%);
}
.arenaFx { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.fxRays, .fxGlow { position: absolute; left: var(--x, 50%); top: var(--y, 40%); width: var(--r, 300px); height: var(--r, 300px); translate: -50% -50%; border-radius: 50%; }
.fxRays {
  background: repeating-conic-gradient(from 0deg, rgba(255, 227, 163, 0.20) 0deg 5deg, rgba(255, 227, 163, 0) 5deg 15deg);
  -webkit-mask-image: radial-gradient(closest-side, #000 20%, rgba(0, 0, 0, 0.45) 55%, transparent 100%);
          mask-image: radial-gradient(closest-side, #000 20%, rgba(0, 0, 0, 0.45) 55%, transparent 100%);
}
.fxGlow { width: calc(var(--r, 300px) * 0.6); height: calc(var(--r, 300px) * 0.6); background: radial-gradient(circle, rgba(247, 160, 112, 0.55) 0%, rgba(var(--orange-rgb), 0.18) 42%, rgba(var(--orange-rgb), 0) 70%); }
.fxBeam { /* soft spotlight cone from the top edge down onto the winner */
  position: absolute; top: -20px; left: var(--x, 50%); width: calc(var(--y, 200px) * 1.15 + 60px); height: calc(var(--y, 200px) + 70px); translate: -50% 0;
  background: conic-gradient(from 156deg at 50% 0%, rgba(255, 244, 230, 0) 0deg, rgba(255, 244, 230, 0.11) 16deg, rgba(255, 244, 230, 0.13) 24deg, rgba(255, 244, 230, 0.11) 32deg, rgba(255, 244, 230, 0) 48deg);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 45%, #000 80%, transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0%, #000 45%, #000 80%, transparent 100%);
}
.arenaEyebrow {
  margin: 0; display: inline-flex; align-items: center; gap: 0.55rem;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--orange-glow);
}
.arenaEyebrow::before, .arenaEyebrow::after { content: ""; width: 22px; height: 1.5px; border-radius: 2px; background: linear-gradient(90deg, rgba(247, 160, 112, 0), var(--orange-glow)); }
.arenaEyebrow::after { transform: scaleX(-1); }
.arenaTitle { font-size: clamp(1.6rem, 8vw, 2.2rem); font-weight: 800; letter-spacing: -0.025em; line-height: 1.12; margin: 0.4rem 0 0.15rem; color: #fff; text-shadow: 0 4px 24px rgba(0, 0, 0, 0.35); overflow-wrap: anywhere; }
.crown { display: block; width: 36px; height: auto; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35)); }

/* Medallion avatar: metal ring + player-colored face + initial */
.medalWrap { position: relative; display: inline-grid; place-items: center; }
.medalWrap > .crown { position: absolute; left: 50%; bottom: calc(100% - 9px); translate: -50% 0; z-index: 2; }
.medal {
  --s: 50px; position: relative; width: var(--s); height: var(--s); border-radius: 50%; flex: 0 0 auto;
  padding: calc(var(--s) * 0.075);
  background: conic-gradient(from 210deg, var(--mlo), var(--mhi) 22%, var(--m) 38%, var(--mlo) 58%, var(--mhi) 78%, var(--mlo));
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.38);
}
.medal::after { /* one-time shine sweep */
  content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.6) 50%, transparent 62%) no-repeat;
  background-size: 260% 100%; background-position: 140% 0;
}
.medalFace {
  width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.30), rgba(255, 255, 255, 0) 55%), var(--pc, var(--teal));
  color: #fff; font-weight: 800; font-size: calc(var(--s) * 0.4); line-height: 1;
  box-shadow: inset 0 -3px 7px rgba(0, 0, 0, 0.28); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.youTag {
  position: absolute; left: 50%; bottom: -8px; translate: -50% 0; z-index: 2;
  font-size: 0.54rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; line-height: 1;
  padding: 0.22rem 0.42rem; border-radius: var(--pill);
  background: var(--orange); color: var(--dark); box-shadow: 0 0 0 2px #0F272F;
}

.podium {
  --podH: 118px;
  list-style: none; margin: 0.6rem auto 0; padding: 2.2rem 0 0; position: relative; isolation: isolate;
  display: flex; align-items: flex-end; justify-content: center; gap: 8px;
  max-width: 30rem;
}
.podium::before { /* stage edge */
  content: ""; position: absolute; z-index: 2; left: -8%; right: -8%; bottom: 0; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(247, 160, 112, 0), rgba(247, 160, 112, 0.75), rgba(247, 160, 112, 0));
}
.podium::after { /* floor glow */
  content: ""; position: absolute; z-index: -1; left: -14%; right: -14%; bottom: -46px; height: 96px;
  background: radial-gradient(50% 50% at 50% 50%, rgba(var(--orange-rgb), 0.34), rgba(var(--orange-rgb), 0) 100%);
}
.podiumSpot { position: relative; flex: 1 1 0; min-width: 0; max-width: 8.5rem; display: flex; flex-direction: column; align-items: center; margin: 0; padding: 0; }
.podiumTop { position: relative; display: flex; flex-direction: column; align-items: center; width: 100%; padding: 0 2px 0.6rem; }
.podiumName { display: block; max-width: 100%; margin-top: 0.5rem; font-weight: 700; font-size: 0.8rem; line-height: 1.25; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podiumPts { font-size: 0.64rem; font-weight: 600; letter-spacing: 0.04em; color: rgba(255, 255, 255, 0.8); font-variant-numeric: tabular-nums; white-space: nowrap; }
.podiumPts b { font-size: 0.95rem; font-weight: 800; color: #fff; letter-spacing: 0; }
.podiumColWrap { width: 100%; overflow: hidden; padding-top: 4px; margin-top: -4px; border-radius: 14px 14px 0 0; }
.podiumCol {
  position: relative; height: calc(var(--podH) * var(--f, 1)); min-height: 50px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 0.3rem; padding-top: 0.55rem;
  border-radius: 14px 14px 0 0; border: 1px solid rgba(255, 255, 255, 0.12); border-bottom: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.04) 90%);
  box-shadow: inset 0 4px 0 var(--m), inset 0 22px 26px -20px var(--m);
}
.podiumSpot.isLead .podiumCol { /* deeper orange behind the small white text keeps it AA */
  background: linear-gradient(180deg, #C2532A 0%, rgba(176, 72, 34, 0.8) 38%, rgba(var(--orange-rgb), 0.10) 100%);
  border-color: rgba(247, 160, 112, 0.6);
  box-shadow: inset 0 4px 0 var(--m);
}
.podiumPlace { font-size: 1.7rem; font-weight: 800; line-height: 1; letter-spacing: -0.03em; color: var(--mhi); text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35); }
.podiumSpot.isLead .podiumPlace { color: #fff; }
.podiumPlace sup { font-size: 0.42em; font-weight: 700; letter-spacing: 0; margin-left: 1px; vertical-align: 0.9em; }
.tieTag { font-size: 0.58rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; line-height: 1; padding: 0.24rem 0.5rem; border-radius: var(--pill); background: rgba(15, 39, 47, 0.45); color: #fff; }
.podiumSpot.isLead .podiumName { font-weight: 800; }
.podiumSpot.isMe .medal { box-shadow: 0 0 0 3px #0F272F, 0 0 0 5.5px var(--orange-glow), 0 8px 20px rgba(0, 0, 0, 0.38); }
.podiumSpot.isMe .podiumName { margin-top: 0.85rem; }
.podiumSpot.isOff .medal { filter: grayscale(0.85); opacity: 0.6; }

/* "Your finish" strip */
.youFinish {
  display: inline-flex; align-items: center; gap: 0.6rem; max-width: 100%;
  margin: 0.85rem auto 0; padding: 0.36rem 0.85rem 0.36rem 0.4rem; border-radius: var(--pill);
  background: rgba(255, 255, 255, 0.09); border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 0.8rem; font-weight: 500; line-height: 1.3; color: rgba(255, 255, 255, 0.9); text-align: left;
}
.youFinish strong { color: #fff; font-weight: 700; }
.youFinish .placeDisc { --s: 30px; }

/* actions live inside the stage once the results render */
.arena .stickyActions { margin-top: 1.5rem; }
.arena .btnGhost { color: #fff; border-color: rgba(255, 255, 255, 0.28); background: rgba(255, 255, 255, 0.08); }
.arena .btnGhost:active { background: rgba(255, 255, 255, 0.16); }
.arena .btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.waitHost { display: flex; align-items: center; justify-content: center; gap: 0.6rem; margin: 0.2rem 0; font-size: 0.86rem; font-weight: 600; color: rgba(255, 255, 255, 0.85); }
.waitDots { display: inline-flex; gap: 4px; }
.waitDots i { width: 6px; height: 6px; border-radius: 50%; background: var(--orange-glow); animation: dot 1.2s ease-in-out infinite; }
.waitDots i:nth-child(2) { animation-delay: 0.15s; }
.waitDots i:nth-child(3) { animation-delay: 0.3s; }

/* Leaderboard below the stage */
.board { background: #fff; border: 1px solid rgba(var(--teal-rgb), 0.10); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 1.1rem 0.85rem 1rem; }
.boardHead { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.8rem; flex-wrap: wrap; }
.boardTitle { margin: 0; display: flex; align-items: center; gap: 0.5rem; font-size: 1.02rem; font-weight: 700; color: var(--teal); }
.boardTitle svg { width: 20px; height: 20px; color: var(--orange); flex: 0 0 auto; }
.legend { display: flex; align-items: center; gap: 0.8rem; font-size: 0.7rem; font-weight: 600; color: rgba(var(--teal-rgb), 0.85); }
.legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend i { width: 16px; height: 8px; border-radius: 3px; background: var(--teal); }
.legend i.is-speed { background: repeating-linear-gradient(135deg, var(--teal) 0 2px, rgba(var(--teal-rgb), 0.25) 2px 4px); }
.boardList { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.boardRow { position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: center; gap: 0.55rem; margin: 0; padding: 0.6rem 0.75rem 0.6rem 0.55rem; border-radius: 14px; background: rgba(var(--teal-rgb), 0.03); border: 1.5px solid rgba(var(--teal-rgb), 0.08); }
.boardRow::before { /* score bar race: width = score / leader */
  content: ""; position: absolute; z-index: -1; inset: 0; border-radius: inherit; transform-origin: left;
  transform: scaleX(var(--w, 1));
  background: linear-gradient(90deg, rgba(var(--pc-rgb), 0.16), rgba(var(--pc-rgb), 0.05));
}
.boardRow.isMe { border-color: rgba(var(--orange-rgb), 0.6); box-shadow: 0 0 0 3px rgba(var(--orange-rgb), 0.12); }
.boardRow .placeDisc { --s: 28px; }
.boardRow .playerAvatar { width: 30px; height: 30px; font-size: 0.82rem; }
.boardWho { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; text-align: left; }
.boardName { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 0.4rem; min-width: 0; font-weight: 700; font-size: 0.92rem; color: var(--dark); }
.boardNameText { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; max-width: 100%; }
.boardSub { font-size: 0.74rem; color: rgba(var(--teal-rgb), 0.85); }
/* answer points vs speed bonus, scaled to the leader's score */
.boardSplit { display: flex; height: 5px; margin-top: 0.35rem; max-width: 13rem; border-radius: var(--pill); background: rgba(var(--teal-rgb), 0.08); overflow: hidden; }
.boardSplit span { display: block; height: 100%; transform-origin: left; }
.boardSplit .is-base { width: calc(var(--b, 0) * 100%); background: var(--pc, var(--teal)); }
.boardSplit .is-speed { width: calc(var(--sp, 0) * 100%); background: repeating-linear-gradient(135deg, var(--pc, var(--teal)) 0 2px, rgba(var(--pc-rgb, 36, 76, 79), 0.3) 2px 4px); }
.boardPts { flex: 0 0 auto; text-align: right; line-height: 1.05; font-variant-numeric: tabular-nums; }
.boardPts b { display: block; font-size: 1.1rem; font-weight: 800; color: var(--teal); }
.boardPts small { font-size: 0.6rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(var(--teal-rgb), 0.82); }

/* ---- modal (name prompt / confirmations) ---- */
.modalOverlay {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(15, 39, 47, 0.55);
  display: grid; place-items: center;
  padding: 1rem max(1rem, env(safe-area-inset-right)) 1rem max(1rem, env(safe-area-inset-left));
  animation: modalFade 0.2s var(--ease) both;
}
.modal {
  width: 100%; max-width: 22rem; background: #fff;
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 1.4rem 1.4rem 1.2rem;
  animation: viewIn 0.3s var(--ease) both;
}
.modalTitle { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.01em; color: var(--teal); margin: 0 0 0.4rem; }
.modalText { font-size: 0.9rem; line-height: 1.55; color: rgba(var(--teal-rgb), 0.85); margin: 0 0 1rem; }
.modalNote { font-size: 0.82rem; font-weight: 600; line-height: 1.45; color: var(--teal); background: rgba(var(--teal-rgb), 0.07); border-radius: 10px; padding: 0.55rem 0.75rem; margin: -0.35rem 0 1rem; }
.modal .textInput { margin-bottom: 1rem; }
.modalActions { display: flex; justify-content: flex-end; gap: 0.6rem; flex-wrap: wrap; }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }

/* ============ MOTION ============ */
/* Entrance choreography runs only while a root carries .is-live (added by
   celebrate()/liveOn(); never under reduced motion). Without it everything
   renders in its final state. */
.is-live .fxRays { animation: fxIn 1s var(--ease) var(--fxd, 1s) both, raysSpin 60s linear var(--fxd, 1s) 2; }
.is-live .fxGlow { animation: fxIn 0.9s var(--ease) var(--fxd, 1s) both; }
.is-live .fxBeam { animation: fade 1.2s ease-out calc(var(--fxd, 1s) - 0.25s) both; }
.is-live .arenaEyebrow { animation: riseIn 0.5s var(--ease) 0.05s both; }
.is-live .arenaTitle { animation: popIn 0.65s var(--spring) 0.15s both; }
.is-live .youFinish { animation: riseIn 0.55s var(--ease) 0.4s both; }
.is-live .podiumCol { animation: colRise 0.75s cubic-bezier(0.2, 0.9, 0.25, 1) var(--d, 0.2s) both; }
.is-live .podiumTop { animation: dropIn 0.65s var(--spring) calc(var(--d, 0.2s) + 0.42s) both; }
.is-live .podiumSpot.isLead .crown { animation: crownIn 0.75s var(--ease) calc(var(--d, 0.2s) + 0.8s) both, crownBob 3.2s ease-in-out calc(var(--d, 0.2s) + 1.6s) 3; }
.is-live .medal::after { animation: shine 1.1s ease-out calc(var(--d, 0.2s) + 1s) both; }
/* actions only slide (never fade) so an early tap/Tab never lands on an invisible button */
.is-live .stickyActions { animation: nudgeIn 0.6s var(--ease) 0.3s both; }
.is-live .board { animation: riseIn 0.55s var(--ease) var(--boardd, 1.6s) both; }
.is-live .boardRow { animation: slideIn 0.5s var(--ease) calc(var(--boardd, 1.6s) + 0.15s + var(--i, 0) * 0.09s) both; }
.is-live .boardRow::before { animation: barGrow 1s var(--ease) calc(var(--boardd, 1.6s) + 0.3s + var(--i, 0) * 0.09s) both; }
.is-live .boardSplit span { animation: scaleX 0.9s var(--ease) calc(var(--boardd, 1.6s) + 0.45s + var(--i, 0) * 0.09s) both; }

.is-live .standGain { animation: gainPop 0.5s var(--spring) 0.25s both; }
.is-live .standRow::before { animation: barGrow 0.9s var(--ease) 0.35s both; }
.is-live .standRow { animation: rowMove 0.7s var(--ease) 1.05s both; }
.is-live .standRow.isClimb { animation: rowMove 0.7s var(--ease) 1.05s both, rowFlash 0.9s ease-out 1.6s both; }
.is-live .standRank { animation: popIn 0.45s var(--spring) 1.7s both; }

.is-live .option.is-correct { animation: correctPop 0.5s var(--spring) both; }
.is-live .option.is-correct::after { animation: shine 1s ease-out 0.25s both; }
.is-live .option.is-incorrect { animation: shake 0.45s ease-in-out 0.05s both; }
.is-live .optTag { animation: popIn 0.4s var(--spring) 0.3s both; }
.is-live .verdictIcon { animation: popIn 0.5s var(--spring) 0.1s both; }
.is-live .verdictPts { animation: gainPop 0.5s var(--spring) 0.3s both; }
.is-live .seg.is-now { animation: segIn 0.6s var(--ease) both; }

@keyframes riseIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes nudgeIn { from { transform: translateY(12px); } to { transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.82) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fxIn { from { opacity: 0; scale: 0.4; } to { opacity: 1; scale: 1; } }
@keyframes raysSpin { to { rotate: 360deg; } }
@keyframes colRise { from { transform: translateY(102%); } to { transform: none; } }
@keyframes dropIn { 0% { opacity: 0; transform: translateY(-30px) scale(0.6); } 55% { opacity: 1; } 100% { opacity: 1; transform: none; } }
@keyframes crownIn { 0% { opacity: 0; transform: translateY(-36px) rotate(-20deg) scale(0.6); } 65% { opacity: 1; transform: translateY(3px) rotate(5deg) scale(1.06); } 100% { opacity: 1; transform: none; } }
@keyframes crownBob { 0%, 100% { transform: none; } 50% { transform: translateY(-3px) rotate(-2deg); } }
@keyframes shine { from { background-position: 140% 0; } to { background-position: -40% 0; } }
@keyframes scaleX { from { transform: scaleX(0); } to { transform: none; } }
@keyframes barGrow { from { transform: scaleX(var(--w0, 0)); } }
@keyframes gainPop { 0% { opacity: 0; transform: translateY(10px) scale(0.5); } 100% { opacity: 1; transform: none; } }
@keyframes rowMove { from { transform: translateY(calc(var(--shift, 0) * (var(--rowH) + var(--gap)))); } to { transform: none; } }
@keyframes rowFlash { 0% { box-shadow: 0 0 0 0 rgba(var(--success-rgb), 0.45); } 100% { box-shadow: 0 0 0 10px rgba(var(--success-rgb), 0); } }
@keyframes correctPop { 0% { transform: scale(1); } 40% { transform: scale(1.025); } 100% { transform: none; } }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
@keyframes dot { 0%, 80%, 100% { transform: none; opacity: 0.45; } 40% { transform: translateY(-4px); opacity: 1; } }
@keyframes segIn { from { transform: scaleX(0.2); } to { transform: none; } }

/* ============ NARROW PHONES ============ */
@media (min-width: 480px) {
  .podium { --podH: 140px; gap: 12px; }
  .podium .medal { --s: 58px; }
  .podiumName { font-size: 0.86rem; }
  .podiumPlace { font-size: 2rem; }
  .crown { width: 42px; }
}
@media (max-width: 400px) {
  .podium { gap: 5px; }
  .podium .medal { --s: 44px; }
  .podiumName { font-size: 0.72rem; }
  .podiumPts { font-size: 0.58rem; }
  .podiumPts b { font-size: 0.84rem; }
  .podiumPlace { font-size: 1.45rem; }
  .youTag { font-size: 0.5rem; padding: 0.2rem 0.36rem; }
  .tieTag { letter-spacing: 0.06em; padding: 0.24rem 0.38rem; } /* "EMPATE" in a 4-player column */
  /* "ANFITRIÓN" + "TÚ" must leave the name some room */
  .playerRow { gap: 0.65rem; }
  .playerBadge { letter-spacing: 0.04em; padding: 0.25rem 0.45rem; }
  .playerBadge + .playerBadge { margin-left: -0.3rem; }
  /* my row: the name keeps the first line, the badges go under it (Spanish badges are longer) */
  html:lang(es) .playerRow.isMe { flex-wrap: wrap; row-gap: 0.3rem; }
  html:lang(es) .playerRow.isMe :is(.playerName, .nameEdit) { flex: 1 0 calc(100% - 34px - 0.65rem); }
  html:lang(es) .playerRow.isMe :is(.playerName, .nameEdit) + .playerBadge { margin-left: calc(34px + 0.65rem); }
  .legend { display: none; }
  .standRow .playerAvatar { display: none; }
  .optWho + .optMark .optTag span { display: none; } /* crowded rows: icon only */
  .codeTile { width: 48px; height: 56px; font-size: 1.7rem; }
  .answeredChips { gap: 0; }
  .answeredChip + .answeredChip { margin-left: -7px; }
  .answeredChip { box-shadow: 0 0 0 2px var(--cream); }
}
@media (max-width: 359px) {
  .codeInput { letter-spacing: 0.22em; padding-left: 0.6rem; padding-right: 0.4rem; }
  /* my row, every language */
  .playerRow.isMe { flex-wrap: wrap; row-gap: 0.3rem; }
  .playerRow.isMe :is(.playerName, .nameEdit) { flex: 1 0 calc(100% - 34px - 0.65rem); }
  .playerRow.isMe :is(.playerName, .nameEdit) + .playerBadge { margin-left: calc(34px + 0.65rem); }
  .scorePill { padding-left: 0.3rem; }
  .scorePill .scoreName { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-width: 340px) {
  .codeTile { width: 44px; height: 52px; font-size: 1.55rem; }
  .youFinish { font-size: 0.74rem; }
}

/* Reduced motion: no choreography and no loops — final values render statically.
   (animation:none, not a tiny duration, so delayed `both` animations can never
   leave content hidden.) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
}
