/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }

/* ── Variables ──────────────────────────────────────────────────────────── */
:root {
  --bg:          #0d0d1a;
  --surface:     #131326;
  --card:        rgba(255,255,255,0.06);
  --card-border: rgba(255,255,255,0.10);
  --primary:     #7c6af0;
  --primary-dim: rgba(124,106,240,0.18);
  --success:     #43e97b;
  --success-dim: rgba(67,233,123,0.18);
  --danger:      #f5365c;
  --danger-dim:  rgba(245,54,92,0.18);
  --warning:     #ffd166;
  --text:        #f0f0ff;
  --text-muted:  rgba(240,240,255,0.45);
  --radius:      18px;
  --radius-sm:   11px;
  --ease:        cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Base ───────────────────────────────────────────────────────────────── */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

#app {
  width: 100vw;
  height: 100dvh;
  position: relative;
  overflow: hidden;
}

/* ── Screens ────────────────────────────────────────────────────────────── */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
  overflow-y: auto;
  padding: 20px 16px;
}
.screen.active {
  opacity: 1;
  transform: none;
  pointer-events: all;
}
.screen.leaving {
  opacity: 0;
  transform: translateY(-12px);
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.96); }

.btn:focus-visible,
.option-card:focus-visible,
.pause-btn:focus-visible,
.vol-btn:focus-visible,
.pack-card:focus-visible,
.player-entry input:focus-visible {
  outline: 2px solid var(--warning);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 20px rgba(124,106,240,0.45);
}
.btn-primary:hover { box-shadow: 0 6px 28px rgba(124,106,240,0.6); }

.btn:disabled {
  cursor: not-allowed;
  transform: none;
  opacity: 0.62;
}

.btn-primary:disabled {
  background: linear-gradient(135deg, rgba(148,163,184,0.45), rgba(71,85,105,0.55));
  color: rgba(255,255,255,0.62);
  box-shadow: none;
}

.btn-primary:disabled:hover {
  box-shadow: none;
}

.btn-ghost {
  background: var(--card);
  color: var(--text-muted);
  border: 1px solid var(--card-border);
}
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,0.10); }

.btn-xl { font-size: 1.05rem; padding: 15px 40px; }
.btn-sm { font-size: 0.78rem; padding: 8px 18px; }

/* ──────────────────────────────────────────────────────────────────────── */
/*  START SCREEN                                                            */
/* ──────────────────────────────────────────────────────────────────────── */

#screen-start {
  justify-content: flex-start;
  padding-top: max(18px, env(safe-area-inset-top));
  padding-bottom: max(18px, env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at 50% 30%, rgba(124,106,240,0.18) 0%, transparent 60%), var(--bg);
}

.start-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

/* Logo parade */
.logo-parade {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 4px;
}
.parade-item {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  animation: float 3s ease-in-out infinite;
}
.parade-item:nth-child(odd)  { animation-delay: 0.4s; }
.parade-item:nth-child(3n)   { animation-delay: 0.8s; }
.parade-item:nth-child(4n)   { animation-delay: 1.2s; }
.parade-item img { width: 36px; height: 36px; object-fit: contain; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

.game-title {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}
.game-title .accent { color: var(--primary); }

.subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.best-score {
  font-size: 0.85rem;
  color: var(--text-muted);
  min-height: 1.2em;
}
.best-score strong { color: var(--warning); }

.start-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 280px;
}

.input-hints {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 4px;
}
.input-hints span { display: flex; align-items: center; gap: 4px; }

/* ──────────────────────────────────────────────────────────────────────── */
/*  GAME SCREEN                                                             */
/* ──────────────────────────────────────────────────────────────────────── */

#screen-game {
  justify-content: flex-start;
  padding: 0;
  overflow: hidden;
}

/* HUD */
.hud {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
  background: rgba(13,13,26,0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--card-border);
  position: relative;
  flex-shrink: 0;
}

