*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #071018;
  --bg-2: #0c1a24;
  --surface: #122433;
  --line: rgba(214, 232, 240, 0.12);
  --text: #eef6f8;
  --muted: #8fa8b5;
  --accent: #3ecf8e;
  --accent-2: #2bb673;
  --warn: #e8c468;
  --danger: #f07178;
  --choice-a: #2f6fed;
  --choice-b: #e4572e;
  --choice-c: #2bb673;
  --choice-d: #c9a227;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Hanken Grotesk", system-ui, sans-serif;
  --radius: 14px;
}

html, body {
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(62, 207, 142, 0.16), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(47, 111, 237, 0.14), transparent 50%),
    linear-gradient(165deg, var(--bg), var(--bg-2) 45%, #050d12);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

#app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 16, 24, 0.72);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.brand span { color: var(--accent); font-weight: 500; font-size: 0.85rem; margin-left: 0.5rem; }

.main {
  flex: 1;
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.15;
  margin-bottom: 0.4rem;
}
.hero-sub { color: var(--muted); margin-bottom: 1.5rem; max-width: 36rem; }

.row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.row.spread { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 0.85rem; }

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.65rem 1.2rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #042016;
  box-shadow: 0 10px 24px rgba(62, 207, 142, 0.22);
}
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}
.btn-danger {
  background: rgba(240, 113, 120, 0.15);
  border-color: rgba(240, 113, 120, 0.35);
  color: #ffc4c7;
}
.btn-lg { padding: 0.9rem 1.5rem; font-size: 1.05rem; }

.input, .textarea, select {
  width: 100%;
  background: rgba(18, 36, 51, 0.9);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 0.7rem 0.85rem;
  font: inherit;
  outline: none;
}
.input:focus, .textarea:focus, select:focus { border-color: var(--accent); }
.textarea { min-height: 72px; resize: vertical; }
label.field { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.82rem; color: var(--muted); }

.quiz-list { display: grid; gap: 0.75rem; }
.quiz-card {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(18, 36, 51, 0.95), rgba(8, 18, 26, 0.9));
}
.quiz-card h3 { font-size: 1.05rem; margin-bottom: 0.2rem; }
.quiz-card p { color: var(--muted); font-size: 0.85rem; }

.editor-q {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  background: rgba(8, 18, 26, 0.55);
}
.editor-q .q-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.choices-grid { display: grid; gap: 0.5rem; }
.choice-row { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem; align-items: center; }
.choice-row input[type=radio] { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }

.stage {
  text-align: center;
  padding: 1rem 0 2rem;
}
.pin {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 10vw, 5rem);
  letter-spacing: 0.28em;
  font-weight: 700;
  margin: 0.5rem 0 1rem;
}
.qr-wrap {
  display: inline-flex;
  padding: 0.85rem;
  border-radius: 16px;
  background: #fff;
  margin: 0.5rem auto 1rem;
}
.qr-wrap canvas, .qr-wrap img { display: block; width: 200px; height: 200px; }
.join-url {
  word-break: break-all;
  font-size: 0.85rem;
  max-width: 28rem;
  margin: 0 auto 0.75rem;
}
.nick-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 1rem 0;
  min-height: 2.5rem;
}
.nick-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem 0.35rem 0.4rem;
  border-radius: 999px;
  background: rgba(62, 207, 142, 0.12);
  border: 1px solid rgba(62, 207, 142, 0.28);
  animation: pop 0.35s ease;
}
@keyframes pop {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(62, 207, 142, 0.25), rgba(47, 111, 237, 0.22));
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 1.05rem;
  line-height: 1;
  flex-shrink: 0;
}
.avatar-sm { width: 1.55rem; height: 1.55rem; font-size: 0.85rem; }
.avatar-lg {
  width: 3.6rem;
  height: 3.6rem;
  font-size: 1.85rem;
  margin: 0.35rem auto 0.15rem;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}

