/* =============================================================================
   ANGRY TRIVIA - Global Styles
   Better contrast, animations, polish
   ============================================================================= */

:root {
  /* Colors - Improved contrast */
  --bg-dark: #121214;
  --bg-card: #1c1c1f;
  --bg-input: #2a2a2e;
  --bg-elevated: #323236;
  
  /* Accent - Brighter orange for better visibility */
  --accent: #ff7a45;
  --accent-hover: #ff9566;
  --accent-glow: rgba(255, 122, 69, 0.3);
  
  /* Status colors - More vibrant */
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.15);
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.15);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.15);
  
  /* Text - Better contrast hierarchy */
  --text: #ffffff;
  --text-bright: #ffffff;
  --text-secondary: #c8c8cc;
  --text-muted: #9a9a9e;
  --border: #3a3a3e;
  --border-light: #4a4a4e;
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  
  /* Typography */
  --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', Consolas, monospace;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

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

body {
  font-family: var(--font);
  background: var(--bg-dark);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =============================================================================
   LAYOUT
   ============================================================================= */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-lg);
}

.container--narrow {
  max-width: 500px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  transition: border-color var(--transition-fast);
}

.card:hover {
  border-color: var(--border-light);
}

.card--elevated {
  background: var(--bg-elevated);
  border: none;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.card--accent {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(255, 122, 69, 0.05) 100%);
}

.flex {
  display: flex;
  gap: var(--space-md);
}

.flex--between {
  justify-content: space-between;
  align-items: center;
}

.flex--center {
  justify-content: center;
  align-items: center;
}

.grid {
  display: grid;
  gap: var(--space-md);
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }

/* =============================================================================
   TYPOGRAPHY
   ============================================================================= */

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-bright);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-mono { font-family: var(--font-mono); }

/* =============================================================================
   FORMS
   ============================================================================= */

.form-group {
  margin-bottom: var(--space-md);
}

label {
  display: block;
  margin-bottom: var(--space-sm);
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.9rem;
  letter-spacing: 0.01em;
}

input, select, textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text-bright);
  font-size: 1rem;
  font-family: var(--font);
  transition: all var(--transition-fast);
}

input:hover, select:hover, textarea:hover {
  border-color: var(--border-light);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-elevated);
}

input::placeholder {
  color: var(--text-muted);
}

/* =============================================================================
   BUTTONS
   ============================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn--primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.btn--primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn--primary:active {
  transform: translateY(0);
}

.btn--secondary {
  background: var(--bg-input);
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn--secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--border-light);
}

.btn--success {
  background: var(--success);
  color: #0a0a0a;
  box-shadow: 0 2px 12px rgba(52, 211, 153, 0.3);
}

.btn--success:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

.btn--warning {
  background: var(--warning);
  color: #0a0a0a;
}

.btn--danger {
  background: var(--danger);
  color: white;
}

.btn--large {
  padding: 1.125rem 2rem;
  font-size: 1.125rem;
  border-radius: 12px;
}

.btn--block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* =============================================================================
   GAME ELEMENTS
   ============================================================================= */

.team-code {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--accent);
  background: var(--bg-input);
  padding: var(--space-lg) var(--space-xl);
  border-radius: 12px;
  text-align: center;
  user-select: all;
  border: 2px dashed var(--border);
}

.score-display {
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 30px var(--accent-glow);
}

/* Timer with animations */
.timer {
  font-family: var(--font-mono);
  font-size: 5rem;
  font-weight: 700;
  text-align: center;
  color: var(--text-bright);
  transition: color 0.3s, transform 0.3s;
}

.timer--warning { 
  color: var(--warning);
  animation: timerPulse 1s ease-in-out infinite;
}

.timer--danger { 
  color: var(--danger);
  animation: timerShake 0.5s ease-in-out infinite;
}

@keyframes timerPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes timerShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Question box */
.question-text {
  font-size: 1.5rem;
  font-weight: 500;
  text-align: center;
  padding: var(--space-xl) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: var(--space-lg);
  line-height: 1.5;
  color: var(--text-bright);
}

.answer-input {
  font-size: 1.375rem;
  text-align: center;
  padding: var(--space-lg);
  letter-spacing: 0.02em;
}

/* Answer status */
.answer-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-radius: 10px;
  font-weight: 500;
}

.answer-status--submitted {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success);
}

.answer-status--waiting {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning);
}

/* =============================================================================
   LEADERBOARD
   ============================================================================= */

.leaderboard {
  list-style: none;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: 10px;
  margin-bottom: var(--space-sm);
  background: var(--bg-input);
  transition: all var(--transition-fast);
}

.leaderboard-item:hover {
  background: var(--bg-elevated);
}

.leaderboard-item--highlight {
  background: rgba(255, 122, 69, 0.1);
  border: 1px solid var(--accent);
}

