/* ================================================================
   AntiGravity Quiz — TV Viewer Stylesheet
   Dark industrial theme, optimized for 1920x1080
   ================================================================ */

/* ----------------------------------------------------------------
   CSS Custom Properties
   ---------------------------------------------------------------- */
:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111113;
  --bg-card: #161619;
  --bg-elevated: #1c1c20;
  --accent: #ff6b35;
  --accent-glow: rgba(255, 107, 53, 0.35);
  --accent-dim: #cc5529;
  --correct: #2ecc71;
  --wrong: #e74c3c;
  --warn: #f39c12;
  --text-primary: #eaeaea;
  --text-secondary: #8a8a8e;
  --text-dim: #555;
  --gold: #ffd700;
  --silver: #c0c0c0;
  --bronze: #cd7f32;
  --font-main: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Cascadia Code", "Fira Code", "Consolas", monospace;
  --radius: 12px;
  --radius-sm: 6px;
  --transition: 0.3s ease;
}

/* ----------------------------------------------------------------
   Reset & Base
   ---------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden {
  display: none !important;
}

/* ----------------------------------------------------------------
   Screens — stacked full-viewport, only .active is visible
   ---------------------------------------------------------------- */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  z-index: 1;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
}

/* ----------------------------------------------------------------
   Connection status bar
   ---------------------------------------------------------------- */
.connection-status {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  background: rgba(231, 76, 60, 0.9);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  animation: pulse-dot 1s ease infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ================================================================
   SCREEN: WAITING
   ================================================================ */
.waiting-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
}

.logo-block {
  text-align: center;
}

.logo-title {
  font-size: 80px;
  font-weight: 900;
  letter-spacing: 12px;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--accent) 0%, #ff9e6b 50%, var(--accent) 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 4s ease infinite;
}

@keyframes shimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.logo-subtitle {
  font-size: 22px;
  color: var(--text-secondary);
  letter-spacing: 4px;
  margin-top: 8px;
}

/* QR block */
.qr-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid rgba(255, 107, 53, 0.2);
}

.qr-label {
  font-size: 16px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.qr-image {
  width: 200px;
  height: 200px;
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 8px;
}

.qr-url {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
}

/* Waiting pulse */
.waiting-pulse {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 200px;
  height: 200px;
}

.pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  animation: pulse-expand 3s ease infinite;
}

.pulse-ring.delay-1 {
  animation-delay: 1s;
}

.pulse-ring.delay-2 {
  animation-delay: 2s;
}

@keyframes pulse-expand {
  0% { transform: scale(0.5); opacity: 0.6; }
  100% { transform: scale(1.5); opacity: 0; }
}

.waiting-text {
  position: relative;
  font-size: 18px;
  color: var(--text-secondary);
  text-align: center;
}

/* Teams lobby */
.teams-lobby {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  max-width: 800px;
}

.lobby-chip {
  padding: 10px 20px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 107, 53, 0.3);
  border-radius: 24px;
  font-size: 16px;
  color: var(--text-primary);
  opacity: 0;
  transform: scale(0.8);
}

.lobby-chip.chip-enter {
  animation: chip-in 0.4s ease forwards;
}

@keyframes chip-in {
  to { opacity: 1; transform: scale(1); }
}

/* ================================================================
   SCREEN: ROUND INTRO
   ================================================================ */
.round-intro-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  opacity: 0;
  transform: translateY(40px);
}

.round-intro-container.animate-in {
  animation: slide-up 0.6s ease forwards;
}

@keyframes slide-up {
  to { opacity: 1; transform: translateY(0); }
}

.round-number {
  font-size: 28px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 6px;
  color: var(--accent);
}

.round-title {
  font-size: 72px;
  font-weight: 900;
  text-align: center;
  max-width: 900px;
}

.round-type-badge {
  display: inline-block;
  padding: 8px 24px;
  border: 2px solid var(--accent);
  border-radius: 24px;
  font-size: 18px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
}