.music-pick {
  max-width: 420px;
  margin: 1rem auto 1.25rem;
  text-align: left;
}
.music-pick .req {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--warn);
  margin-top: 0.15rem;
}
.music-hint { margin-top: 0.45rem; font-size: 0.82rem; }
.music-now {
  margin: 0.85rem auto 1rem;
  max-width: 420px;
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  background: rgba(62, 207, 142, 0.1);
  border: 1px solid rgba(62, 207, 142, 0.28);
  color: var(--text);
  font-size: 0.92rem;
}

#hostMusicDock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 0.65rem 0.85rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
  background: rgba(7, 16, 24, 0.92);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
#hostMusicDock[hidden] { display: none !important; }
.host-music-dock-inner {
  width: min(720px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.host-music-icon {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(62, 207, 142, 0.16);
  color: var(--accent);
  flex-shrink: 0;
}
.host-music-meta {
  flex: 1;
  min-width: 0;
  text-align: left;
}
.host-music-meta strong {
  display: block;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}
.host-vol-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.78rem;
}
.host-vol-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
}
#hostVolLabel {
  min-width: 2.5rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
body:has(#hostMusicDock:not([hidden])) #app {
  padding-bottom: 5.5rem;
}

html.host-immersive,
body.host-immersive {
  overflow: hidden;
}
body.host-immersive #app {
  min-height: 100vh;
  min-height: 100dvh;
}
body.host-immersive .topbar {
  display: none !important;
}
body.host-immersive .main.stage-immersive {
  width: min(1100px, 100%);
  padding: 1.25rem 1rem 6rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
}
body.host-immersive .main.stage-immersive .hero-title {
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  margin-bottom: 0.35rem;
}
body.host-immersive .answer-grid {
  gap: 0.9rem;
}
body.host-immersive .answer-btn {
  min-height: 5rem;
  font-size: 1.12rem;
}

.question-prompt {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3.5vw, 2.2rem);
  line-height: 1.25;
  margin: 0.75rem 0 1.25rem;
}
.timer {
  font-variant-numeric: tabular-nums;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--warn);
  margin-bottom: 0.45rem;
}
.timer.urgent { color: var(--danger); animation: pulse 0.8s ease infinite; }
@keyframes pulse {
  50% { opacity: 0.55; }
}

.timer-bar {
  width: min(420px, 100%);
  height: 10px;
  margin: 0 auto 1rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  overflow: hidden;
}
.timer-bar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--warn));
  box-shadow: 0 0 12px rgba(62, 207, 142, 0.35);
  transition: width 0.08s linear;
}
.timer-bar.urgent .timer-bar-fill {
  background: linear-gradient(90deg, var(--danger), #ffb347);
  box-shadow: 0 0 14px rgba(240, 113, 120, 0.45);
}

.answer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
@media (max-width: 560px) {
  .answer-grid { grid-template-columns: 1fr; }
}
.answer-btn {
  border: none;
  border-radius: 16px;
  padding: 1.15rem 1rem;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  text-align: left;
  min-height: 4.5rem;
  transition: transform 0.15s ease, filter 0.15s ease, outline 0.15s ease;
}
.answer-btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.06); }
.answer-btn:disabled { cursor: default; opacity: 0.85; }
.answer-btn.a { background: var(--choice-a); }
.answer-btn.b { background: var(--choice-b); }
.answer-btn.c { background: var(--choice-c); }
.answer-btn.d { background: var(--choice-d); }
.answer-btn.correct { outline: 3px solid #fff; filter: brightness(1.1); }
.answer-btn.wrong { filter: grayscale(0.5) brightness(0.7); }
.answer-btn.picked { box-shadow: inset 0 0 0 3px rgba(255,255,255,0.9); }
.answer-btn.scripture { cursor: pointer; }
.answer-btn.scripture:hover { transform: translateY(-2px); filter: brightness(1.14); }
.scripture-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.92;
}
.scripture-note { margin-top: 0.85rem; }
.scripture-pop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(5, 10, 14, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.scripture-pop-card {
  width: min(520px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.4rem 1.3rem 1.2rem;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  text-align: left;
}
.scripture-kicker {
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 0.35rem;
}
.scripture-pop-card h3 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  margin-bottom: 0.75rem;
}
.scripture-verse {
  font-size: 1.05rem;
  line-height: 1.55;
  margin-bottom: 0.85rem;
}

.leaderboard {
  width: min(420px, 100%);
  margin: 1.25rem auto 0;
  text-align: left;
}
.leaderboard li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.2rem;
  border-bottom: 1px solid var(--line);
  list-style: none;
}
.leaderboard .lb-who {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}
.leaderboard .rank { color: var(--muted); width: 1.5rem; }

