/* ------------------------------------------------------------------ *
 * Host — the big shared screen.
 * Sizing leans on vmin/clamp so it reads well on a laptop or a TV.
 * ------------------------------------------------------------------ */

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;

  /* Retint the shared base.css tokens to the amber/teal/coral swarm palette
     for the whole host page — not just setup — so lobby through results
     match the landing page instead of base.css's old purple aurora. Scoped
     to host.css only; play.css keeps the original palette untouched. */
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.2);
  --text: #f3f1e8;
  --text-dim: #a6acc4;
  --text-faint: #6b7191;
  --accent: #3fcba0;
  --accent-2: #8ff5d6;

  --amber-1: #ffd98e;
  --amber-2: #ffb238;
  --amber-3: #f5871f;
  --teal-1: #8ff5d6;
  --teal-2: #3fcba0;
  --coral-1: #ff8f5e;
  --coral-2: #f0653a;
  --ink: #f3f1e8;
  --ink-muted: #a6acc4;
  --ink-faint: #6b7191;
  --panel-border: rgba(255, 255, 255, 0.09);

  color: var(--text);
  /* Solid fallback only — the animated #hive-bg canvas (see hive-bg.js)
     paints the actual scene, since it fills all the empty space with a
     live honeycomb instead of a static image. */
  background: #0a0c16;
}

/* Replaces base.css's purple drifting aurora — the animated canvas below
   already carries the whole page. */
body::before {
  display: none;
}

#hive-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
}

.hive-vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse 85% 70% at 50% 40%, rgba(5, 6, 13, 0) 0%, rgba(5, 6, 13, 0.22) 70%, rgba(5, 6, 13, 0.55) 100%);
}

.btn-primary {
  background: linear-gradient(135deg, var(--teal-1), var(--teal-2));
  color: #08251c;
  box-shadow: 0 10px 30px rgba(63, 203, 160, 0.4);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--amber-1), var(--amber-2));
  color: #3a1d05;
  box-shadow: 0 14px 38px rgba(255, 178, 56, 0.5);
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  pointer-events: none;
}

.topbar > * {
  pointer-events: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: block;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
  background: linear-gradient(120deg, var(--teal-1) 0%, var(--teal-2) 35%, var(--amber-2) 75%, var(--amber-1) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand:hover {
  opacity: 0.85;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 1rem;
  transition: background 0.15s var(--ease);
}

.icon-btn:hover {
  background: var(--surface-2);
}

.btn-disband {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12.5px;
  white-space: nowrap;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
}

.btn-disband:hover {
  background: rgba(255, 77, 109, 0.16);
  border-color: rgba(255, 77, 109, 0.4);
  color: #ffb3c0;
}

#host-status {
  background: rgba(255, 176, 32, 0.16);
  border-color: rgba(255, 176, 32, 0.4);
  color: #ffd88a;
}

.screen {
  flex: 1;
  min-height: 100vh;
  padding: 76px 4vw 40px;
  position: relative;
  z-index: 2;
}

/* ================= SETUP ================= *
 * The amber/teal artwork palette now lives on body (see above) and covers
 * every screen, so setup only needs its own layout.
 * ------------------------------------------------------------------ */

.setup {
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.setup-head {
  text-align: center;
  max-width: 60ch;
  padding: 18px 0 36px;
}

.setup-head .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 14px;
}

.setup-head .eyebrow::before,
.setup-head .eyebrow::after {
  content: "";
  width: 20px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--amber-2));
}

.setup-head .eyebrow::after {
  background: linear-gradient(90deg, var(--teal-2), transparent);
}

.setup-head h1 {
  font-size: clamp(34px, 4.6vw, 50px);
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  color: var(--ink);
}

.setup-head .wordmark {
  background: linear-gradient(120deg, var(--teal-1) 0%, var(--teal-2) 35%, var(--amber-2) 75%, var(--amber-1) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.setup-head p {
  margin: 0 auto;
  max-width: 460px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-muted);
}

.setup-body {
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: 1.75fr 1fr;
  gap: 22px;
  align-items: start;
}

@media (max-width: 920px) {
  .setup-body {
    grid-template-columns: 1fr;
  }
}

.setup .panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.018));
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  padding: 26px 26px 24px;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.setup .panel h2 {
  font-size: 19px;
  font-weight: 600;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.panel-actions {
  display: flex;
  gap: 8px;
}

.chip-btn {
  padding: 7px 14px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--ink);
}

