/* HOST / TV VIEW — Optimized for big screen, readable from 3+ meters */

body {
  overflow: hidden;
  height: 100vh;
}

/* ═══════════ SCREENS ═══════════ */
.screen {
  display: none;
  width: 100vw;
  height: 100vh;
}

.screen.active {
  display: flex;
}

/* ═══════════ SETUP SCREEN ═══════════ */
#setup-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 40px;
}

.logo-section {
  text-align: center;
  animation: fadeIn 0.6s ease;
}

.logo-section h1 {
  font-size: 72px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--purple-light), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -2px;
}

.logo-section p {
  font-size: 24px;
  color: var(--text-secondary);
  margin-top: 8px;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  max-width: 800px;
  width: 100%;
  animation: fadeIn 0.6s ease 0.2s both;
}

.category-card {
  background: var(--bg-secondary);
  border: 3px solid transparent;
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
}

.category-card:hover {
  transform: translateY(-4px);
  border-color: var(--bg-card);
}

.category-card.selected {
  border-color: var(--purple);
  background: rgba(124, 58, 237, 0.15);
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.3);
}

.category-card .emoji {
  font-size: 48px;
  display: block;
  margin-bottom: 8px;
}

.category-card .name {
  font-size: 18px;
  font-weight: 700;
}

.setup-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: fadeIn 0.6s ease 0.4s both;
}

.question-count-selector {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 20px;
  color: var(--text-secondary);
}

.question-count-selector select {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 2px solid var(--bg-card);
  border-radius: 12px;
  padding: 10px 20px;
  font-size: 20px;
  font-family: inherit;
  cursor: pointer;
}

/* ═══════════ LOBBY SCREEN ═══════════ */
#lobby-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 40px;
}

.room-code-display {
  text-align: center;
  animation: bounceIn 0.5s ease;
}

.room-code-display .label {
  font-size: 28px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.room-code-display .code {
  font-size: 120px;
  font-weight: 900;
  letter-spacing: 16px;
  background: linear-gradient(135deg, var(--cyan), var(--purple-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: glowText 2s ease-in-out infinite;
}

.room-code-display .url {
  font-size: 22px;
  color: var(--text-muted);
  margin-top: 8px;
}

.lobby-players {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  max-width: 900px;
}

.lobby-player {
  background: var(--bg-secondary);
  border-radius: 20px;
  padding: 20px 32px;
  display: flex;
  align-items: center;
  gap: 16px;
  animation: slideInUp 0.4s ease;
  min-width: 200px;
}

.lobby-player .avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  color: white;
}

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

.lobby-waiting {
  font-size: 22px;
  color: var(--text-muted);
  animation: pulse 2s ease-in-out infinite;
}

/* ═══════════ GAME SCREEN ═══════════ */
#game-screen {
  flex-direction: column;
  height: 100vh;
  position: relative;
}

/* Top bar */
.game-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.game-category {
  display: flex;
  align-items: center;
  gap: 12px;
}

.game-category .emoji {
  font-size: 36px;
}

.game-category .name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-secondary);
}

.game-progress {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-secondary);
}

.game-progress .current {
  color: var(--cyan);
  font-size: 28px;
}

/* Timer */
.timer-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.timer-display {
  font-size: 64px;
  font-weight: 900;
  color: var(--text-primary);
  transition: color 0.3s ease;
  min-width: 80px;
  text-align: center;
}

.timer-display.warning { color: var(--orange); }
.timer-display.danger { color: var(--red); animation: countdownPulse 1s ease-in-out infinite; }

.timer-bar-container {
  width: 300px;
  height: 8px;
  background: var(--bg-card);
  border-radius: 4px;
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--purple));
  border-radius: 4px;
  transition: width 1s linear;
}

.timer-bar.warning { background: linear-gradient(90deg, var(--orange), var(--red)); }

/* Main content area */
.game-content {
  flex: 1;
  display: flex;
  padding: 20px 40px 40px;
  gap: 40px;
  overflow: hidden;
}

/* Question area */
.question-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.question-text {
  font-size: 48px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text-primary);
  animation: fadeInScale 0.4s ease;
  text-align: center;
  padding: 20px;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  flex: 1;
}