.podium-hero { margin-top: 0.5rem; }
.podium-kicker {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--warn);
  margin-bottom: 0.25rem;
}
.podium {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  gap: 0.65rem;
  align-items: end;
  margin: 1.75rem auto 1rem;
  max-width: 560px;
  min-height: 280px;
}
.podium .place {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  border-radius: 18px 18px 10px 10px;
  padding: 0.85rem 0.45rem 0;
  background: rgba(18, 36, 51, 0.55);
  border: 1px solid var(--line);
  animation: riseIn 0.55s ease both;
}
.podium .place.second { animation-delay: 0.08s; }
.podium .place.first { animation-delay: 0.16s; }
.podium .place.third { animation-delay: 0.24s; }
@keyframes riseIn {
  from { transform: translateY(28px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.podium-medal {
  font-size: 1.55rem;
  line-height: 1;
  margin-bottom: 0.15rem;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.35));
}
.podium .place.first {
  min-height: 250px;
  background:
    linear-gradient(180deg, rgba(232, 196, 104, 0.42), rgba(18,36,51,0.35) 42%, rgba(18,36,51,0.92));
  border-color: rgba(232, 196, 104, 0.45);
  box-shadow: 0 18px 40px rgba(232, 196, 104, 0.12);
  z-index: 2;
}
.podium .place.second {
  min-height: 200px;
  background: linear-gradient(180deg, rgba(180, 198, 214, 0.28), rgba(18,36,51,0.92));
}
.podium .place.third {
  min-height: 170px;
  background: linear-gradient(180deg, rgba(205, 127, 80, 0.28), rgba(18,36,51,0.92));
}
.podium .place.empty { opacity: 0.45; }
.podium .name {
  font-weight: 700;
  margin-top: 0.35rem;
  font-size: 0.98rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 0.35rem;
}
.podium .place.first .name { font-size: 1.12rem; }
.podium .score { color: var(--muted); font-size: 0.88rem; margin-bottom: 0.55rem; }
.podium-stand {
  width: 100%;
  margin-top: auto;
  padding: 0.65rem 0.4rem;
  border-radius: 10px 10px 8px 8px;
  background: rgba(0,0,0,0.28);
  border-top: 1px solid rgba(255,255,255,0.08);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.podium .place.first .podium-stand {
  background: rgba(232, 196, 104, 0.22);
  color: #ffe9a8;
}
.podium-actions {
  justify-content: center;
  margin-top: 1.25rem;
  gap: 0.75rem;
}

@media (max-width: 560px) {
  .podium { min-height: 240px; gap: 0.4rem; }
  .podium .place.first { min-height: 210px; }
  .podium .place.second { min-height: 170px; }
  .podium .place.third { min-height: 145px; }
  .avatar-lg { width: 2.8rem; height: 2.8rem; font-size: 1.4rem; }
}

.banner {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  background: rgba(62, 207, 142, 0.1);
  border: 1px solid rgba(62, 207, 142, 0.25);
}
.banner.error {
  background: rgba(240, 113, 120, 0.12);
  border-color: rgba(240, 113, 120, 0.35);
  color: #ffc9cc;
}
.banner.warn {
  background: rgba(232, 196, 104, 0.12);
  border-color: rgba(232, 196, 104, 0.35);
}

.muted { color: var(--muted); }
.center { text-align: center; }
.hidden { display: none !important; }

.btn-hero {
  width: 100%;
  margin: 0.5rem 0 1.5rem;
  font-size: 1.1rem;
  padding: 1rem 1.25rem;
}
.section-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0.5rem 0 0.75rem;
}

.lobby-hero {
  position: relative;
  margin: 0 0 1.6rem;
  padding: 1.35rem 1.25rem 1.25rem;
  border-radius: 22px;
  border: 1px solid rgba(62, 207, 142, 0.28);
  background:
    radial-gradient(420px 180px at 100% 0%, rgba(47, 111, 237, 0.24), transparent 62%),
    radial-gradient(360px 160px at 0% 110%, rgba(62, 207, 142, 0.2), transparent 58%),
    linear-gradient(165deg, rgba(18, 36, 51, 0.96), rgba(7, 16, 24, 0.94));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}
.lobby-hero .hero-title { margin-top: 0.35rem; }
.lobby-hero .hero-sub { margin-bottom: 1rem; }
.signin-home {
  min-height: min(72vh, 640px);
  display: grid;
  align-content: center;
}
.signin-hero { text-align: center; }
.signin-hero .btn-play { margin-top: 0.35rem; }
.signin-note { margin: 1rem 0 0; }
.btn-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-width: 220px;
  font-size: 1.15rem;
  padding: 0.95rem 1.45rem;
  box-shadow: 0 14px 32px rgba(62, 207, 142, 0.32);
}
.play-mark {
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(4, 32, 22, 0.16);
  font-size: 0.78rem;
}
.deck-list { display: grid; gap: 0.75rem; }
.deck-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.9rem;
  align-items: center;
  padding: 0.8rem 0.9rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(18, 36, 51, 0.96), rgba(8, 18, 26, 0.9));
  animation: tileIn 0.4s ease both;
}
.deck-card:nth-child(2) { animation-delay: 0.05s; }
.deck-card:nth-child(3) { animation-delay: 0.1s; }
.deck-count {
  width: 4.3rem;
  height: 4.3rem;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #3d7ef2, #2457b8);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 8px 18px rgba(47, 111, 237, 0.25);
}
.deck-count b {
  font-family: var(--font-display);
  font-size: 1.45rem;
  line-height: 1;
}
.deck-count span {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.88;
}
.deck-card.past .deck-count {
  background: linear-gradient(160deg, #e8c468, #b8892a);
  color: #1c1404;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25), 0 8px 18px rgba(232, 196, 104, 0.18);
}
.deck-body { min-width: 0; }
.deck-body h3 {
  font-size: 1.05rem;
  margin-bottom: 0.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deck-body p { color: var(--muted); font-size: 0.82rem; }
.deck-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: flex-end; }
.pod-line { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.45rem; }
@media (max-width: 720px) {
  .deck-card { grid-template-columns: auto 1fr; }
  .deck-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .btn-play { width: 100%; }
}

.period-toggle {
  display: inline-flex;
  gap: 0.35rem;
  margin: 0.25rem 0 1.25rem;
  padding: 0.25rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.25);
}
.period-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
}
.period-btn.is-active {
  color: #0b0d10;
  background: var(--accent, #e9c46a);
}

.leader-card {
  margin: 0 0 1.5rem;
  padding: 1.15rem 1.25rem;
  border: 1px solid rgba(233, 196, 106, 0.35);
  background:
    linear-gradient(135deg, rgba(233, 196, 106, 0.14), transparent 55%),
    rgba(0, 0, 0, 0.28);
}
.leader-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent, #e9c46a);
  margin-bottom: 0.35rem;
}
.leader-name {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin: 0 0 0.65rem;
}
.leader-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  margin-bottom: 0.55rem;
}
.leader-meta span { color: var(--muted); font-size: 0.9rem; }
.leader-meta b { color: var(--text); margin-right: 0.2rem; }

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.history-row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1.4fr) 4.5rem minmax(10rem, 1fr);
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.22);
}
.history-rank {
  color: var(--muted);
  font-weight: 700;
}
.history-who {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.history-who strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
}
.history-stat b { font-size: 1.05rem; color: var(--accent, #e9c46a); }
.history-stat span { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.history-podiums {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}
.pod-chip {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.22rem 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
}
.pod-chip.gold { border-color: rgba(233, 196, 106, 0.55); color: #f0d78a; }
.pod-chip.silver { border-color: rgba(200, 210, 220, 0.4); color: #c8d2dc; }
.pod-chip.bronze { border-color: rgba(205, 127, 50, 0.5); color: #d4a574; }

@media (max-width: 720px) {
  .history-row {
    grid-template-columns: 1.5rem 1fr auto;
    grid-template-areas:
      "rank who who"
      "rank rate pods";
  }
  .history-rank { grid-area: rank; }
  .history-who { grid-area: who; }
  .history-stat { grid-area: rate; }
  .history-podiums { grid-area: pods; justify-content: flex-start; }
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
}
.quick-form {
  max-width: 640px;
}

.join-shell {
  max-width: 420px;
  margin: 2rem auto;
  text-align: center;
}
.join-shell .brand { margin-bottom: 1rem; }

.score-flash {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  line-height: 1;
  color: var(--accent);
  text-shadow: 0 8px 28px rgba(62, 207, 142, 0.45);
  animation: scoreJump 0.7s cubic-bezier(0.2, 1.4, 0.3, 1) both;
}
.score-flash.miss { color: var(--danger); text-shadow: none; font-size: 1.8rem; }
.score-pop { margin: 0.85rem 0 0.2rem; }
.streak-call {
  margin-top: 0.25rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--warn);
  animation: pop 0.45s ease 0.15s both;
}

.join-count {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  min-width: 7.5rem;
  margin: 0.2rem auto 0.8rem;
  padding: 0.55rem 1.1rem 0.65rem;
  border-radius: 18px;
  background: rgba(62, 207, 142, 0.12);
  border: 1px solid rgba(62, 207, 142, 0.35);
  box-shadow: 0 10px 30px rgba(62, 207, 142, 0.12);
  animation: pop 0.4s ease;
}
.join-count b {
  font-family: var(--font-display);
  font-size: 2.4rem;
  line-height: 1;
  color: var(--accent);
}
.join-count span {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.qr-live { animation: qrGlow 2.4s ease-in-out infinite; }
@keyframes qrGlow {
  50% { box-shadow: 0 0 0 8px rgba(62, 207, 142, 0.18); }
}
.you-in {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin: 0.4rem auto 0.8rem;
}
.you-in strong { display: block; font-size: 1.35rem; }
.you-in .arena-stamp { margin: 0 0 0.15rem; }

.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  width: min(640px, 100%);
  margin: 0 auto 0.75rem;
}
.hud-round, .hud-score {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  font-weight: 800;
  letter-spacing: 0.04em;
}
.hud-round em, .hud-score small {
  font-style: normal;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.78rem;
}
.timer.timer-orb {
  width: 92px;
  height: 92px;
  margin: 0.15rem auto 0.35rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 2.15rem;
  letter-spacing: 0;
  color: var(--warn);
  background:
    radial-gradient(circle at 40% 30%, rgba(232, 196, 104, 0.2), transparent 55%),
    #0d1c28;
  border: 4px solid var(--warn);
  box-shadow: 0 0 0 7px rgba(232, 196, 104, 0.12), 0 14px 30px rgba(0, 0, 0, 0.35);
}
.timer.timer-orb.urgent {
  color: #fff;
  border-color: var(--danger);
  box-shadow: 0 0 0 7px rgba(240, 113, 120, 0.18), 0 14px 30px rgba(0, 0, 0, 0.35);
  animation: timerShake 0.42s linear infinite;
}
.reveal-stamp { margin-bottom: 0.2rem; }
@keyframes timerShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}
@keyframes tileIn {
  from { transform: translateY(18px) scale(0.92); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes correctPop {
  0% { transform: scale(0.86); }
  55% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
@keyframes scoreJump {
  0% { transform: scale(0.4) translateY(10px); opacity: 0; }
  60% { transform: scale(1.12) translateY(0); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.answer-grid.is-live .answer-btn {
  animation: tileIn 0.42s cubic-bezier(0.2, 1.35, 0.35, 1) both;
}
.answer-grid.is-live .answer-btn:nth-child(2) { animation-delay: 0.06s; }
.answer-grid.is-live .answer-btn:nth-child(3) { animation-delay: 0.12s; }
.answer-grid.is-live .answer-btn:nth-child(4) { animation-delay: 0.18s; }
.answer-grid.is-reveal .answer-btn.correct {
  animation: correctPop 0.55s cubic-bezier(0.2, 1.5, 0.3, 1) both;
  box-shadow: 0 0 0 3px #fff, 0 12px 32px rgba(255, 255, 255, 0.18);
}
.answer-grid.is-reveal .answer-btn.wrong {
  animation: tileIn 0.35s ease both;
  transform: scale(0.96);
}
.question-prompt { animation: tileIn 0.35s ease both; }
.leaderboard .lb-row {
  animation: tileIn 0.35s ease both;
}
.leaderboard .lb-row:nth-child(2) { animation-delay: 0.04s; }
.leaderboard .lb-row:nth-child(3) { animation-delay: 0.08s; }
.leaderboard .rank-1 {
  background: rgba(232, 196, 104, 0.1);
  border-radius: 10px;
  padding-left: 0.45rem;
  padding-right: 0.45rem;
}
.lb-medal { margin-right: 0.15rem; }
.fx-win { position: relative; }
.fx-win::before,
.fx-win::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  background: var(--warn);
  box-shadow:
    -70px 18px 0 var(--accent),
    64px 10px 0 var(--choice-a),
    -36px 36px 0 var(--choice-b),
    40px 42px 0 var(--choice-d),
    -8px 8px 0 #fff,
    18px 28px 0 var(--accent);
  animation: confetti 0.9s ease-out both;
}
.fx-win::after { animation-delay: 0.08s; transform: scaleX(-1); }
@keyframes confetti {
  from { opacity: 0; transform: translate(-50%, 8px) scale(0.6); }
  30% { opacity: 1; }
  to { opacity: 0; transform: translate(-50%, -28px) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .answer-grid.is-live .answer-btn,
  .answer-grid.is-reveal .answer-btn.correct,
  .answer-grid.is-reveal .answer-btn.wrong,
  .question-prompt,
  .leaderboard .lb-row,
  .score-flash,
  .qr-live,
  .timer.timer-orb.urgent,
  .fx-win::before,
  .fx-win::after {
    animation: none;
  }
}

/* Arena / gulag-inspired presentation (SFire palette) */
.arena-shell {
  position: relative;
}
.arena-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(240, 113, 120, 0.07), transparent 28%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 3px,
      rgba(0, 0, 0, 0.08) 3px,
      rgba(0, 0, 0, 0.08) 4px
    );
  z-index: 0;
}
.arena-shell > * { position: relative; z-index: 1; }

.arena-stamp {
  display: inline-block;
  margin: 0.35rem 0 0.75rem;
  padding: 0.28rem 0.7rem;
  border: 1px solid rgba(240, 113, 120, 0.55);
  color: #ffb4b8;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: rgba(240, 113, 120, 0.1);
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}

.arena-answers .answer-btn {
  border-radius: 10px;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08), 0 10px 24px rgba(0,0,0,0.28);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.arena-answers .answer-btn:active:not(:disabled) {
  transform: scale(0.98);
  filter: brightness(1.08);
}
.arena-locked {
  border-color: rgba(232, 196, 104, 0.45) !important;
  background: rgba(232, 196, 104, 0.12) !important;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.35rem;
  max-height: 11rem;
  overflow: auto;
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 18, 26, 0.65);
}
.avatar-pick {
  appearance: none;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.4rem 0.15rem;
  cursor: pointer;
}
.avatar-pick.selected {
  border-color: var(--accent);
  background: rgba(62, 207, 142, 0.16);
  box-shadow: 0 0 0 1px rgba(62, 207, 142, 0.35);
}
.known-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.known-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem !important;
  font-size: 0.85rem;
}

@media (max-width: 560px) {
  .avatar-grid { grid-template-columns: repeat(6, 1fr); }
}