.q-counter {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.hud-pack {
  max-width: min(36vw, 240px);
  padding: 7px 12px;
  border: 1px solid rgba(124,106,240,0.5);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(124,106,240,0.28), rgba(0,224,255,0.12));
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 8px 22px rgba(124,106,240,0.16);
}

.hud-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.score-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.score-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  font-weight: 600;
  text-transform: uppercase;
}

.score-pop {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--success);
  pointer-events: none;
  animation: scorePop 0.85s var(--ease) forwards;
}

.question-feedback {
  min-height: 1.6em;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  padding: 0 12px;
}

.question-feedback.is-correct { color: var(--success); }
.question-feedback.is-wrong   { color: var(--danger); }
.question-feedback.is-timeout { color: var(--warning); }

@keyframes scorePop {
  0%   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  60%  { opacity: 1; transform: translateX(-50%) translateY(-22px) scale(1.2); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-36px) scale(0.9); }
}

/* Mic meter */
.hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mic-meter {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.mic-meter.active {
  opacity: 1;
  pointer-events: all;
}

.speech-unsupported .mic-meter {
  display: none;
}

.meter-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
}

.bar {
  width: 3px;
  background: var(--success);
  border-radius: 2px;
  height: 4px;
  transform-origin: bottom;
}
.mic-meter.active .bar { animation: barBounce 0.7s ease-in-out infinite; }
.mic-meter.active .bar:nth-child(1) { animation-duration: 0.65s; animation-delay: 0.00s; }
.mic-meter.active .bar:nth-child(2) { animation-duration: 0.80s; animation-delay: 0.10s; }
.mic-meter.active .bar:nth-child(3) { animation-duration: 0.55s; animation-delay: 0.20s; }
.mic-meter.active .bar:nth-child(4) { animation-duration: 0.90s; animation-delay: 0.05s; }

@keyframes barBounce {
  0%, 100% { height: 3px;  opacity: 0.45; }
  50%       { height: 14px; opacity: 1;   }
}

/* Volume control */
.vol-wrap {
  position: relative;
}

.vol-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 6px;
  border-radius: 8px;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.vol-btn:hover { background: rgba(255,255,255,0.08); }

.volume-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 150px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 100;
}

.vol-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

#volume-slider {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

.voice-indicator { display: none; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.85); }
}

/* Shuffle stage */
.shuffle-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 20px;
}

.shuffle-slot {
  width: min(200px, 52vw);
  height: min(200px, 52vw);
  border-radius: 28px;
  background: var(--card);
  border: 2px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform 0.2s var(--ease), box-shadow 0.3s;
}

#shuffle-img {
  width: 70%;
  height: 70%;
  object-fit: contain;
  transition: filter 0.1s, transform 0.3s var(--ease);
}

#shuffle-text-name {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  transition: opacity 0.08s, color 0.15s, font-size 0.1s;
  text-align: center;
  padding: 0 16px;
}

#shuffle-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* Question stage */
.question-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 14px 16px 16px;
  gap: 12px;
  overflow: hidden;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

.mode-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Prompt */
.prompt {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}

.prompt-logo {
  width: min(130px, 34vw);
  height: min(130px, 34vw);
  object-fit: contain;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--card-border);
  padding: 16px;
  animation: popIn 0.3s var(--ease);
}

.prompt-name {
  font-size: clamp(2rem, 7vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--warning);
  animation: popIn 0.3s var(--ease);
}