/* ---- categories ---- */

.pack-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-height: 46vh;
  overflow-y: auto;
  padding-right: 4px;
}

@media (max-width: 920px) {
  .pack-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  .pack-grid { grid-template-columns: 1fr; }
}

.pack {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  text-align: left;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
}

.pack:hover {
  background: rgba(255, 255, 255, 0.06);
}

.pack.on {
  background: linear-gradient(135deg, rgba(63, 203, 160, 0.1), rgba(255, 178, 56, 0.06));
  border-color: rgba(63, 203, 160, 0.4);
}

/* Tick badge for a selected category. */
.pack.on::after {
  content: "\2713";
  position: absolute;
  top: 9px;
  right: 10px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--teal-2);
  color: #08251c;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pack .emoji {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

.pack .meta {
  display: grid;
  min-width: 0;
}

.pack .name {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pack .count {
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 2px;
}

.pack-summary {
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--panel-border);
  font-size: 12.5px;
  color: var(--ink-faint);
  text-align: center;
}

/* ---- rules ---- */

.field {
  display: grid;
  gap: 10px;
  margin-bottom: 24px;
}

.field-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.field-label b {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--teal-1);
  font-variant-numeric: tabular-nums;
}

/* --fill is kept in sync by host.js so the filled part tracks the thumb. */
.setup input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 99px;
  outline: none;
  background: linear-gradient(
    90deg,
    var(--teal-2) 0%,
    var(--teal-2) var(--fill, 45%),
    rgba(255, 255, 255, 0.1) var(--fill, 45%),
    rgba(255, 255, 255, 0.1) 100%
  );
}

.setup input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal-1), var(--teal-2));
  border: 2px solid #0a0c16;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.setup input[type="range"]::-moz-range-thumb {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal-1), var(--teal-2));
  border: 2px solid #0a0c16;
  cursor: pointer;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 24px;
}

@media (max-width: 520px) {
  .segmented { grid-template-columns: repeat(2, 1fr); }
}

.segmented button {
  padding: 9px 4px;
  border-radius: 9px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.segmented button:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
}

.segmented button.active {
  background: linear-gradient(135deg, var(--amber-2), var(--amber-3));
  color: #3a1d05;
  border-color: transparent;
}

.toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  margin-bottom: 18px;
}

.toggle:last-child {
  margin-bottom: 0;
}

.toggle input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 38px;
  height: 22px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
  margin-top: 2px;
}

.toggle input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #dadff0;
  transition: transform 0.2s ease, background 0.2s ease;
}

.toggle input:checked {
  background: linear-gradient(135deg, var(--teal-1), var(--teal-2));
}

.toggle input:checked::after {
  transform: translateX(16px);
  background: #08251c;
}

.toggle span {
  display: grid;
  gap: 2px;
}

.toggle b {
  font-size: 13.5px;
  font-weight: 600;
}

.toggle em {
  font-style: normal;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-faint);
}

/* ---- create ---- */

.cta-wrap {
  display: flex;
  justify-content: center;
  padding: 30px 0 20px;
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 34px;
  border: none;
  border-radius: 14px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--amber-1), var(--amber-3));
  color: #3a1d05;
  box-shadow: 0 20px 50px -14px rgba(255, 178, 56, 0.55);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cta:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 24px 56px -14px rgba(255, 178, 56, 0.65);
}

.cta:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow: none;
}

/* ================= LOBBY ================= */

.lobby {
  display: none;
  gap: 24px;
  position: relative;
}

.lobby.active {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  align-items: center;
}

@media (max-width: 950px) {
  .lobby.active {
    grid-template-columns: 1fr;
    gap: 26px;
  }
}

.lobby-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 22px;
}

.join-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 4px 6px;
  margin-left: -6px;
  border-radius: 8px;
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--ink-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.join-line:hover {
  background: var(--surface);
  color: var(--ink-muted);
}

