@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --primary: #6366f1;
  --primary-h: #4f46e5;
  --primary-soft: rgba(99,102,241,.15);
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 14px;
  --shadow: 0 4px 24px rgba(0,0,0,.08);
}

[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --primary-soft: rgba(99,102,241,.25);
}

[data-theme="galaxy"] {
  --bg: #030712;
  --surface: #111827;
  --border: #1f2937;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --primary: #a78bfa;
  --primary-h: #7c3aed;
  --primary-soft: rgba(167,139,250,.2);
}

[data-theme="neon"] {
  --bg: #050505;
  --surface: #0d0d0d;
  --border: #1a1a1a;
  --text: #00ff88;
  --text-muted: #00cc66;
  --primary: #00ff88;
  --primary-h: #00cc66;
  --primary-soft: rgba(0,255,136,.15);
  --success: #00ff88;
  --danger: #ff3366;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Outfit', system-ui, sans-serif;
  background-color: var(--bg);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .3s, color .3s;
}

/* Pulsing judge buttons when buzzer is locked */
.btn-pulse { animation: btn-pulse 1.2s ease-in-out infinite; }
@keyframes btn-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(99,102,241,.5); }
  50%      { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(99,102,241,0); }
}

/* ── Live reactions ─────────────────────────────────────────────── */
.reactions-bar {
  position: fixed;
  bottom: .75rem;
  right: .75rem;
  display: flex;
  gap: .25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .3rem .5rem;
  box-shadow: 0 6px 24px rgba(0,0,0,.18);
  z-index: 95;
  backdrop-filter: blur(8px);
}
.reaction-btn {
  background: transparent;
  border: none;
  font-size: 1.45rem;
  padding: .2rem .35rem;
  cursor: pointer;
  border-radius: 50%;
  line-height: 1;
  transition: transform .12s, background .12s;
  font-family: inherit;
}
.reaction-btn:hover { transform: scale(1.18); background: var(--bg); }
.reaction-btn:active { transform: scale(.92); }
.reaction-pop { animation: reaction-pop .32s ease-out; }
@keyframes reaction-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.6); }
  100% { transform: scale(1); }
}

.reactions-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 85;
}
.floating-reaction {
  position: absolute;
  bottom: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  animation-name: float-up;
  animation-timing-function: cubic-bezier(.2,.65,.4,1);
  animation-fill-mode: forwards;
  will-change: transform, opacity;
  user-select: none;
}
.float-emoji {
  font-size: calc(2.6rem * var(--scale, 1));
  filter: drop-shadow(0 0 12px var(--color, currentColor))
          drop-shadow(0 4px 12px rgba(0,0,0,.4));
  display: block;
  line-height: 1;
}
.float-name {
  font-size: .8rem;
  font-weight: 800;
  background: rgba(0,0,0,.55);
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

.reactions-layer-projector .float-emoji { font-size: calc(5rem * var(--scale, 1)); }
.reactions-layer-projector .float-name  { font-size: 1rem; padding: 3px 12px; }

@keyframes float-up {
  0%   { transform: translate(0, 0) rotate(0); opacity: 0; }
  8%   { opacity: 1; }
  100% {
    transform: translate(var(--drift-x, 0), -85vh) rotate(var(--tilt, 0));
    opacity: 0;
  }
}

@media (max-width: 640px) {
  .reactions-bar { bottom: .5rem; right: .5rem; padding: .25rem .35rem; }
  .reaction-btn  { font-size: 1.25rem; padding: .15rem .25rem; }
}

/* ── Screens ── */
.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.hidden { display: none !important; }

/* ── Glass card ── */
.glass-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1.2rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  transition: all .18s;
}