/* ================================================================
   SCREEN: QUESTION
   ================================================================ */
.question-layout {
  display: flex;
  align-items: flex-start;
  gap: 40px;
  width: 100%;
  max-width: 1720px;
  padding: 60px 80px;
  height: 100%;
}

.question-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.question-header {
  display: flex;
  gap: 16px;
  align-items: center;
}

.question-round-label,
.question-index-label {
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-secondary);
  padding: 4px 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
}

.question-index-label {
  color: var(--accent);
}

/* Media */
.question-media {
  max-height: 400px;
  overflow: hidden;
  border-radius: var(--radius);
}

.media-image {
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: var(--radius);
}

.media-video {
  max-width: 100%;
  max-height: 400px;
  border-radius: var(--radius);
}

/* Question text */
.question-text-block {
  padding: 24px 32px;
  background: var(--bg-card);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
}

.question-text {
  font-size: 36px;
  font-weight: 600;
  line-height: 1.4;
}

/* Options grid */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 8px;
}

.option {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: var(--bg-elevated);
  border: 2px solid transparent;
  border-radius: var(--radius);
  transition: all var(--transition);
}

.option-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 2px solid var(--text-dim);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.option-text {
  font-size: 24px;
  font-weight: 500;
}

.option.option-correct {
  border-color: var(--correct);
  background: rgba(46, 204, 113, 0.1);
}

.option.option-correct .option-letter {
  background: var(--correct);
  border-color: var(--correct);
  color: #fff;
}

.option.option-wrong {
  border-color: var(--wrong);
  background: rgba(231, 76, 60, 0.1);
}

.option.option-wrong .option-letter {
  background: var(--wrong);
  border-color: var(--wrong);
  color: #fff;
}

/* Timer column */
.timer-column {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 220px;
  padding-top: 80px;
}

.timer-container {
  position: relative;
  width: 200px;
  height: 200px;
}

.timer-svg {
  width: 200px;
  height: 200px;
  transform: rotate(-90deg);
}

.timer-bg {
  fill: none;
  stroke: var(--bg-elevated);
  stroke-width: 8;
}

.timer-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.9s linear, stroke 0.3s ease;
}

.timer-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.timer-container.timer-warn .timer-ring {
  stroke: var(--warn);
}

.timer-container.timer-warn .timer-value {
  color: var(--warn);
}

.timer-container.timer-critical .timer-ring {
  stroke: var(--wrong);
  animation: timer-pulse 0.5s ease infinite;
}

.timer-container.timer-critical .timer-value {
  color: var(--wrong);
  animation: timer-pulse 0.5s ease infinite;
}

@keyframes timer-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ================================================================
   SCREEN: BUZZER
   ================================================================ */
.buzzer-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.buzzer-flash {
  position: absolute;
  inset: 0;
  background: var(--accent);
  opacity: 0;
  pointer-events: none;
}

.buzzer-flash.flash-animate {
  animation: flash 0.6s ease-out;
}

@keyframes flash {
  0% { opacity: 0.6; }
  100% { opacity: 0; }
}

.buzzer-content {
  text-align: center;
  z-index: 1;
}

.buzzer-label {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 8px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}

.buzzer-team {
  font-size: 72px;
  font-weight: 900;
  margin-bottom: 8px;
  animation: buzz-in 0.3s ease;
}