.join-line:hover .copy-icon {
  opacity: 1;
}

.join-line b {
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.join-line .copy-icon {
  flex: none;
  opacity: 0.45;
  transition: opacity 0.15s ease;
}

.join-line.copied .copy-icon {
  opacity: 1;
  color: var(--teal-1);
}

.code-label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
  margin-bottom: 6px;
}

.code-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.btn-copy {
  flex: none;
  width: 38px;
  height: 38px;
  margin-bottom: 3px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--panel-border);
  color: var(--ink-muted);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.btn-copy:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.btn-copy.copied {
  background: rgba(63, 203, 160, 0.16);
  border-color: rgba(63, 203, 160, 0.45);
  color: var(--teal-1);
  transform: scale(1.05);
}

/* Individual glowing tiles rather than one solid code block — first half of
   the code reads amber, second half teal, echoing the wordmark gradient. */
.code-tiles {
  display: flex;
  gap: 10px;
}

.code-tile {
  width: clamp(62px, 8.5vw, 92px);
  height: clamp(80px, 11vw, 118px);
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--panel-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 12px 24px -12px rgba(0, 0, 0, 0.6);
  position: relative;
}

.code-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 1px;
  background: linear-gradient(160deg, rgba(255, 217, 142, 0.5), rgba(63, 203, 160, 0.35) 60%, transparent);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.7;
  pointer-events: none;
}

.code-tile span {
  font-family: var(--font-display);
  font-size: clamp(2.3rem, 4.4vw, 3.4rem);
  font-weight: 800;
  line-height: 1;
}

