/* =====================================================
   RBW Live Tracker — Premium Dark Design System
   ===================================================== */

:root {
  /* Core Palette */
  --bg-base: #080b12;
  --bg-surface: #0d1117;
  --bg-card: #111823;
  --bg-card-hover: #161f2e;
  --bg-glass: rgba(13, 17, 23, 0.7);

  /* Accent Colors */
  --accent-queue: #3b82f6;
  --accent-queue-glow: rgba(59, 130, 246, 0.25);
  --accent-game: #8b5cf6;
  --accent-game-glow: rgba(139, 92, 246, 0.25);
  --accent-live: #22c55e;
  --accent-live-glow: rgba(34, 197, 94, 0.35);

  /* ELO Colors */
  --elo-iron: #6b7280;
  --elo-bronze: #cd7f32;
  --elo-silver: #9ca3af;
  --elo-gold: #f59e0b;
  --elo-platinum: #06b6d4;
  --elo-diamond: #3b82f6;
  --elo-master: #8b5cf6;
  --elo-grandmaster: #f97316;

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  --text-accent: #60a5fa;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.05);
  --border-card: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);

  /* Spacing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 8px 40px rgba(0, 0, 0, 0.6);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* =====================================================
   Background Ambient Orbs
   ===================================================== */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  animation: floatOrb 12s ease-in-out infinite;
}
.orb-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, #1d4ed8 0%, transparent 70%);
  top: -200px; left: -200px;
  animation-delay: 0s;
}
.orb-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #6d28d9 0%, transparent 70%);
  top: 30%; right: -150px;
  animation-delay: -4s;
}
.orb-3 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #0e7490 0%, transparent 70%);
  bottom: -100px; left: 40%;
  animation-delay: -8s;
}
@keyframes floatOrb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 15px) scale(0.95); }
}

/* =====================================================
   Header
   ===================================================== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8, 11, 18, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}
.logo-icon svg { width: 20px; height: 20px; }
.logo-text { display: flex; flex-direction: column; }
.logo-title {
  font-size: 16px;
  font-weight: 800;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
  line-height: 1.2;
}
.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.3px;
}

/* Header right */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 100px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-live);
  letter-spacing: 1px;
}
.live-dot {
  width: 6px; height: 6px;
  background: var(--accent-live);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-live-glow);
  animation: pulseDot 2s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

.last-updated {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.refresh-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  color: var(--accent-queue);
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
}
.refresh-btn:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.5);
  transform: translateY(-1px);
}
.refresh-btn svg { width: 14px; height: 14px; }
.refresh-btn.spinning svg { animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =====================================================
   Stats Bar
   ===================================================== */
.stats-bar {
  max-width: 1400px;
  margin: 24px auto 0;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 20px;
  gap: 2px;
  position: relative;
}
.stat-divider {
  width: 1px;
  height: 40px;
  background: var(--border-subtle);
  flex-shrink: 0;
}
.stat-num {
  font-size: 24px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  background: linear-gradient(135deg, #f1f5f9, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}
.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* =====================================================
   Main Layout
   ===================================================== */
.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 24px 60px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  position: relative;
  z-index: 1;
}
@media (max-width: 960px) {
  .main { grid-template-columns: 1fr; }
}

/* =====================================================
   Section
   ===================================================== */
.section { display: flex; flex-direction: column; gap: 16px; }

.section-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.section-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.section-icon svg { width: 16px; height: 16px; }
.queue-icon {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-queue);
  border: 1px solid rgba(59, 130, 246, 0.2);
}
.game-icon {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-game);
  border: 1px solid rgba(139, 92, 246, 0.2);
}
.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.section-count {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-queue);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 100px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}
.section-count.game-count {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-game);
  border-color: rgba(139, 92, 246, 0.25);
}
.section-desc {
  font-size: 13px;
  color: var(--text-muted);
  padding-left: 42px;
}

/* =====================================================
   Queue Groups
   ===================================================== */
.queue-groups { display: flex; flex-direction: column; gap: 12px; }

.queue-group {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.2s ease;
  animation: slideIn 0.3s ease;
}
.queue-group:hover {
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 4px 24px rgba(59, 130, 246, 0.08);
}
.queue-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(59, 130, 246, 0.05);
  border-bottom: 1px solid var(--border-subtle);
}
.queue-channel-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.queue-channel-name::before {
  content: '🔊';
  font-size: 14px;
}
.queue-player-count {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  background: rgba(59, 130, 246, 0.1);
  padding: 2px 8px;
  border-radius: 100px;
}
.queue-players { padding: 8px; display: flex; flex-direction: column; gap: 4px; }

/* =====================================================
   Player Card (Queue)
   ===================================================== */
.player-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  cursor: default;
  position: relative;
  overflow: hidden;
}
.player-card:hover {
  background: rgba(255, 255, 255, 0.04);
}
.player-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--elo-color, var(--elo-silver));
  border-radius: 0 2px 2px 0;
  opacity: 0.7;
}

.player-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--elo-color, #475569), transparent);
  border: 2px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.player-info { flex: 1; min-width: 0; }
.player-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-discord-id {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.elo-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
  flex-shrink: 0;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--elo-color, var(--text-secondary));
}

/* =====================================================
   Games Grid
   ===================================================== */
.games-grid { display: flex; flex-direction: column; gap: 16px; }

.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.2s ease;
  animation: slideIn 0.3s ease;
}
.game-card:hover {
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: 0 4px 24px rgba(139, 92, 246, 0.1);
}

.game-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(59, 130, 246, 0.05));
  border-bottom: 1px solid var(--border-subtle);
}
.game-id {
  display: flex;
  align-items: center;
  gap: 8px;
}
.game-number {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.5px;
}
.game-number-hash {
  color: var(--accent-game);
}
.game-status-dot {
  width: 8px; height: 8px;
  background: var(--accent-game);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.6);
  animation: pulseDot 1.5s ease-in-out infinite;
}
.game-duration {
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  background: rgba(139, 92, 246, 0.1);
  padding: 3px 8px;
  border-radius: 100px;
  border: 1px solid rgba(139, 92, 246, 0.15);
}

.game-teams {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.team-col {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.team-col:first-child {
  border-right: 1px solid var(--border-subtle);
}
.team-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.team-label.team1 { color: #22c55e; }
.team-label.team2 { color: #ef4444; }
.team-label::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}
.team-label.team1::before { background: #22c55e; }
.team-label.team2::before { background: #ef4444; }

/* In-game player card (compact) */
.player-card-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}
.player-card-compact:hover { background: rgba(255,255,255,0.03); }
.player-avatar-sm {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--elo-color, #475569), rgba(255,255,255,0.05));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  border: 1.5px solid rgba(255,255,255,0.08);
}
.player-info-compact { flex: 1; min-width: 0; }
.player-name-compact {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-id-compact {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.elo-badge-sm {
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--elo-color, var(--text-muted));
  flex-shrink: 0;
}

/* =====================================================
   Empty State
   ===================================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 20px;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  font-size: 14px;
}
.empty-icon { font-size: 28px; opacity: 0.5; }

/* =====================================================
   Loading state
   ===================================================== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 11, 18, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.loading-overlay.visible { opacity: 1; pointer-events: all; }
.loading-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border-card);
  border-top-color: var(--accent-queue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* =====================================================
   Animations
   ===================================================== */
@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =====================================================
   Scrollbar
   ===================================================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-card); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }
