/* Reflex Tap — activity styles (player + host).
   Source of truth: MASTER_SPEC Part C + DESIGN.md. */

/* ---------- shared stage bits ---------- */

.rh-round, .rp-round {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-soft);
}

.rh-round b, .rp-round b { color: var(--color-accent); }

/* ---------- PLAYER ---------- */

.reflex-player {
  width: 100%;
  max-width: 30rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.rp-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.rp-timer {
  font-size: 1.5rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  min-width: 4.6ch;
  text-align: right;
  background: var(--color-surface-raised);
  border: var(--border-width-card) solid var(--color-border-input);
  border-radius: var(--radius-chip);
  padding: 0.35rem 0.7rem;
  color: var(--color-text);
}

.rp-timer.low { color: var(--color-danger); border-color: var(--color-danger); }

.rp-next {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text-strong);
}

.rp-next b {
  color: var(--color-accent);
  font-size: 1.25rem;
}

.rp-wrongs {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-danger-text-pale);
  min-height: 1.1em;
}

/* Small breathing room: tiles never touch the stage edges (top keeps the
   Next indicator as its spacing). */
.rp-grid {
  display: grid;
  gap: 0.55rem;
  width: 100%;
  padding: 0 0.45rem 0.45rem;
}

.rp-tile {
  aspect-ratio: 1;
  border: none;
  border-radius: var(--radius-tile);
  font-size: clamp(1.3rem, 5vw, 2rem);
  font-weight: 900;
  color: var(--color-on-primary);
  cursor: pointer;
  box-shadow: var(--shadow-button);
  transition: transform 0.05s ease, opacity 0.25s ease, box-shadow 0.05s ease;
  -webkit-tap-highlight-color: transparent;
}

.rp-tile:active {
  transform: scale(0.93);
  box-shadow: var(--shadow-button-pressed);
}

.rp-tile:nth-child(5n + 1) { background: var(--palette-1); }
.rp-tile:nth-child(5n + 2) { background: var(--palette-2); }
.rp-tile:nth-child(5n + 3) { background: var(--palette-3); }
.rp-tile:nth-child(5n + 4) { background: var(--palette-4); }
.rp-tile:nth-child(5n) { background: var(--palette-5); }

.rp-tile.cleared {
  opacity: 0.18;
  transform: scale(0.82);
  pointer-events: none;
  box-shadow: none;
}

/* Owner correction 2026-09-22: a wrong tap is answered by a STATIC
   danger ring + dim, never by motion. Active number targets stay steady
   during play; the ring flashes for ~320ms and clears (reflex-player.js
   owns the transient class so the tile is never permanently marked). */
.rp-tile.wrong {
  outline: 4px solid var(--color-danger);
  outline-offset: -4px;
  filter: brightness(0.78) saturate(0.85);
}

.rp-grid.dense .rp-tile { font-size: 1.05rem; border-radius: var(--radius-input); }
.rp-grid.dense { gap: 0.3rem; }

/* countdown + GO + overlays */

.rp-stage {
  position: relative;
  width: 100%;
}

.rp-countdown {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-scrim-stage);
  border-radius: var(--radius-card);
  z-index: 5;
}

.rp-countdown b {
  font-size: clamp(5rem, 22vw, 9rem);
  font-weight: 900;
  color: var(--color-accent);
  text-shadow: var(--shadow-pop);
  animation: rb-pop 1s ease infinite;
  font-variant-numeric: tabular-nums;
}

.rp-go {
  font-size: clamp(4rem, 18vw, 7rem);
  font-weight: 900;
  color: var(--color-success);
  text-shadow: var(--shadow-pop-ink);
  animation: rb-go 0.7s ease forwards;
}

/* "Get ready" announcement (BUG-003 scheduling fix): shown between the
   host pressing Start and the 3-2-1, so the pause reads as intentional. */

.rp-ready {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-scrim-stage);
  border-radius: var(--radius-card);
  z-index: 5;
  font-size: clamp(1.6rem, 7vw, 2.6rem);
  font-weight: 900;
  color: var(--color-text);
  text-align: center;
  padding: 1rem;
}

.rh-ready {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-scrim-stage);
  border-radius: var(--radius-card);
  z-index: 5;
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 900;
  color: var(--color-text);
  text-shadow: var(--shadow-pop);
  text-align: center;
  padding: 1rem;
}

@keyframes rb-pop {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

@keyframes rb-go {
  0% { transform: scale(0.3); opacity: 0; }
  35% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}

/* Owner correction 2026-09-22: the legacy Reflex animations are part of
   the complete flow and must honour reduced motion. The countdown numeral
   and the GO word appear at their final composition immediately; the
   cleared/wrong tile states change instantly (no scale/fade transition).
   Input is never delayed in either mode. */
@media (prefers-reduced-motion: reduce) {
  .rp-countdown b { animation: none; }
  .rp-go { animation: none; }
  .rp-tile { transition: none; }
}

.rp-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: var(--color-scrim-stage-deep);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: var(--radius-card);
  z-index: 6;
  text-align: center;
  padding: 1rem;
}

.rp-overlay .rp-big {
  font-size: clamp(1.8rem, 8vw, 3rem);
  font-weight: 900;
  color: var(--color-text);
}

.rp-overlay .rp-big.gold { color: var(--medal-gold); }
.rp-overlay .rp-big.timesup { color: var(--color-danger-text); }

.rp-overlay .rp-sub {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-text-soft);
}

.rp-overlay .rp-time {
  font-size: 2rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--color-accent);
}

/* ---------- HOST ---------- */

/* One-viewport live-show layout: the whole gameplay screen fits the
   projector/browser window. Top bar (round + Next) stays fixed, the stage
   absorbs the remaining height — nothing scrolls. */

.reflex-host {
  width: 100%;
  height: calc(100dvh - 8rem);
  max-height: calc(100dvh - 8rem);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 0;
}

/* Game locked to one viewport (core adds game-running to <body>): absorb
   the REAL remaining height instead of the fixed 8rem estimate, so the
   game screen exactly fills the projector with no scroll and no clip. */
body.host.game-running .reflex-host {
  height: auto;
  max-height: none;
  flex: 1;
}

.rh-top {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.rh-top-controls {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.rh-top .btn {
  font-size: 1rem;
  padding: 0.55rem 1.1rem;
  min-height: 2.9rem;
}

.rh-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  background: var(--color-surface-faint);
  border: var(--border-width-card) solid var(--color-surface-raised-2);
  border-radius: var(--radius-panel);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.9rem;
  gap: 0.55rem;
  overflow: hidden;
}

.rh-timer {
  font-size: clamp(2.8rem, 9vh, 5rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  min-width: 5ch;
  text-align: center;
  color: var(--color-text);
  line-height: 1;
}

.rh-timer.low { color: var(--color-danger); }

/* W5: TIME'S UP replaces the 0.0 in the timer slot itself — a smaller
   danger-red word in the timer's place, no separate overlay. */
.rh-timer.timesup {
  font-size: clamp(1.8rem, 6vh, 3rem);
  color: var(--color-danger);
  white-space: nowrap;
}

.rh-progress {
  font-size: clamp(1rem, 2.6vh, 1.35rem);
  font-weight: 800;
  color: var(--color-success);
  text-align: center;
}

.rh-instruction {
  font-size: 0.95rem;
  color: var(--color-text-soft);
  text-align: center;
}

.rh-tiles {
  display: grid;
  gap: 0.4rem;
  width: 100%;
  max-width: 40rem;
  flex: 1;
  min-height: 0;
  grid-auto-rows: minmax(0, 1fr);
}

.rh-tile {
  border-radius: var(--radius-tile-small);
  font-size: clamp(0.9rem, 3vh, 1.6rem);
  font-weight: 900;
  color: var(--color-on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
}

.rh-tile:nth-child(5n + 1) { background: var(--palette-1); }
.rh-tile:nth-child(5n + 2) { background: var(--palette-2); }
.rh-tile:nth-child(5n + 3) { background: var(--palette-3); }
.rh-tile:nth-child(5n + 4) { background: var(--palette-4); }
.rh-tile:nth-child(5n) { background: var(--palette-5); }

/* The 3-2-1 bomb and the KaBoomz explosion live in the shared module
   (src/activities/shared/bomb.js + css/base.css kb-* rules) — every
   activity's host screen uses the same countdown from one place. */


/* The leaderboard and podium (C7/C8) live in css/base.css - one shared
   implementation for every activity's host screen (Slice 4). */


/* host setup screen (C11) - owner correction 2026-09-23 (M4): the
   Creator/Game Setup single-page structure per Creator Option A - a
   compact rounds TABLE (Round | Tap count | Time limit | actions), never
   three full-width rows per round on mobile. */

.reflex-setup {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.rs-title { margin: 0; font-size: 1.45rem; font-weight: 800; color: var(--color-text); }

.rs-sub { margin: 0; color: var(--color-text-muted); font-size: 0.95rem; }

.rs-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 0.9rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.rs-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.rs-card-title { margin: 0; font-size: 1.05rem; font-weight: 800; color: var(--color-text); }

.rs-card-hint { font-size: 0.82rem; color: var(--color-text-muted); }

/* the table header (desktop/tablet only - mobile rows carry their labels) */
.rs-head {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) minmax(0, 1fr) 132px;
  gap: 0.6rem;
  padding: 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

.rs-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.rs-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) minmax(0, 1fr) 132px;
  gap: 0.6rem;
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border-soft);
  border-radius: 10px;
  padding: 0.4rem 0.55rem;
  font-weight: 700;
}

.rs-label {
  font-weight: 900;
  color: var(--color-text);
  text-align: center;
}

.rs-field { display: flex; align-items: center; gap: 0.4rem; min-width: 0; }

.rs-field-label { display: none; font-size: 0.72rem; font-weight: 800; color: var(--color-text-muted); }

.rs-row input {
  width: 100%;
  min-width: 0;
  font-size: 1rem;
  font-weight: 800;
  padding: 0.4rem 0.5rem;
  border: 1.5px solid var(--color-border-input);
  border-radius: 8px;
  background: var(--color-surface-input);
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  min-height: 40px;
  box-sizing: border-box;
}

.rs-row-actions {
  display: flex;
  gap: 0.3rem;
  justify-content: flex-end;
}

.rs-btn {
  border: 1.5px solid var(--color-border);
  background: var(--color-surface-control);
  color: var(--color-text);
  border-radius: 8px;
  width: 40px;
  min-width: 40px;
  height: 40px;
  font-weight: 900;
  cursor: pointer;
}

.rs-btn:hover { background: var(--color-surface-hover); }
.rs-btn.remove { color: var(--color-danger-text-soft); }

.rs-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }

