/* ==========================================================================
   STREAMER OLYMPIADE - GAMING / ESPORTS DARK THEME CSS
   ========================================================================== */

:root {
  /* Core Colors */
  --bg-darker: #06070a;
  --bg-dark: #0c0e17;
  --bg-card: rgba(18, 22, 36, 0.85);
  --bg-card-hover: rgba(28, 34, 56, 0.95);
  --bg-glass: rgba(15, 18, 30, 0.65);
  
  /* Neon Accents */
  --neon-cyan: #00f2fe;
  --neon-cyan-glow: rgba(0, 242, 254, 0.4);
  --neon-purple: #9d4edd;
  --neon-purple-glow: rgba(157, 78, 221, 0.4);
  --neon-pink: #ff2a85;
  --neon-gold: #ffb703;
  --neon-gold-glow: rgba(255, 183, 3, 0.4);
  --neon-emerald: #10b981;
  --neon-ruby: #ef4444;

  /* Text Colors */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Borders & Shadows */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-neon: rgba(0, 242, 254, 0.35);
  --border-purple: rgba(157, 78, 221, 0.35);
  --card-radius: 16px;
  --pill-radius: 9999px;
  --shadow-glow: 0 0 25px rgba(0, 242, 254, 0.15);
  --shadow-purple: 0 0 25px rgba(157, 78, 221, 0.2);
  --shadow-gold: 0 0 30px rgba(255, 183, 3, 0.25);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Outfit', 'Inter', sans-serif;
  background-color: var(--bg-darker);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(157, 78, 221, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 25%, rgba(0, 242, 254, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 50% 85%, rgba(255, 42, 133, 0.08) 0%, transparent 50%),
    linear-gradient(to bottom, #06070a, #0c0e17);
  background-attachment: fixed;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--neon-cyan);
}

/* Glassmorphism Classes */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--card-radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.glass-panel-glow {
  border-color: var(--border-neon);
  box-shadow: var(--shadow-glow);
}

/* Container & Layout */
.app-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 4rem;
}

/* Header & Navigation */
header.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 1.5rem;
  margin-bottom: 2rem;
  background: rgba(12, 14, 23, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--card-radius);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  border-radius: 12px;
  box-shadow: 0 0 20px var(--neon-cyan-glow);
  font-size: 1.5rem;
}

.brand-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(120deg, #ffffff 40%, var(--neon-cyan) 80%, var(--neon-purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  background: rgba(0, 242, 254, 0.15);
  border: 1px solid var(--neon-cyan);
  border-radius: 6px;
  color: var(--neon-cyan);
  letter-spacing: 1px;
}

/* Top Stats & Quick Controls */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.mode-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--pill-radius);
  font-size: 0.85rem;
  font-weight: 600;
}

.mode-pill.highlight {
  border-color: var(--neon-gold);
  background: rgba(255, 183, 3, 0.1);
  color: var(--neon-gold);
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(8, 10, 18, 0.9);
  padding: 0.4rem;
  border-radius: var(--pill-radius);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
  margin-bottom: 2rem;
}

.nav-tab-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--pill-radius);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab-btn.active {
  color: #000;
  background: linear-gradient(135deg, var(--neon-cyan), #4facfe);
  box-shadow: 0 0 16px var(--neon-cyan-glow);
  font-weight: 700;
}

/* Standard Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  text-decoration: none;
  user-select: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, var(--neon-cyan), #00b4d8);
  color: #060b13;
  box-shadow: 0 0 15px var(--neon-cyan-glow);
}
.btn-primary:hover {
  box-shadow: 0 0 25px var(--neon-cyan-glow);
  filter: brightness(1.1);
}

.btn-purple {
  background: linear-gradient(135deg, var(--neon-purple), #7209b7);
  color: #ffffff;
  box-shadow: 0 0 15px var(--neon-purple-glow);
}
.btn-purple:hover {
  box-shadow: 0 0 25px var(--neon-purple-glow);
  filter: brightness(1.15);
}

.btn-gold {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #1a1003;
  box-shadow: 0 0 15px var(--neon-gold-glow);
}
.btn-gold:hover {
  box-shadow: 0 0 25px var(--neon-gold-glow);
  filter: brightness(1.1);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-subtle);
  color: var(--text-main);
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.825rem;
  border-radius: 8px;
}

.btn-lg {
  padding: 0.9rem 1.8rem;
  font-size: 1.15rem;
  border-radius: 14px;
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 10px;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(10, 12, 20, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-main);
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 12px var(--neon-cyan-glow);
  background: rgba(12, 16, 28, 0.95);
}

/* Wheel Layout Section */
.wheel-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .wheel-layout {
    grid-template-columns: 1fr;
  }
}