@keyframes popIn {
  from { transform: scale(0.88); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

/* Timer ring */
.timer-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
}

.timer-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-track {
  fill: none;
  stroke: rgba(255,255,255,0.08);
  stroke-width: 6;
}

.timer-arc {
  fill: none;
  stroke: var(--success);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 282.74;
  stroke-dashoffset: 0;
  transition: stroke 0.4s;
}

.timer-number {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 800;
  transition: color 0.4s;
}

/* Options — text mode */
.options {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.options-logo {
  flex-direction: row;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.option-card {
  background: var(--card);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.15s, background 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  color: var(--text);
  text-align: left;
  width: 100%;
  font-size: 0.95rem;
  font-weight: 500;
}

.options-logo .option-card {
  flex-direction: column;
  width: calc(33.333% - 7px);
  min-width: 100px;
  padding: 8px 8px 10px;
  align-items: center;
  text-align: center;
  gap: 7px;
}

.option-card:hover:not(:disabled) {
  background: var(--card-hover, rgba(255,255,255,0.10));
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(124,106,240,0.2);
}

.option-card:active:not(:disabled) { transform: scale(0.97); }

.opt-key {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.opt-text {
  font-size: 0.92rem;
  font-weight: 500;
  flex: 1;
}

.opt-logo-wrap {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.opt-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

/* Image-option mode: wrap fills card width, key sits below */
.options-logo .opt-logo-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  border-radius: 10px;
}

.options-logo .opt-logo {
  width: 78%;
  height: 78%;
  object-fit: contain;
}

.opt-name-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Answer state styles */
.option-card.correct {
  background: var(--success-dim);
  border-color: var(--success);
  box-shadow: 0 0 18px rgba(67,233,123,0.35);
  animation: correctPop 0.35s var(--ease);
}

.option-card.wrong {
  background: var(--danger-dim);
  border-color: var(--danger);
  animation: wrongShake 0.4s var(--ease);
}

.option-card.dim {
  opacity: 0.35;
}

@keyframes correctPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.04); }
  100% { transform: scale(1); }
}

@keyframes wrongShake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-6px); }
  60%     { transform: translateX(6px); }
}

/* Keyboard hint */
.key-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
}

.key-hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: rgba(255,255,255,0.08);
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text);
}

/* ──────────────────────────────────────────────────────────────────────── */
/*  RESULTS SCREEN                                                          */
/* ──────────────────────────────────────────────────────────────────────── */

#screen-results { justify-content: flex-start; padding-top: 28px; overflow-y: auto; }

.results-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 520px;
  padding-bottom: 32px;
}

.rank-badge {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.final-score {
  font-size: 4rem;
  font-weight: 900;
  line-height: 1;
  animation: popIn 0.4s var(--ease);
}

.final-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: -10px;
}

.result-message {
  max-width: 420px;
  margin-top: -8px;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.4;
  text-align: center;
}

.result-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Breakdown table */
.breakdown {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.br-row {
  display: grid;
  grid-template-columns: 28px 28px 1fr 22px 44px 32px;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--card-border);
  font-size: 0.8rem;
}
.br-row:last-child { border-bottom: none; }
.br-row.br-correct { background: rgba(67,233,123,0.05); }
.br-row.br-wrong   { background: rgba(245,54,92,0.05);  }