@keyframes buzz-in {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.buzzer-captain {
  font-size: 32px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.buzzer-time {
  font-size: 24px;
  font-family: var(--font-mono);
  color: var(--accent);
}

/* ================================================================
   SCREEN: VERDICT
   ================================================================ */
.verdict-container {
  text-align: center;
  opacity: 0;
  transform: scale(0.8);
}

.verdict-container.animate-in {
  animation: pop-in 0.4s ease forwards;
}

@keyframes pop-in {
  to { opacity: 1; transform: scale(1); }
}

.verdict-icon {
  font-size: 120px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 16px;
}

.verdict-icon.verdict-correct {
  color: var(--correct);
  text-shadow: 0 0 40px rgba(46, 204, 113, 0.4);
}

.verdict-icon.verdict-wrong {
  color: var(--wrong);
  text-shadow: 0 0 40px rgba(231, 76, 60, 0.4);
}

.verdict-team {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 12px;
}

.verdict-score {
  font-size: 36px;
  font-weight: 900;
  font-family: var(--font-mono);
}

.verdict-score.score-positive {
  color: var(--correct);
}

.verdict-score.score-negative {
  color: var(--wrong);
}

/* ================================================================
   SCREEN: SCORES
   ================================================================ */
.scores-container {
  width: 100%;
  max-width: 1100px;
  padding: 60px;
}

.scores-title {
  font-size: 36px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 4px;
  color: var(--accent);
  margin-bottom: 40px;
  text-align: center;
}

.scores-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 24px;
  background: var(--bg-card);
  border-radius: var(--radius);
  animation: score-slide 0.4s ease backwards;
}

.score-row:nth-child(1) { animation-delay: 0.05s; }
.score-row:nth-child(2) { animation-delay: 0.1s; }
.score-row:nth-child(3) { animation-delay: 0.15s; }
.score-row:nth-child(4) { animation-delay: 0.2s; }
.score-row:nth-child(5) { animation-delay: 0.25s; }
.score-row:nth-child(6) { animation-delay: 0.3s; }
.score-row:nth-child(7) { animation-delay: 0.35s; }
.score-row:nth-child(8) { animation-delay: 0.4s; }

@keyframes score-slide {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

.score-rank {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 22px;
  font-weight: 800;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.score-first .score-rank {
  background: var(--gold);
  color: #000;
}

.score-second .score-rank {
  background: var(--silver);
  color: #000;
}

.score-third .score-rank {
  background: var(--bronze);
  color: #000;
}

.score-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.score-name {
  font-size: 22px;
  font-weight: 600;
}

.score-bar-track {
  width: 100%;
  height: 6px;
  background: var(--bg-primary);
  border-radius: 3px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  border-radius: 3px;
  transition: width 1s ease;
}

.score-value {
  font-size: 28px;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--accent);
  min-width: 80px;
  text-align: right;
}

/* ================================================================
   SCREEN: MINIGAME
   ================================================================ */
.minigame-container {
  text-align: center;
}

.minigame-icon {
  font-size: 80px;
  margin-bottom: 24px;
}

.minigame-title {
  font-size: 48px;
  font-weight: 800;
  margin-bottom: 12px;
}

.minigame-captain {
  font-size: 28px;
  color: var(--text-secondary);
  margin-bottom: 40px;
}

.minigame-result-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: scale(0.8);
}

.minigame-result-block.animate-in {
  animation: pop-in 0.5s ease forwards;
}

.minigame-score-value {
  font-size: 96px;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--accent);
}

.minigame-score-label {
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 4px;
  color: var(--text-secondary);
}

/* ================================================================
   SCREEN: NOMINATIONS
   ================================================================ */
.nominations-container {
  width: 100%;
  max-width: 1200px;
  padding: 60px;
}

.nominations-title {
  font-size: 36px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 4px;
  color: var(--accent);
  text-align: center;
  margin-bottom: 40px;
}

.nominations-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.nomination-card {
  padding: 24px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid rgba(255, 107, 53, 0.15);
  animation: score-slide 0.4s ease backwards;
}

.nomination-card:nth-child(1) { animation-delay: 0.1s; }
.nomination-card:nth-child(2) { animation-delay: 0.2s; }
.nomination-card:nth-child(3) { animation-delay: 0.3s; }
.nomination-card:nth-child(4) { animation-delay: 0.4s; }
.nomination-card:nth-child(5) { animation-delay: 0.5s; }
.nomination-card:nth-child(6) { animation-delay: 0.6s; }
.nomination-card:nth-child(7) { animation-delay: 0.7s; }
.nomination-card:nth-child(8) { animation-delay: 0.8s; }