.wheel-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  position: relative;
  overflow: hidden;
}

.wheel-stage::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, var(--neon-cyan-glow) 0%, transparent 70%);
  filter: blur(40px);
  pointer-events: none;
  opacity: 0.4;
}

.wheel-canvas-container {
  position: relative;
  width: 480px;
  height: 480px;
  max-width: 100%;
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
}

#wheelCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Center Spin Button Overlay */
.wheel-center-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e2538, #0a0d16);
  border: 4px solid var(--neon-cyan);
  box-shadow: 0 0 25px var(--neon-cyan-glow), inset 0 0 15px rgba(0, 0, 0, 0.8);
  color: var(--neon-cyan);
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 1px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 10;
  user-select: none;
}

.wheel-center-btn:hover {
  transform: translate(-50%, -50%) scale(1.08);
  border-color: #fff;
  color: #fff;
  box-shadow: 0 0 35px var(--neon-cyan-glow);
}

.wheel-center-btn:active {
  transform: translate(-50%, -50%) scale(0.95);
}

.wheel-center-btn.spinning {
  pointer-events: none;
  animation: pulse-spin 1s infinite alternate;
}

@keyframes pulse-spin {
  from {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 20px var(--neon-cyan-glow);
  }
  to {
    border-color: var(--neon-purple);
    box-shadow: 0 0 35px var(--neon-purple-glow);
  }
}

/* Pointer Indicator */
.wheel-pointer {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 44px;
  z-index: 12;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.7));
  transform-origin: 50% 10%;
  transition: transform 0.05s ease-out;
}

.wheel-pointer.tick {
  transform: translateX(-50%) rotate(-18deg);
}

/* Sidebar Info & Active Games */
.sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.active-games-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.active-game-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.9rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  font-size: 0.9rem;
  transition: all 0.15s ease;
}

.active-game-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.active-game-item.played {
  opacity: 0.5;
  text-decoration: line-through;
}