.code-tile.amber-glow span {
  background: linear-gradient(160deg, var(--amber-1), var(--amber-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.code-tile.teal-glow span {
  background: linear-gradient(160deg, var(--teal-1), var(--teal-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.qr-panel {
  display: flex;
  align-items: center;
  gap: 18px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 16px 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 16px 30px -16px rgba(0, 0, 0, 0.55);
}

.qr-code-wrap {
  flex: none;
  width: 148px;
  height: 148px;
  border-radius: 14px;
  padding: 10px;
  background: linear-gradient(160deg, #f3eedd, #e7e0c8);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
  line-height: 0;
}

.qr-code-wrap svg {
  display: block;
  width: 100%;
  height: 100%;
}

.qr-text {
  display: grid;
  gap: 4px;
}

.qr-text .t1 {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.settings-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Neutral pill + a small colored dot — same convention the landing page
   uses for its feature pills, so this reads as one design system rather
   than a one-off saturated-pill treatment. */
.settings-summary .pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--panel-border);
  color: var(--ink-muted);
}

.settings-summary .pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: none;
}

.settings-summary .pill .dot.amber {
  background: var(--amber-2);
  box-shadow: 0 0 8px rgba(255, 178, 56, 0.7);
}

.settings-summary .pill .dot.teal {
  background: var(--teal-2);
  box-shadow: 0 0 8px rgba(63, 203, 160, 0.7);
}

.lobby-right {
  display: grid;
  gap: 18px;
  align-content: center;
}

.players-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.players-head h2 {
  font-size: 1.3rem;
}

.players-count {
  font-family: var(--font-display);
  color: var(--teal-1);
  font-size: 1.1rem;
  font-weight: 700;
}

.player-grid {
  display: grid;
  /* Compact squares (matching the empty-state seat placeholders), not
     full-width pills — with up to 40 players this needs to stay a dense
     grid rather than one stretched row per name. */
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 12px;
  align-content: start;
  max-height: 42vh;
  overflow-y: auto;
}

/* Empty-state placeholder seats — purely decorative, swapped for real
   player chips the moment anyone joins. */
.seat {
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  border: 1.5px dashed rgba(166, 172, 196, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(166, 172, 196, 0.35);
  animation: seat-pulse 3.2s ease-in-out infinite;
}

.seat svg {
  width: 22px;
  height: 22px;
  opacity: 0.5;
}

.seat:nth-child(2) { animation-delay: 0.4s; }
.seat:nth-child(3) { animation-delay: 0.8s; }
.seat:nth-child(4) { animation-delay: 1.2s; }
.seat:nth-child(5) { animation-delay: 1.6s; }
.seat:nth-child(6) { animation-delay: 2s; }
.seat:nth-child(7) { animation-delay: 2.4s; }
.seat:nth-child(8) { animation-delay: 2.8s; }

@keyframes seat-pulse {
  0%, 100% { border-color: rgba(166, 172, 196, 0.22); }
  50% { border-color: rgba(143, 245, 214, 0.4); }
}

.waiting-line {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  gap: 8px;
}

.waiting-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal-2);
  box-shadow: 0 0 8px var(--teal-2);
  animation: blink 1.4s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.player-chip {
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  animation: pop-in 0.42s var(--ease) both;
  position: relative;
  min-width: 0;
}

.player-chip.gone {
  opacity: 0.45;
}

.player-chip .av {
  font-size: 1.7rem;
  line-height: 1;
}

.player-chip .av svg {
  width: 1em;
  height: 1em;
  display: block;
}

.player-chip .nm {
  font-weight: 700;
  font-size: 0.78rem;
  line-height: 1.2;
  max-width: 100%;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-chip .kick {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  opacity: 0;
  background: rgba(0, 0, 0, 0.35);
  font-size: 0.7rem;
  color: var(--text-faint);
  transition: opacity 0.15s var(--ease);
}

.player-chip:hover .kick {
  opacity: 1;
}

.player-chip .kick:hover {
  color: var(--bad);
}

@keyframes pop-in {
  0% {
    opacity: 0;
    transform: scale(0.6) translateY(10px);
  }
  60% {
    transform: scale(1.06);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

.actions-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-settings {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--panel-border);
  color: var(--ink-muted);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-settings:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.btn-start {
  padding: 14px 34px;
  border-radius: 14px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  background: linear-gradient(120deg, var(--amber-1), var(--amber-3));
  color: #241405;
  position: relative;
  border: none;
  box-shadow: 0 14px 30px -12px rgba(245, 135, 31, 0.45);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-start:hover:not(:disabled) {
  transform: translateY(-2px);
}

.btn-start:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-start:disabled::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 18px;
  border: 1.5px solid rgba(255, 178, 56, 0.5);
  animation: ring-pulse 2.4s ease-in-out infinite;
}

@keyframes ring-pulse {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.09); opacity: 0; }
}

/* ================= COUNTDOWN ================= */

.countdown {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.cd-category {
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--text-dim);
}

.cd-number {
  font-family: var(--font-display);
  font-size: clamp(7rem, 26vmin, 18rem);
  font-weight: 800;
  line-height: 0.9;
  background: linear-gradient(120deg, #fff, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: cd-pulse 1s var(--ease) infinite;
}

@keyframes cd-pulse {
  0% {
    transform: scale(0.82);
    opacity: 0.4;
  }
  40% {
    transform: scale(1.05);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0.85;
  }
}

.cd-progress {
  font-size: 1.05rem;
}

.cd-badge {
  padding: 0.5em 1.4em;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0.1em;
  background: linear-gradient(135deg, var(--amber-2), var(--coral-2));
  box-shadow: 0 10px 30px rgba(240, 101, 58, 0.4);
  animation: badge-throb 1.1s var(--ease) infinite alternate;
}

@keyframes badge-throb {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.08);
  }
}

/* ================= QUESTION ================= */

.question {
  flex-direction: column;
  gap: 22px;
}

.q-top {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.answered-pill {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.double-pill {
  background: linear-gradient(135deg, var(--amber-2), var(--coral-2));
  border-color: transparent;
  color: #fff;
}

.timer-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.timer-track {
  flex: 1;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.timer-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--a3), var(--a2), var(--a0));
  transform-origin: left;
}

.timer-num {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  min-width: 2.2ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.timer-num.urgent {
  color: var(--a0);
  animation: urgent 0.5s var(--ease) infinite alternate;
}

@keyframes urgent {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.16);
  }
}

.q-text {
  font-size: clamp(1.7rem, 4.4vw, 3.6rem);
  line-height: 1.14;
  text-align: center;
  margin: auto 0;
  max-width: 22ch;
  margin-inline: auto;
  text-wrap: balance;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.choices.three {
  grid-template-columns: repeat(3, 1fr);
}

.choices.two {
  grid-template-columns: repeat(2, 1fr);
}

.choice {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: clamp(14px, 2.2vh, 24px) clamp(16px, 2vw, 28px);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--answer), var(--answer-dark));
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.34);
  font-size: clamp(1.05rem, 1.9vw, 1.7rem);
  font-weight: 700;
  color: #fff;
  animation: choice-in 0.4s var(--ease) both;
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease), filter 0.35s var(--ease);
  min-height: 0;
}

.choice:nth-child(1) {
  animation-delay: 0.04s;
}
.choice:nth-child(2) {
  animation-delay: 0.1s;
}
.choice:nth-child(3) {
  animation-delay: 0.16s;
}
.choice:nth-child(4) {
  animation-delay: 0.22s;
}

@keyframes choice-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.choice .shape {
  flex: none;
  width: clamp(28px, 3vw, 44px);
  height: clamp(28px, 3vw, 44px);
  display: grid;
  place-items: center;
}

.choice .shape svg {
  width: 100%;
  height: 100%;
  fill: rgba(255, 255, 255, 0.92);
}

.choice .label {
  flex: 1;
  text-wrap: balance;
}

/* reveal states */

.choice.wrong-answer {
  opacity: 0.28;
  filter: grayscale(0.7);
  transform: scale(0.97);
}

.choice.right-answer {
  outline: 4px solid #fff;
  outline-offset: 3px;
  transform: scale(1.02);
  animation: right-flash 0.7s var(--ease) 2;
}

@keyframes right-flash {
  0%,
  100% {
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.34);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.22), 0 10px 26px rgba(0, 0, 0, 0.34);
  }
}

.choice .tally {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 0.25em 0.7em;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
}

.choice .bar {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.16);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.7s var(--ease);
  pointer-events: none;
}

.choice {
  position: relative;
  overflow: hidden;
}

.choice > * {
  position: relative;
  z-index: 1;
}

/* Phones hosting their own game (no separate big screen) get a tight
   viewport — the desktop/TV spacing above leaves the bottom answer choices
   pushed off-screen. Scoped to narrow widths only, so the TV/laptop layout
   above is untouched. */
@media (max-width: 640px) {
  .screen.question {
    padding: 76px 4vw 24px;
  }

  .question {
    gap: 14px;
    /* Explicit rather than relying on the flex initial value — content
       should hug the top under the logo/topbar, not float in the middle
       of the screen. */
    justify-content: flex-start;
  }

  .q-text {
    font-size: clamp(1.5rem, 7.5vw, 2.3rem);
    /* Auto top/bottom margins soak up whatever space is left between the
       (top-anchored) timer and the (bottom-anchored) choices, so the
       question sits centered in the middle instead of stacking right under
       the timer. */
    margin: auto 0;
  }

  .timer-num {
    font-size: 1.5rem;
  }

  .choices {
    gap: 12px;
  }

  /* Chunkier tiles closer to the desktop screen's proportions, instead of
     the thin pill-shaped rows the base mobile styling collapsed to. */
  .choice {
    padding: 28px 18px;
    min-height: 96px;
    font-size: clamp(1.1rem, 4.4vw, 1.35rem);
    gap: 12px;
  }

  .choice .shape {
    width: 30px;
    height: 30px;
  }
}

/* ================= REVEAL ================= */

.reveal {
  display: none;
  gap: 2.4vw;
  align-items: stretch;
}

.reveal.active {
  display: flex;
}

@media (max-width: 1000px) {
  .reveal.active {
    flex-direction: column;
  }
}

.reveal-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.reveal-head {
  display: grid;
  gap: 10px;
  justify-items: start;
}

.reveal-head h2 {
  font-size: clamp(1.3rem, 2.6vw, 2.2rem);
  line-height: 1.2;
  text-wrap: balance;
}

.reveal-choices {
  margin-top: auto;
}

.explanation,
.fastest {
  margin: 0;
  font-size: 1rem;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
}