.nomination-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}

.nomination-team {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 8px;
}

.nomination-reason {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ================================================================
   SCREEN: FINISHED
   ================================================================ */
.finished-container {
  text-align: center;
  max-width: 1000px;
  padding: 60px;
}

.finished-title {
  font-size: 64px;
  font-weight: 900;
  letter-spacing: 8px;
  margin-bottom: 48px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.final-podium {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 48px;
}

.podium-entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 40px;
  background: var(--bg-card);
  border-radius: var(--radius);
  min-width: 200px;
  animation: pop-in 0.5s ease backwards;
}

.podium-1 {
  animation-delay: 0.3s;
  border: 2px solid var(--gold);
  transform: scale(1.1);
}

.podium-2 {
  animation-delay: 0.5s;
  border: 2px solid var(--silver);
}

.podium-3 {
  animation-delay: 0.7s;
  border: 2px solid var(--bronze);
}

.podium-medal {
  font-size: 48px;
}

.podium-name {
  font-size: 24px;
  font-weight: 700;
}

.podium-score {
  font-size: 32px;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--accent);
}

.finished-toast {
  font-size: 22px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 700px;
  margin: 0 auto;
}

/* ================================================================
   OVERLAY: AI ORB + SUBTITLES
   ================================================================ */
.ai-overlay {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 30px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.ai-overlay:not(.hidden) {
  opacity: 1;
}

.ai-orb-container {
  position: relative;
  width: 300px;
  height: 300px;
}

#ai-orb-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.ai-orb-name {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: rgba(255, 107, 53, 0.6);
}

.ai-subtitle {
  max-width: 900px;
  padding: 14px 28px;
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 107, 53, 0.2);
  border-radius: var(--radius);
  margin-top: -20px;
  text-align: center;
  font-size: 20px;
  font-style: italic;
  color: #eaeaea;
  line-height: 1.5;
}

.ai-subtitle:empty {
  display: none;
}

/* 3D Avatar container */
.ai-avatar-container {
  width: 400px;
  height: 500px;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
}
.ai-avatar-container.hidden {
  display: none;
}
.ai-avatar-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ================================================================
   OVERLAY: BONUS AWARD
   ================================================================ */
.bonus-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 200;
  pointer-events: none;
}

.bonus-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 48px;
  background: var(--bg-card);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 0 60px var(--accent-glow);
}

.bonus-overlay.bonus-animate .bonus-content {
  animation: bonus-pop 0.5s ease;
}

@keyframes bonus-pop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.bonus-points {
  font-size: 56px;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--accent);
}

.bonus-team {
  font-size: 28px;
  font-weight: 700;
}

.bonus-reason {
  font-size: 18px;
  color: var(--text-secondary);
  text-align: center;
  max-width: 400px;
}

/* ================================================================
   SCORES SIDE PANEL (slides in from right)
   ================================================================ */
.scores-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  background: rgba(16, 16, 19, 0.95);
  backdrop-filter: blur(12px);
  border-left: 1px solid rgba(255, 107, 53, 0.2);
  z-index: 90;
  padding: 32px 20px;
  transform: translateX(100%);
  transition: transform 0.4s ease;
  overflow-y: auto;
}

.scores-panel.panel-visible {
  transform: translateX(0);
}

.panel-title {
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--accent);
  margin-bottom: 24px;
  text-align: center;
}

.panel-scores {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-score-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
}