.rs-error { margin: 0; color: var(--color-danger-text-soft); font-weight: 700; min-height: 1.2em; }

.rs-hint { margin: 0; color: var(--color-text-muted); font-size: 0.9rem; }

/* compact mobile rows: round + grouped actions on line 1, the two
   labelled fields on line 2 - never three full-width controls */
@media (max-width: 640px) {
  .rs-head { display: none; }
  .rs-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "label actions"
      "num time";
    gap: 0.45rem 0.6rem;
    align-items: center;
  }
  .rs-label { grid-area: label; text-align: left; font-size: 0.9rem; }
  .rs-row-actions { grid-area: actions; }
  .rs-field { grid-area: num; flex-direction: column; align-items: stretch; gap: 0.15rem; }
  .rs-field + .rs-field { grid-area: time; }
  .rs-field-label { display: block; }
}

/* =====================================================================
   Batch 7 — UNIFIED GAMEPLAY SHELL adaptations (activity-owned).
   These rules are REFLEX-specific; the shared shell stylesheet never
   names .rh-* / .rp-*. body.game-shell-live is only a context selector.
   ===================================================================== */

/* ---------- HOST: hero fills the shell content region ---------- */
body.game-shell-live.game-shell-host .reflex-host {
  width: 100%;
  height: 100%;
  gap: 1rem;
}

/* Primary progression lives in the shell action slot; this top bar holds
   activity-owned SECONDARY controls only, left-aligned. */
body.game-shell-live.game-shell-host .reflex-host .rh-top {
  justify-content: flex-start;
  gap: 0.6rem;
}
body.game-shell-live.game-shell-host .reflex-host .rh-round { display: none; }
body.game-shell-live.game-shell-host .reflex-host .rh-top-controls { flex-wrap: wrap; }

body.game-shell-live.game-shell-host .reflex-host .rh-stage {
  flex: 1;
  min-height: 0;
  justify-content: center;
  gap: 1rem;
}

body.game-shell-live.game-shell-host .reflex-host .rh-progress {
  font-size: clamp(1.1rem, 3vh, 1.6rem);
}
body.game-shell-live.game-shell-host .reflex-host .rh-instruction {
  font-size: clamp(1rem, 2.6vh, 1.4rem);
}

