:root {
  color-scheme: light;
  --bg: #0a0e1a;
  --surface: #121829;
  --surface2: #1a2138;
  --ink: #e8ecf4;
  --muted: #8892a8;
  --line: #2a3350;
  --primary: #00d4aa;
  --primary-strong: #00b894;
  --accent: #ff6b35;
  --soft: rgba(0,212,170,0.08);
  --warn: #fff5df;
  --warn-text: #7a4a00;
  --gold: #ffd700;
  --silver: #c0c0c0;
  --bronze: #cd7f32;
  --live: #ff3b5c;
  --win: #00c853;
  --draw: #ffc107;
  --loss: #ff5252;
  --shadow: 0 8px 32px rgba(0,0,0,0.3);
  --radius: 12px;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  width: min(1200px, calc(100% - 24px));
  margin: 0 auto;
}

/* === HEADER === */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,14,26,0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand .trophy { font-size: 24px; }

nav { display: flex; gap: 18px; }
nav a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
nav a:hover, nav a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  text-decoration: none;
}

/* === HERO / TODAY === */
.hero {
  padding: 32px 0 24px;
  background: linear-gradient(180deg, rgba(0,212,170,0.06) 0%, transparent 100%);
}

.hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-head h1 {
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary) 0%, #00b4d8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-head h1 span {
  -webkit-text-fill-color: var(--ink);
  font-size: 0.5em;
  display: block;
  background: none;
}

.update-badge {
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.update-badge .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary);
  animation: pulse 2s infinite;
}

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

.matches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.match-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.match-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0,212,170,0.1);
}

.match-card.live {
  border-color: var(--live);
  box-shadow: 0 0 20px rgba(255,59,92,0.15);
}

.match-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--muted);
}

.match-status {
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
}

.match-status.live {
  background: var(--live);
  color: #fff;
  animation: pulse 1.5s infinite;
}

.match-status.ft { background: var(--surface2); color: var(--muted); }
.match-status.soon { background: rgba(0,212,170,0.15); color: var(--primary); }

.match-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.team {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
}

.team.right { justify-content: flex-end; text-align: right; }

.team .flag { font-size: 24px; }

.score {
  font-size: 28px;
  font-weight: 900;
  color: var(--primary);
  min-width: 80px;
  text-align: center;
  letter-spacing: 4px;
}

.score .dash { color: var(--muted); font-size: 20px; }

.match-goals {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.match-goals .goal { display: flex; align-items: center; gap: 4px; }
.match-goals .goal .min { color: var(--primary); font-weight: 700; min-width: 36px; }

.match-ground {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

/* === TABS === */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.tab-btn {
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover { border-color: var(--primary); color: var(--primary); }
.tab-btn.active { background: var(--primary); color: var(--bg); border-color: var(--primary); }

/* === GROUP TABLE === */
.group-section {
  padding: 24px 0;
}

.group-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 500px;
}

th, td {
  padding: 10px 12px;
  text-align: center;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}

th {
  background: var(--surface2);
  color: var(--muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td:first-child, th:first-child { text-align: left; }

td:first-child {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pos-badge {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
}

.pos-1, .pos-2 { background: var(--primary); }
.pos-3 { background: var(--muted); }

/* === SIMULATOR === */
.sim-section {
  padding: 24px 0;
}

.sim-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}

.sim-card h3 {
  margin-bottom: 16px;
  font-size: 18px;
  color: var(--primary);
}

.sim-match {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--surface2);
  flex-wrap: wrap;
}

.sim-match .flag { font-size: 20px; }

.sim-input {
  width: 48px;
  height: 36px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.sim-input:focus {
  outline: 2px solid var(--primary);
  border-color: var(--primary);
}

.sim-vs { color: var(--muted); font-weight: 700; font-size: 14px; }
.sim-team { font-weight: 600; font-size: 14px; min-width: 100px; }

.sim-result {
  margin-top: 16px;
  padding: 16px;
  border-radius: 8px;
  background: var(--soft);
  border: 1px solid rgba(0,212,170,0.2);
}

.sim-result h4 {
  color: var(--primary);
  margin-bottom: 8px;
  font-size: 14px;
}

.sim-standings {
  width: 100%;
  font-size: 12px;
}

.sim-standings td, .sim-standings th {
  padding: 6px 8px;
  font-size: 12px;
}

.qualified { background: rgba(0,212,170,0.06); }

/* === SCHEDULE === */
.schedule-section { padding: 24px 0 40px; }

.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar input,
.filter-bar select {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
}

.filter-bar input:focus,
.filter-bar select:focus {
  outline: 2px solid var(--primary);
  border-color: var(--primary);
}

.schedule-list { display: flex; flex-direction: column; gap: 8px; }

.schedule-item {
  display: grid;
  grid-template-columns: 100px 1fr auto 80px;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
}

.schedule-item .date { color: var(--muted); font-size: 13px; }
.schedule-item .teams { font-weight: 600; }
.schedule-item .score-col { font-weight: 800; color: var(--primary); }
.schedule-item .group-col {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}

/* === AD BANDS === */
.ad-band {
  width: min(1200px, calc(100% - 24px));
  margin: 20px auto;
}

.ad-placeholder {
  display: grid;
  place-items: center;
  min-height: 60px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
}

/* === FOOTER === */
footer {
  border-top: 1px solid var(--line);
  padding: 24px 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

footer a { color: var(--primary); }

/* === LOADING / EMPTY === */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--muted);
}

.loading .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-size: 15px;
}

.section-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title .icon { font-size: 24px; }

/* === NO MATCHES TODAY === */
.no-matches {
  text-align: center;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}

.no-matches .next-label {
  margin-top: 12px;
  font-size: 13px;
  color: var(--primary);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  nav { display: none; }
  
  .matches-grid {
    grid-template-columns: 1fr;
  }
  
  .schedule-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  
  .schedule-item .group-col { text-align: left; }
  
  .sim-match { flex-direction: column; align-items: stretch; }
  .sim-team { min-width: auto; }
  
  .hero-head h1 { font-size: 28px; }
}

@media (max-width: 480px) {
  .score { font-size: 22px; min-width: 60px; }
  .team { font-size: 13px; }
  .team .flag { font-size: 20px; }
}