.panel-rank {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  background: var(--bg-primary);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.panel-score-row:nth-child(1) .panel-rank {
  background: var(--gold);
  color: #000;
}

.panel-score-row:nth-child(2) .panel-rank {
  background: var(--silver);
  color: #000;
}

.panel-score-row:nth-child(3) .panel-rank {
  background: var(--bronze);
  color: #000;
}

.panel-team-name {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-score-val {
  font-size: 18px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent);
}

/* ================================================================
   Utility: background grid pattern (industrial feel)
   ================================================================ */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 107, 53, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 107, 53, 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* ================================================================
   Scrollbar (for nominations / scores overflow)
   ================================================================ */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-dim);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ================================================================
   MINIGAME ROUND RESULTS
   ================================================================ */
.minigame-summary {
  width: 100%;
  max-width: 1200px;
  padding: 40px;
  text-align: center;
}

.minigame-summary h2 {
  font-size: 36px;
  font-weight: 900;
  color: var(--accent);
  margin-bottom: 32px;
  text-transform: uppercase;
  letter-spacing: 4px;
}

.mg-results-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mg-result-row {
  display: grid;
  grid-template-columns: 50px 1fr 100px;
  grid-template-rows: auto auto;
  gap: 4px 16px;
  padding: 16px 24px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border-left: 4px solid var(--text-dim);
  align-items: center;
  text-align: left;
  animation: slide-up 0.5s ease backwards;
}

.mg-result-row:nth-child(1) { animation-delay: 0.1s; }
.mg-result-row:nth-child(2) { animation-delay: 0.2s; }
.mg-result-row:nth-child(3) { animation-delay: 0.3s; }
.mg-result-row:nth-child(4) { animation-delay: 0.4s; }
.mg-result-row:nth-child(5) { animation-delay: 0.5s; }
.mg-result-row:nth-child(6) { animation-delay: 0.6s; }
.mg-result-row:nth-child(7) { animation-delay: 0.7s; }
.mg-result-row:nth-child(8) { animation-delay: 0.8s; }

.mg-result-row.gold   { border-left-color: var(--gold); }
.mg-result-row.silver { border-left-color: var(--silver); }
.mg-result-row.bronze { border-left-color: var(--bronze); }

.mg-rank {
  font-size: 28px;
  font-weight: 900;
  color: var(--text-dim);
  grid-row: 1 / 3;
}

.mg-result-row.gold .mg-rank   { color: var(--gold); }
.mg-result-row.silver .mg-rank { color: var(--silver); }
.mg-result-row.bronze .mg-rank { color: var(--bronze); }

.mg-team {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.mg-score {
  font-size: 28px;
  font-weight: 900;
  color: var(--accent);
  text-align: right;
  grid-row: 1 / 3;
}

.mg-details {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  grid-column: 2;
}

.mg-achievements {
  grid-column: 2 / 4;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.mg-ach-badge {
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 215, 0, 0.1);
  color: var(--gold);
  border: 1px solid rgba(255, 215, 0, 0.25);
}

/* ================================================================
   SCREEN: SCOREBOARD (Final Reveal + Leaderboard)
   ================================================================ */

.scoreboard-container {
  position: relative;
  width: 100%;
  max-width: 1100px;
  padding: 50px 60px;
  z-index: 2;
}

.scoreboard-title {
  font-size: 40px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 6px;
  color: var(--accent);
  text-align: center;
  margin-bottom: 40px;
}

.scoreboard-title.final-mode {
  font-size: 36px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--accent) 50%, var(--gold) 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 3s ease infinite;
}

.scoreboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

/* --- Individual scoreboard row --- */
.sb-row {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 72px;
  padding: 0 24px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 2px solid transparent;
  opacity: 0;
  transform: translateX(-40px);
  transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              opacity 0.3s ease,
              border-color 0.4s ease,
              box-shadow 0.4s ease,
              background 0.4s ease;
  position: relative;
}

.sb-row.sb-visible {
  opacity: 1;
  transform: translateX(0);
}

