:root {
  --bg: #f7f8f4;
  --panel: #ffffff;
  --panel-soft: #fbfcf9;
  --text: #101828;
  --muted: #667085;
  --border: #e5e7eb;
  --navy: #071a3d;
  --emerald: #087f5b;
  --emerald-soft: #e7f8f0;
  --sand: #efe3c8;
  --sky: #d6ecff;
  --red-accent: #d64545;
  --gold: #d9a441;
  --shadow: 0 14px 32px rgba(16, 24, 40, 0.06);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 15%, rgba(8, 127, 91, 0.06), transparent 24%),
    linear-gradient(rgba(7, 26, 61, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(7, 26, 61, 0.025) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 32px 32px, 32px 32px, auto;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input { font: inherit; }

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background: var(--navy);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
}

.sidebar-top {
  display: grid;
  gap: 24px;
}

.brand-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #ffffff 0%, #efe3c8 100%);
  color: var(--navy);
  font-weight: 800;
  letter-spacing: .04em;
}

.brand-button strong,
.sidebar-note h2,
.hero-card h1,
.section-card h2,
.team-page-top h1,
.loading-screen h1,
.detail-block h3,
.group-card h3,
.venue-card h3,
.team-card h3 {
  margin: 0;
}

.sidebar-nav {
  display: grid;
  gap: 10px;
}

.sidebar-nav button {
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: #dbe4ff;
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
}

.sidebar-nav button.active,
.sidebar-nav button:hover {
  background: #ffffff;
  color: var(--navy);
}