.btn:hover { opacity: .88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-ghost   { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-sm      { padding: .35rem .75rem; font-size: .82rem; border-radius: 7px; }
.btn-lg      { padding: .85rem 2rem; font-size: 1.1rem; border-radius: 12px; }
.btn-icon    { padding: .5rem; border-radius: 8px; aspect-ratio: 1; }
.btn-full    { width: 100%; justify-content: center; }

/* ── Inputs ── */
input, textarea, select {
  font-family: inherit;
  font-size: .95rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 9px;
  padding: .55rem .9rem;
  color: var(--text);
  width: 100%;
  transition: border-color .18s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
}
label { font-size: .85rem; font-weight: 600; color: var(--text-muted); display: block; margin-bottom: .3rem; }

/* ── Screen Lobby ── */
#screen-lobby { gap: 1.5rem; }
.lobby-logo   { font-size: 2.8rem; font-weight: 900; color: var(--primary); letter-spacing: -1px; }
.lobby-sub    { color: var(--text-muted); font-size: 1rem; margin-top: .25rem; }
.lobby-card   { width: 100%; max-width: 420px; }
.code-input   { font-size: 2rem; text-align: center; font-weight: 800; letter-spacing: .3rem; text-transform: uppercase; }
.lobby-actions { display: flex; flex-direction: column; gap: .75rem; }
.lobby-divider { display: flex; align-items: center; gap: .75rem; color: var(--text-muted); font-size: .82rem; }
.lobby-divider::before, .lobby-divider::after { content:''; flex:1; height:1px; background:var(--border); }

/* ── Screen Setup ── */
#screen-setup { gap: 1rem; }
.setup-card   { width: 100%; max-width: 420px; }
.avatar-grid  { display: grid; grid-template-columns: repeat(6,1fr); gap: .4rem; margin: .5rem 0; }
.avatar-btn   {
  font-size: 1.5rem; padding: .3rem; border-radius: 8px; border: 2px solid transparent;
  background: var(--bg); cursor: pointer; transition: all .15s;
}
.avatar-btn.selected { border-color: var(--primary); background: var(--primary-soft); }
.color-strip  { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0; }
.color-dot    {
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  border: 3px solid transparent; transition: border-color .15s;
}
.color-dot.selected { border-color: var(--text); }
.team-toggle  { display: flex; gap: .5rem; }
.team-btn     {
  flex: 1; padding: .5rem; border-radius: 9px; border: 2px solid var(--border);
  background: var(--bg); color: var(--text-muted); cursor: pointer; font-weight: 600;
  font-family: inherit; transition: all .18s;
}
.team-btn.selected { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }

/* ── Screen Game ── */
#screen-game  { padding: 0; align-items: stretch; justify-content: flex-start; }

.topbar {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.topbar-code  { font-weight: 800; font-size: 1.1rem; letter-spacing: .1rem; color: var(--primary); }
.topbar-prog  { flex: 1; text-align: center; font-size: .85rem; color: var(--text-muted); }

/* Timer ring */
.timer-ring-wrap { position: relative; width: 44px; height: 44px; flex-shrink: 0; }
.timer-ring svg  { transform: rotate(-90deg); }
.timer-ring-bg   { fill: none; stroke: var(--border); stroke-width: 3; }
.timer-ring-fg   { fill: none; stroke: var(--primary); stroke-width: 3; stroke-linecap: round; transition: stroke-dashoffset .9s linear; }
.timer-ring-num  {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700;
}

/* HUD */
.hud {
  display: flex; gap: 1rem; padding: .6rem 1rem;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.hud-item { text-align: center; }
.hud-val  { font-size: 1.3rem; font-weight: 800; color: var(--primary); }
.hud-lbl  { font-size: .7rem; color: var(--text-muted); font-weight: 600; }

/* Question card */
.game-content    { flex: 1; padding: 1rem; display: flex; flex-direction: column; gap: 1rem; overflow-y: auto; }
.question-card   { }
.q-badges        { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .75rem; }
.badge           {
  font-size: .72rem; font-weight: 700; padding: .2rem .55rem; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary);
}
.badge-cat   { background: rgba(16,185,129,.12); color: var(--success); }
.badge-diff  { background: rgba(245,158,11,.12); color: var(--warning); }
.q-image     { width: 100%; border-radius: 10px; max-height: 220px; object-fit: cover; margin-bottom: .75rem; }
.q-audio     { width: 100%; margin-bottom: .75rem; }
.q-yt-wrap   { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: 10px; margin-bottom: .75rem; }
.q-yt-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; border-radius: 10px; }
/* Audio-only: position the iframe off-screen so audio still plays but video is invisible */
.q-yt-hidden {
  position: fixed !important;
  top: -10000px !important;
  left: -10000px !important;
  width: 320px !important;
  height: 180px !important;
  padding-bottom: 0 !important;
  margin: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.q-yt-hidden iframe {
  width: 320px !important;
  height: 180px !important;
}
.eq-bars     { display: flex; align-items: flex-end; gap: 3px; height: 40px; margin-bottom: .75rem; }
.eq-bar      {
  width: 5px; background: var(--primary); border-radius: 2px;
  animation: eq-anim 0.8s ease-in-out infinite alternate;
}
.eq-bar:nth-child(1) { height: 60%; animation-delay: 0s; }
.eq-bar:nth-child(2) { height: 90%; animation-delay: .1s; }
.eq-bar:nth-child(3) { height: 50%; animation-delay: .2s; }
.eq-bar:nth-child(4) { height: 80%; animation-delay: .15s; }
.eq-bar:nth-child(5) { height: 40%; animation-delay: .3s; }
@keyframes eq-anim { to { height: 100%; } }

.q-text      { font-size: 1.25rem; font-weight: 700; line-height: 1.4; margin-bottom: 1rem; }
.q-answer-reveal { background: var(--primary-soft); border: 1px solid var(--primary); border-radius: 9px; padding: .6rem 1rem; color: var(--primary); font-weight: 700; }

/* Quiz options */
.quiz-opts   { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.quiz-opt    {
  display: flex; align-items: center; gap: .65rem;
  background: var(--bg); border: 2px solid var(--border);
  border-radius: 10px; padding: .7rem .9rem; cursor: pointer;
  font-family: inherit; font-size: .95rem; font-weight: 600; color: var(--text);
  transition: all .18s; text-align: left;
}
.quiz-opt:disabled { opacity: .5; cursor: not-allowed; }
.quiz-opt:not(:disabled):hover { border-color: var(--primary); background: var(--primary-soft); }
.quiz-opt .opt-letter {
  width: 26px; height: 26px; border-radius: 7px; display: flex; align-items: center;
  justify-content: center; font-size: .78rem; font-weight: 800;
  background: var(--border); color: var(--text-muted); flex-shrink: 0;
}
.quiz-opt.selected { border-color: var(--primary); background: var(--primary-soft); }
.quiz-opt.selected .opt-letter { background: var(--primary); color: #fff; }
.quiz-opt.correct { border-color: var(--success); background: rgba(16,185,129,.12); }
.quiz-opt.correct .opt-letter { background: var(--success); color: #fff; }
.quiz-opt.wrong   { border-color: var(--danger);  background: rgba(239,68,68,.1); }
.quiz-opt.wrong   .opt-letter { background: var(--danger); color: #fff; }

/* Status msg */
.status-msg { text-align: center; font-weight: 600; color: var(--text-muted); padding: .5rem; }

/* Countdown overlay */
.countdown-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 300; backdrop-filter: blur(4px);
}
.countdown-number {
  font-size: 8rem; font-weight: 900; color: #fff;
  animation: countdown-pop .4s ease-out;
}
@keyframes countdown-pop {
  from { transform: scale(1.8); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* Buzzer button */
.buzzer-wrap { display: flex; justify-content: center; padding: 1rem 0; }
.buzzer {
  width: 160px; height: 160px; border-radius: 50%;
  background: linear-gradient(135deg, var(--danger) 0%, #b91c1c 100%);
  box-shadow: 0 0 0 10px rgba(239,68,68,.2), 0 12px 40px rgba(239,68,68,.4);
  border: none; color: #fff; font-size: 1.5rem; font-weight: 900;
  cursor: pointer; font-family: inherit;
  transition: all .15s; user-select: none;
}
.buzzer:active { transform: scale(.93); box-shadow: 0 0 0 4px rgba(239,68,68,.2), 0 4px 16px rgba(239,68,68,.3); }
.buzzer:disabled { opacity: .4; cursor: not-allowed; }
.buzzer.open { animation: buzzer-pulse 1s ease-in-out infinite; }
@keyframes buzzer-pulse {
  0%,100% { box-shadow: 0 0 0 10px rgba(239,68,68,.2), 0 12px 40px rgba(239,68,68,.4); }
  50%      { box-shadow: 0 0 0 20px rgba(239,68,68,.1), 0 16px 50px rgba(239,68,68,.5); }
}

/* Buzzer overlay */
.buzzer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.8);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 200; gap: 1rem;
}
.buzzer-overlay-avatar { font-size: 4rem; }
.buzzer-overlay-name   { font-size: 2rem; font-weight: 800; color: #fff; }
.buzzer-overlay-sub    { color: rgba(255,255,255,.7); }

/* Score delta */
.score-delta {
  position: fixed; top: 30%; left: 50%; transform: translateX(-50%);
  font-size: 2.5rem; font-weight: 900; z-index: 400;
  animation: delta-anim 1.5s ease-out forwards;
}
.score-delta.pos { color: var(--success); }
.score-delta.neg { color: var(--danger); }
@keyframes delta-anim {
  0%   { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-80px); }
}

/* ── Projector screen ── */
#screen-projector {
  padding: 0; flex-direction: row; align-items: stretch;
  justify-content: flex-start; min-height: 100vh;
}
.proj-sidebar {
  width: 280px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow-y: auto;
}
.proj-sidebar-title { padding: 1rem; font-size: 1rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05rem; }
.proj-player-row {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem 1rem; border-bottom: 1px solid var(--border);
}
.proj-player-rank { font-size: .75rem; font-weight: 800; color: var(--text-muted); width: 20px; }
.proj-player-avatar { font-size: 1.4rem; }
.proj-player-name   { flex: 1; font-weight: 600; font-size: .9rem; }
.proj-player-score  { font-weight: 800; color: var(--primary); }
.proj-team-scores   { padding: .75rem 1rem; display: flex; gap: .5rem; }
.proj-team-card     { flex: 1; border-radius: 9px; padding: .5rem; text-align: center; background: var(--bg); }
.proj-team-name     { font-size: .72rem; font-weight: 700; color: var(--text-muted); }
.proj-team-pts      { font-size: 1.4rem; font-weight: 900; color: var(--primary); }
.proj-log           { flex: 1; overflow-y: auto; padding: .5rem 1rem; }
.proj-log-entry     { font-size: .78rem; padding: .3rem 0; border-bottom: 1px solid var(--border); color: var(--text-muted); }

.proj-main     { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.proj-header   { padding: .75rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 1rem; }
.proj-title    { font-size: 1.5rem; font-weight: 900; color: var(--primary); flex: 1; }
.proj-status-badge {
  padding: .3rem .9rem; border-radius: 999px; font-size: .82rem; font-weight: 700;
  background: var(--primary-soft); color: var(--primary);
}

.proj-timer-bar-wrap { padding: 0 1.5rem; margin-top: .5rem; }
.proj-timer-num  { font-size: 3rem; font-weight: 900; text-align: center; color: var(--primary); line-height: 1; }
.proj-timer-bar  {
  height: 10px; border-radius: 5px; background: var(--border); margin-top: .4rem; overflow: hidden;
}
.proj-timer-fill {
  height: 100%; border-radius: 5px; background: var(--primary);
  transition: width .9s linear;
}

.proj-content  { flex: 1; padding: 1.5rem; overflow-y: auto; }
.proj-q-text   { font-size: 1.8rem; font-weight: 800; line-height: 1.3; margin-bottom: 1.5rem; }
.proj-quiz-opts { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.proj-quiz-opt  {
  border-radius: 12px; border: 2px solid var(--border); padding: .75rem 1rem;
  display: flex; align-items: center; gap: .75rem; font-size: 1.05rem; font-weight: 600;
  background: var(--bg);
}
.proj-quiz-opt .opt-letter {
  width: 32px; height: 32px; border-radius: 8px; background: var(--border);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .85rem;
}
.proj-opt-bar-wrap { flex: 1; }
.proj-opt-bar  { height: 6px; border-radius: 3px; background: var(--primary); transition: width .5s ease; }
.proj-opt-count { font-size: .8rem; color: var(--text-muted); }
.proj-quiz-opt.correct { border-color: var(--success); background: rgba(16,185,129,.1); }
.proj-quiz-opt.correct .opt-letter { background: var(--success); color: #fff; }

.proj-answer   { margin-top: 1rem; background: var(--primary-soft); border: 1.5px solid var(--primary); border-radius: 10px; padding: .75rem 1.25rem; font-size: 1.2rem; font-weight: 800; color: var(--primary); }
.proj-buzz-banner {
  padding: .5rem 1.5rem; background: rgba(239,68,68,.1); border-top: 1px solid rgba(239,68,68,.3);
  font-weight: 700; color: var(--danger);
}

/* ── Podium ── */
#screen-podium { gap: 2rem; padding: 2rem; }
.podium-title   { font-size: 2.5rem; font-weight: 900; text-align: center; }
.podium-wrap    { display: flex; align-items: flex-end; gap: 1rem; justify-content: center; margin: 1rem 0; }
.podium-step    { display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.podium-step-bar {
  width: 100px; border-radius: 8px 8px 0 0;
  background: linear-gradient(to top, var(--primary), var(--primary-h));
}
.podium-step:nth-child(1) .podium-step-bar { height: 120px; background: linear-gradient(to top, #f59e0b, #d97706); }
.podium-step:nth-child(2) .podium-step-bar { height: 180px; }
.podium-step:nth-child(3) .podium-step-bar { height: 80px; background: linear-gradient(to top, #94a3b8, #64748b); }
.podium-rank   { font-size: 1.5rem; font-weight: 900; }
.podium-avatar { font-size: 2.5rem; }
.podium-name   { font-weight: 700; font-size: .95rem; }
.podium-score  { font-weight: 900; color: var(--primary); font-size: 1.1rem; }

/* ── Admin dock ── */
.admin-dock {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--surface);
  border-top: 2px solid var(--primary);
  box-shadow: 0 -4px 24px rgba(0,0,0,.15);
  transition: transform .3s;
}
.admin-dock.collapsed { transform: translateY(calc(100% - 42px)); }
.dock-handle {
  display: flex; align-items: center; gap: .75rem; padding: .5rem 1rem;
  cursor: pointer; border-bottom: 1px solid var(--border);
  background: var(--primary); color: #fff;
}
.dock-handle-title { font-weight: 700; font-size: .9rem; flex: 1; }
.dock-tabs {
  display: flex; border-bottom: 1px solid var(--border); overflow-x: auto;
}
.dock-tab {
  padding: .55rem 1rem; font-size: .82rem; font-weight: 700; color: var(--text-muted);
  border: none; background: none; cursor: pointer; font-family: inherit;
  border-bottom: 2px solid transparent; white-space: nowrap;
  transition: all .18s;
}
.dock-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.dock-panel { padding: 1rem; max-height: 45vh; overflow-y: auto; }
.dock-panel.hidden { display: none; }

.control-row   { display: flex; gap: .5rem; margin-bottom: .75rem; flex-wrap: wrap; }
.answer-key-box {
  background: rgba(16,185,129,.1); border: 1px solid var(--success); border-radius: 9px;
  padding: .5rem 1rem; font-weight: 700; color: var(--success); margin-bottom: .75rem;
  font-size: 1.1rem;
}

/* Question form */
.q-type-toggle { display: flex; gap: .5rem; margin-bottom .75rem; }
.q-type-btn    {
  flex: 1; padding: .45rem; border-radius: 8px; border: 2px solid var(--border);
  background: var(--bg); font-weight: 700; cursor: pointer; font-family: inherit;
  font-size: .85rem; color: var(--text-muted); transition: all .18s;
}
.q-type-btn.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }

.options-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.opt-row       { display: flex; align-items: center; gap: .4rem; }
.opt-row input[type="radio"] { width: auto; flex-shrink: 0; }

.q-list        { display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; }
.q-item        {
  display: flex; align-items: center; gap: .5rem;
  background: var(--bg); border: 1px solid var(--border); border-radius: 9px; padding: .5rem .75rem;
}
.q-item-num    { font-size: .75rem; font-weight: 800; color: var(--text-muted); min-width: 22px; }
.q-item-type   { font-size: .72rem; padding: .1rem .4rem; border-radius: 5px; background: var(--primary-soft); color: var(--primary); }
.q-item-text   { flex: 1; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-item-actions { display: flex; gap: .25rem; flex-shrink: 0; }

/* Bank */
.bank-list  { display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; }
.bank-item  { display: flex; align-items: center; gap: .5rem; background: var(--bg); border: 1px solid var(--border); border-radius: 9px; padding: .5rem .75rem; }
.bank-name  { flex: 1; font-weight: 600; }
.bank-count { font-size: .8rem; color: var(--text-muted); }

/* Players tab */
.player-list   { display: flex; flex-direction: column; gap: .5rem; }
.player-item   {
  display: flex; align-items: center; gap: .65rem;
  background: var(--bg); border: 1px solid var(--border); border-radius: 9px; padding: .5rem .75rem;
}
.player-avatar {
  font-size: 1.25rem;
  border: 3px solid currentColor;
  border-radius: 50%;
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--surface);
}
.proj-player-avatar {
  border: 3px solid currentColor;
  border-radius: 50%;
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.podium-avatar {
  border: 4px solid currentColor;
  border-radius: 50%;
  width: 56px; height: 56px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface);
}
.player-info   { flex: 1; }
.player-name   { font-weight: 700; font-size: .9rem; }
.player-stats  { font-size: .72rem; color: var(--text-muted); }
.player-score  { font-weight: 900; color: var(--primary); font-size: 1.1rem; }
.player-actions { display: flex; gap: .25rem; }

/* Import */
.import-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: .75rem; }
.import-row > * { flex: 1; min-width: 120px; }

/* Activity log */
.log-panel { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: .3rem; }
.log-entry { font-size: .82rem; color: var(--text-muted); padding: .25rem 0; border-bottom: 1px solid var(--border); }

/* ── Admin Dashboard screen ── */
#screen-admin-dashboard { align-items: flex-start; padding: 2rem; gap: 1.5rem; }
.dashboard-title { font-size: 2rem; font-weight: 900; }
.rooms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; width: 100%; }
.room-card  { display: flex; flex-direction: column; gap: .4rem; }
.room-code  { font-size: 1.5rem; font-weight: 900; color: var(--primary); }
.room-stat  { font-size: .85rem; color: var(--text-muted); }

/* ── Toast ── */
.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 500; display: flex; flex-direction: column; gap: .5rem; }
.toast {
  min-width: 240px; padding: .75rem 1.25rem; border-radius: 10px;
  font-size: .9rem; font-weight: 600; box-shadow: 0 4px 20px rgba(0,0,0,.15);
  animation: toast-in .3s ease-out;
}
.toast.info    { background: var(--surface); border-left: 4px solid var(--primary); color: var(--text); }
.toast.success { background: rgba(16,185,129,.12); border-left: 4px solid var(--success); color: var(--success); }
.toast.error   { background: rgba(239,68,68,.1);  border-left: 4px solid var(--danger);  color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } }
@keyframes toast-out { to   { opacity: 0; transform: translateX(20px); } }

/* ── Confetti ── */
.confetti-piece {
  position: fixed; width: 10px; height: 10px; border-radius: 2px;
  top: -10px; animation: confetti-fall linear forwards;
  z-index: 9999; pointer-events: none;
}
@keyframes confetti-fall {
  0%   { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ── Admin small badges (non-blocking) ── */
.admin-countdown-badge {
  position: fixed;
  top: 70px; left: 50%; transform: translateX(-50%);
  background: var(--warning); color: #fff;
  padding: .55rem 1.2rem; border-radius: 999px;
  font-weight: 800; font-size: 1.1rem;
  box-shadow: 0 6px 24px rgba(245,158,11,.4);
  z-index: 110; animation: countdown-pop .35s ease-out;
}

.admin-buzz-banner {
  position: fixed;
  top: 70px; left: 50%; transform: translateX(-50%);
  background: var(--danger); color: #fff;
  padding: .55rem 1.2rem; border-radius: 999px;
  font-weight: 700; font-size: .95rem;
  box-shadow: 0 6px 24px rgba(239,68,68,.4);
  z-index: 110;
  animation: countdown-pop .35s ease-out;
  max-width: 90vw;
}

/* ── Login screen ── */
#screen-login { gap: 1rem; }
code {
  font-family: 'Courier New', monospace;
  font-size: .8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: .15rem .4rem;
  border-radius: 4px;
}

/* ── Auth bar ── */
#auth-bar .btn { font-size: .8rem; }

/* ── Misc ── */
.section-title { font-size: 1rem; font-weight: 800; margin-bottom: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05rem; }
.flex-gap { display: flex; gap: .5rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
hr    { border: none; border-top: 1px solid var(--border); margin: .75rem 0; }

/* ── Mobile ── */
@media (max-width: 640px) {
  .quiz-opts     { grid-template-columns: 1fr; }
  .proj-quiz-opts { grid-template-columns: 1fr; }
  #screen-projector { flex-direction: column; }
  .proj-sidebar  { width: 100%; height: 200px; border-right: none; border-bottom: 1px solid var(--border); }
  .admin-dock    { transform: translateY(calc(100% - 42px)); }
  .admin-dock.expanded { transform: none; }
  .buzzer        { width: 200px; height: 200px; font-size: 1.8rem; }
  .options-grid  { grid-template-columns: 1fr; }
}
