/* =====================================================================
   Components: the reusable pieces of the show. Every screen is built
   from these; screens add composition (layout.css), never new styling.

   Catalogue (class → component):
     .gs-panel            GameShowPanel (+ --accent --spot --production --alert)
     .btn, .gs-cta        GameShowButton (variants) and the big entrance CTA
     .modal-overlay/.modal GameShowModal
     .gs-label, inputs    form fields, .segmented toggles
     .chip, .gs-badge     chips and badges; .hud-category = CategoryBadge
     .lb-list/.lb-item    Scoreboard / RankingBoard rows (lobby: LobbyPlayer)
     .game-hud            BroadcastHUD (+ Timer)
     .hud-question-area   QuestionPanel
     .answer-opt          AnswerOption
     .answer-feedback     lower third with the player's own result
     .event-banner        EventBanner
     .broadcast-label     where the show is (not the connection)
     .account-*           sign in / signed-in account (top right)
     .pd, .emblem-face    stage screens: atril PodiumDisplay and the emblem (HTML on 3D)
     .podium-*            final podium (HTML)
     .mc-*                match setup, pause between blocks, results
   Player colour: any component accepts --pc (a --player-N token).
   ===================================================================== */

/* --- GameShowPanel ------------------------------------------------- */
.gs-panel {
  position: relative;
  min-width: 0;
  padding: var(--s-5);
  border-radius: var(--r-lg);
  background: var(--surface-panel);
  border: 1px solid var(--line-1);
  box-shadow: var(--edge-highlight), var(--shadow-2);
  overflow-wrap: anywhere;
}
.gs-panel + .gs-panel { margin-top: var(--s-3); }
/* A thin lit edge on top, like a broadcast graphic. */
.gs-panel--accent::before, .gs-panel--spot::before, .gs-panel--alert::before {
  content: ""; position: absolute; left: var(--s-5); right: var(--s-5); top: -1px; height: 2px;
  border-radius: 2px; background: var(--signal);
}
.gs-panel--spot::before { background: var(--spot); }
.gs-panel--alert::before { background: var(--danger); }
.gs-panel--production { background: linear-gradient(180deg, rgb(15 23 39 / .95), rgb(8 13 23 / .97)); }
.panel-title {
  display: flex; align-items: baseline; gap: var(--s-2);
  margin-bottom: var(--s-3);
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-lg);
  letter-spacing: .02em; text-transform: uppercase; color: var(--text-1);
}
.panel-count { font-size: var(--fs-sm); color: var(--text-3); font-weight: 600; }

/* --- Fields ---------------------------------------------------------- */
.gs-label {
  display: block; margin-bottom: var(--s-2);
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-xs);
  letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-2);
}
input, select {
  width: 100%; min-width: 0; min-height: 46px;
  padding: 10px 14px; border-radius: var(--r-md);
  border: 1px solid var(--line-2); background: var(--surface-sunken);
  color: var(--text-1); font-size: 16px; line-height: 1.2;
  -webkit-appearance: none; appearance: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background-color var(--dur-fast);
}
input::placeholder { color: var(--text-3); opacity: 1; }
@media (hover: hover) { input:not(:focus):hover, select:not(:focus):hover { border-color: var(--line-3); } }
input:focus, select:focus { border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft); }
select {
  padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23b3bed1' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px 8px;
}
select:disabled { opacity: .6; cursor: default; }
select option { background: var(--ink-3); color: var(--text-1); }
.field-error { min-height: 0; margin-top: var(--s-2); font-size: var(--fs-sm); color: var(--danger-strong); }
.field-error:empty { display: none; }
.field-hint { margin-top: var(--s-2); font-size: var(--fs-sm); color: var(--text-2); }
.code-input {
  font-family: var(--font-display); font-weight: 700; font-size: 1.5rem;
  text-transform: uppercase; letter-spacing: .32em; text-align: center;
  font-variant-numeric: tabular-nums; min-height: 54px;
}
.code-input::placeholder { color: var(--graphite); letter-spacing: .32em; }

/* Segmented toggle (two or three exclusive options) */
.segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-1); padding: var(--s-1); border-radius: var(--r-md); background: var(--surface-sunken); border: 1px solid var(--line-1); }
.vis-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; border-radius: var(--r-sm); color: var(--text-2); font-size: var(--fs-sm); font-weight: 600;
  transition: background-color var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast);
}
.vis-btn.active { background: var(--ink-5); color: var(--text-1); box-shadow: inset 0 0 0 1px var(--signal-line); }
.vis-btn:disabled { opacity: .45; cursor: not-allowed; }

