:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1b1d22;
  --text-muted: #5d636f;
  --border: #e2e5ea;
  --accent: #1f5fd1;
  --f1: #d6262b;
  --f2: #0f7c8c;
  --motogp: #1f2a44;
  --wsbk: #6b3fa0;
  --formulae: #127a3e;
  --f1academy: #c2387a;
  --wec: #1d4f91;
  --nascar: #b8860b;
  --indycar: #4a5568;
  --seriea: #0b5bd3;
  --premierleague: #3d195b;
  --laliga: #c8102e;
  --bundesliga: #b5121b;
  --ligue1: #0a3a5c;
  --ucl: #0e1e5b;
  --uel: #c45a00;
  --uecl: #1b8a5a;
  --cricket: #0f6e4f;
  --nba: #1d428a;
  --fiba: #b8410f;
  --volley: #b5179e;
  --tennis: #5a8f00;
  --rugby: #6b4423;
  --cycling: #d97706;
  --nfl: #013369;
  --mlb: #bf0d3e;
  --free-bg: #e3f5e8;
  --free-text: #17663a;
  --pay-bg: #eef0f3;
  --pay-text: #4a505c;
  --verify-bg: #fff3d6;
  --verify-text: #845a00;
  --next: #1f5fd1;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121418;
    --surface: #1b1e24;
    --text: #e9ebef;
    --text-muted: #9aa1ad;
    --border: #2c3038;
    --accent: #7aa7ff;
    --f1: #ff5a5f;
    --f2: #3fb6c6;
    --motogp: #8fa3d6;
    --wsbk: #b08ae0;
    --formulae: #4cc283;
    --f1academy: #f07ab0;
    --wec: #6f9be0;
    --nascar: #e3b341;
    --indycar: #a0aec0;
    --seriea: #6fa4f5;
    --premierleague: #b98ae0;
    --laliga: #ff7a85;
    --bundesliga: #f27a80;
    --ligue1: #7fb3d9;
    --ucl: #8fa0e8;
    --uel: #f0a060;
    --uecl: #5fd09a;
    --cricket: #57c79d;
    --nba: #7fa2e8;
    --fiba: #f09060;
    --volley: #ec7fd8;
    --tennis: #a3d65c;
    --rugby: #c99a6e;
    --cycling: #f5a524;
    --nfl: #7f9ccc;
    --mlb: #f06a8c;
    --free-bg: #183626;
    --free-text: #7fd9a2;
    --pay-bg: #262a31;
    --pay-text: #b3b9c4;
    --verify-bg: #3a2f12;
    --verify-text: #f0c665;
    --next: #7aa7ff;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

a { color: var(--accent); }

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

.masthead {
  padding: 32px 0 20px;
}

.masthead h1 {
  margin: 0;
  font-size: 1.9rem;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 4px 0 0;
  color: var(--text-muted);
}

/* Navigation (main page and generated pages) */
.site-name {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.site-name a { color: var(--text); text-decoration: none; }

.sport-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 10px;
  font-size: 0.9rem;
}
.sport-nav a { color: var(--text-muted); text-decoration: none; }
.sport-nav a:hover { color: var(--accent); text-decoration: underline; }

.title-link { color: inherit; text-decoration: none; }
.title-link:hover { text-decoration: underline; }

/* Generated pages */
.page { padding-bottom: 8px; }
.page h1 { font-size: 1.6rem; line-height: 1.25; margin: 8px 0 6px; letter-spacing: -0.01em; }
.breadcrumbs { font-size: 0.85rem; color: var(--text-muted); }
.breadcrumbs a { color: var(--text-muted); }
.lead { margin: 0 0 6px; color: var(--text-muted); }
.when.big { font-size: 1.1rem; margin: 10px 0 4px; }
.block-title {
  margin: 22px 0 6px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.page .block { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 4px 16px 10px; margin-top: 14px; }
.page .block .block-title { margin-top: 12px; }
.hub-list { list-style: none; margin: 10px 0 0; padding: 0; }
.hub-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 12px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}
.hub-list li:first-child { border-top: none; }
.hub-list a { font-weight: 600; }
.more-links { margin-top: 20px; font-size: 0.9rem; }

/* Filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-bottom: 8px;
}

.chip-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-group[hidden] { display: none; }

/* Space reserved before the JavaScript fills the page, so the layout doesn't jump (CLS) */
#sport-filter { min-height: 34px; }
#events { min-height: 100vh; }
.select select { min-width: 150px; }

.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 6px 14px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.chip.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--surface);
}

.toggle,
.select {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  cursor: pointer;
}

.select select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
}

.timezone-note {
  margin: 0 0 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Event cards */
.event {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
}

.event.next { border-color: var(--next); box-shadow: 0 0 0 1px var(--next); }
.event.past { opacity: 0.6; }

.event-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.series {
  font-weight: 700;
  color: #fff;
  padding: 1px 8px;
  border-radius: 4px;
}
.series.f1 { background: var(--f1); }
.series.f2 { background: var(--f2); }
.series.motogp { background: var(--motogp); }
.series.wsbk { background: var(--wsbk); }
.series.formulae { background: var(--formulae); }
.series.f1academy { background: var(--f1academy); }
.series.wec { background: var(--wec); }
.series.nascar { background: var(--nascar); }
.series.indycar { background: var(--indycar); }
.series.seriea { background: var(--seriea); }
.series.premierleague { background: var(--premierleague); }
.series.laliga { background: var(--laliga); }
.series.bundesliga { background: var(--bundesliga); }
.series.ligue1 { background: var(--ligue1); }
.series.ucl { background: var(--ucl); }
.series.uel { background: var(--uel); }
.series.uecl { background: var(--uecl); }
.series[class*="cricket-"] { background: var(--cricket); }
.series.nba { background: var(--nba); }
.series.fiba { background: var(--fiba); }
.series[class*="volley-"] { background: var(--volley); }
.series[class*="tennis-"] { background: var(--tennis); }
.series[class*="rugby-"] { background: var(--rugby); }
.series[class*="cycling-"] { background: var(--cycling); }
.series.nfl { background: var(--nfl); }
.series.mlb { background: var(--mlb); }

@media (prefers-color-scheme: dark) {
  .series { color: #121418; }
}

.event h2 {
  margin: 6px 0 2px;
  font-size: 1.3rem;
}

.details {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.when {
  margin: 10px 0 0;
  font-weight: 600;
}

.when-label,
.session-name {
  display: inline-block;
  min-width: 140px;
  color: var(--text-muted);
  font-weight: 400;
}

.sessions {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  font-size: 0.9rem;
}

.matches { margin-top: 10px; }

.matches li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 12px;
  padding: 4px 0;
  border-top: 1px solid var(--border);
}
.matches li:first-child { border-top: none; }
.matches .session-name { min-width: 0; color: var(--text); font-weight: 600; }
.matches .session-time { color: var(--text-muted); }

.alert {
  margin: 10px 0 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--verify-bg);
  color: var(--verify-text);
  font-size: 0.9rem;
}

.series-note {
  margin: 14px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.block { margin-top: 16px; }

.block h3 {
  margin: 0 0 6px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.broadcaster {
  display: grid;
  grid-template-columns: 140px 1fr;
  grid-template-areas:
    "country name"
    "country tags"
    "country note";
  column-gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}
.broadcaster:first-child { border-top: none; }

.broadcaster.no-country {
  grid-template-columns: 1fr;
  grid-template-areas: "name" "tags" "note";
}

.country { grid-area: country; font-size: 0.9rem; color: var(--text-muted); }
.name { grid-area: name; font-weight: 600; }
.tags { grid-area: tags; display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.note { grid-area: note; font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }

.tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 4px;
  white-space: nowrap;
}
.tag.free { background: var(--free-bg); color: var(--free-text); }
.tag.pay,
.tag.neutral { background: var(--pay-bg); color: var(--pay-text); }
.tag.verify { background: var(--verify-bg); color: var(--verify-text); }
.tag.next-tag { background: var(--next); color: var(--surface); }

.empty { color: var(--text-muted); font-size: 0.9rem; margin: 0; }
.empty.large { text-align: center; padding: 40px 0; }

.site-footer {
  margin-top: 32px;
  padding: 20px 0 40px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

@media (max-width: 560px) {
  .broadcaster {
    grid-template-columns: 1fr;
    grid-template-areas: "country" "name" "tags" "note";
  }
  .country { font-size: 0.8rem; }
}