.br-num   { color: var(--text-muted); font-size: 0.72rem; font-weight: 700; }
.br-logo  { width: 22px; height: 22px; object-fit: contain; border-radius: 4px; }
.br-detail { min-width: 0; }
.br-name  { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-answer { display: block; color: var(--text-muted); font-size: 0.68rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-mode  { font-size: 0.75rem; }
.br-time  { color: var(--text-muted); font-size: 0.75rem; text-align: right; }
.br-pts   { text-align: right; color: var(--success); font-size: 0.8rem; }
.br-row.br-wrong .br-pts { color: var(--text-muted); }

.results-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ──────────────────────────────────────────────────────────────────────── */
/*  HISTORY SCREEN                                                          */
/* ──────────────────────────────────────────────────────────────────────── */

#screen-history { justify-content: flex-start; padding-top: 20px; overflow-y: auto; }
#screen-leaderboard { justify-content: flex-start; padding-top: 20px; overflow-y: auto; }

.history-inner,
.leaderboard-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 560px;
  padding-bottom: 32px;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.history-header h2 { font-size: 1.1rem; font-weight: 700; }

#history-list { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.leaderboard-list { display: flex; flex-direction: column; gap: 10px; width: 100%; }

.leaderboard-note {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 44px 40px 1fr 72px;
  gap: 10px;
  align-items: center;
  padding: 13px 16px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
}
.leaderboard-row.is-highlighted { border-color: var(--warning); box-shadow: 0 0 0 1px rgba(255,210,63,0.25); }

.leaderboard-rank { color: var(--warning); font-weight: 800; }
.leaderboard-avatar {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  font-size: 0.9rem;
  font-weight: 800;
}
.leaderboard-player { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.leaderboard-score { text-align: right; color: var(--success); font-weight: 800; }
.leaderboard-meta { grid-column: 3 / 5; color: var(--text-muted); font-size: 0.72rem; }

.history-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.history-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.history-summary::-webkit-details-marker { display: none; }
details[open] .history-summary { border-bottom: 1px solid var(--card-border); }

.hs-emoji { font-size: 1.4rem; flex-shrink: 0; }

.hs-info { flex: 1; min-width: 0; }
.hs-score { font-size: 0.9rem; font-weight: 700; }
.hs-score em { font-style: normal; color: var(--text-muted); font-weight: 500; font-size: 0.82rem; }
.hs-meta  { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.hs-arrow { font-size: 1.1rem; color: var(--text-muted); transition: transform 0.2s; }
details[open] .hs-arrow { transform: rotate(90deg); }

.history-detail {
  padding: 6px 0;
}

.hd-row {
  display: grid;
  grid-template-columns: 24px 1fr 22px 52px 28px;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  font-size: 0.78rem;
}
.hd-row.hd-ok   { color: var(--text); }
.hd-row.hd-fail { color: var(--text-muted); }
.hd-q    { font-weight: 700; color: var(--text-muted); }
.hd-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.hd-mode { font-size: 0.72rem; }
.hd-time { color: var(--text-muted); font-size: 0.72rem; text-align: right; }
.hd-pts  { text-align: right; font-weight: 700; color: var(--success); }
.hd-row.hd-fail .hd-pts { color: var(--danger); }

/* Empty history */
.empty-history {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
}
.empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-sub  { font-size: 0.82rem; margin-top: 6px; color: var(--text-muted); opacity: 0.6; }

.player-entry {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.player-entry label {
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.player-entry input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font: inherit;
}

.avatar-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.avatar-entry input {
  padding: 10px 12px;
}

.avatar-entry input[readonly] {
  cursor: default;
}

.avatar-entry input.is-saved-feedback {
  border-color: var(--success);
  box-shadow: 0 0 0 2px rgba(67,233,123,0.22);
}

.avatar-presets {
  display: flex;
  flex-wrap: nowrap;
  gap: 7px;
  margin-top: 2px;
  align-items: center;
}

.avatar-choice {
  min-width: 32px;
  min-height: 32px;
  padding: 2px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 1.34rem;
  line-height: 1;
  transition: transform 0.15s var(--ease), box-shadow 0.15s, border-color 0.15s;
}

.avatar-choice:hover {
  transform: translateY(-1px) scale(1.08);
}

.avatar-choice:first-child {
  padding-inline: 9px;
  border-color: var(--card-border);
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.avatar-choice.is-active {
  border-color: var(--warning);
  box-shadow: 0 0 0 2px rgba(255,209,102,0.28);
}

.logo-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 8px;
  color: var(--text);
  text-align: center;
  font-weight: 800;
  line-height: 1.15;
}

.opt-logo-fallback {
  font-size: clamp(0.64rem, 2.5vw, 0.82rem);
  overflow-wrap: anywhere;
}

.name-help,
.leaderboard-submit-status,
.share-status {
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

/* ──────────────────────────────────────────────────────────────────────── */
/*  Pack selector                                                           */
/* ──────────────────────────────────────────────────────────────────────── */

.pack-selector {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 720px;
}

.pack-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 12px;
  background: var(--card);
  border: 2px solid var(--card-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.15s var(--ease), border-color 0.15s, box-shadow 0.15s;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

.pack-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(124,106,240,0.25);
}

.pack-card.is-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(124,106,240,0.25);
}

.pack-card:active { transform: scale(0.97); }

.pack-card.pack-disney:hover {
  border-color: #06b6d4;
  box-shadow: 0 8px 24px rgba(6,182,212,0.25);
}

.pack-icon  { font-size: 2rem; }
.pack-name  { font-size: 1rem; font-weight: 700; }
.pack-desc  { font-size: 0.7rem; color: var(--text-muted); text-align: center; line-height: 1.4; }
.selected-pack {
  margin-top: -8px;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-align: center;
}

/* ──────────────────────────────────────────────────────────────────────── */
/*  Loading screen                                                          */
/* ──────────────────────────────────────────────────────────────────────── */

#screen-loading { gap: 20px; }

.loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 240px;
}

.loading-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-msg {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

.loading-bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 99px;
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
  transition: width 0.3s var(--ease);
  width: 0%;
}

/* ──────────────────────────────────────────────────────────────────────── */
/*  Disney-specific                                                         */
/* ──────────────────────────────────────────────────────────────────────── */

/* Characters can be portrait images — allow taller prompt area */
.prompt-logo.disney-char {
  width: min(140px, 34vw);
  height: min(175px, 44vw);
  object-fit: contain;
  padding: 4px;
}

/* Disney option cards — portrait aspect ratio */
.options-logo.disney .option-card {
  min-width: 108px;
}
.options-logo.disney .opt-logo-wrap {
  aspect-ratio: 3 / 4;
}
.options-logo.disney .opt-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Film mode shows char name under the image */
.prompt-film-char {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: center;
}

/* ──────────────────────────────────────────────────────────────────────── */
/*  Results — switch pack button                                            */
/* ──────────────────────────────────────────────────────────────────────── */

.results-actions { flex-wrap: wrap; }

/* ──────────────────────────────────────────────────────────────────────── */
/*  Utility                                                                 */
/* ──────────────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Pause overlay ──────────────────────────────────────────────────────── */
.pause-overlay {
  position: absolute;
  inset: 0;
  background: rgba(13, 13, 26, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.pause-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.pause-icon {
  font-size: 3.5rem;
  line-height: 1;
}

.pause-title {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.25em;
  color: var(--warning);
}

.pause-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Pause HUD button ────────────────────────────────────────────────────── */
.pause-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.55;
  padding: 4px 6px;
  border-radius: 8px;
  transition: opacity 0.15s, background 0.15s;
  color: var(--text);
  line-height: 1;
}

.pause-btn:hover {
  opacity: 1;
  background: rgba(255,255,255,0.08);
}

/* ── Scoring hint (start screen) ─────────────────────────────────────────── */
.scoring-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
  letter-spacing: 0.01em;
}

/* ──────────────────────────────────────────────────────────────────────── */
/*  Responsive tweaks                                                       */
/* ──────────────────────────────────────────────────────────────────────── */
@media (max-width: 380px) {
  .game-title { font-size: 2.2rem; }
  .hud { gap: 6px; padding-inline: 10px; }
  .q-counter { font-size: 0.68rem; }
  .hud-pack { max-width: 34vw; padding: 6px 8px; font-size: 0.68rem; }
  .score-value { font-size: 1.25rem; }
  .pack-selector { grid-template-columns: 1fr; }
  .options-logo .option-card { width: calc(33.333% - 6px); min-width: 86px; }
  .br-row { grid-template-columns: 24px 24px 1fr 20px 38px 28px; gap: 5px; padding: 8px 10px; }
  .question-feedback { font-size: 0.76rem; }
}

@media (max-height: 760px) {
  .screen { padding-top: 12px; padding-bottom: 12px; }
  .start-inner { gap: 10px; }
  .logo-parade { gap: 8px; margin-bottom: 0; }
  .parade-item { width: 42px; height: 42px; border-radius: 12px; }
  .parade-item img { width: 30px; height: 30px; }
  .parade-item:nth-child(n + 7) { display: none; }
  .game-title { font-size: 2.35rem; }
  .subtitle { font-size: 0.86rem; }
  .pack-card { padding: 14px 10px; }
  .input-hints,
  .scoring-hint { font-size: 0.72rem; }
}

@media (max-height: 720px) {
  .hud { padding: 10px 14px 8px; }
  .hud-pack { max-width: 32vw; padding: 6px 9px; font-size: 0.72rem; }
  .question-stage { gap: 7px; padding: 10px 12px 12px; }
  .prompt { min-height: 82px; }
  .prompt-logo { width: min(92px, 28vw); height: min(92px, 28vw); }
  .timer-wrap { width: 54px; height: 54px; }
  .question-feedback { min-height: 1.2em; font-size: 0.76rem; }
  .options { gap: 6px; }
  .option-card { padding: 9px 12px; font-size: 0.86rem; }
  .options-logo .option-card { min-width: 82px; padding: 6px; gap: 5px; }
  .key-hint { display: none; }
}

@media (min-height: 800px) {
  .shuffle-slot { width: 220px; height: 220px; }
  .prompt-logo  { width: 150px; height: 150px; }
  .timer-wrap   { width: 80px; height: 80px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .parade-item,
  .mic-meter.active .bar,
  .loading-spinner {
    animation: none !important;
  }
}

/* ──────────────────────────────────────────────────────────────────────── */
/*  Admin page                                                              */
/* ──────────────────────────────────────────────────────────────────────── */
.admin-body {
  min-height: 100dvh;
  overflow: auto;
}

.admin-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.admin-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.2);
}

.admin-login {
  max-width: 560px;
  margin: 15vh auto 0;
}

.admin-kicker {
  color: var(--warning);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.admin-card h1,
.admin-card h2,
.admin-header h1 {
  margin-top: 6px;
}

.admin-muted {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
  margin-top: 8px;
}

.admin-login label {
  display: block;
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-login-row {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.admin-login-row input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font: inherit;
}

.admin-error {
  min-height: 1.4em;
  margin-top: 10px;
  color: var(--danger);
  font-size: 0.84rem;
}

.admin-dashboard {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.admin-stat {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.admin-stat strong {
  display: block;
  font-size: 1.8rem;
  color: var(--text);
}

.admin-stat span {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.admin-controls {
  display: grid;
  grid-template-columns: minmax(150px, 180px) minmax(170px, 210px) minmax(300px, 1fr) minmax(96px, 120px);
  gap: 12px;
  align-items: end;
}

.admin-controls label {
  display: grid;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-controls input,
.admin-controls select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font: inherit;
  text-transform: none;
  letter-spacing: normal;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.admin-tab {
  flex: 0 0 auto;
  padding: 10px 14px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: rgba(255,255,255,0.03);
  color: var(--text-muted);
  font-weight: 800;
  cursor: pointer;
}

.admin-tab.is-active {
  border-color: var(--primary);
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(124,106,240,0.25);
}

.admin-panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.admin-panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.admin-table-wrap {
  margin-top: 12px;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.admin-table th,
.admin-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--card-border);
  text-align: left;
  white-space: nowrap;
}

.admin-table th {
  color: var(--text-muted);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-sort {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.admin-table td:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-avatar {
  width: 28px;
  height: 28px;
  font-size: 0.78rem;
}

.admin-logo-thumb {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(255,255,255,0.92);
  padding: 5px;
}

.admin-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.admin-chip.is-easy {
  color: #bbf7d0;
  background: rgba(34,197,94,0.14);
}

.admin-chip.is-medium {
  color: #fde68a;
  background: rgba(245,158,11,0.14);
}

.admin-chip.is-hard {
  color: #fecaca;
  background: rgba(239,68,68,0.14);
}

.admin-chip.is-review {
  color: #fda4af;
  background: rgba(244,63,94,0.2);
}

@media (max-width: 900px) {
  .admin-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-controls label:nth-child(3) { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .admin-controls { grid-template-columns: 1fr; }
  .admin-controls label:nth-child(3) { grid-column: auto; }
}

@media (max-width: 760px) {
  .admin-grid { grid-template-columns: 1fr; }
  .admin-login-row,
  .admin-header,
  .admin-panel-header { flex-direction: column; }
  .admin-panel-actions { justify-content: flex-start; }
}