/* --- GameShowButton -------------------------------------------------
   primary   amber stage light: the one main action of a screen
   signal    cyan: confirm inside a flow
   secondary satin control
   ghost     quiet, for secondary navigation
   success / danger  outcome actions
   ------------------------------------------------------------------ */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 18px; border-radius: var(--r-md);
  font-size: var(--fs-md); font-weight: 700; white-space: nowrap; line-height: 1.1;
  color: var(--text-1); background: var(--surface-control); border: 1px solid var(--line-2);
  box-shadow: var(--edge-highlight);
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast), border-color var(--dur-fast), box-shadow var(--dur-fast), opacity var(--dur-fast);
}
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn:not(:disabled):active { transform: translateY(1px) scale(.985); }
@media (hover: hover) { .btn:not(:disabled):hover { border-color: var(--line-3); background: var(--surface-control-hover); } }
.btn-primary {
  background: linear-gradient(180deg, var(--spot-strong) -40%, var(--spot) 100%);
  border-color: var(--spot); color: var(--spot-ink);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .35), 0 6px 18px rgb(246 183 82 / .18);
}
@media (hover: hover) { .btn-primary:not(:disabled):hover { background: var(--spot-strong); border-color: var(--spot-strong); box-shadow: inset 0 1px 0 rgb(255 255 255 / .4), 0 8px 24px rgb(246 183 82 / .26); } }
.btn-signal { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
@media (hover: hover) { .btn-signal:not(:disabled):hover { background: var(--signal-strong); border-color: var(--signal-strong); } }
.btn-secondary { background: var(--surface-control); }
.btn-ghost { background: transparent; border-color: var(--line-1); box-shadow: none; color: var(--text-2); }
@media (hover: hover) { .btn-ghost:not(:disabled):hover { color: var(--text-1); background: rgb(255 255 255 / .04); } }
.btn-success { background: var(--success); border-color: var(--success); color: var(--success-ink); }
.btn-danger { background: var(--danger-surface); border-color: rgb(255 95 118 / .5); color: var(--danger-strong); }
@media (hover: hover) { .btn-danger:not(:disabled):hover { background: #451825; border-color: var(--danger); } }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn-lg { min-height: 54px; padding: 12px 26px; font-size: var(--fs-lg); }
.btn-google { background: #f6f8fb; border-color: #dfe5ee; color: #1f2937; box-shadow: none; }
@media (hover: hover) { .btn-google:not(:disabled):hover { background: #fff; border-color: #c9d2df; } }
.google-icon { width: 18px; height: 18px; flex-shrink: 0; }

/* Big entrance call to action (home): caption-style label + sub line. */
.gs-cta {
  display: flex; align-items: center; gap: var(--s-4); width: 100%;
  min-height: 78px; padding: var(--s-4) var(--s-5);
  border-radius: var(--r-lg); text-align: left;
  background: var(--surface-control); border: 1px solid var(--line-2);
  box-shadow: var(--edge-highlight), var(--shadow-1);
  transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast), background-color var(--dur-fast), box-shadow var(--dur-base);
}
.gs-cta > i { flex-shrink: 0; font-size: 28px; color: var(--signal); }
.gs-cta-text { display: grid; gap: 2px; min-width: 0; }
.gs-cta-text strong {
  font-family: var(--font-display); font-weight: 700; font-size: 1.55rem; line-height: 1;
  letter-spacing: .02em; text-transform: uppercase;
}
.gs-cta-text span { font-size: var(--fs-sm); color: var(--text-2); }
.gs-cta:active { transform: translateY(1px) scale(.99); }
@media (hover: hover) { .gs-cta:hover { border-color: var(--signal-line); background: var(--surface-control-hover); } }
.gs-cta[aria-expanded="true"] { border-color: var(--signal-line); box-shadow: var(--glow-signal); }
.gs-cta--quiet { background: rgb(4 7 13 / .55); }
.gs-cta--quiet > i { color: var(--text-2); }
.gs-cta--spot {
  background: linear-gradient(180deg, #ffcd7c -30%, var(--spot) 100%);
  border-color: var(--spot); color: var(--spot-ink);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .38), 0 10px 30px rgb(246 183 82 / .2);
}
.gs-cta--spot > i { color: var(--spot-ink); }
.gs-cta--spot .gs-cta-text span { color: rgb(42 23 2 / .78); }
@media (hover: hover) { .gs-cta--spot:hover { background: var(--spot-strong); border-color: var(--spot-strong); } }

/* --- Chips, badges, CategoryBadge ------------------------------------ */
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 600; color: var(--text-2);
  background: rgb(255 255 255 / .03); border: 1px solid var(--line-1);
}
.chip[style*="--cat"] { color: var(--cat); border-color: color-mix(in srgb, var(--cat) 30%, transparent); background: color-mix(in srgb, var(--cat) 9%, transparent); }
.chip.diff-easy { color: var(--success); }
.chip.diff-medium { color: var(--warning); }
.chip.diff-all, .chip.blitz { color: var(--signal); }
.gs-badge, .room-badge, .status-badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--r-pill);
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-xs);
  letter-spacing: var(--tracking-caps); text-transform: uppercase; white-space: nowrap;
  border: 1px solid var(--line-2); color: var(--text-2);
}
.room-badge.public, .status-badge.open { color: var(--success); border-color: rgb(61 220 145 / .35); background: var(--success-soft); }
.room-badge.private { color: var(--signal-strong); border-color: var(--signal-line); background: var(--signal-soft); }

/* --- GameShowModal ----------------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: var(--z-modal);
  display: flex; align-items: center; justify-content: center;
  padding: max(16px, var(--safe-t)) var(--gutter) max(16px, var(--safe-b));
  background: var(--surface-scrim);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  overflow-y: auto;
}
.modal-overlay--confirm { z-index: var(--z-confirm); }
.modal {
  position: relative;
  width: 100%; max-width: 440px; max-height: calc(100dvh - 32px); overflow-y: auto;
  padding: var(--s-6); border-radius: var(--r-lg);
  background: var(--surface-raised); border: 1px solid var(--line-2);
  box-shadow: var(--edge-highlight), var(--shadow-3);
}
.modal::before {
  content: ""; position: absolute; left: var(--s-6); right: var(--s-6); top: -1px; height: 2px; border-radius: 2px;
  background: var(--spot);
}
.modal-sm { max-width: 400px; }
@media (prefers-reduced-motion: no-preference) {
  .modal-overlay:not(.hidden) .modal { animation: modalIn var(--dur-slow) var(--ease-out); }
}
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.modal-title {
  margin: 2px 0 var(--s-5);
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-2xl);
  letter-spacing: .01em; text-transform: uppercase; line-height: 1;
}
.modal-text { margin: calc(-1 * var(--s-2)) 0 var(--s-2); color: var(--text-2); }
.modal-field { margin-bottom: var(--s-4); }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); margin-top: var(--s-5); }

/* --- Scoreboard / RankingBoard ----------------------------------------
   Rows carry the player colour (--pc) as a thin bar and on the name. */
.lb-list { display: grid; gap: 4px; }
.lb-item {
  --pc: var(--text-3);
  position: relative; display: flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 6px 10px 6px 14px; border-radius: var(--r-md);
  background: rgb(255 255 255 / .025); border: 1px solid transparent;
  font-size: .95rem;
}
.lb-item::before {
  content: ""; position: absolute; left: 5px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px;
  background: var(--pc);
}
.lb-item.is-me { background: rgb(255 255 255 / .06); border-color: var(--line-2); }
.lb-item.is-leader { background: linear-gradient(90deg, var(--spot-soft), rgb(255 255 255 / .02) 70%); border-color: rgb(246 183 82 / .28); }
.lb-rank {
  display: grid; place-items: center; flex-shrink: 0; width: 28px; height: 28px;
  border-radius: var(--r-sm); background: var(--ink-4); color: var(--text-2);
  font-family: var(--font-display); font-size: 1rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.lb-rank.gold { background: var(--gold); color: #3a2603; }
.lb-rank.silver { background: var(--silver); color: #1d2738; }
.lb-rank.bronze { background: var(--bronze); color: #2c1405; }
.lb-crown { color: var(--spot); font-size: 1rem; flex-shrink: 0; }
.lb-host { color: var(--text-3); font-size: .95rem; flex-shrink: 0; }
.lb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lb-me-tag { flex-shrink: 0; padding: 1px 7px; border-radius: var(--r-pill); background: var(--ink-5); color: var(--text-2); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.lb-score { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-1); }
.lb-move { flex-shrink: 0; width: 1em; font-size: .9rem; text-align: center; }
.lb-move.up { color: var(--success); }
.lb-move.down { color: var(--danger); }
.lb-delta {
  position: absolute; right: 10px; top: -6px; padding: 0 6px; border-radius: var(--r-pill);
  font-family: var(--font-display); font-size: .85rem; font-weight: 700; pointer-events: none;
  background: var(--ink-2);
}
.lb-delta.positive { color: var(--success); }
.lb-delta.negative { color: var(--danger); }
@media (prefers-reduced-motion: no-preference) {
  .lb-delta { animation: deltaFloat 1.3s var(--ease-out) forwards; }
  .lb-item.score-up { animation: rowFlash .8s var(--ease-out); --flash: rgb(61 220 145 / .22); }
  .lb-item.score-down { animation: rowFlash .8s var(--ease-out); --flash: rgb(255 95 118 / .18); }
}
@keyframes deltaFloat { 0% { opacity: 0; transform: translateY(4px); } 15% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px); } }
@keyframes rowFlash { from { background-color: var(--flash); } }
.lb-transfer, .lb-kick { flex-shrink: 0; }

/* LobbyPlayer: a contestant waiting to go on stage */
.lobby-roster .lb-item { min-height: 54px; gap: 12px; }
.lobby-roster .lb-rank { display: none; }
.lb-avatar {
  display: grid; place-items: center; flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%;
  background: color-mix(in srgb, var(--pc) 22%, var(--ink-3)); color: var(--pc);
  box-shadow: inset 0 0 0 2px var(--pc);
  font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; text-transform: uppercase;
}
.lb-ready { flex-shrink: 0; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-xs); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--success); }
@media (prefers-reduced-motion: no-preference) {
  .lobby-roster .lb-item.is-new { animation: playerEnter var(--dur-slow) var(--ease-pop); }
}
@keyframes playerEnter { from { opacity: 0; transform: translateX(-14px) scale(.97); } }

/* --- BroadcastHUD + Timer ---------------------------------------------- */
.game-hud {
  position: relative;
  display: grid; align-items: center; column-gap: 14px; row-gap: 8px;
  grid-template-columns: auto minmax(40px, 1fr) auto auto auto auto;
  grid-template-areas:
    "count prog cat streak score time"
    "timer timer timer timer timer timer";
  padding: 10px 18px 0; border-radius: var(--r-lg);
  background: var(--surface-hud); border: 1px solid var(--line-2);
  box-shadow: var(--edge-highlight), var(--shadow-2);
  overflow: hidden;
}
.hud-left, .hud-center, .hud-right { display: contents; }
.hud-counter {
  grid-area: count; font-family: var(--font-display); font-weight: 700; font-size: 1.45rem; line-height: 1;
  letter-spacing: .02em;
}
.hud-progress-bar { grid-area: prog; height: 6px; border-radius: var(--r-pill); background: rgb(255 255 255 / .07); overflow: hidden; }
.hud-progress-fill { height: 100%; width: 0; border-radius: inherit; background: var(--signal); transition: width var(--dur-slow) var(--ease-out); }
.hud-category {
  --cat: var(--signal);
  grid-area: cat; justify-self: center; max-width: 100%;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: var(--r-pill);
  color: var(--cat); background: color-mix(in srgb, var(--cat) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--cat) 40%, transparent);
  font-family: var(--font-display); font-weight: 700; font-size: .95rem; letter-spacing: var(--tracking-caps); text-transform: uppercase;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hud-streak {
  grid-area: streak; display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--warning-soft); color: var(--warning);
  font-family: var(--font-display); font-size: .95rem; font-weight: 700;
}
.hud-connection {
  grid-area: streak; display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--warning-soft); color: var(--warning); border: 1px solid rgb(255 159 69 / .35);
  font-family: var(--font-display); font-weight: 700; font-size: .9rem; letter-spacing: .04em; text-transform: uppercase;
}
.hud-score {
  grid-area: score; padding: 4px 12px; border-radius: var(--r-pill);
  background: rgb(255 255 255 / .06); border: 1px solid var(--line-1); color: var(--text-1);
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; white-space: nowrap;
}
.hud-timer-text {
  grid-area: time; min-width: 3.4ch; text-align: right;
  font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; line-height: 1; white-space: nowrap;
  transition: color var(--dur-base);
}
.hud-timer-wrap { grid-area: timer; height: 4px; margin: 0 -18px; background: rgb(255 255 255 / .06); }
.hud-timer-fill { height: 100%; width: 100%; background: var(--signal); transition: width .1s linear, background-color var(--dur-base); }
.hud-timer-fill.warning { background: var(--warning); }
.hud-timer-fill.urgent { background: var(--danger); }
/* Last seconds: the timer takes the spotlight (one soft pulse a second). */
.game-hud.is-urgent .hud-timer-text { color: var(--danger-strong); }
@media (prefers-reduced-motion: no-preference) {
  .game-hud.is-urgent .hud-timer-text { animation: timerPulse 1s var(--ease-out) infinite; }
}
@keyframes timerPulse { 0% { transform: scale(1.12); } 40% { transform: scale(1); } }
.hud-block {
  grid-area: block; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-sm);
  letter-spacing: .04em; text-transform: uppercase; color: var(--spot);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* --- QuestionPanel ----------------------------------------------------- */
