@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Lexend:wght@400;600;800&display=swap');

/* ── Global Variables ─────────────────────────── */
:root {
  --bg-dark: #05080f;
  --bg-surface: #0c121d;
  --bg-card: rgba(18, 26, 38, 0.8);
  --bg-accent: rgba(30, 41, 59, 0.6);
  --bg-pitch: radial-gradient(circle at 50% 120%, #14532d 0%, #05080f 80%);
  
  --primary: #3b82f6;
  --primary-glow: rgba(59, 130, 246, 0.4);
  --secondary: #6366f1;
  --accent-gold: #fbbf24;
  --accent-silver: #e2e8f0;
  --accent-bronze: #d97706;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  
  --border-light: rgba(255, 255, 255, 0.08);
  
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;

  /* Tier Colors */
  --t1: #fbbf24; --t2: #3b82f6; --t3: #10b981; --t4: #f97316; --t5: #64748b;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .nav-brand { font-family: 'Lexend', sans-serif; }
.text-gradient { background: linear-gradient(135deg, #fff 0%, #94a3b8 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* ── Navigation ───────────────────────────────── */
.navbar {
  background: rgba(5, 8, 15, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  position: sticky; top: 0; z-index: 1000;
  height: 64px; display: flex; align-items: center;
}

.nav-inner { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; display: flex; justify-content: space-between; align-items: center; }
.nav-brand { font-size: 1.2rem; font-weight: 800; text-decoration: none; color: white; }
.nav-brand span { color: var(--primary); }

.nav-links { display: flex; gap: 0.5rem; }
.nav-link {
  text-decoration: none; color: var(--text-muted); font-size: 0.8rem; font-weight: 600;
  padding: 0.5rem 0.8rem; border-radius: 8px; display: flex; align-items: center; gap: 8px; transition: 0.2s;
  min-height: 44px; /* WCAG minimum */
}
.nav-link svg { width: 18px; height: 18px; }
.nav-link.active { color: var(--primary); background: rgba(59, 130, 246, 0.1); }

@media (max-width: 768px) {
  .navbar { position: fixed; top: auto; bottom: 0; height: 70px; border-bottom: none; border-top: 1px solid var(--border-light); background: #05080f; }
  .nav-inner { padding: 0; }
  .nav-brand { display: none; }
  .nav-links { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; }
  .nav-link { flex-direction: column; font-size: 0.65rem; padding: 0.5rem 0; gap: 4px; border-radius: 0; flex: 1; text-align: center; }
  .nav-link svg { width: 22px !important; height: 22px !important; }
  .nav-link.desktop-only { display: none !important; }
  
  main { padding-bottom: 90px; }
  
  body::before {
    content: "WC2026 Fantasy";
    display: flex; align-items: center; justify-content: center;
    height: 50px; background: var(--bg-dark); 
    font-family: 'Lexend'; font-weight: 800; font-size: 0.95rem; color: white;
    border-bottom: 1px solid var(--border-light);
  }
}

/* ── Hero & Stats ────────────────────────────── */
.hero-header {
  padding: 3rem 1.5rem; background: var(--bg-pitch);
  text-align: center; border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  position: relative; overflow: hidden; margin-bottom: 1.5rem;
}

.hero-title { font-size: clamp(1.75rem, 6vw, 3rem); font-weight: 800; line-height: 1.1; margin-bottom: 0.5rem; }
.hero-subtitle { font-size: 0.95rem; color: var(--text-muted); max-width: 500px; margin: 0 auto 1.5rem; }

.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; max-width: 800px; margin: 0 auto; }
.stat-card {
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-light);
  border-radius: 12px; padding: 1.25rem 0.5rem; text-align: center;
}
.stat-val { font-size: 1.75rem; font-weight: 800; font-family: 'Lexend'; color: white; line-height: 1; }
.stat-lbl { font-size: 0.6rem; text-transform: uppercase; color: var(--text-dim); font-weight: 800; letter-spacing: 0.05em; margin-top: 6px; }

@media (max-width: 600px) {
  .hero-header { padding: 2.5rem 1rem 1.5rem; }
  .stat-val { font-size: 1.1rem; }
  .stats-row { gap: 0.5rem; }
  .hero-actions { display: flex; flex-direction: column; gap: 0.75rem; }
  .btn-modern { width: 100%; min-height: 44px; }
}

/* ── Layout & Cards ───────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.card { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1rem; }

.grid-bento { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1.25rem; }
@media (max-width: 900px) {
  .grid-bento { display: flex; flex-direction: column; gap: 1rem; }
  .card { grid-column: span 12 !important; }
}

/* ── Leaderboard (Desktop: Table, Mobile: Cards) ── */
.leaderboard-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.leaderboard-table th { padding: 12px; text-align: left; font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; border-bottom: 1px solid var(--border-light); }
.leaderboard-table td { padding: 16px 12px; border-bottom: 1px solid var(--border-light); }

.leaderboard-cards { display: none; }

@media (max-width: 768px) {
  .leaderboard-table { display: none; }
  .leaderboard-cards { display: flex; flex-direction: column; gap: 0.75rem; }
  
  .player-card {
    background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 12px;
    padding: 1.25rem; display: flex; align-items: center; gap: 1rem;
    position: relative;
  }
  .player-card.rank-1 { border: 2px solid var(--accent-gold); box-shadow: 0 0 20px rgba(251, 191, 36, 0.1); }
  
  .rank-badge {
    width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-family: Lexend; font-size: 1rem; background: var(--bg-dark);
  }
  .rank-1 .rank-badge { background: var(--accent-gold); color: #000; }
  
  .player-info { flex: 1; min-width: 0; }
  .player-name { font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
  .player-meta { font-size: 0.75rem; color: var(--text-dim); font-weight: 600; }
  
  .player-pts-box { text-align: right; }
  .player-pts-val { font-size: 1.5rem; font-weight: 800; font-family: Lexend; color: var(--primary); }
  .player-pts-lbl { font-size: 0.5rem; text-transform: uppercase; font-weight: 800; display: block; color: var(--text-dim); }
}

/* ── Squad Cards (Accordion) ──────────────────── */
.squad-section { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 12px; overflow: hidden; margin-bottom: 1rem; }
.squad-header { padding: 1.25rem; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.squad-header .toggle-icon { transition: transform 0.3s; color: var(--text-dim); }
.squad-header.active .toggle-icon { transform: rotate(180deg); }
.squad-body { padding: 0 1.25rem 1.25rem; display: none; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.75rem; }
.squad-body.active { display: grid; }

.team-chip {
  background: var(--bg-dark); border: 1px solid var(--border-light); border-radius: 8px;
  padding: 10px; display: flex; align-items: center; gap: 8px; font-size: 0.8rem; font-weight: 600;
}

/* ── Visual Bracket ───────────────────────────── */
.bracket-wrapper { overflow-x: auto; padding: 1rem 0; -webkit-overflow-scrolling: touch; }
.bracket-container { display: flex; gap: 1.5rem; min-width: max-content; padding: 0 1rem; }
.bracket-round { width: 280px; flex-shrink: 0; }
.round-label { font-size: 0.7rem; font-weight: 800; color: var(--primary); text-transform: uppercase; text-align: center; margin-bottom: 1rem; letter-spacing: 0.1em; }

.match-card-visual {
  background: var(--bg-accent); border: 1px solid var(--border-light); border-radius: 10px;
  padding: 1rem; margin-bottom: 1rem; display: flex; flex-direction: column; gap: 8px;
}
.match-card-visual.is-owned { border-left: 4px solid var(--success); background: rgba(16, 185, 129, 0.05); }

/* ── Floating Action Button ──────────────────── */
.fab {
  position: fixed; bottom: 85px; right: 16px; width: 56px; height: 56px; border-radius: 50%;
  background: var(--success); color: white; display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; box-shadow: 0 4px 15px rgba(0,0,0,0.4); z-index: 3000; border: none;
}

/* ── Group Selector ───────────────────────────── */
.group-selector {
  display: flex; gap: 8px; overflow-x: auto; padding: 0.75rem 1rem;
  background: var(--bg-dark); position: sticky; top: 0; z-index: 900;
  border-bottom: 1px solid var(--border-light); scrollbar-width: none;
}
.group-selector::-webkit-scrollbar { display: none; }
.group-pill {
  padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border-light);
  font-size: 0.75rem; font-weight: 700; white-space: nowrap; color: var(--text-muted); cursor: pointer;
}
.group-pill.active { background: var(--primary); border-color: var(--primary); color: white; }

/* ── Prize Pool (Vertical on Mobile) ────────── */
.prize-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 768px) { .prize-grid { grid-template-columns: 1fr; } }

/* ── Buttons ──────────────────────────────────── */
.btn-modern {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0.75rem 1.25rem; border-radius: 10px; font-weight: 700; font-size: 0.85rem;
  text-decoration: none; cursor: pointer; transition: 0.2s; border: none; min-height: 44px;
}
.btn-primary-modern { background: var(--primary); color: white; box-shadow: 0 4px 12px var(--primary-glow); }
.btn-secondary-modern { background: var(--bg-accent); color: white; border: 1px solid var(--border-light); }

/* ── Utilities ────────────────────────────────── */
.w-full { width: 100%; }
.mt-4 { margin-top: 1rem; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.avatar-sm { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: white; }