.sidebar-note {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  padding: 18px;
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-note p,
.brand-button small {
  color: #cbd5e1;
}

.main-stage {
  padding: 28px;
  display: grid;
  gap: 24px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-soft {
  background: var(--panel-soft);
  box-shadow: none;
}

.hero-card,
.section-card,
.team-page-top,
.loading-screen {
  padding: 24px;
}

.hero-card {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: flex-start;
  background:
    radial-gradient(circle at top right, rgba(214, 236, 255, 0.9), transparent 34%),
    linear-gradient(135deg, rgba(239, 227, 200, 0.35), rgba(255, 255, 255, 0.9)),
    var(--panel);
}

.hero-copy,
.hero-subcopy,
.hero-route-line,
.match-meta,
.detail-copy,
.section-card p,
.venue-card p,
.team-card p,
.loading-screen p,
.detail-list-item p,
.empty-panel,
.player-cell span,
.stat-inline span,
.detail-stat span,
.spotlight-card p,
.mini-fixture p,
.format-step p {
  color: var(--muted);
}

.hero-copy {
  margin: 10px 0 0;
  max-width: 760px;
  line-height: 1.6;
  font-size: 16px;
}

.hero-subcopy,
.hero-route-line {
  margin: 10px 0 0;
}

.hero-status {
  display: grid;
  gap: 14px;
  min-width: 260px;
}

.hero-status div,
.stat-card,
.metric-card,
.record-card,
.spotlight-card,
.mini-fixture,
.format-step {
  display: grid;
  gap: 8px;
}

.hero-status strong,
.metric-card strong,
.spotlight-card strong,
.mini-fixture strong,
.record-card strong,
.stat-card strong {
  font-size: 22px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 12px;
  color: var(--muted);
}

.metrics-grid,
.spotlight-grid,
.match-list,
.groups-grid,
.teams-grid,
.venues-grid,
.record-grid,
.team-sections-grid,
.team-hero-stats,
.mini-fixtures-grid,
.format-grid,
.detail-list {
  display: grid;
  gap: 16px;
}

.metrics-grid,
.spotlight-grid,
.mini-fixtures-grid,
.format-grid,
.team-hero-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.match-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.groups-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.teams-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.venues-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.record-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.team-sections-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.metric-card {
  padding: 20px;
  border-top: 4px solid var(--navy);
}

.metric-card strong {
  font-size: 38px;
}

.spotlight-card,
.mini-fixture,
.format-step,
.section-intro,
.group-card,
.venue-card,
.record-card,
.stat-card {
  padding: 18px;
}

.section-header,
.section-mini-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.section-header {
  margin-bottom: 18px;
}

.search-input {
  min-width: 260px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  background: white;
}

.section-divider {
  height: 1px;
  background: var(--border);
  margin: 22px 0;
}

.match-card,
.team-card,
.detail-list-item,
.team-pill,
.back-button,
.inline-cta-button {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: white;
  color: inherit;
}

.match-card,
.team-card,
.detail-list-item {
  padding: 16px;
  text-align: left;
  cursor: pointer;
}

.match-card:hover,
.team-card:hover,
.detail-list-item:hover,
.team-pill:hover,
.back-button:hover,
.inline-cta-button:hover {
  border-color: #b8c6dd;
}

.match-card.is-selected,
.team-row-highlight {
  background: var(--primary-soft, #e7eefc);
}

.match-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.match-headline {
  font-weight: 800;
  margin-bottom: 8px;
}

.match-headline span { color: var(--muted); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(214, 236, 255, 0.9);
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
}

.badge-soft {
  background: var(--emerald-soft);
  color: var(--emerald);
}

.detail-panel {
  min-height: 220px;
  display: grid;
  gap: 16px;
}

.detail-block {
  display: grid;
  gap: 10px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.detail-grid.four-col {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.detail-stat {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  gap: 8px;
}

.empty-panel {
  display: grid;
  place-items: center;
  min-height: 140px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 18px;
  text-align: center;
  background: linear-gradient(135deg, rgba(214, 236, 255, 0.12), rgba(231, 248, 240, 0.16));
}

.compact-empty { min-height: 0; }
.left-align-empty { place-items: start; text-align: left; }

.group-card table,
.squad-table {
  width: 100%;
  border-collapse: collapse;
}

.group-card th,
.group-card td,
.squad-table th,
.squad-table td {
  text-align: left;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.group-card th:last-child,
.group-card td:last-child { text-align: right; }

.team-pill {
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
}

.team-pill-inline {
  border: 0;
  padding: 0;
  background: transparent;
}

.team-pill img,
.team-card-head img,
.team-hero-logo {
  object-fit: contain;
  background: white;
}

.team-pill img,
.team-pill-fallback {
  width: 24px;
  height: 24px;
}

.team-pill-fallback,
.team-logo-fallback,
.format-step-index {
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 800;
}

.team-pill-fallback,
.team-logo-fallback {
  background: #e2e8f0;
  color: var(--navy);
  font-size: 11px;
}

.format-step-index {
  width: 36px;
  height: 36px;
  background: var(--navy);
  color: white;
}

.team-card-head,
.team-hero-main,
.player-cell,
.stat-inline,
.team-pill-row {
  display: flex;
  align-items: center;
}

.team-card-head,
.team-hero-main,
.team-pill-row {
  gap: 14px;
}

.team-card-head {
  margin-bottom: 14px;
}

.team-card-head img,
.team-logo-fallback {
  width: 44px;
  height: 44px;
}

.team-hero {
  display: grid;
  gap: 24px;
}

.team-hero-logo,
.team-logo-fallback.large {
  width: 84px;
  height: 84px;
}

.team-logo-fallback.large { font-size: 20px; }
.team-page { display: grid; gap: 24px; }

.back-button,
.inline-cta-button {
  padding: 10px 14px;
  cursor: pointer;
}

.back-button {
  margin-bottom: 18px;
}

.inline-cta-button {
  margin-top: 12px;
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.source-links a {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(214, 236, 255, 0.65);
  color: var(--navy);
  font-size: 13px;
  font-weight: 600;
}

.squad-table-wrap,
.group-table-wrap {
  overflow-x: auto;
}

.player-cell,
.stat-inline {
  justify-content: space-between;
  gap: 12px;
}

.loading-screen {
  min-height: 240px;
  display: grid;
  place-items: center;
  text-align: center;
}

.group-card-button,
.venue-card-button {
  width: 100%;
  border: 1px solid var(--border);
  text-align: left;
  cursor: pointer;
}

.group-card-button table {
  width: 100%;
}

.stacked-hero-copy {
  width: 100%;
}

.compact-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.standings-table {
  min-width: 720px;
}

@media (max-width: 1240px) {
  .metrics-grid,
  .spotlight-grid,
  .mini-fixtures-grid,
  .format-grid,
  .match-list,
  .groups-grid,
  .teams-grid,
  .venues-grid,
  .record-grid,
  .team-sections-grid,
  .detail-grid,
  .detail-grid.four-col,
  .team-hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .hero-card { flex-direction: column; }
}

@media (max-width: 720px) {
  .main-stage { padding: 18px; }
  .sidebar { padding: 18px; }
  .metrics-grid,
  .spotlight-grid,
  .mini-fixtures-grid,
  .format-grid,
  .match-list,
  .groups-grid,
  .teams-grid,
  .venues-grid,
  .record-grid,
  .team-sections-grid,
  .detail-grid,
  .detail-grid.four-col,
  .team-hero-stats {
    grid-template-columns: 1fr;
  }
  .search-input { min-width: 0; width: 100%; }
  .section-header { flex-direction: column; align-items: stretch; }
}