.hud-question-area h2 {
  position: relative;
  padding: 18px 28px; border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgb(18 30 52 / .95), rgb(9 16 30 / .96));
  border: 1px solid var(--line-2);
  box-shadow: var(--edge-highlight), 0 0 0 1px rgb(57 207 238 / .08), var(--shadow-2);
  font-size: var(--fs-question); font-weight: 750; line-height: var(--lh-snug); letter-spacing: -.012em;
  text-align: center; text-wrap: balance; overflow-wrap: anywhere;
}
.hud-question-area h2::before {
  content: ""; position: absolute; left: 50%; top: -1px; width: min(240px, 40%); height: 2px; transform: translateX(-50%);
  border-radius: 2px; background: var(--signal);
}
@media (prefers-reduced-motion: no-preference) {
  body:not(.reduce-motion) .hud-question-area:not(.hidden) h2 { animation: questionIn var(--dur-slow) var(--ease-out); }
}
@keyframes questionIn { from { opacity: 0; transform: translateY(-10px) scale(.985); clip-path: inset(0 12% 0 12% round var(--r-lg)); } }

/* --- AnswerOption -------------------------------------------------------
   normal · hover · selected · locked (sent) · correct (mine) ·
   correct (revealed when I missed) · wrong (mine) · dimmed */