/* Badge Chips */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-cyan { background: rgba(0, 242, 254, 0.15); color: var(--neon-cyan); border: 1px solid var(--neon-cyan); }
.badge-purple { background: rgba(157, 78, 221, 0.15); color: #c084fc; border: 1px solid var(--neon-purple); }
.badge-gold { background: rgba(255, 183, 3, 0.15); color: var(--neon-gold); border: 1px solid var(--neon-gold); }
.badge-emerald { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid #10b981; }

/* Leaderboard Page */
.leaderboard-grid {
  display: grid;
  grid-template-columns: 2fr 1.2fr;
  gap: 2rem;
}

@media (max-width: 900px) {
  .leaderboard-grid {
    grid-template-columns: 1fr;
  }
}

.podium-container {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 2.5rem;
  padding-top: 2rem;
}

.podium-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all 0.3s ease;
}

.podium-step.rank-1 {
  order: 2;
  transform: translateY(-20px);
}
.podium-step.rank-2 {
  order: 1;
}
.podium-step.rank-3 {
  order: 3;
}

.podium-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  position: relative;
  background: #1e2438;
  margin-bottom: 0.5rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.podium-step.rank-1 .podium-avatar {
  width: 92px;
  height: 92px;
  border: 4px solid var(--neon-gold);
  box-shadow: var(--shadow-gold);
  font-size: 2.6rem;
}

.podium-step.rank-2 .podium-avatar {
  border: 3px solid #cbd5e1;
  box-shadow: 0 0 20px rgba(203, 213, 225, 0.3);
}

.podium-step.rank-3 .podium-avatar {
  border: 3px solid #b45309;
  box-shadow: 0 0 20px rgba(180, 83, 9, 0.3);
}

.podium-crown {
  position: absolute;
  top: -24px;
  font-size: 1.8rem;
  animation: crown-float 2s ease-in-out infinite alternate;
}

@keyframes crown-float {
  from { transform: translateY(0); }
  to { transform: translateY(-6px); }
}

.podium-name {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.2rem;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.podium-score {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--neon-cyan);
}

.podium-pedestal {
  width: 110px;
  border-radius: 12px 12px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 0.75rem;
}

.podium-step.rank-1 .podium-pedestal {
  height: 120px;
  background: linear-gradient(to top, rgba(255, 183, 3, 0.2), rgba(255, 183, 3, 0.45));
  border: 1px solid var(--neon-gold);
  color: var(--neon-gold);
}

.podium-step.rank-2 .podium-pedestal {
  height: 90px;
  background: linear-gradient(to top, rgba(203, 213, 225, 0.15), rgba(203, 213, 225, 0.3));
  border: 1px solid #94a3b8;
  color: #cbd5e1;
}

.podium-step.rank-3 .podium-pedestal {
  height: 65px;
  background: linear-gradient(to top, rgba(180, 83, 9, 0.15), rgba(180, 83, 9, 0.3));
  border: 1px solid #b45309;
  color: #d97706;
}

/* Ranking Table List */
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ranking-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
  background: rgba(20, 24, 38, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  transition: all 0.2s ease;
}

.ranking-card:hover {
  background: rgba(28, 34, 54, 0.85);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateX(4px);
}

.ranking-card.rank-first {
  border-color: rgba(255, 183, 3, 0.4);
  background: rgba(255, 183, 3, 0.05);
}

.ranking-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ranking-number {
  font-size: 1.1rem;
  font-weight: 800;
  width: 28px;
  color: var(--text-dim);
}

.ranking-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  border: 2px solid;
}

.ranking-details {
  display: flex;
  flex-direction: column;
}

.ranking-player-name {
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.ranking-score-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ranking-score-value {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--neon-cyan);
  min-width: 40px;
  text-align: right;
}

.ranking-score-unit {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Round History List */
.history-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 450px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: rgba(14, 17, 28, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
}

/* Modals & Overlays */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 5, 8, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-neon);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), var(--shadow-glow);
  border-radius: 20px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.modal-overlay.open .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-size: 1.4rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.5rem;
  padding: 0.2rem;
  line-height: 1;
}
.modal-close-btn:hover {
  color: var(--text-main);
}

/* Confetti Canvas */
#confettiCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 999;
}

/* Games Grid */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.game-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.game-card:hover {
  border-color: rgba(0, 242, 254, 0.3);
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.game-card.active-wheel {
  border-color: rgba(0, 242, 254, 0.4);
}

.game-card.active-wheel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
}

/* MiniGame Arena Screen */
.minigame-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 480px;
  position: relative;
}

/* Aim Trainer Target */
.aim-target {
  position: absolute;
  border-radius: 50%;
  cursor: crosshair;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: transform 0.05s ease;
  animation: target-pop 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes target-pop {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: .25s;
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .25s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--neon-cyan);
}
input:checked + .slider:before {
  transform: translateX(20px);
  background-color: #060b13;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .app-container {
    padding: 1rem 0.75rem 3rem;
  }
  .header-actions {
    width: 100%;
    justify-content: space-between;
  }
  .wheel-canvas-container {
    width: 320px;
    height: 320px;
  }
  .wheel-center-btn {
    width: 70px;
    height: 70px;
    font-size: 0.8rem;
  }
}