/* Pulsing glow on currently revealed team */
.sb-row.reveal-active {
  border-color: var(--accent);
  box-shadow: 0 0 24px var(--accent-glow), 0 0 48px rgba(255, 107, 53, 0.15);
  animation: sb-pulse-glow 0.8s ease infinite alternate;
}

@keyframes sb-pulse-glow {
  from {
    box-shadow: 0 0 24px var(--accent-glow), 0 0 48px rgba(255, 107, 53, 0.15);
  }
  to {
    box-shadow: 0 0 36px var(--accent-glow), 0 0 72px rgba(255, 107, 53, 0.25);
  }
}

/* Brief flash when rank changes */
.sb-row.rank-changed {
  animation: sb-rank-flash 0.6s ease;
}

@keyframes sb-rank-flash {
  0% { background: var(--bg-card); }
  30% { background: rgba(255, 107, 53, 0.12); }
  100% { background: var(--bg-card); }
}

/* --- Rank badge --- */
.sb-rank {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 22px;
  font-weight: 800;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: background 0.5s ease, color 0.5s ease, box-shadow 0.5s ease;
}

.sb-rank.gold {
  background: var(--gold);
  color: #000;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
}

.sb-rank.silver {
  background: var(--silver);
  color: #000;
}

.sb-rank.bronze {
  background: var(--bronze);
  color: #000;
}

/* --- Team name --- */
.sb-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.sb-name {
  font-size: 24px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Progress bar --- */
.sb-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-primary);
  border-radius: 3px;
  overflow: hidden;
}

.sb-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  border-radius: 3px;
  transition: width 1.2s ease;
}

/* --- Score value --- */
.sb-score-wrap {
  position: relative;
  min-width: 100px;
  text-align: right;
  flex-shrink: 0;
}

.sb-score {
  font-size: 32px;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--accent);
  transition: transform 0.2s ease;
}

.sb-score.counting {
  animation: sb-count-pulse 0.15s ease infinite alternate;
}

@keyframes sb-count-pulse {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}

/* --- Floating "+N" points --- */
.sb-points-added {
  position: absolute;
  right: -10px;
  top: -8px;
  font-size: 22px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--correct);
  pointer-events: none;
  animation: sb-float-up 1.8s ease-out forwards;
  text-shadow: 0 0 10px rgba(46, 204, 113, 0.5);
}

@keyframes sb-float-up {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  60% {
    opacity: 1;
    transform: translateY(-30px) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: translateY(-50px) scale(0.8);
  }
}

/* ================================================================
   FINAL REVEAL — Winner & Effects
   ================================================================ */

/* Winner row */
.sb-row.winner {
  border-color: var(--gold) !important;
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.3), 0 0 60px rgba(255, 215, 0, 0.15) !important;
  background: rgba(255, 215, 0, 0.06);
  transform: scale(1.03) translateX(0) !important;
  animation: sb-winner-glow 2s ease infinite alternate !important;
  z-index: 5;
}

@keyframes sb-winner-glow {
  from {
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3), 0 0 60px rgba(255, 215, 0, 0.15);
  }
  to {
    box-shadow: 0 0 44px rgba(255, 215, 0, 0.45), 0 0 80px rgba(255, 215, 0, 0.2);
  }
}

.sb-row.winner .sb-score {
  color: var(--gold);
}

/* Champion crown */
.champion-crown {
  font-size: 28px;
  position: absolute;
  top: -18px;
  left: 14px;
  z-index: 10;
  filter: drop-shadow(0 2px 6px rgba(255, 215, 0, 0.5));
  animation: sb-crown-bounce 0.6s ease;
}