.answer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.answer-opt {
  position: relative;
  display: flex; align-items: center; gap: 14px; min-height: 62px; min-width: 0;
  padding: 10px 16px 10px 10px; border-radius: var(--r-md);
  background: linear-gradient(180deg, rgb(20 32 54 / .96), rgb(11 19 34 / .97));
  border: 1px solid var(--line-2);
  box-shadow: var(--edge-highlight), var(--shadow-1);
  font-size: var(--fs-answer); font-weight: 650; text-align: left; line-height: 1.25; overflow-wrap: anywhere;
  transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast), background-color var(--dur-fast), box-shadow var(--dur-fast), opacity var(--dur-base);
}
.answer-opt-label {
  display: grid; place-items: center; flex-shrink: 0; width: 38px; height: 38px; border-radius: var(--r-sm);
  background: var(--ink-1); border: 1px solid var(--line-2); color: var(--signal-strong);
  font-family: var(--font-display); font-size: 1.3rem; font-weight: 700;
  transition: background-color var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
@media (hover: hover) {
  .answer-opt:not(:disabled):hover { border-color: var(--signal-line); transform: translateY(-1px); box-shadow: var(--edge-highlight), var(--shadow-2); }
  .answer-opt:not(:disabled):hover .answer-opt-label { border-color: var(--signal); }
}
.answer-opt:not(:disabled):active { transform: scale(.985); }
.answer-opt.selected { border-color: var(--signal); box-shadow: var(--edge-highlight), var(--glow-signal); background: linear-gradient(180deg, #123048, #0b1d31); }
.answer-opt.selected .answer-opt-label { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
/* Locked: the choice is sent; it says so without colouring the outcome. */
.answer-opt.selected:disabled::after {
  content: "Enviada"; position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  padding: 2px 8px; border-radius: var(--r-pill); background: var(--signal-soft); color: var(--signal-strong);
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-xs); letter-spacing: var(--tracking-caps); text-transform: uppercase;
}
.answer-opt.selected:disabled { padding-right: 86px; }
.answer-opt.dimmed { opacity: .45; }
.answer-opt.correct, .answer-opt.wrong { opacity: 1; padding-right: 16px; }
.answer-opt.correct::after, .answer-opt.wrong::after { content: none; }
.answer-opt.correct { background: linear-gradient(180deg, #0f3b2b, var(--success-surface)); border-color: var(--success); box-shadow: var(--edge-highlight), var(--glow-success); }
.answer-opt.correct .answer-opt-label { background: var(--success); border-color: var(--success); color: var(--success-ink); }
/* The right answer when I missed it: shown, but not celebrated. */
.answer-opt.correct:not(.is-mine) { background: rgb(12 43 32 / .7); box-shadow: var(--edge-highlight), inset 0 0 0 1px rgb(61 220 145 / .35); }
.answer-opt.wrong { background: linear-gradient(180deg, #3d1520, var(--danger-surface)); border-color: var(--danger); box-shadow: var(--edge-highlight), var(--glow-danger); }
.answer-opt.wrong .answer-opt-label { background: var(--danger); border-color: var(--danger); color: var(--danger-ink); }
@media (prefers-reduced-motion: no-preference) {
  body:not(.reduce-motion) .answer-opt.correct.is-mine { animation: answerWin .5s var(--ease-pop); }
  body:not(.reduce-motion) .answer-opt.wrong { animation: answerMiss .42s var(--ease-in-out); }
  body:not(.reduce-motion) .answer-overlay:not(.hidden) .answer-opt { animation: answerIn var(--dur-slow) var(--ease-out) backwards; }
  body:not(.reduce-motion) .answer-overlay:not(.hidden) .answer-opt:nth-child(2) { animation-delay: 40ms; }
  body:not(.reduce-motion) .answer-overlay:not(.hidden) .answer-opt:nth-child(3) { animation-delay: 80ms; }
  body:not(.reduce-motion) .answer-overlay:not(.hidden) .answer-opt:nth-child(4) { animation-delay: 120ms; }
}
@keyframes answerIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes answerWin { 40% { transform: scale(1.025); } }
@keyframes answerMiss { 20% { transform: translateX(-5px); } 45% { transform: translateX(5px); } 70% { transform: translateX(-3px); } }

/* --- Lower third: the player's own result ------------------------------ */
.answer-feedback {
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  min-height: 44px; padding: 8px 16px; border-radius: var(--r-md);
  font-weight: 700; text-align: center; border: 1px solid transparent;
}
.answer-feedback.hidden { display: flex !important; visibility: hidden; }
.answer-feedback.correct { background: rgb(12 43 32 / .92); border-color: rgb(61 220 145 / .6); color: var(--success-strong); }
.answer-feedback.wrong { background: rgb(52 18 27 / .92); border-color: rgb(255 95 118 / .6); color: var(--danger-strong); }
.answer-feedback.neutral { background: rgb(10 16 28 / .9); border-color: var(--line-2); color: var(--text-2); }
.feedback-icon { font-size: 1.3rem; }
.feedback-delta { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: no-preference) {
  body:not(.reduce-motion) .answer-feedback:not(.hidden) { animation: feedbackIn var(--dur-base) var(--ease-out); }
}
@keyframes feedbackIn { from { opacity: 0; transform: translateY(6px); } }

/* --- EventBanner ---------------------------------------------------------
   A broadcast slab over the stage: "NUEVO LÍDER", "ALBERTO HA ENTRADO".
   Tone via --tone; wipes in from the left, holds, wipes out. */
.event-banner {
  --tone: var(--spot);
  position: absolute; left: 50%; top: 14%; z-index: var(--z-banner);
  display: flex; align-items: stretch; max-width: min(92%, 560px);
  transform: translateX(-50%);
  pointer-events: none; visibility: hidden;
}
.event-banner.is-on { visibility: visible; }
.event-banner-bar { flex-shrink: 0; width: 6px; border-radius: var(--r-sm) 0 0 var(--r-sm); background: var(--tone); box-shadow: 0 0 18px color-mix(in srgb, var(--tone) 45%, transparent); }
.event-banner-body {
  display: grid; gap: 2px; padding: 10px 22px 12px 16px; min-width: 0;
  border-radius: 0 var(--r-md) var(--r-md) 0;
  background: linear-gradient(90deg, rgb(10 16 30 / .96), rgb(10 16 30 / .9));
  border: 1px solid var(--line-2); border-left: 0;
  box-shadow: var(--shadow-3);
}
.event-banner-kicker { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-sm); letter-spacing: .12em; text-transform: uppercase; color: var(--tone); }
.event-banner-title {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.4rem);
  line-height: 1; letter-spacing: .01em; text-transform: uppercase; color: var(--text-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.event-banner-title .pc { color: var(--pc, var(--text-1)); }
@media (prefers-reduced-motion: no-preference) {
  .event-banner.is-on { animation: bannerIn var(--dur-slow) var(--ease-out); }
  .event-banner.is-off { animation: bannerOut var(--dur-base) var(--ease-in-out) forwards; visibility: visible; }
}
@keyframes bannerIn { from { clip-path: inset(0 100% 0 0); opacity: .4; } to { clip-path: inset(0 0 0 0); opacity: 1; } }
@keyframes bannerOut { to { clip-path: inset(0 0 0 100%); opacity: 0; } }

/* --- Stage screens: HTML laid onto the 3D set (scene3d.js) --------------
   Laid out at a fixed size and mapped onto the 3D quad with matrix3d, so
   the text is real text: sharp at any 3D resolution. */
.pd, .emblem-face { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.pd {
  --tone: var(--pc, var(--signal));
  display: grid; align-content: center; justify-items: center; gap: 2px;
  padding: 10px 18px 12px; overflow: hidden;
  border-radius: 16px;
  border: 4px solid var(--tone);
  background:
    radial-gradient(circle, color-mix(in srgb, var(--tone) 34%, transparent) 1.6px, transparent 2.2px) 0 100% / 11px 11px repeat-x,
    linear-gradient(180deg, #121c30 0%, #070b14 62%, color-mix(in srgb, var(--tone) 14%, #05080f) 100%);
  box-shadow: inset 0 0 0 2px rgb(0 0 0 / .55), inset 0 0 26px color-mix(in srgb, var(--tone) 30%, transparent);
  font-family: var(--font-display); font-weight: 700; text-transform: uppercase; line-height: 1;
  color: var(--text-1); text-align: center; white-space: nowrap;
}
.pd-top, .pd-bottom { display: inline-flex; align-items: center; justify-content: center; gap: 10px; max-width: 100%; min-width: 0; }
.pd-text {
  overflow: hidden; text-overflow: ellipsis;
  /* Keep ellipsis horizontally, with room for font ink above/below the line.
     Firefox can clip that ink when the display has a perspective transform. */
  padding-block: .16em; margin-block: -.16em;
}
.pd-top { font-size: 58px; letter-spacing: .02em; text-shadow: 0 0 18px color-mix(in srgb, var(--tone) 45%, transparent); }
.pd-bottom { font-size: 36px; letter-spacing: .05em; color: var(--tone); }
.pd-top i { color: var(--spot); font-size: .78em; }
.pd-bottom i { font-size: .9em; }
.pd[data-tone="player"] .pd-bottom { color: color-mix(in srgb, var(--pc) 70%, #fff); }
.pd.is-event .pd-top { color: var(--tone); }
.pd.is-event .pd-bottom { color: var(--text-1); }
.pd[data-tone="muted"] { --tone: var(--text-3); }
@media (prefers-reduced-motion: no-preference) {
  body:not(.reduce-motion) .pd.is-pulse .pd-bottom { animation: pdPulse 1.4s ease-in-out infinite; }
  body:not(.reduce-motion) .pd.is-flash { animation: pdFlash .5s var(--ease-out); }
}
@keyframes pdPulse { 50% { opacity: .55; } }
@keyframes pdFlash { from { filter: brightness(1.8); } to { filter: none; } }

.emblem-face {
  --cat: var(--signal);
  display: grid; place-content: center; justify-items: center; gap: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #16264a 0%, #0a1222 55%, #04070d 100%);
  box-shadow: inset 0 0 0 10px rgb(160 182 224 / .06), inset 0 0 0 90px rgb(0 0 0 / .18);
  font-family: var(--font-display); font-weight: 700; text-transform: uppercase; line-height: 1.2; text-align: center;
  color: var(--text-1);
}
/* Rasterize only the emblem's ink. Source HTML still defines the layout;
   Firefox projects one bitmap instead of individual font glyphs. */
.emblem-face > :not(.emblem-ink) { visibility: hidden; }
#stageScreens .emblem-ink { position: absolute; inset: 0; width: 100%; height: 100%; }
.ef-brain { font-size: 230px; color: var(--signal); text-shadow: 0 0 34px rgb(57 207 238 / .65); margin: -10px 0 6px; }
.ef-title { font-size: 92px; letter-spacing: .08em; color: var(--text-1); }
.ef-sub { font-size: 54px; letter-spacing: .22em; color: var(--spot); }
.ef-kicker { font-size: 46px; letter-spacing: .14em; color: var(--text-2); }
.ef-cat { display: inline-flex; align-items: center; gap: 12px; color: var(--cat); }
.ef-line { font-size: 46px; letter-spacing: .1em; color: var(--text-3); }
.emblem-face[data-kind="room"] .ef-line { max-width: 72%; line-height: 1.05; color: var(--text-1); }
.ef-code { white-space: nowrap; font-size: 150px; letter-spacing: .04em; color: var(--spot); text-shadow: 0 0 30px rgb(246 183 82 / .5); margin: 10px 0; }
.ef-crown { font-size: 200px; color: var(--spot); text-shadow: 0 0 40px rgb(246 183 82 / .6); }
.emblem-face[data-kind="question"] .ef-brain { font-size: 190px; }

/* --- On-air tag and motion toggle ------------------------------------- */
.broadcast-label {
  position: absolute; top: 12px; left: 14px;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px 4px 9px; border-radius: var(--r-xs);
  background: rgb(4 7 13 / .74); border: 1px solid var(--line-1);
  color: var(--text-1); font-family: var(--font-display); font-size: var(--fs-sm); font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  pointer-events: none; white-space: nowrap;
}
.broadcast-label i { color: var(--signal); font-size: 1rem; }

/* --- Account: sign in, or who is signed in (one control, top right) ------ */
.account-slot {
  position: absolute; top: 10px; right: 12px; z-index: 3;
  display: grid; justify-items: end; gap: 6px; max-width: min(60%, 320px);
}
.account-slot:empty { display: none; }
.account-btn {
  display: inline-flex; align-items: center; gap: 9px; min-height: 40px; max-width: 100%;
  padding: 5px 14px 5px 10px; border-radius: var(--r-pill);
  border: 1px solid var(--line-2); background: rgb(4 7 13 / .8);
  color: var(--text-1); font-size: var(--fs-sm); font-weight: 700;
  box-shadow: var(--edge-highlight), var(--shadow-1);
}
.account-btn > i { font-size: 1.2rem; color: var(--signal); }
.account-btn--user { padding: 4px 12px 4px 4px; }
@media (hover: hover) { .account-btn:not(:disabled):hover { border-color: var(--signal-line); background: rgb(10 16 28 / .92); } }
.account-btn:disabled { opacity: .75; cursor: progress; }
.account-id { display: grid; min-width: 0; text-align: left; line-height: 1.15; }
.account-id strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-id span { font-size: var(--fs-2xs); font-weight: 600; color: var(--success); }
.account-caret { color: var(--text-3) !important; font-size: .85rem !important; }
.account-error {
  margin: 0; padding: 6px 10px; border-radius: var(--r-sm);
  background: var(--danger-surface); border: 1px solid rgb(255 95 118 / .5);
  color: var(--danger-strong); font-size: var(--fs-xs); font-weight: 600;
}
.account-slot .auth-skeleton { display: block; width: 150px; height: 40px; }
.save-done { color: var(--success-strong); }
.profile-stat-value.is-good { color: var(--success); }
.motion-toggle {
  position: absolute; right: 12px; bottom: 12px;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 6px 12px; border-radius: var(--r-pill);
  border: 1px solid var(--line-2); background: rgb(4 7 13 / .78);
  color: var(--text-2); font-size: var(--fs-xs); font-weight: 600;
}
@media (hover: hover) { .motion-toggle:hover { color: var(--text-1); border-color: var(--signal-line); } }

/* --- Scoreboard panel (in game) ------------------------------------------ */
.rank-overlay {
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
  border-radius: var(--r-lg); background: var(--surface-hud); border: 1px solid var(--line-2);
  box-shadow: var(--edge-highlight), var(--shadow-2);
}
.rank-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line-1); }
.rank-title { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-lg); letter-spacing: .04em; text-transform: uppercase; }
.rank-toggle-btn {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--ink-3); font-size: 1.1rem; font-weight: 700;
}
@media (hover: hover) { .rank-toggle-btn:hover { border-color: var(--signal-line); } }
.rank-list { padding: 8px; overflow-y: auto; min-height: 0; }
.rank-list .lb-item { font-size: .92rem; }
.rank-overlay.collapsed { align-self: start; }
.rank-overlay.collapsed .rank-header { border-bottom: 0; }
.rank-overlay.collapsed .rank-list { display: none; }
/* Something relevant happened: the scoreboard takes the focus briefly. */
@media (prefers-reduced-motion: no-preference) {
  .rank-overlay.is-hot { animation: boardHot 1.2s var(--ease-out); }
}
@keyframes boardHot { 0% { box-shadow: var(--edge-highlight), var(--glow-spot); border-color: var(--spot-line); } }

/* --- Final podium (HTML) --------------------------------------------- */
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 10px; min-height: 180px; margin: var(--s-2) 0 var(--s-4); }
.podium-slot { --pc: var(--text-3); display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; flex: 0 1 108px; }
@media (prefers-reduced-motion: no-preference) {
  .podium-slot { animation: podiumRise .7s var(--ease-out) backwards; }
  .podium-slot:nth-child(1) { animation-delay: .25s; }
  .podium-slot:nth-child(2) { animation-delay: .05s; }
  .podium-slot:nth-child(3) { animation-delay: .4s; }
}
@keyframes podiumRise { from { opacity: 0; transform: translateY(26px); } }
.podium-medal { font-size: 1.35rem; }
.podium-slot:has(.p1) .podium-medal { color: var(--gold); font-size: 1.6rem; }
.podium-slot:has(.p2) .podium-medal { color: var(--silver); }
.podium-slot:has(.p3) .podium-medal { color: var(--bronze); }
.podium-avatar {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
  background: color-mix(in srgb, var(--pc) 22%, var(--ink-3)); color: var(--pc); box-shadow: inset 0 0 0 2px var(--pc);
  font-family: var(--font-display); font-size: 1.3rem; font-weight: 700;
}
.podium-avatar.p1 { width: 58px; height: 58px; font-size: 1.6rem; }
/* The avatar (design/avatar.js): the skin's character as a bust, its ring in
   the player's colour. It fills .lb-avatar, .podium-avatar and the gallery. */
.avatar-svg { display: block; width: 100%; height: 100%; border-radius: 50%; }
.lb-avatar:has(> .avatar-svg), .podium-avatar:has(> .avatar-svg) { overflow: hidden; background: none; box-shadow: none; }
.lb-avatar--sm { width: 26px; height: 26px; }
.podium-name { max-width: 100%; font-weight: 700; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-score { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.podium-bar {
  display: grid; place-items: start center; padding-top: 8px;
  width: 100%; max-width: 92px; border-radius: var(--r-md) var(--r-md) 0 0;
  border: 1px solid var(--line-2); border-bottom: 0; background: var(--surface-raised);
  font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; color: var(--text-3);
}
.podium-bar.p1 { height: 100px; border-color: var(--spot-line); background: linear-gradient(180deg, rgb(246 197 72 / .28), var(--ink-3) 85%); color: var(--gold); }
.podium-bar.p2 { height: 72px; background: linear-gradient(180deg, rgb(202 212 228 / .18), var(--ink-3) 85%); color: var(--silver); }
.podium-bar.p3 { height: 54px; background: linear-gradient(180deg, rgb(220 140 76 / .22), var(--ink-3) 85%); color: var(--bronze); }

/* --- Status / connection ----------------------------------------------- */
.status-bar {
  display: none; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 0 var(--s-3); padding: 7px 12px; border-radius: var(--r-md);
  background: rgb(4 7 13 / .6); border: 1px solid var(--line-1);
  font-size: var(--fs-sm);
}
.status-bar.visible { display: flex; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); flex-shrink: 0; }
.status-dot.connected { background: var(--success); }
.status-dot.reconnecting { background: var(--warning); }
.status-text { color: var(--text-2); }
.status-meta { color: var(--text-2); font-variant-numeric: tabular-nums; margin-left: auto; }

/* --- Skeletons ------------------------------------------------------------ */
.auth-skeleton, .auth-skeleton-line, .profile-stat-skeleton, .lobby-card-skeleton {
  background: linear-gradient(90deg, var(--ink-3) 25%, var(--ink-4) 50%, var(--ink-3) 75%) !important;
  background-size: 200% 100% !important;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.auth-skeleton { display: inline-block; width: 110px; height: 34px; border-radius: var(--r-pill); }
.auth-skeleton-line { height: 11px; border-radius: 6px; margin-bottom: 7px; }
.auth-error { margin-top: 8px; font-size: var(--fs-sm); color: var(--danger-strong); }

/* --- Avatars and profile (GameShowModal "Mi perfil") ---------------------- */
.profile-avatar, .profile-avatar-lg, .profile-avatar-xl, .room-host-dot {
  display: inline-grid; place-items: center; flex-shrink: 0; overflow: hidden;
  border-radius: 50%; background: var(--signal); color: var(--signal-ink); font-weight: 800;
}
.profile-avatar { width: 32px; height: 32px; font-size: .8rem; }
.profile-avatar img, .profile-avatar-lg img, .profile-avatar-xl img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar-xl { width: 64px; height: 64px; font-size: 1.7rem; box-shadow: 0 0 0 3px var(--ink-2), 0 0 0 5px var(--signal-line); }
.profile-avatar-lg { width: 64px; height: 64px; margin: 0 auto 12px; font-size: 1.7rem; }
.profile-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: var(--s-4); }
.profile-top .modal-title { margin: 0; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0;
  border-radius: var(--r-pill); border: 1px solid var(--line-2); background: var(--surface-control); color: var(--text-2);
}
@media (hover: hover) { .icon-btn:hover { color: var(--text-1); border-color: var(--signal-line); } }
.profile-header {
  display: flex; align-items: center; gap: var(--s-4); margin-bottom: var(--s-5); padding: var(--s-4);
  border-radius: var(--r-md); background: linear-gradient(135deg, var(--ink-4), var(--ink-3)); border: 1px solid var(--line-1);
}
.profile-id { display: grid; gap: 4px; min-width: 0; justify-items: start; }
.profile-name { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 700; text-transform: uppercase; line-height: 1.05; overflow-wrap: anywhere; }
.profile-email { font-size: var(--fs-sm); color: var(--text-2); overflow-wrap: anywhere; }
.profile-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700; }
.profile-tag.google { background: var(--success-soft); color: var(--success); }
.profile-tag.guest { background: var(--ink-4); color: var(--text-2); }
.profile-header:has(.profile-avatar-lg) { flex-direction: column; text-align: center; }
.profile-section { margin-bottom: var(--s-5); }
.field-hint.is-error { color: var(--danger-strong); }
.profile-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: var(--s-4); padding: 12px 14px; border-radius: var(--r-md); background: var(--ink-3); border: 1px solid var(--line-1); }
.profile-toggle-title { display: block; font-weight: 700; }
.profile-toggle-sub { display: block; font-size: var(--fs-xs); color: var(--text-2); }
.switch {
  position: relative; width: 50px; height: 28px; flex-shrink: 0; border-radius: var(--r-pill);
  border: 1px solid var(--line-2); background: var(--ink-5); transition: background var(--dur-base);
}
.switch span { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--text-2); transition: transform var(--dur-base) var(--ease-out), background var(--dur-base); }
.switch[aria-checked="true"] { background: var(--signal-soft); border-color: var(--signal-line); }
.switch[aria-checked="true"] span { transform: translateX(22px); background: var(--signal); }
.profile-rooms-skeleton { width: 100%; height: 40px; border-radius: 8px; }
.profile-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.profile-stat { display: grid; align-content: start; gap: 2px; padding: 12px 8px; text-align: center; border-radius: var(--r-md); background: var(--ink-3); border: 1px solid var(--line-1); }
@media (max-width: 479px) { .profile-stats { grid-template-columns: repeat(2, 1fr); } }
.profile-stat-value { display: block; font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; line-height: 1.1; color: var(--spot); font-variant-numeric: tabular-nums; }
.profile-stat-label { font-size: var(--fs-xs); color: var(--text-2); }
.profile-stat-skeleton { display: block; width: 36px; height: 26px; margin: 0 auto 6px; border-radius: 6px; }
.profile-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.profile-rooms-section { margin-bottom: 16px; }
.profile-section-title { margin-bottom: 8px; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-sm); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-2); }
.profile-rooms-list { display: grid; gap: 6px; }
.profile-room-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: var(--r-md); background: var(--ink-3); border: 1px solid var(--line-1); }
.profile-room-info { display: grid; gap: 2px; min-width: 0; }
.profile-room-name { font-size: .9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-room-meta { font-size: var(--fs-xs); color: var(--text-2); }
.profile-rooms-empty { font-size: var(--fs-sm); color: var(--text-2); text-align: center; }
.btn-room-close { flex-shrink: 0; min-height: 34px; padding: 4px 10px; border-radius: var(--r-sm); border: 1px solid rgb(255 95 118 / .45); color: var(--danger-strong); font-size: var(--fs-sm); }
.btn-room-close:disabled { opacity: .5; }

/* --- Public room card ------------------------------------------------- */
.room-card {
  padding: var(--s-4); border-radius: var(--r-lg); border: 1px solid var(--line-1);
  background: var(--surface-panel); box-shadow: var(--edge-highlight);
  transition: border-color var(--dur-fast), transform var(--dur-fast) var(--ease-out);
}
@media (hover: hover) { .room-card:hover { border-color: var(--line-3); transform: translateY(-1px); } }
.room-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.room-card-title { flex: 1; min-width: 0; }
.room-card-name { font-family: var(--font-display); font-size: 1.45rem; font-weight: 700; line-height: 1.1; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-card-host { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: var(--fs-sm); color: var(--text-2); }
.room-card-ago { color: var(--text-3); }
.room-host-dot { width: 20px; height: 20px; font-size: .6rem; }
.room-card-players { margin-bottom: 12px; }
.player-bar-wrap { display: flex; align-items: center; gap: 10px; }
.player-seats { flex: 1; display: flex; gap: 3px; }
.player-seat { flex: 1; height: 6px; border-radius: 2px; background: rgb(255 255 255 / .07); }
.player-seat.taken { background: var(--signal); }
.player-seats.is-full .player-seat.taken { background: var(--warning); }
.player-count-label { min-width: 40px; text-align: right; font-family: var(--font-display); font-size: 1rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-2); }
.room-card-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.room-card-footer { display: flex; justify-content: flex-end; }
.lobby-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 48px 20px; text-align: center; color: var(--text-2); }
.lobby-empty-icon { font-size: 3rem; color: var(--spot); }
.lobby-empty-title { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 700; text-transform: uppercase; color: var(--text-1); }
.lobby-empty-sub { max-width: 320px; font-size: .92rem; }
.lobby-loading { display: grid; gap: 12px; color: var(--text-2); }
.lobby-card-skeleton { height: 150px; border-radius: var(--r-lg); }

/* --- Score float, shake, confetti --------------------------------------- */
#confettiCanvas { position: fixed; inset: 0; z-index: var(--z-confetti); pointer-events: none; }
.score-float {
  position: fixed; z-index: var(--z-float); left: 50%; top: 42%;
  font-family: var(--font-display); font-size: 2.6rem; font-weight: 700; pointer-events: none; transform: translateX(-50%);
  text-shadow: 0 2px 14px rgb(1 4 12 / .8); font-variant-numeric: tabular-nums;
  animation: scoreFloat 1.3s var(--ease-out) forwards;
}
.score-float.positive { color: var(--success-strong); }
.score-float.negative { color: var(--danger-strong); }
@keyframes scoreFloat {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(.9); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -80px) scale(.95); }
}
.shake { animation: shakeScreen .4s ease; }
@keyframes shakeScreen { 20% { transform: translateX(-4px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }

/* =====================================================================
   Match setup (web/match/): the production panel, the pause between
   blocks and the results.
   ===================================================================== */
.mc-setup { display: grid; gap: var(--s-3); }
.mc-muted { margin: 0; color: var(--text-3); font-size: var(--fs-sm); }
.mc-h { margin: 4px 0 0; font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.mc-pill { margin-left: 4px; padding: 1px 6px; border-radius: var(--r-pill); background: var(--warning-soft); color: var(--warning); font-size: var(--fs-2xs); font-weight: 700; }
.mc-kind .mc-pill { display: block; width: fit-content; margin: 3px auto 0; white-space: nowrap; }
.mc-kinds { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 6px; padding: var(--s-1); border-radius: var(--r-md); background: var(--surface-sunken); border: 1px solid var(--line-1); }
.mc-kind, .mc-preset-btn {
  min-height: 44px; padding: 8px 10px; border-radius: var(--r-sm);
  border: 1px solid transparent; background: transparent; color: var(--text-2);
  font: inherit; font-size: var(--fs-sm); font-weight: 700; cursor: pointer;
  transition: background-color var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.mc-preset-btn { border-color: var(--line-1); background: var(--ink-3); color: var(--text-1); }
.mc-kind.active { background: var(--ink-5); color: var(--text-1); box-shadow: inset 0 0 0 1px var(--signal-line); }
.mc-preset.active .mc-preset-btn { border-color: var(--signal-line); background: var(--signal-soft); box-shadow: inset 0 0 0 1px var(--signal-line); }
.mc-kind:disabled, .mc-preset-btn:disabled { cursor: default; opacity: .75; }
.mc-kind:focus-visible, .mc-preset-btn:focus-visible, .mc-setup select:focus-visible, .mc-icon-btn:focus-visible { outline: 2px solid var(--signal-strong); outline-offset: 2px; }
.mc-body { display: grid; gap: var(--s-3); }
.mc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3) var(--s-2); }
.mc-field {
  display: grid; gap: 6px; min-width: 0;
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-xs);
  letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-2);
}
.mc-field select { min-height: 44px; width: 100%; font-family: var(--font-ui); font-weight: 500; letter-spacing: 0; text-transform: none; }
.mc-group { margin: 0; padding: 10px 12px 12px; border: 1px solid var(--line-1); border-radius: var(--r-md); }
.mc-group legend { padding: 0 4px; font-size: var(--fs-sm); font-weight: 700; }
.mc-details { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; font-size: var(--fs-sm); }
.mc-details div { display: flex; justify-content: space-between; gap: 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line-1); }
.mc-details dt { color: var(--text-3); }
.mc-details dd { margin: 0; font-weight: 700; }
.mc-presets { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mc-preset-btn { width: 100%; display: grid; gap: 2px; text-align: left; }
.mc-preset-name { font-size: .95rem; }
.mc-seq { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 3px; font-size: var(--fs-sm); }
.mc-seq-num, .mc-block-num {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: var(--r-pill);
  background: var(--ink-4); font-family: var(--font-display); font-size: .85rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.mc-count { display: flex; justify-content: space-between; font-size: var(--fs-sm); }
.mc-blocks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mc-block { padding: 10px 12px; border: 1px solid var(--line-1); border-radius: var(--r-md); background: var(--ink-3); display: grid; gap: 8px; }
.mc-block-head { display: flex; gap: 10px; align-items: flex-start; }
.mc-block-num { min-width: 28px; height: 28px; font-size: 1rem; background: var(--spot-soft); color: var(--spot); }
.mc-block-info { display: grid; gap: 2px; min-width: 0; font-size: var(--fs-sm); }
.mc-block-sum { color: var(--text-2); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.mc-block-time { color: var(--text-3); font-size: var(--fs-xs); }
.mc-block-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.mc-icon-btn { min-height: 36px; gap: 4px; }
.mc-block-config { padding-top: 8px; border-top: 1px dashed var(--line-2); }
.mc-add { display: grid; gap: 8px; }
.mc-estimate { margin: 0; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: var(--fs-sm); color: var(--text-2); }
.mc-estimate strong { color: var(--text-1); }
.mc-saving { color: var(--text-3); font-size: var(--fs-xs); }
.mc-notice:empty { display: none; }
.mc-notice { padding: 8px 12px; border-radius: var(--r-md); background: var(--signal-soft); border: 1px solid var(--signal-line); font-size: var(--fs-sm); }
.mc-error { padding: 10px 12px; border-radius: var(--r-md); background: var(--danger-surface); border: 1px solid rgb(255 95 118 / .5); color: var(--danger-strong); font-size: var(--fs-sm); display: grid; gap: 6px; }
.mc-error p { margin: 0; }
.mc-error-block { padding-top: 6px; border-top: 1px solid rgb(255 95 118 / .3); }
.mc-start { width: 100%; }
.waiting-msg {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px; text-align: center; color: var(--text-2); font-size: var(--fs-sm);
  border: 1px dashed var(--line-2); border-radius: var(--r-md);
}
.waiting-msg::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--spot); box-shadow: 0 0 10px var(--spot); }
@media (prefers-reduced-motion: no-preference) { .waiting-msg::before { animation: onAir 1.6s ease-in-out infinite; } }
@media (max-width: 420px) {
  .mc-btn-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .mc-icon-btn { min-width: 44px; min-height: 44px; justify-content: center; }
  .mc-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Block bar in the HUD: only in a match of several blocks (match-view.js). */
.game-hud.with-block {
  grid-template-areas:
    "block block block block block block"
    "count prog cat streak score time"
    "timer timer timer timer timer timer";
}

/* Pause between blocks: a TV interstitial */
.mc-intro {
  position: fixed; inset: 0; z-index: var(--z-intro); display: grid; place-items: center; overflow-y: auto;
  padding: max(16px, var(--safe-t)) max(16px, var(--safe-r)) max(16px, var(--safe-b)) max(16px, var(--safe-l));
  background: radial-gradient(ellipse at 50% 40%, rgb(10 18 34 / .82), rgb(3 5 10 / .92));
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.mc-intro-card {
  position: relative;
  width: min(540px, 100%); padding: var(--s-5); border-radius: var(--r-lg);
  background: var(--surface-raised); border: 1px solid var(--line-2); box-shadow: var(--edge-highlight), var(--shadow-3);
  display: grid; gap: var(--s-3);
}
.mc-intro-card::before { content: ""; position: absolute; left: var(--s-5); right: var(--s-5); top: -1px; height: 2px; border-radius: 2px; background: var(--spot); }
@media (prefers-reduced-motion: no-preference) { .mc-intro:not(.hidden) .mc-intro-card { animation: modalIn var(--dur-slow) var(--ease-out); } }
.mc-intro-kicker { margin: 0; font-family: var(--font-display); font-size: var(--fs-sm); font-weight: 700; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-3); }
.mc-next { padding: 12px 14px; border-radius: var(--r-md); background: var(--spot-soft); border: 1px solid var(--spot-line); }
.mc-next h2 { margin: 2px 0 4px; font-family: var(--font-display); font-size: var(--fs-2xl); text-transform: uppercase; }
.mc-next p { margin: 0; font-size: var(--fs-sm); color: var(--text-2); }
.mc-countdown { margin: 0; text-align: center; font-size: var(--fs-md); color: var(--text-2); }
.mc-countdown strong { font-family: var(--font-display); font-size: 2.6rem; line-height: 1; color: var(--text-1); font-variant-numeric: tabular-nums; }
.mc-status-tag { font-size: var(--fs-2xs); color: var(--text-3); }

/* Results tables */
.mc-results { text-align: left; display: grid; gap: 8px; margin-top: 12px; }
.mc-headline { margin: 0; font-weight: 800; }
.mc-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.mc-table caption { text-align: left; padding: 6px 0; font-weight: 700; color: var(--text-2); }
.mc-table th, .mc-table td { padding: 6px; border-bottom: 1px solid var(--line-1); text-align: left; }
.mc-table th { font-family: var(--font-display); font-size: var(--fs-xs); letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); font-weight: 700; }
.mc-table tr.is-me td { background: rgb(255 255 255 / .05); font-weight: 700; }