.leaderboard-rank {
  font-size: 1.25rem;
  font-weight: 700;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-bright);
}

.leaderboard-rank--1 { 
  background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
  color: #1a1a1a;
}
.leaderboard-rank--2 { 
  background: linear-gradient(135deg, #e0e0e0 0%, #c0c0c0 100%);
  color: #1a1a1a;
}
.leaderboard-rank--3 { 
  background: linear-gradient(135deg, #cd7f32 0%, #a0522d 100%);
  color: #1a1a1a;
}

.leaderboard-name {
  flex: 1;
  font-weight: 500;
  color: var(--text-bright);
}

.leaderboard-score {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent);
}

.leaderboard-delta {
  font-size: 0.875rem;
  color: var(--success);
  margin-left: var(--space-sm);
}

/* =============================================================================
   ROAST / COMMENTARY BOX
   ============================================================================= */

.roast-box {
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(255, 122, 69, 0.08) 100%);
  border: 1px solid var(--accent);
  border-radius: 16px;
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
}

.roast-box::before {
  content: '"';
  position: absolute;
  top: -20px;
  left: 10px;
  font-size: 6rem;
  color: var(--accent);
  opacity: 0.15;
  font-family: Georgia, serif;
}

.roast-text {
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--text-secondary);
  font-style: italic;
  position: relative;
  z-index: 1;
}

.roast-savagery {
  display: inline-block;
  margin-top: var(--space-md);
  padding: var(--space-xs) var(--space-md);
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* =============================================================================
   BADGES & STATUS
   ============================================================================= */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.375rem 0.875rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge--pending { 
  background: var(--warning);
  color: #1a1a1a;
}
.badge--approved { 
  background: var(--success);
  color: #1a1a1a;
}
.badge--active { 
  background: var(--accent);
  color: white;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot--online { 
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}
.status-dot--offline { 
  background: var(--text-muted);
}

/* =============================================================================
   ANIMATIONS
   ============================================================================= */

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

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px var(--accent-glow); }
  50% { box-shadow: 0 0 40px var(--accent-glow), 0 0 60px var(--accent-glow); }
}

@keyframes correctAnswer {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); background: var(--success-bg); }
  100% { transform: scale(1); }
}

@keyframes wrongAnswer {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

@keyframes confettiFall {
  0% { transform: translateY(-100%) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.animate-pulse { animation: pulse 2s infinite; }
.animate-slideIn { animation: slideIn 0.4s ease-out; }
.animate-slideInUp { animation: slideInUp 0.5s ease-out; }
.animate-fadeIn { animation: fadeIn 0.3s ease-out; }
.animate-scaleIn { animation: scaleIn 0.3s ease-out; }
.animate-bounce { animation: bounce 0.6s ease-in-out; }
.animate-glow { animation: glow 2s ease-in-out infinite; }
.animate-correct { animation: correctAnswer 0.5s ease-out; }
.animate-wrong { animation: wrongAnswer 0.4s ease-out; }

/* =============================================================================
   CONFETTI (for wins)
   ============================================================================= */

.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -10px;
  animation: confettiFall 3s linear forwards;
}

/* =============================================================================
   AUDIO INDICATOR
   ============================================================================= */

.audio-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-input);
  border-radius: 999px;
}

.audio-bar {
  width: 4px;
  height: 16px;
  background: var(--accent);
  border-radius: 2px;
  animation: audioBar 0.5s ease-in-out infinite;
}

.audio-bar:nth-child(2) { animation-delay: 0.1s; }
.audio-bar:nth-child(3) { animation-delay: 0.2s; }
.audio-bar:nth-child(4) { animation-delay: 0.3s; }

@keyframes audioBar {
  0%, 100% { height: 8px; }
  50% { height: 20px; }
}

/* =============================================================================
   SPEED BONUS
   ============================================================================= */

.speed-bonus {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
  color: #1a1a1a;
  font-size: 0.875rem;
  font-weight: 700;
  border-radius: 6px;
  animation: bounce 0.5s ease-out;
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 768px) {
  .container { padding: var(--space-md); }
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  .grid--2, .grid--3 { grid-template-columns: 1fr; }
  .timer { font-size: 3.5rem; }
  .question-text { 
    font-size: 1.25rem;
    padding: var(--space-lg);
  }
  .score-display { font-size: 2.5rem; }
  .team-code { 
    font-size: 1.75rem;
    letter-spacing: 0.2em;
  }
}

/* =============================================================================
   UTILITIES
   ============================================================================= */

.hidden { display: none !important; }
.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.ml-sm { margin-left: var(--space-sm); }
.mr-sm { margin-right: var(--space-sm); }

.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }

.font-bold { font-weight: 600; }
.font-mono { font-family: var(--font-mono); }

.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

/* Screen transitions */
.screen {
  animation: fadeIn 0.3s ease-out;
}