.reveal-side {
  width: min(400px, 38vw);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (max-width: 1000px) {
  .reveal-side {
    width: 100%;
  }
}

.reveal-side h3 {
  font-size: 1.1rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.kbd-hint {
  text-align: center;
  font-size: 0.78rem;
  margin: 0;
}

kbd {
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: ui-monospace, monospace;
  font-size: 0.9em;
}

/* ---- leaderboard ---- */

.board {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
}

.board li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  transition: transform 0.5s var(--ease), background 0.4s var(--ease);
}

.board li.top {
  background: linear-gradient(120deg, rgba(255, 204, 70, 0.24), rgba(255, 204, 70, 0.05));
  border-color: rgba(255, 204, 70, 0.45);
}

.board .rank {
  flex: none;
  width: 1.9em;
  font-weight: 800;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.board .av {
  flex: none;
  font-size: 1.2rem;
}

.board .av svg {
  width: 1.2em;
  height: 1.2em;
  display: block;
}

.board .nm {
  flex: 1;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board .delta {
  flex: none;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ok);
  opacity: 0;
  animation: delta-in 0.5s var(--ease) 0.25s both;
}

.board .delta.zero {
  color: var(--text-faint);
}

@keyframes delta-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.board .score {
  flex: none;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  min-width: 4ch;
  text-align: right;
}

.board .streak {
  flex: none;
  font-size: 0.8rem;
}

/* ================= RESULTS ================= */

.results {
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.results-title {
  font-size: clamp(2rem, 5vw, 3.4rem);
}

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 18px;
  min-height: 260px;
}

.podium-step {
  display: grid;
  justify-items: center;
  gap: 10px;
  animation: rise 0.75s var(--ease) both;
}

.podium-step:nth-child(1) {
  animation-delay: 0.7s;
}
.podium-step:nth-child(2) {
  animation-delay: 0.35s;
}
.podium-step:nth-child(3) {
  animation-delay: 0s;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(70px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.podium-step .av {
  font-size: clamp(2.6rem, 6vmin, 4rem);
  line-height: 1;
}

.podium-step .av svg {
  width: 1em;
  height: 1em;
  display: block;
}

.podium-step .nm {
  font-weight: 800;
  font-size: 1.1rem;
  max-width: 12ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-step .sc {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--text-dim);
}

.podium-block {
  width: clamp(120px, 15vw, 190px);
  border-radius: 16px 16px 0 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 800;
  color: rgba(0, 0, 0, 0.42);
}

.podium-step[data-place="1"] .podium-block {
  height: 190px;
  background: linear-gradient(180deg, var(--gold), #b8860b);
  box-shadow: 0 -6px 40px rgba(255, 204, 70, 0.45);
}

.podium-step[data-place="2"] .podium-block {
  height: 140px;
  background: linear-gradient(180deg, var(--silver), #7d8698);
}

.podium-step[data-place="3"] .podium-block {
  height: 105px;
  background: linear-gradient(180deg, var(--bronze), #91542a);
}

.results-lower {
  width: min(1100px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 18px;
  align-items: start;
}

@media (max-width: 900px) {
  .results-lower {
    grid-template-columns: 1fr;
  }
}

.board-full {
  max-height: 34vh;
}

.stats {
  padding: 20px;
  display: grid;
  gap: 12px;
}

.stat {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
}

.stat .ico {
  font-size: 1.4rem;
  flex: none;
}

.stat .txt b {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  font-weight: 700;
}

.stat .txt svg {
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.2em;
}

.fastest svg {
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.2em;
}

.results-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ================= toast ================= */

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translate(-50%, 24px);
  padding: 12px 22px;
  border-radius: 999px;
  background: rgba(10, 12, 22, 0.92);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s var(--ease);
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Floating reaction bubbles from players. */
.reaction {
  position: fixed;
  bottom: 60px;
  font-size: 2.2rem;
  pointer-events: none;
  z-index: 80;
  animation: float-up 2.6s var(--ease) forwards;
}

@keyframes float-up {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.6);
  }
  15% {
    opacity: 1;
    transform: translateY(-30px) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: translateY(-46vh) scale(0.9);
  }
}