/* =====================================================================
   Owner correction 2026-09-30 - projector timer/action geometry.
   The timer (left) and the primary action (right) share ONE footprint:
   the same outer width and height, aligned tops AND bottoms, with a
   consistent clear gap between the controls and the game-content box.
   Nothing overlaps or eats into the box below at 1920x1080, 1366x768
   or 1280x720. TIME'S UP lives inside the SAME fixed capsule - it never
   enlarges, repositions or stretches it.
   ===================================================================== */

body.game-shell-live.game-shell-host.rz-host-live {
  --rz-control-w: clamp(150px, 11vw, 250px);
  --rz-control-h: clamp(52px, 8vh, 96px);
  /* Both controls share ONE row that clears the genuine logo (the row is
     at least the default action row below the utilities, and at least a
     small gap under the logo's measured bottom) - the timer never sits
     on the logo and both slots stay equal. */
  --rz-control-top: max(
    calc(clamp(12px, 1.8vh, 24px) + clamp(48px, 4vw, 68px)),
    calc(var(--gs-logo-bottom) + clamp(10px, 1.4vh, 18px))
  );
  --rz-control-gap: clamp(14px, 2.4vh, 30px);
  /* the content region starts BELOW the complete control row */
  --gs-content-top: calc(var(--rz-control-top) + var(--rz-control-h) + var(--rz-control-gap));
  --gs-timer-top: var(--rz-control-top);
  --gs-action-top: var(--rz-control-top);
}

body.game-shell-live.game-shell-host.rz-host-live .gs-timer,
body.game-shell-live.game-shell-host.rz-host-live .gs-action {
  top: var(--rz-control-top);
  min-width: var(--rz-control-w);
  min-height: var(--rz-control-h);
  align-items: center;
}

body.game-shell-live.game-shell-host.rz-host-live .gs-timer > *,
body.game-shell-live.game-shell-host.rz-host-live .gs-action > * {
  width: var(--rz-control-w);
  height: var(--rz-control-h);
  min-width: 0;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* The timer value scales WITH the fixed capsule (never the other way):
   the numeral fits the slot, and TIME'S UP is scaled to fit inside the
   very same capsule - the footprint is identical in both states. */
body.game-shell-live.game-shell-host.rz-host-live .gs-timer > .rh-timer {
  font-size: min(3rem, calc(var(--rz-control-w) / 3.4));
  line-height: 1;
  overflow: hidden;
  white-space: nowrap;
}
body.game-shell-live.game-shell-host.rz-host-live .gs-timer > .rh-timer.timesup {
  font-size: min(1.75rem, calc(var(--rz-control-w) / 6.9));
}

/* Leaderboards have NO timer, so the action may size to its label (the
   active round keeps the equal timer/Next footprint). Owner correction
   2026-09-30: "Final results" must never overflow its yellow button at
   any required viewport. */
body.game-shell-live.game-shell-host.rz-host-live:has(.rh-lb) .gs-action > * {
  width: auto;
  min-width: var(--rz-control-w);
  max-width: min(380px, 32vw);
  padding: 0 clamp(12px, 1.4vw, 28px);
  white-space: nowrap;
}

/* full-width grid mirror, scaled to the projector */
body.game-shell-live.game-shell-host .reflex-host .rh-tiles {
  width: min(76vw, 1200px);
  max-width: none;
  gap: clamp(8px, 1vw, 16px);
}
body.game-shell-live.game-shell-host .reflex-host .rh-tile {
  font-size: clamp(1rem, 4vh, 2.2rem);
}

/* =====================================================================
   Owner correction 2026-09-30 (checker item 5) - MID-GAME hierarchy.

   The reveal screen has NO timer, so the freed upper space is used: the
   board starts at the top of the content region, "Leaderboard" is a
   strong projector-readable title, rows are READABLE (not merely
   visible), and two players never render as stretched slabs. Rows only;
   never a podium.
   ===================================================================== */

body.game-shell-live.game-shell-host .reflex-host .rh-lb {
  justify-content: flex-start;
  gap: clamp(6px, 1vh, 14px);
}
/* The reveal's top bar holds nothing (round label hidden, action moved to
   the shell): it must not push the board down. */
body.game-shell-live.game-shell-host .reflex-host:has(.rh-lb) .rh-top { display: none; }
body.game-shell-live.game-shell-host .reflex-host .rh-lb-title {
  flex: none;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.9rem, 5.4vh, 4.4rem);
  line-height: 1.04;
  letter-spacing: 0.01em;
  color: #FFFFFF;
  text-shadow: 0 4px 0 rgba(150, 32, 8, 0.32), 0 0 30px rgba(255, 255, 255, 0.16);
  text-align: center;
}
body.game-shell-live.game-shell-host .reflex-host .rh-lb .rh-instruction {
  flex: none;
  font-size: clamp(0.95rem, 2.2vh, 1.4rem);
  color: rgba(255, 247, 237, 0.92);
}
body.game-shell-live.game-shell-host .reflex-host .rh-lb-rows {
  flex: 1;
  min-height: 0;
  justify-content: flex-start;
  gap: clamp(5px, 0.9vh, 12px);
  padding-top: clamp(4px, 0.8vh, 10px);
}
body.game-shell-live.game-shell-host .reflex-host .rh-lb-rows .rh-lb-row {
  flex: 1 1 auto;
  max-height: clamp(44px, 8.6vh, 88px);
  min-height: 0;
  padding-top: clamp(5px, 0.9vh, 12px);
  padding-bottom: clamp(5px, 0.9vh, 12px);
}
body.game-shell-live.game-shell-host .reflex-host .rh-lb-rows .rh-lb-row .lb-rank {
  font-size: clamp(16px, 2vh, 28px);
}
body.game-shell-live.game-shell-host .reflex-host .rh-lb-rows .rh-lb-row .lb-name {
  font-size: clamp(16px, 2.2vh, 30px);
}
body.game-shell-live.game-shell-host .reflex-host .rh-lb-rows .rh-lb-row .lb-time {
  font-size: clamp(16px, 2.2vh, 30px);
}
body.game-shell-live.game-shell-host .reflex-host .rh-lb-rows .rh-lb-row .lb-round {
  font-size: clamp(13px, 1.6vh, 22px);
}
body.game-shell-live.game-shell-host .reflex-host .rh-lb-rows .rh-lb-row .lb-arrow {
  font-size: clamp(13px, 1.6vh, 22px);
}

/* =====================================================================
   FINAL WINNER SCREEN (owner correction 2026-09-30): the ONLY screen
   that crowns the winner. Places 1-3 on the approved podium (1st centre
   and tallest, 2nd left, 3rd right) plus places 4-10 in compact rows
   directly below - all inside one projector viewport.
   ===================================================================== */

body.game-shell-live.game-shell-host .reflex-host .rh-podium-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.6rem, 3.6vh, 3rem);
  color: #FFFFFF;
  text-shadow: 0 3px 0 rgba(150, 32, 8, 0.28);
}
body.game-shell-live.game-shell-host .reflex-host .rh-final-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 1.8vh, 24px);
  width: 100%;
  background: transparent;
  border: 0;
  /* explicit safe space below place 10 (checker item 6): nothing may
     reach the viewport edge or a control */
  padding: 0 0 clamp(12px, 2.2vh, 44px);
  overflow: hidden;
}
body.game-shell-live.game-shell-host .reflex-host .rh-final-podium {
  flex: none;
  width: min(100%, 1080px);
  height: clamp(140px, 24vh, 300px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(14px, 1.6vw, 34px);
}
body.game-shell-live.game-shell-host .reflex-host .rh-final-podium .podium-slot {
  flex: 0 1 clamp(130px, 21vw, 320px);
  max-width: 320px;
  padding: clamp(10px, 1.6vh, 22px) clamp(8px, 1vw, 18px) 0;
  /* all three places carry dark ink on their medal colours (approved) */
  color: #20242C;
}
body.game-shell-live.game-shell-host .reflex-host .rh-final-podium .podium-slot.first { height: clamp(140px, 24vh, 300px); }
body.game-shell-live.game-shell-host .reflex-host .rh-final-podium .podium-slot.second { height: clamp(112px, 18.5vh, 225px); }
body.game-shell-live.game-shell-host .reflex-host .rh-final-podium .podium-slot.third { height: clamp(94px, 14vh, 175px); }
body.game-shell-live.game-shell-host .reflex-host .rh-final-podium .ps-place { font-size: clamp(13px, 1.1vw, 22px); }
body.game-shell-live.game-shell-host .reflex-host .rh-final-podium .ps-name { font-size: clamp(16px, 1.5vw, 30px); }
body.game-shell-live.game-shell-host .reflex-host .rh-final-podium .ps-time { font-size: clamp(14px, 1.25vw, 26px); }

/* Owner correction 2026-09-30 (checker item 3): places 4-10 sit on a
   cream result panel with dark ink text - the approved reference
   treatment - inside the coral stage. Separators, not boxes. */
body.game-shell-live.game-shell-host .reflex-host .rh-final-rows[hidden] { display: none; }
body.game-shell-live.game-shell-host .reflex-host .rh-final-rows {
  flex: none;
  width: min(100%, 1080px);
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  background: #FFF7ED;
  border-radius: clamp(10px, 1.2vw, 20px);
  padding: clamp(4px, 0.8vh, 12px) clamp(10px, 1.2vw, 22px);
  box-shadow: 0 12px 26px rgba(140, 28, 8, 0.24);
}
body.game-shell-live.game-shell-host .reflex-host .rh-final-rows .rh-lb-row {
  flex: 0 0 auto;
  height: clamp(26px, 4.2vh, 54px);
  padding: 0 clamp(6px, 0.8vw, 14px);
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(32, 36, 44, 0.12);
  border-radius: 0;
  color: #20242C;
}
body.game-shell-live.game-shell-host .reflex-host .rh-final-rows .rh-lb-row:last-child { border-bottom: 0; }
body.game-shell-live.game-shell-host .reflex-host .rh-final-rows .rh-lb-row .lb-rank { font-size: clamp(15px, 1.25vw, 26px); color: #C9482C; }
body.game-shell-live.game-shell-host .reflex-host .rh-final-rows .rh-lb-row .lb-name { font-size: clamp(15px, 1.35vw, 28px); color: #20242C; }
body.game-shell-live.game-shell-host .reflex-host .rh-final-rows .rh-lb-row .lb-time { font-size: clamp(15px, 1.25vw, 26px); color: #20242C; }
/* three or fewer players: the podium is the whole screen (no empty rail) */
body.game-shell-live.game-shell-host .reflex-host .rh-final-stage.rh-final-nolist .rh-final-podium { height: auto; }
body.game-shell-live.game-shell-host .reflex-host .rh-final-empty {
  flex: none;
  color: #FFFFFF;
  font-weight: 800;
  font-size: clamp(16px, 1.6vw, 28px);
  text-align: center;
}

/* ---------- final winner sequence (owner correction 2026-09-30) ----------
   3rd -> 2nd -> 1st, a short Congratulations + confetti moment, then the
   settled board. The sequence state classes are added/removed by
   reflex-host.js; reduced motion never receives them. */

.rh-seq-hidden { visibility: hidden; }

/* The Congratulations moment lives in the stage's own flow and reserves
   its band permanently (visibility, not display), so revealing it can
   neither shift the podium/rows nor overlap them (checker items 2/6). */
body.game-shell-live.game-shell-host .reflex-host .rh-congrats {
  flex: none;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.6rem, 4.6vh, 3.8rem);
  /* enough line box for the display font's ascenders: the stage clips at
     its edges, so the banner must never lose the top of its glyphs */
  line-height: 1.22;
  padding-top: 0.06em;
  color: #FFFFFF;
  text-shadow: 0 4px 0 rgba(32, 36, 44, 0.5), 0 0 30px rgba(255, 255, 255, 0.25);
  white-space: nowrap;
  pointer-events: none;
  visibility: hidden;
}
body.game-shell-live.game-shell-host .reflex-host .rh-congrats.rh-congrats-on { visibility: visible; }

body.game-shell-live.game-shell-host .reflex-host .rh-party {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}
body.game-shell-live.game-shell-host .reflex-host .rh-party span {
  position: absolute;
  top: -8%;
  display: block;
  width: clamp(7px, 0.7vw, 13px);
  height: clamp(7px, 0.7vw, 13px);
  border-radius: 2px;
  opacity: 0;
  animation: rh-party-fall var(--p-dur, 2000ms) cubic-bezier(0.3, 0.5, 0.7, 1) var(--p-delay, 0ms) both;
}
body.game-shell-live.game-shell-host .reflex-host .rh-party .p-dot { border-radius: 50%; }
body.game-shell-live.game-shell-host .reflex-host .rh-party .p-rect { width: clamp(11px, 1.1vw, 20px); height: clamp(6px, 0.6vw, 11px); }
body.game-shell-live.game-shell-host .reflex-host .rh-party .p-diamond { transform: rotate(45deg); }
body.game-shell-live.game-shell-host .reflex-host .rh-party .p-bar { width: clamp(14px, 1.4vw, 26px); height: clamp(4px, 0.4vw, 7px); border-radius: 3px; }
body.game-shell-live.game-shell-host .reflex-host .rh-party .p-star {
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
@keyframes rh-party-fall {
  0% { opacity: 0; transform: translateY(0) rotate(var(--p-rot, 0deg)) scale(0.9); }
  12% { opacity: 1; }
  100% { opacity: 0.85; transform: translateY(110vh) rotate(calc(var(--p-rot, 0deg) + 480deg)) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  body.game-shell-live.game-shell-host .reflex-host .rh-party { display: none; }
  body.game-shell-live.game-shell-host .reflex-host .rh-party span { animation: none; }
}

/* =====================================================================
   PLAYER completion (owner correction 2026-09-30, checker item 4):
   a dedicated full-screen Game Complete composition on the KaBoomz coral
   backdrop - genuine logo, big title, thanks line, approved-palette
   confetti. No round label, no grid, no timer, no score/rank/podium.
   ===================================================================== */

body.game-shell-live.game-shell-player .reflex-player.rp-complete-live .rp-top,
body.game-shell-live.game-shell-player .reflex-player.rp-complete-live .rp-grid,
body.game-shell-live.game-shell-player .reflex-player.rp-complete-live .rp-next,
body.game-shell-live.game-shell-player .reflex-player.rp-complete-live .rp-wrongs {
  display: none;
}

/* The dedicated completion owns the whole screen: the shell's own logo
   would duplicate the composition's genuine logo, so it is hidden while
   the completion overlay is mounted. Leave game still paints above
   (body-level, z-index 920). */
body.game-shell-live.game-shell-player:has(.rp-overlay.rp-complete) .gs-logo { display: none; }

body.game-shell-live.game-shell-player .rp-overlay.rp-complete {
  position: fixed;
  inset: 0;
  z-index: 6;
  background: #FF6B4A;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-radius: 0;
  padding: calc(env(safe-area-inset-top) + 10px) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  overflow: hidden;
}

.rp-done {
  position: relative;
  z-index: 2;
  width: min(88vw, 460px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2.2vh, 24px);
  text-align: center;
  /* clears the player's Leave control AND the phone safe area */
  padding-bottom: calc(env(safe-area-inset-bottom) + 96px);
}
.rp-done-logo { width: clamp(140px, 46vw, 220px); height: auto; }
.rp-done-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.1rem, 9.5vw, 3.4rem);
  line-height: 1.02;
  color: #FFFFFF;
  text-shadow: 0 4px 0 rgba(150, 32, 8, 0.35);
}
.rp-done-sub { font-size: clamp(1.05rem, 4.6vw, 1.4rem); font-weight: 800; color: #FFF7ED; }

.rp-party {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}
.rp-party span {
  position: absolute;
  top: -8%;
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  opacity: 0;
  animation: rp-party-fall var(--p-dur, 2000ms) cubic-bezier(0.3, 0.5, 0.7, 1) var(--p-delay, 0ms) both;
}
.rp-party .p-dot { border-radius: 50%; }
.rp-party .p-rect { width: 14px; height: 7px; }
.rp-party .p-diamond { transform: rotate(45deg); }
.rp-party .p-bar { width: 18px; height: 5px; border-radius: 3px; }
.rp-party .p-star {
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
@keyframes rp-party-fall {
  0% { opacity: 0; transform: translateY(0) rotate(var(--p-rot, 0deg)) scale(0.9); }
  12% { opacity: 1; }
  100% { opacity: 0.85; transform: translateY(110vh) rotate(calc(var(--p-rot, 0deg) + 480deg)) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .rp-party { display: none; }
  .rp-party span { animation: none; }
}

/* ---------- PLAYER: timer stays (part of the Reflex mechanic) ----------
   The Reflex player countdown (rp-timer) is deliberately NOT hidden. */