.option-card {
  border-radius: 24px;
  display: flex;
  align-items: center;
  padding: 24px 32px;
  gap: 20px;
  font-size: 28px;
  font-weight: 700;
  color: white;
  animation: fadeIn 0.4s ease;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.option-card:nth-child(1) { background: #E53E3E; animation-delay: 0.05s; }
.option-card:nth-child(2) { background: #3182CE; animation-delay: 0.1s; }
.option-card:nth-child(3) { background: #D69E2E; animation-delay: 0.15s; }
.option-card:nth-child(4) { background: #38A169; animation-delay: 0.2s; }

.option-card .option-letter {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 900;
  flex-shrink: 0;
}

.option-card .option-text {
  flex: 1;
  line-height: 1.3;
}

/* Reveal states */
.option-card.correct {
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.6);
  animation: pulse 0.5s ease;
}

.option-card.correct::after {
  content: '✓';
  position: absolute;
  right: 24px;
  font-size: 40px;
}

.option-card.wrong {
  opacity: 0.3;
  transform: scale(0.95);
}

/* Answer count */
.answer-count {
  text-align: center;
  font-size: 24px;
  color: var(--text-muted);
  padding: 8px;
}

.answer-count .count {
  color: var(--cyan);
  font-weight: 800;
  font-size: 28px;
}

/* Scoreboard sidebar */
.scoreboard-sidebar {
  width: 320px;
  background: var(--bg-secondary);
  border-radius: 24px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.scoreboard-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--bg-card);
}

.score-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--bg-primary);
  transition: all 0.5s ease;
  animation: slideInRight 0.3s ease;
}

.score-entry .rank {
  font-size: 20px;
  font-weight: 900;
  color: var(--text-muted);
  min-width: 30px;
}

.score-entry:nth-child(2) .rank { color: var(--orange); }
.score-entry:nth-child(3) .rank { color: var(--text-secondary); }
.score-entry:nth-child(4) .rank { color: #CD7F32; }

.score-entry .player-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

.score-entry .player-name {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-entry .player-score {
  font-size: 20px;
  font-weight: 800;
  color: var(--cyan);
}

.score-entry .streak-badge {
  font-size: 14px;
  color: var(--orange);
  animation: streakPulse 1s ease-in-out infinite;
}

/* Reveal overlay */
.reveal-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.95), transparent);
  padding: 40px;
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  animation: slideInUp 0.4s ease;
  z-index: 5;
}

.reveal-player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 16px;
  font-size: 20px;
  font-weight: 700;
}

.reveal-player.correct {
  background: rgba(16, 185, 129, 0.2);
  border: 2px solid var(--green);
  color: var(--green);
}

.reveal-player.wrong {
  background: rgba(239, 68, 68, 0.2);
  border: 2px solid var(--red);
  color: var(--red);
  opacity: 0.6;
}

.reveal-player .points {
  color: var(--orange);
  font-size: 16px;
}

/* ═══════════ PODIUM SCREEN ═══════════ */
#podium-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 40px;
}

.podium-title {
  font-size: 64px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--orange), var(--cyan), var(--purple-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: glowText 2s ease-in-out infinite;
}

.podium-container {
  display: flex;
  align-items: flex-end;
  gap: 24px;
  height: 400px;
}

.podium-place {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: slideInUp 0.6s ease;
}

.podium-place:nth-child(1) { animation-delay: 0.4s; animation-fill-mode: both; }
.podium-place:nth-child(2) { animation-delay: 0.2s; animation-fill-mode: both; }
.podium-place:nth-child(3) { animation-delay: 0.6s; animation-fill-mode: both; }

.podium-player-info {
  text-align: center;
  margin-bottom: 16px;
}

.podium-player-info .name {
  font-size: 32px;
  font-weight: 800;
}

.podium-player-info .score {
  font-size: 24px;
  color: var(--cyan);
  font-weight: 700;
}

.podium-block {
  border-radius: 16px 16px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.3);
}

.podium-place.first .podium-block {
  width: 200px;
  height: 280px;
  background: linear-gradient(180deg, var(--orange), #D97706);
}

.podium-place.second .podium-block {
  width: 180px;
  height: 200px;
  background: linear-gradient(180deg, var(--text-secondary), #475569);
}

.podium-place.third .podium-block {
  width: 180px;
  height: 140px;
  background: linear-gradient(180deg, #CD7F32, #8B6914);
}

.podium-crown {
  font-size: 64px;
  animation: bounceIn 0.8s ease 0.6s both;
}

/* Full results below podium */
.full-results {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  max-width: 800px;
}

.full-result-entry {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 220px;
  animation: fadeIn 0.4s ease;
}

.full-result-entry .rank {
  font-size: 24px;
  font-weight: 900;
  color: var(--text-muted);
}

.full-result-entry .name {
  font-size: 20px;
  font-weight: 700;
  flex: 1;
}

.full-result-entry .score {
  font-size: 20px;
  font-weight: 800;
  color: var(--cyan);
}

.play-again-btn {
  margin-top: 20px;
}

/* Difficulty badge */
.difficulty-badge {
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
}

.difficulty-badge.easy { background: rgba(16, 185, 129, 0.2); color: var(--green); }
.difficulty-badge.medium { background: rgba(245, 158, 11, 0.2); color: var(--orange); }
.difficulty-badge.hard { background: rgba(239, 68, 68, 0.2); color: var(--red); }
