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

:root {
  --bg: #0a0a0f;
  --bg2: #111118;
  --bg3: #1a1a24;
  --surface: #1e1e2a;
  --surface2: #2a2a38;
  --border: #2e2e3e;
  --text: #e8e8f0;
  --text2: #9898b0;
  --text3: #6a6a80;
  --accent: #6c5ce7;
  --accent2: #a29bfe;
  --green: #00e676;
  --red: #ff5252;
  --orange: #ffab00;
  --live-bg: #d32f2f;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 8px;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  z-index: 1000;
}
.skip-link:focus { top: 8px; }

.loading {
  color: var(--text3);
  text-align: center;
  padding: 40px 16px;
  font-size: 0.95rem;
}

.no-data {
  color: var(--text3);
  text-align: center;
  padding: 32px 16px;
}

.error {
  color: var(--red);
  text-align: center;
  padding: 24px;
}

/* ── Header ── */
.site-header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none !important;
}

.brand-mark {
  font-size: 1.5rem;
  line-height: 1;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.brand-text strong { font-size: 1rem; letter-spacing: -0.02em; }
.brand-text span { font-size: 0.75rem; color: var(--text3); }

.main-nav {
  display: flex;
  gap: 8px;
}

.main-nav a {
  color: var(--text2);
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.2s, color 0.2s;
}
.main-nav a:hover {
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, var(--bg2) 0%, var(--surface) 100%);
  padding: 40px 0 32px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -60%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: var(--hero-emblem, none) center/contain no-repeat;
  opacity: 0.04;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-kicker {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent2);
  margin-bottom: 4px;
}

.hero-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 8px;
}

.hero-lead {
  color: var(--text2);
  font-size: 1rem;
  margin-bottom: 20px;
}

.hero-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  display: inline-block;
  font-size: 0.75rem;
  padding: 4px 14px;
  border-radius: 20px;
  background: var(--surface);
  color: var(--text2);
  border: 1px solid var(--border);
}

.live-pulse {
  background: var(--live-bg);
  color: #fff;
  border-color: var(--live-bg);
  animation: pulse 2s infinite;
}

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

/* ── Competition Bar ── */
.comp-bar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}

.comp-scroll {
  display: flex;
  gap: 8px;
  padding: 12px 0;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--surface2) transparent;
  -webkit-overflow-scrolling: touch;
}

.comp-scroll::-webkit-scrollbar { height: 4px; }
.comp-scroll::-webkit-scrollbar-track { background: transparent; }
.comp-scroll::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 4px; }

.comp-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  width: 90px;
  padding: 10px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text2);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  font-size: 0.7rem;
  text-align: center;
}

.comp-item:hover {
  background: var(--surface2);
  border-color: var(--accent);
  color: var(--text);
}
.comp-item.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.comp-emblem {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.comp-emblem-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg3);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text2);
}

.comp-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
}

.comp-area {
  font-size: 0.6rem;
  color: var(--text3);
}

/* ── Filter Bar ── */
.filters {
  background: var(--bg);
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.filter-bar {
  display: flex;
  gap: 6px;
}

.filter-btn {
  padding: 6px 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}
.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Ad Zone ── */
.ad-zone {
  padding: 8px 0;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-zone iframe { max-width: 100%; }

/* ── Section Titles ── */
.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-top: 8px;
}

/* ── Match Cards Grid ── */
.matches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.matches-grid.compact {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.match-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.match-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.match-live {
  border-color: var(--live-bg);
  box-shadow: 0 0 0 1px var(--live-bg);
}

.match-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
}

.match-live-badge {
  background: var(--live-bg);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  animation: pulse 1.5s infinite;
}

.match-teams {
  display: flex;
  align-items: center;
  gap: 8px;
}

.team {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.team.home { justify-content: flex-start; }
.team.away { justify-content: flex-end; }

.team-badge {
  width: 22px;
  height: 22px;
  object-fit: contain;
}
.team-badge.large { width: 36px; height: 36px; }

.team-name {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
}

.match-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
}

.ms-score {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}

.ms-time {
  font-size: 0.8rem;
  color: var(--accent2);
  font-weight: 600;
}

.match-group {
  font-size: 0.65rem;
  color: var(--text3);
  margin-top: 2px;
}

.match-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text3);
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ── Standings ── */
.standings-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.standings-group-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--accent2);
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.standings-table th {
  text-align: left;
  padding: 8px 6px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.standings-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.standings-table tbody tr:hover {
  background: var(--bg3);
}

.standings-table .pos {
  font-weight: 700;
  color: var(--text3);
  text-align: center;
}

.standings-table .team-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.standings-table .pts {
  font-weight: 800;
  color: var(--accent2);
}

.qualifying td { background: rgba(108, 92, 231, 0.06); }

.form-strip {
  display: inline-flex;
  gap: 2px;
  margin-left: 6px;
}
.form-strip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  font-size: 0.55rem;
  font-weight: 700;
  color: #fff;
}
.form-w { background: var(--green); }
.form-d { background: var(--orange); }
.form-l { background: var(--red); }

/* ── Teams Grid ── */
.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.team-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  transition: transform 0.15s;
}
.team-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.team-badge-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--text3);
}

.team-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.8rem;
  color: var(--text2);
}
.team-card-info strong {
  color: var(--text);
  font-size: 0.9rem;
}

/* ── Footer ── */
.site-footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 32px 0;
  margin-top: 24px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text3);
}

.site-footer strong { color: var(--text2); }

.footer-legal {
  margin-top: 6px;
  font-size: 0.7rem;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .header-inner { height: 52px; }
  .brand-text span { display: none; }

  .hero { padding: 28px 0 24px; }
  .hero-title { font-size: 1.5rem; }

  .matches-grid { grid-template-columns: 1fr; }
  .matches-grid.compact { grid-template-columns: 1fr; }

  .standings-table { font-size: 0.7rem; }
  .standings-table th, .standings-table td { padding: 6px 4px; }

  .teams-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

  .comp-item { width: 76px; padding: 8px 4px; }
  .comp-item:first-child { margin-left: 4px; }
  .comp-item:last-child { margin-right: 4px; }
  .comp-emblem { width: 24px; height: 24px; }

  .filter-btn { font-size: 0.75rem; padding: 5px 14px; }
}

@media (max-width: 480px) {
  .hero-title { font-size: 1.25rem; }
  .team-name { font-size: 0.8rem; }
  .ms-score { font-size: 1rem; }
}