@keyframes sb-crown-bounce {
  0% { transform: scale(0) rotate(-30deg); opacity: 0; }
  60% { transform: scale(1.3) rotate(5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Drumroll — pulsing red/orange border on container */
.scoreboard-container.drumroll {
  animation: sb-drumroll 0.3s ease infinite alternate;
}

@keyframes sb-drumroll {
  from {
    box-shadow: inset 0 0 0 3px rgba(255, 107, 53, 0.2);
    border-radius: 16px;
  }
  to {
    box-shadow: inset 0 0 0 3px rgba(255, 107, 53, 0.6);
    border-radius: 16px;
  }
}

/* ================================================================
   Confetti
   ================================================================ */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  overflow: hidden;
}

.confetti-particle {
  position: absolute;
  top: -20px;
  border-radius: 2px;
  opacity: 0;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  0% {
    opacity: 1;
    transform: translateY(0) rotate(0deg) scale(1);
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(110vh) rotate(720deg) scale(0.5);
  }
}

/* ================================================================
   AI SUBTITLE — Final Reveal Commentary
   ================================================================ */
.ai-final-subtitle {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 900px;
  padding: 16px 32px;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 107, 53, 0.3);
  border-radius: 12px;
  font-size: 20px;
  font-style: italic;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.5;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.ai-final-subtitle.subtitle-visible {
  opacity: 1;
}

/* ================================================================
   SCREEN: INTRO (team introductions)
   ================================================================ */
.intro-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: radial-gradient(ellipse at center, #1a1a3e 0%, #0f0f23 100%);
}
.intro-title {
    font-size: 48px;
    color: #fff;
    margin-bottom: 40px;
    text-transform: uppercase;
    letter-spacing: 4px;
}
.intro-team-card {
    background: rgba(255,255,255,0.05);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 24px;
    padding: 48px 64px;
    text-align: center;
    animation: cardAppear 0.6s ease-out;
}
@keyframes cardAppear {
    from { transform: scale(0.8) translateY(30px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}
.intro-team-name {
    font-size: 56px;
    color: #fff;
    margin-bottom: 16px;
}
.intro-captain {
    font-size: 28px;
    color: #60a5fa;
    margin-bottom: 12px;
}
.intro-details {
    font-size: 22px;
    color: #aaa;
    max-width: 600px;
}

/* ================================================================
   SCREEN: VOTING RESULTS
   ================================================================ */
.voting-results-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    padding: 60px;
}
.voting-results-title {
    font-size: 40px;
    color: #fff;
    margin-bottom: 40px;
}
.voting-chart {
    width: 80%;
    max-width: 800px;
}
.vote-bar {
    margin-bottom: 16px;
}
.vote-label {
    color: #ccc;
    font-size: 24px;
    margin-bottom: 6px;
}
.vote-bar-track {
    height: 40px;
    background: #1e1e2e;
    border-radius: 8px;
    overflow: hidden;
}
.vote-bar-fill {
    height: 100%;
    background: #2563eb;
    border-radius: 8px;
    transition: width 1s ease-out;
}
.vote-correct .vote-bar-fill {
    background: #22c55e;
}
.vote-correct .vote-label {
    color: #4ade80;
    font-weight: bold;
}
.vote-count {
    text-align: right;
    color: #888;
    font-size: 18px;
    margin-top: 2px;
}

/* ================================================================
   OVERLAY: Achievement popup
   ================================================================ */
.achievement-overlay {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 999;
    animation: achieveIn 0.5s ease-out;
}
.achievement-overlay.hidden { display: none; }
@keyframes achieveIn {
    from { transform: translateX(100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
.achievement-content {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #000;
    padding: 16px 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 22px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.achievement-icon { font-size: 32px; }
.achievement-team { color: #333; font-weight: normal; }

/* ================================================================
   Tour progress
   ================================================================ */
.tour-progress {
    color: #888;
    font-size: 18px;
    margin-left: auto;
}

/* ================================================================
   Timer states
   ================================================================ */
.timer-expired { color: #ef4444 !important; animation: timerFlash 0.5s ease-in-out 3; }
.timer-paused { opacity: 0.4; }
.timer-critical { animation: timerPulse 0.5s ease-in-out infinite; }
@keyframes timerFlash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
@keyframes timerPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}
