/* AllGameTimes — single stylesheet.
 *
 * This file replaces the .NET app's per-component CSS isolation. That build
 * emitted 13,729 `b-xxxxxxxxxx` scoping attributes and 2,714 inline `style=`
 * attributes into a 1.47 MB /soccer response (BUG 3). Here the whole design is
 * one cacheable file, and the only inline styles are the two team colours per
 * row, which are data, not layout.
 */

/* ---------- theme tokens ----------
 *
 * Two themes, one token set. Dark is the default; light is applied either by
 * an explicit choice (`<html data-theme="light">`, set by /static/theme.js
 * before first paint) or by the OS preference when the visitor has not chosen.
 *
 * The `:root:not([data-theme])` guard is what makes the OS preference a
 * *default* rather than an override: once the toggle writes data-theme, the
 * media query stops applying and the visitor's choice wins in both directions.
 */

:root {
  color-scheme: dark;

  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1e222b;
  --border: #2a2f3a;
  --text: #e6e8ec;
  --text-dim: #9aa3b2;
  --accent: #4f9cf9;
  --accent-contrast: #ffffff;

  /* The wordmark's orange, sampled from the logo art. "Game" is the only
   * coloured word in "AllGameTimes"; "All" and "Times" stay in the body
   * colour. Brightened slightly from the logo's #E86F1C so it clears 4.5:1
   * against the dark surface at the nav's 1.125rem size. */
  --brand-orange: #f0801f;

  /* Scrim over the home banner. The photo is a warm, mid-dark image, so the
   * hero text needs a wash behind it in both themes: dark text on the raw
   * photo is unreadable, and so is light text without a dark wash. Kept light
   * enough that the turf and the ball leather still read as colour — the text
   * gets the rest of its contrast from --hero-text-shadow. */
  --hero-scrim-top: rgba(15, 17, 21, 0.34);
  --hero-scrim-bottom: rgba(15, 17, 21, 0.62);
  --hero-text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75), 0 2px 12px rgba(0, 0, 0, 0.55);

  /* Ring drawn around a team colour dot so a dark brand colour stays visible
   * on a dark surface (and a light one on a light surface). */
  --dot-ring: rgba(255, 255, 255, 0.22);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);

  /* Animated-viewer tokens. These exist because the stage draws team colours
   * as translucent tints and a moving marker on top of them. A tint that reads
   * as "team colour" over a dark surface washes out to near-white over a light
   * one, and a white marker disappears entirely — so both the tint strength
   * and the marker colour have to be theme tokens rather than constants in
   * flow.js. */
  --flow-tint: 0.22;
  --flow-marker: #ffd166;
  /* The ring drawn around the ball. The ball is filled with the possessing
   * team's colour, and a dark brand colour on a dark surface (or a light one
   * on a light surface) would otherwise vanish — the same problem `--dot-ring`
   * solves for row dots. */
  --flow-marker-ring: rgba(255, 255, 255, 0.62);
  --flow-trail: #8ecae6;
  --flow-scoring: #ffd166;
  --flow-miss: #e5484d;
  --flow-made: #2ec4b6;

  /* Result colours for the team pages' form chips and result rows. Kept as
   * tokens rather than literals so the light theme can darken them for
   * contrast against a white surface. */
  --win: #1a7f37;
  --loss: #b42318;

  /* Play-chip tones. Same reasoning as the result colours: these hues read on
   * the dark surface, but the same values fall below a readable contrast
   * against white at the chip's 0.6rem size. */
  --chip-pass: #4f9cf9;
  --chip-run: #39b86b;
  --chip-incomplete: #d68a3a;
  --chip-sack: #c96a5a;
  --chip-punt: #b07cf0;
  --chip-kick: #f0a24a;
  --chip-penalty: #d6b400;

  --radius: 10px;
  --gap: 1rem;
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dfe3e9;
  --text: #14171c;
  --text-dim: #5b6472;
  --accent: #1f6feb;
  --accent-contrast: #ffffff;

  /* Darkened from the logo's #E86F1C so the wordmark clears 4.5:1 on white. */
  --brand-orange: #b84e08;

  /* The light theme keeps the banner but washes it toward white, which is what
   * the original light hero did: the photo stays visible as texture while the
   * dark text keeps its contrast. */
  --hero-scrim-top: rgba(247, 248, 250, 0.42);
  --hero-scrim-bottom: rgba(247, 248, 250, 0.72);
  --hero-text-shadow: 0 1px 2px rgba(255, 255, 255, 0.85), 0 2px 10px rgba(255, 255, 255, 0.6);

  --dot-ring: rgba(0, 0, 0, 0.22);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.08);

  /* On a light surface a 22% tint of a brand colour is too weak to read as
   * that team's colour, so the tint is deepened. The marker and trail colours
   * are darkened for the same reason: #ffd166 on white is a 1.6:1 contrast
   * ratio, which is effectively invisible. */
  --flow-tint: 0.34;
  --flow-marker: #b8860b;
  --flow-marker-ring: rgba(0, 0, 0, 0.55);
  --flow-trail: #1f6feb;
  --flow-scoring: #b8860b;
  --flow-miss: #c2262b;
  --flow-made: #0f7a6c;

  --win: #146c2e;
  --loss: #9f1c12;

  --chip-pass: #1f6feb;
  --chip-run: #1a7f45;
  --chip-incomplete: #a55a17;
  --chip-sack: #a63f2f;
  --chip-punt: #7a3fb8;
  --chip-kick: #9a5a10;
  --chip-penalty: #7a6400;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;

    --bg: #f7f8fa;
    --surface: #ffffff;
    --surface-2: #f0f2f5;
    --border: #dfe3e9;
    --text: #14171c;
    --text-dim: #5b6472;
    --accent: #1f6feb;
    --accent-contrast: #ffffff;

    --brand-orange: #b84e08;
    --hero-scrim-top: rgba(247, 248, 250, 0.42);
    --hero-scrim-bottom: rgba(247, 248, 250, 0.72);
    --hero-text-shadow: 0 1px 2px rgba(255, 255, 255, 0.85), 0 2px 10px rgba(255, 255, 255, 0.6);

    --dot-ring: rgba(0, 0, 0, 0.22);
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.08);

    --flow-tint: 0.34;
    --flow-marker: #b8860b;
    --flow-marker-ring: rgba(0, 0, 0, 0.55);
    --flow-trail: #1f6feb;
    --flow-scoring: #b8860b;
    --flow-miss: #c2262b;
    --flow-made: #0f7a6c;

    --win: #146c2e;
    --loss: #9f1c12;

    --chip-pass: #1f6feb;
    --chip-run: #1a7f45;
    --chip-incomplete: #a55a17;
    --chip-sack: #a63f2f;
    --chip-punt: #7a3fb8;
    --chip-kick: #9a5a10;
    --chip-penalty: #7a6400;
  }
}

*, *::before, *::after { box-sizing: border-box; }

/* The home banner breaks out to the full viewport width, which can leave a
 * sub-pixel horizontal overflow. Clipping it here is cheaper than a scrollbar
 * on every page. */
html { overflow-x: clip; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- header ---------- */

.site-header {
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text);
  letter-spacing: -0.01em;
  flex: none;
}

/* The wordmark. "All" and "Times" inherit the brand's colour; only "Game"
 * carries the logo orange, which is how the original site split the name. */
.brand-game { color: var(--brand-orange); }

/* The nav scrolls horizontally instead of wrapping on narrow screens: six
 * sport links plus the toggle never fit a phone, and a wrapped header eats
 * half the viewport. `min-width: 0` lets the flex child actually shrink. */
.nav {
  display: flex;
  gap: 0.25rem;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.nav::-webkit-scrollbar { display: none; }

.nav-link {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  flex: none;
}

.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--accent); color: var(--accent-contrast); }

/* ---------- theme toggle ---------- */

.theme-toggle {
  flex: none;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--accent);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 1.1rem;
  height: 1.1rem;
  display: block;
}

/* Show the icon for the theme the button switches *to*. The default (no
 * data-theme) follows the OS, so both icons are driven off the resolved
 * theme attribute that theme.js always writes. */
.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ---------- layout ---------- */

main { max-width: 60rem; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }

h1 { font-size: 1.6rem; margin: 0 0 0.5rem; letter-spacing: -0.02em; }

.lede { color: var(--text-dim); margin: 0 0 2rem; }

/* ---------- home ---------- */

/* Landing page sections. The .NET home used a light theme with an orange
 * accent; this port keeps the same section structure but renders it in the
 * site's dark palette so every page looks identical. */

/* The banner is the original site's hero photograph — a row of balls on a
 * turf line — behind a scrim. The scrim is a token pair rather than a fixed
 * gradient so the light theme can wash the photo toward white instead of
 * darkening it, which is what keeps the dark hero text readable in both.
 *
 * It breaks out of `main`'s 60rem column to span the viewport, because a
 * banner inset to the reading column reads as a card rather than a banner.
 * `overflow-x: clip` on the root absorbs the sub-pixel overflow that the
 * `100vw` breakout would otherwise turn into a horizontal scrollbar.
 *
 * The photo and the scrim are separate layers on purpose. A single
 * `background-image` stack cannot be filtered, so the only way to keep the
 * image vivid was to darken it until it went grey. Painting the photo on
 * `::before` lets it carry a saturation/contrast boost, and the scrim on
 * `::after` can then stay light enough that the turf and the ball leather
 * still read as colour. The text gets its contrast from `--hero-text-shadow`
 * rather than from a heavier wash. */
.home-hero {
  position: relative;
  text-align: center;
  padding: 4rem 1rem 3rem;
  border-bottom: 1px solid var(--border);
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  overflow: hidden;
}

.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("/static/images/hero.webp") center center / cover no-repeat;
  filter: saturate(1.22) contrast(1.08);
  z-index: 0;
}

.home-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(var(--hero-scrim-top), var(--hero-scrim-bottom));
  z-index: 1;
}

.home-hero-inner {
  position: relative;
  z-index: 2;
  max-width: 60rem;
  margin: 0 auto;
}

.home-hero h1 {
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
  text-shadow: var(--hero-text-shadow);
}

.home-hero h1 .accent { color: var(--accent); }

.home-hero .lede {
  max-width: 42rem;
  margin: 0 auto 1.75rem;
  font-size: 1.1rem;
  text-shadow: var(--hero-text-shadow);
}

.home-cta-group {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.home-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
}

.home-cta:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}

.home-cta.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.home-cta.primary:hover { filter: brightness(1.1); }

.home-section { padding: 2.5rem 0; }

.home-section > h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 1.25rem;
}

/* Sport cards with photo headers, mirroring the .NET landing grid. */
.sports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: var(--gap);
}

.sport-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
}

.sport-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  text-decoration: none;
}

.sport-card-image {
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
}

.sport-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.sport-card:hover .sport-card-image img { transform: scale(1.06); }

.sport-card-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.65) 0%, transparent 55%);
}

.live-indicator {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 1;
  background: #e5484d;
  color: #fff;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.sport-card-content { padding: 1rem 1.1rem 1.25rem; }

.sport-card-content h3 {
  margin: 0 0 0.3rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.sport-card-content p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ---------- sport tiles ----------
 *
 * The clickable sport filters at the top of the home page and the teams index.
 * A tile is a small square thumbnail with the sport's name under it; the home
 * page's tiles are buttons that filter in place, the teams page's are anchors
 * that jump to a section. Both share the frame so the two pages read as one
 * design.
 */

.sport-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
  gap: 0.75rem;
}

.sport-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.sport-tile-btn,
.sport-tile-jump {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.5rem 0.35rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}

/* The teams page's tiles are anchors, so they carry the name and count inside
 * the frame; the home page's tiles put the name below as a link to the full
 * schedule. Both keep the same outer size so the two pages line up. */
.sport-tile-jump {
  padding-bottom: 0.6rem;
  /* The name wraps to two lines for "NCAA Football" and one for "NFL", which
   * left the tiles in a row at different heights. Reserving two lines and
   * pushing the count to the bottom keeps every frame the same size. */
  justify-content: flex-start;
}

.sport-tile-jump .sport-tile-name {
  min-height: 2.5em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sport-tile-jump .sport-tile-count { margin-top: auto; }

.sport-tile-btn:hover,
.sport-tile-jump:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}

.sport-tile-btn:focus-visible,
.sport-tile-jump:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The active filter. The accent ring is what tells the reader the page below
 * is narrowed, since the tiles themselves never move. */
.sport-tile-btn.is-active {
  border-color: var(--accent);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.sport-tile-image {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: calc(var(--radius) - 3px);
  overflow: hidden;
  background: var(--surface-2);
}

.sport-tile-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.sport-tile-btn:hover .sport-tile-image img,
.sport-tile-jump:hover .sport-tile-image img {
  transform: scale(1.06);
}

.sport-tile-name {
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.25;
  overflow-wrap: anywhere;
  color: var(--text);
}

/* On the home page the name is the link to the sport's full schedule, so it
 * gets the hover treatment a link needs. */
a.sport-tile-name:hover { color: var(--accent); text-decoration: none; }

.sport-tile-count {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* The badges sit on the thumbnail, so they need their own contrast against a
 * photo rather than against the page surface. */
.sport-tile .live-indicator,
.sport-tile .today-indicator {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  z-index: 1;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.sport-tile .live-indicator {
  background: #e5484d;
  color: #fff;
}

.sport-tile .today-indicator {
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
}

/* The tiles are a fixed 9-across grid on a wide screen so the row never
 * orphans the ninth sport on its own line. Below that they wrap naturally. */
@media (min-width: 60rem) {
  .sport-tiles { grid-template-columns: repeat(9, minmax(0, 1fr)); }
}

/* ---------- home ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: var(--gap);
}

.card {
  display: block;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}

.card h2 { margin: 0 0 0.25rem; font-size: 1.05rem; }
.card p { margin: 0; color: var(--text-dim); font-size: 0.875rem; }

/* ---------- week nav ---------- */

.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  margin: 0 0 1.5rem;
  padding: 0.6rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.week-link { font-size: 0.9rem; font-weight: 500; }
.week-range { color: var(--text-dim); font-size: 0.9rem; font-variant-numeric: tabular-nums; }

/* Scope toggle (soccer only) and DST note share the week-nav row. */
.scope-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.scope-link {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  color: var(--text-dim);
  background: var(--surface-2);
  white-space: nowrap;
}

a.scope-link:hover { color: var(--text); text-decoration: none; background: var(--border); }

.scope-current {
  color: var(--accent-contrast);
  background: var(--accent);
}

.dst-note {
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ---------- schedule ---------- */

.day { margin-bottom: 2rem; }

/* Each day is a <details>, so a finished day collapses without JavaScript.
 * The summary is the clickable heading; the default disclosure triangle is
 * replaced with a chevron that rotates when the day opens. */
.day > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Safari and Chrome both draw their own marker unless it is removed. */
.day > summary::-webkit-details-marker { display: none; }
.day > summary::marker { content: ""; }

/* The chevron. `::before` rather than an inline SVG so it costs no markup and
 * inherits the heading's colour in both themes. */
.day > summary::before {
  content: "";
  flex: none;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.day[open] > summary::before { transform: rotate(45deg); }

/* Keyboard focus has to be visible: the summary is the only control on the
 * page that collapses a day. */
.day > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* The summary *is* the heading, so this rule styles the flex container the
 * chevron and count sit in. */
.day-heading {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin: 0 0 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

/* A day whose games have all finished. Dimmed so the eye skips it and lands
 * on today's slate, but still readable when opened. */
.day.day-past > summary { opacity: 0.7; }
.day.day-past > summary:hover { opacity: 1; }

/* The game count sits at the end of the heading, so a collapsed day still
 * tells you how many games it holds. */
.day-count {
  margin-left: auto;
  padding-left: 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  letter-spacing: 0;
  text-transform: none;
}

.games { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }

/* Every row uses the same five fixed columns so scores, status pills, and
 * network pills line up across all rows on every sport page. Fixed widths
 * (not `auto`) are what make the alignment hold: a wide network name
 * truncates instead of pushing its neighbours around. */
.game {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr) 5.5rem 6rem 7.5rem auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.925rem;
}

/* Explicit column placement: a row missing a score or a status still keeps
 * its network pill in the network column. The trailing `auto` track holds the
 * live-only matchup button; it collapses to zero width on rows without one,
 * so the other columns stay aligned. */
.time { grid-column: 1; }
.game .matchup { grid-column: 2; }
.score { grid-column: 3; }
.status { grid-column: 4; }
.network { grid-column: 5; }
/* Pinned to the first row: the venue/odds lines below span columns 2-5, and
 * auto-placement would otherwise push the button past them onto a second row. */
.game-cta { grid-column: 6; grid-row: 1; }

.game.completed { opacity: 0.75; }

/* Live games stand out: accent border and a pulsing badge. */
.game.live {
  border-color: var(--accent);
  background: linear-gradient(to right, var(--surface), var(--surface-2));
}

.live-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fff;
  background: #e5484d;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  animation: live-pulse 2s ease-in-out infinite;
}

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

.final-badge {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  padding: 0.15rem 0.5rem;
  background: var(--surface-2);
  border-radius: 4px;
}

.live-clock {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}

/* The period sits before the clock and is dimmer, so the two numbers in a
 * live chip read as "which period" then "how much time left" rather than as
 * two clocks. */
.live-period {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
}

.time {
  color: var(--text-dim);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Scoped to the game row: `<main class="matchup">` on the detail page shares
 * the name, and an unscoped rule here turned that page into a flex row. */
.game .matchup { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; min-width: 0; }

.team {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The colour dot is the only place team colours are used. The ring uses a
 * theme token rather than the team's secondary colour: a white secondary is
 * invisible on a white surface, which is exactly the light-theme bug. */
.team::before {
  content: "";
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--primary, #777);
  box-shadow: inset 0 0 0 1px var(--dot-ring);
  flex: none;
}

.at { color: var(--text-dim); font-size: 0.8rem; }

/* The score is the reason the row exists, so it is the largest and heaviest
 * text in it — bigger than the team names, not the same size as the network
 * pill. Tabular figures keep the two numbers from shifting as they change. */
.score {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  line-height: 1.1;
  white-space: nowrap;
}

/* Final result: the winning side is emphasised and the loser dimmed, so the
 * outcome reads at a glance. A draw leaves both sides neutral. */
.score-win { color: var(--text); font-weight: 800; }
.score-loss { color: var(--text-dim); font-weight: 600; }

.team.winner { font-weight: 700; }
.team.loser { color: var(--text-dim); }

/* Status column: LIVE/FINAL pills and the clock. */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.network {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  padding: 0.15rem 0.45rem;
  background: var(--surface-2);
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  justify-self: stretch;
  text-align: center;
}

/* The extra lines stop at the network column so the matchup button keeps its
 * own track; spanning to `-1` would push the button onto a second row. */
.also-on, .venue {
  grid-column: 2 / 6;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* The way into the matchup page. It is a real link, not a button, because it
 * navigates. Every row has one now, so the three states are colour-coded:
 * red for a game in progress, muted for a final, outlined for a scheduled
 * game. The fill is what makes it findable at a glance among the dim score and
 * network text. */
.game-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: filter 0.15s, border-color 0.15s, color 0.15s;
}

.game-cta:hover {
  filter: brightness(1.1);
  text-decoration: none;
}

.game-cta:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Live: the same red as the LIVE badge, so the button and the badge read as
 * one signal rather than two competing ones. */
.game-cta-live {
  background: #e5484d;
  color: #fff;
}

/* Final: quiet. The result is already on the row; this is an invitation to
 * look closer, not an alert. */
.game-cta-final {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-dim);
}

.game-cta-final:hover {
  color: var(--text);
  border-color: var(--accent);
  filter: none;
}

/* Upcoming: outlined in the accent, so it reads as "there is more here" without
 * competing with a live game's red. */
.game-cta-upcoming {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}

.game-cta-upcoming:hover {
  background: var(--accent);
  color: var(--accent-contrast);
  filter: none;
}

/* ---------- themed game row (home page only) ----------
 *
 * The row is split on a diagonal: the away team's colour on the left, the home
 * team's on the right. The colours arrive as `--away-tint` and `--home-tint`,
 * already darkened in Rust so white text and the name pills read against them
 * in both themes.
 *
 * The split is a hard-edged gradient on a pseudo-element rather than a soft
 * blend, because two distinct halves is what makes the row read as two teams.
 * The seam is a separate skewed bar so the edge stays crisp at every row
 * height — a skewed gradient stop blurs at the ends.
 *
 * The gradient is only correct while the halves sit side by side. On a phone
 * they stack and the meta band takes up to half the row, so a 50% stop lands
 * inside the home half and both name pills end up on the away team's colour.
 * The phone block below therefore paints the halves themselves instead.
 */
/* The row is a two-column grid: the away half, then the home half. The seam is
 * the boundary between them, so it can never cut through a team name. */
.game-themed {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 0;
  border-color: transparent;
  overflow: hidden;
}

.game-themed::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: linear-gradient(
    to right,
    var(--away-tint, #1e222b) 0%,
    var(--away-tint, #1e222b) 50%,
    var(--home-tint, #1e222b) 50%,
    var(--home-tint, #1e222b) 100%
  );
}

/* The slanted seam, drawn on the boundary between the two halves. It stops at
 * the meta band rather than running through it: the band is a single dark
 * strip, and a bright line across it would read as a rendering artefact. */
.game-themed::after {
  content: "";
  position: absolute;
  top: -25%;
  bottom: 2.6rem;
  left: 50%;
  width: 2px;
  z-index: -1;
  background: rgba(255, 255, 255, 0.32);
  transform: translateX(-50%) rotate(9deg);
}

.themed-half {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.65rem 0.9rem;
}

/* The away half runs right-to-left so its pill sits against the seam; the home
 * half runs left-to-right for the same reason. */
.themed-away {
  justify-content: flex-end;
  padding-right: 1.1rem;
}

.themed-home {
  justify-content: flex-start;
  padding-left: 1.1rem;
}

/* The bar under the two halves: score, status, network, odds, venue, and the
 * matchup button. It spans both halves so none of it can push the seam off
 * centre, and it is the only place those columns appear on a themed row. */
/* A dark band across the bottom of the row. Without it the meta text sits
 * directly on the two team colours and crosses the seam, which makes both the
 * text and the split hard to read. The band is the same 55% black as the name
 * pills, so the row has one consistent "ink" layer. */
.themed-meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.75rem;
  padding: 0.4rem 0.9rem;
  background: rgba(0, 0, 0, 0.55);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.82);
}

/* The grid-column rules on the plain row do not apply here: the meta bar is a
 * flex container, so every child is just a flex item. */
.themed-meta > * {
  grid-column: auto;
  grid-row: auto;
}

.themed-meta .odds,
.themed-meta .also-on,
.themed-meta .venue {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.72);
}

/* A long "also on" list would otherwise push the button off the row. The full
 * text stays in the DOM (and in the title) so nothing is lost to a screen
 * reader or a copy-paste. */
.themed-meta .also-on {
  max-width: 22rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The button closes the bar. It is not pushed to the far right: the bar is
 * centred under the two halves, and a right-aligned button would leave a gap
 * between it and the text it belongs with. */
.themed-meta .game-cta { flex: none; margin-left: auto; }

/* The sport glyph leads the bar. It is the only place the sport is named on a
 * themed row — the panel itself is filled with team colours — so it sits first,
 * at the same weight as the score, and inherits the bar's text colour. */
.themed-meta .sport-glyph {
  display: inline-flex;
  align-items: center;
  flex: none;
  color: rgba(255, 255, 255, 0.9);
}

.themed-meta .sport-glyph svg {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
}

/* The score is the loudest thing in the bar. */
.themed-meta .score {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
}

.themed-meta .score-loss { color: rgba(255, 255, 255, 0.6); }

/* On a phone two side-by-side halves leave about 150px each, which wraps every
 * team name onto three lines and puts the seam through the middle of them. The
 * halves stack instead: away on top, home below, with the seam becoming a
 * horizontal rule between them. The colours still read as two teams, which is
 * the point of the treatment. */
@media (max-width: 40rem) {
  /* `.game.game-themed` rather than `.game-themed`: the phone block further
   * down sets `.game` to a two-column grid with its own padding, and that rule
   * comes later in the file. The extra class is what keeps the themed row a
   * single stacked column. */
  .game.game-themed {
    grid-template-columns: 1fr;
    padding: 0;
  }

  /* The halves paint their own colours here instead of the row painting one
   * gradient behind both. The desktop gradient hard-codes the split at 50% of
   * the row's height, which is only where the halves meet while they sit side
   * by side; once they stack, the meta band pushes the boundary down and the
   * 50% stop lands inside the home half, so both name pills sat on the away
   * team's colour. Painting the halves makes the split follow the layout. */
  .game-themed::before { background: #1e222b; }

  .themed-away { background: var(--away-tint, #1e222b); }
  .themed-home { background: var(--home-tint, #1e222b); }

  /* The seam moves from the vertical edge between the halves to the horizontal
   * edge between them. It is a border on the away half rather than a positioned
   * line, because the halves are different heights (the away half also carries
   * the kickoff time) and a 50% line would cut through the home name. */
  .game-themed::after { display: none; }

  .themed-away,
  .themed-home {
    justify-content: flex-start;
    padding: 0.5rem 0.75rem;
  }

  .themed-away {
    padding-bottom: 0.35rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.32);
  }

  .themed-home { padding-top: 0.35rem; }

  /* The time leads the away half on a phone, where there is no room for it to
   * sit beside the name. */
  .themed-away .time { order: -1; }

  .themed-meta {
    padding: 0.4rem 0.75rem;
    font-size: 0.72rem;
  }

  .themed-meta .also-on { max-width: 100%; }

  /* The phone block's explicit grid placement for the plain row would otherwise
   * apply to the themed row's children too, pushing the halves into rows 1 and
   * 2 of a grid that no longer has those tracks. */
  .game-themed .themed-half,
  .game-themed .themed-meta {
    grid-column: 1 / -1;
    grid-row: auto;
  }
}

/* A live themed row keeps its accent ring, but the fill is the team colours
 * rather than the generic gradient. */
.game-themed.live {
  background: none;
  border-color: var(--accent);
}

/* The name pill. A dark translucent chip over the team's own half, with the
 * text in the team's primary (or secondary) colour — see `pill_text` in
 * view.rs, which picks whichever clears 4.5:1 against this backdrop. */
.team-pill {
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--pill-text, #fff);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.team-pill a { color: inherit; }
.team-pill a:hover { text-decoration: underline; }

/* The dot is redundant once the pill carries the colour, and a coloured dot on
 * a coloured half is noise. */
.team-pill::before { display: none; }

/* The "@" sits between the two pills, on the seam. It needs its own contrast
 * because it is the one element that straddles both halves. */
.game-themed .at {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* A record suffix inside a pill is dimmer than the name but still on the dark
 * chip, so it needs a light colour rather than the page's dim token. */
.team-pill .record { color: rgba(255, 255, 255, 0.72); }

/* Every other column sits on the team colours now, so the dim tokens that read
 * against the page surface are too dark. These are the same values the pills
 * use, which keeps the row internally consistent. */
.game-themed .time,
.game-themed .also-on,
.game-themed .venue,
.game-themed .odds {
  color: rgba(255, 255, 255, 0.78);
}

.game-themed .network {
  background: rgba(0, 0, 0, 0.45);
  color: rgba(255, 255, 255, 0.9);
}

.game-themed .final-badge {
  background: rgba(0, 0, 0, 0.45);
  color: rgba(255, 255, 255, 0.9);
}

.game-themed .score { color: #fff; }
.game-themed .score-loss { color: rgba(255, 255, 255, 0.62); }

/* The final CTA is a quiet chip; on a coloured row it needs a dark fill rather
 * than the page's surface token. */
.game-themed .game-cta-final {
  background: rgba(0, 0, 0, 0.45);
  border-color: rgba(255, 255, 255, 0.28);
  color: rgba(255, 255, 255, 0.9);
}

.game-themed .game-cta-final:hover {
  background: rgba(0, 0, 0, 0.62);
  border-color: #fff;
  color: #fff;
}

/* The upcoming CTA is outlined in the accent; on a coloured row the accent can
 * vanish, so it gets a white outline instead. */
.game-themed .game-cta-upcoming {
  border-color: rgba(255, 255, 255, 0.55);
  color: #fff;
}

.game-themed .game-cta-upcoming:hover {
  background: #fff;
  color: #14171c;
}

/* ---------- coming up next ---------- */

#upcoming {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1.5rem;
  margin-bottom: 2rem;
}

#upcoming > h2 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

#upcoming > .lede { margin-bottom: 1rem; }

.upcoming-count {
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent-contrast);
  background: var(--accent);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.upcoming-games .game[hidden] { display: none; }
.upcoming-none { padding: 1.5rem 0; }

/* ---------- recently completed ---------- */

#recent { padding-top: 1rem; }

/* The master wrapper. It is a <details> so a week of finals costs one line
 * until the reader asks for it, and each day inside is another <details>. */
.recent-master {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.recent-summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  font-size: 1rem;
}

.recent-summary::-webkit-details-marker { display: none; }
.recent-summary::marker { content: ""; }

.recent-summary::before {
  content: "";
  flex: none;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.recent-master[open] > .recent-summary::before { transform: rotate(45deg); }

.recent-summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.recent-summary:hover { background: var(--surface-2); }

.recent-title { flex: 1; }

.recent-days {
  padding: 0 1.1rem 1.1rem;
  display: grid;
  gap: 0.75rem;
}

/* The day headings inside the master are one level quieter than the master
 * itself, so the hierarchy reads: archive → day → game. */
.recent-days .day { margin-bottom: 0; }
.recent-days .day-heading { font-size: 0.75rem; }

/* ---------- teams index: jump tiles and search ---------- */

.teams-jump { margin-bottom: 1.5rem; }

.teams-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.team-search-input {
  flex: 1 1 16rem;
  min-width: 0;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}

.team-search-input::placeholder { color: var(--text-dim); }

.team-search-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.team-search-clear {
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-dim);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.team-search-clear:hover { color: var(--text); border-color: var(--accent); }

.team-search-status {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.team-search-status:empty { display: none; }

/* A team's home region, shown after its abbreviation. Dim and small: it is
 * there to be searched and skimmed, not to compete with the name. */
.team-region {
  font-size: 0.7rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Screen-reader-only text: present in the accessibility tree, absent visually.
 * Used for the search label and the jump-tiles heading, which would otherwise
 * be redundant with the placeholder and the tiles themselves. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Season record suffix after a team name, e.g. "5-2". */
.record {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* Betting line, e.g. "BUF -3 · O/U 54.5". Sits in the extra row under the
 * network pill so it never competes with the status column. */
.odds {
  grid-column: 2 / 6;
  font-size: 0.72rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty { color: var(--text-dim); padding: 2rem 0; text-align: center; }

/* ---------- live now ---------- */

/* The Live Now section is the one place on the home page that is allowed to
 * shout: a tinted panel so it reads as "happening right now" rather than as
 * another schedule block. */
#live {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1.5rem;
  margin-bottom: 2rem;
}

#live > h2 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.live-count {
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: #e5484d;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

/* Filter chips. Horizontally scrollable on a phone rather than wrapping: nine
 * chips wrap into three ragged rows and push the games below the fold. */
.live-filters {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.15rem;
}

.live-filters::-webkit-scrollbar { display: none; }

.filter-chip {
  flex: none;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-dim);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.filter-chip:hover { color: var(--text); border-color: var(--accent); }

.filter-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.filter-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* A filtered-out row is hidden by the script; this keeps the grid gap from
 * leaving a hole where a row used to be. */
.live-games .game[hidden] { display: none; }

.live-none { padding: 1.5rem 0; }

/* ---------- matchup detail ---------- */

/* Final result banner: score, winner, and per-side totals. Only rendered for
 * a finished game, so scheduled and live pages are unchanged. */
.matchup-result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
}

/* The final score is the headline of the page, so it is set at display size
 * rather than as one more chip in the banner. Tabular figures keep the two
 * numbers aligned with the per-side totals on the right. */
.result-score {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.result-headline { font-weight: 600; }

.result-note { color: var(--text-dim); font-size: 0.85rem; }

.result-sides {
  display: inline-flex;
  gap: 0.75rem;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
  font-weight: 600;
}

.result-side { color: var(--text-dim); }
.result-side.result-winner { color: var(--text); font-weight: 700; }
.result-side.result-loser { color: var(--text-dim); }

.matchup-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

.meta-item { white-space: nowrap; }

.meta-item.network {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  background: var(--surface-2);
  border-radius: 4px;
}

.team-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: var(--gap);
  margin-bottom: 1.5rem;
}

.team-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary, #777);
  border-radius: var(--radius);
}

.team-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.team-name { font-weight: 600; font-size: 1.05rem; }

.team-abbr {
  font-size: 0.8rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

.team-card .record, .team-card .standing {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.panel h2 {
  font-size: 1.05rem;
  margin: 0 0 0.75rem;
}

.stat-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: var(--gap);
}

.stat-columns h3 {
  font-size: 0.9rem;
  margin: 0 0 0.5rem;
  color: var(--text-dim);
}

table.stats {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

table.stats th, table.stats td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

table.stats thead th {
  color: var(--text-dim);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

table.stats td.rank { color: var(--text-dim); text-align: right; }

table.stats.compare td { text-align: center; font-variant-numeric: tabular-nums; }

ul.roster {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
}

ul.roster li.player {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
}

.jersey {
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  font-size: 0.78rem;
  min-width: 2rem;
}

.pos {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  padding: 0.1rem 0.4rem;
  background: var(--surface-2);
  border-radius: 4px;
}

/* The box score stacks its two teams instead of sitting side by side. A
 * half-width column cannot hold a stat table with more than a few columns, and
 * the two teams are read one after the other anyway. */
.box-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  /* A team with no box score yet must not stretch its empty state down the
   * height of the other team's tables. */
  align-items: start;
}

/* Grid items default to `min-width: auto`, so a wide stat table would push the
 * column wider than the panel instead of scrolling inside `.box-scroll`. */
.box-columns > div { min-width: 0; }

.box-columns h3 {
  font-size: 0.9rem;
  margin: 0 0 0.5rem;
  color: var(--text-dim);
}

/* The shared empty state pads 2rem for a full-page placeholder; inside a box
 * score column that reads as a hole between the two teams. */
.box-columns .empty { padding: 0.5rem 0; text-align: left; }

/* The box score is a real stat table: one column per stat, short headers, and
 * a legend underneath. It scrolls inside its own box rather than truncating,
 * because a fourteen-column basketball line cannot fit a half-width panel and
 * an ellipsis hides the numbers the page exists to show. */
.box-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.stats.box {
  min-width: 0;
  font-variant-numeric: tabular-nums;
  /* The player column takes the slack so the stat columns stay narrow and
   * adjacent to each other instead of being spread across the panel. */
  width: 100%;
}

table.stats.box th.box-player { width: 100%; }

/* The player cell stays a real table cell: `display: flex` on a `th` takes it
 * out of the table layout and the stat columns stop lining up with their
 * headers. The jersey, name, and position are inline spans instead. */
table.stats.box th.box-player {
  white-space: nowrap;
  font-weight: 500;
  text-align: left;
}

table.stats.box th.box-player .jersey { margin-right: 0.4rem; }
table.stats.box th.box-player .pos { margin-left: 0.4rem; }

table.stats.box thead th {
  white-space: nowrap;
  text-align: right;
}

table.stats.box thead th.box-player {
  text-align: left;
}

table.stats.box tbody td {
  text-align: right;
  white-space: nowrap;
  padding-left: 0.4rem;
  padding-right: 0.4rem;
}

/* A stat the player did not record reads as an em dash, dimmed so the eye
 * skips it instead of reading it as a zero. */
table.stats.box tbody td:empty { color: var(--text-dim); }

.box-group {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin: 0.9rem 0 0.35rem;
}

.box-group:first-child { margin-top: 0; }

.box-legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
  margin: 0.4rem 0 0;
  padding: 0;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.box-legend abbr {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  cursor: help;
}

/* ---------- team pages ---------- */

/* The team's own colours drive the accent, so a Chiefs page reads red and a
 * Packers page reads green without a per-team stylesheet. */
.team-page { --team-primary: var(--primary, var(--accent)); }

.team-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.team-header h1 { margin: 0; font-size: 1.75rem; }

.team-abbr-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.25rem;
  padding: 0.35rem 0.6rem;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--secondary, #fff);
  background: var(--team-primary);
  border-radius: var(--radius);
}

.team-sport {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* The calendar subscription link. It reuses the schedule row's pill shape so
 * the two read as the same kind of action, but sits at the end of the header
 * rather than competing with the team name for attention. */
.team-calendar-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: auto;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}

.team-calendar-link:hover {
  border-color: var(--team-primary);
  color: var(--team-primary);
  text-decoration: none;
}

.team-calendar-link:focus-visible {
  outline: 2px solid var(--team-primary);
  outline-offset: 2px;
}

/* Status strip: record, standing, venue, conference, form. Wraps rather than
 * scrolls, because a team page is read top-down on a phone. */
.team-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding: 0.85rem 1.1rem;
  margin-bottom: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--team-primary);
  border-radius: var(--radius);
}

.team-status-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.team-status-item .label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.team-status-item .value {
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Form strip: the last five results as W/L/D chips. */
.form-strip { display: inline-flex; gap: 0.25rem; }

.form-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 4px;
  color: var(--accent-contrast);
}

.form-chip.form-win { background: var(--win, #1a7f37); }
.form-chip.form-loss { background: var(--loss, #b42318); }
.form-chip.form-draw { background: var(--text-dim); }
.form-chip.form-live { background: var(--accent); }
.form-chip.form-upcoming { background: var(--surface-2); color: var(--text-dim); }

/* Live game banner on a team page. */
.team-live {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
}

.team-live-matchup { font-weight: 600; }
.team-live-score { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.team-live-clock { color: var(--text-dim); font-size: 0.85rem; }
.team-live-link { margin-left: auto; font-weight: 600; }

/* Results and fixtures tables. */
table.team-games {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

table.team-games th, table.team-games td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

table.team-games thead th {
  color: var(--text-dim);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

table.team-games td.result-date { white-space: nowrap; color: var(--text-dim); }
table.team-games td.result-score { font-variant-numeric: tabular-nums; font-weight: 600; }
table.team-games td.result-network { color: var(--text-dim); }
table.team-games td.result-venue { color: var(--text-dim); }
table.team-games td.result-link { text-align: right; white-space: nowrap; }

.home-away {
  display: inline-block;
  min-width: 1.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
}

/* A win row gets a subtle accent so a scan down the results column reads as a
 * sequence of results rather than a wall of text. */
tr.result-win { border-left: 3px solid var(--win, #1a7f37); }
tr.result-loss { border-left: 3px solid var(--loss, #b42318); }
tr.result-draw { border-left: 3px solid var(--text-dim); }

/* Projection panel. */
.projection-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 0.75rem 0;
}

.projection-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.projection-team { font-size: 0.85rem; color: var(--text-dim); }

.projection-value {
  font-size: 2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.projection-at { color: var(--text-dim); font-size: 1.1rem; }

.projection-prob { margin-top: 0.5rem; }

/* A two-tone bar: the home side's share in the accent, the rest in the surface
 * colour. `--home-prob` is 0–1 and set inline by the renderer. */
.projection-bar {
  display: block;
  height: 0.5rem;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--accent) calc(var(--home-prob, 0.5) * 100%),
    var(--surface-2) calc(var(--home-prob, 0.5) * 100%)
  );
}

.projection-label {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.projection-margin {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.projection-note {
  margin: 0.75rem 0 0;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.preview-live { margin-bottom: 1rem; }

/* Teams index. */
.teams-index .teams-section h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.team-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  padding: 0.1rem 0.45rem;
  background: var(--surface-2);
  border-radius: 999px;
}

/* Division groups wrap the conference groups. Football's 762 schools span four
 * divisions and 72 conferences, so the division is the first cut. */
.team-division {
  border-top: 1px solid var(--border);
}

.team-division:first-of-type { border-top: 0; }

.team-division > summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.25rem;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  list-style: none;
}

.team-division > summary::-webkit-details-marker { display: none; }
.team-division > summary::marker { content: ""; }

.team-division > summary::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  flex: none;
  border-right: 2px solid var(--text-dim);
  border-bottom: 2px solid var(--text-dim);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.team-division[open] > summary::before { transform: rotate(45deg); }

.team-division > summary:hover { background: var(--surface-2); border-radius: 4px; }

.team-division > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.team-division > .team-group { margin-left: 0.75rem; }

/* Conference groups inside a sport section. A 762-team flat list is unusable,
 * so each conference is a collapsed <details> the reader opens on demand. */
.team-group {
  border-top: 1px solid var(--border);
}

.team-group:first-of-type { border-top: 0; }

.team-group > summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.25rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  list-style: none;
}

.team-group > summary::-webkit-details-marker { display: none; }
.team-group > summary::marker { content: ""; }

.team-group > summary::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  flex: none;
  border-right: 2px solid var(--text-dim);
  border-bottom: 2px solid var(--text-dim);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.team-group[open] > summary::before { transform: rotate(45deg); }

.team-group > summary:hover { background: var(--surface-2); border-radius: 4px; }

.team-group > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.team-group-name { flex: 1; }

.team-group > ul.team-list { padding: 0.25rem 0 0.75rem 1rem; }

ul.team-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 0.25rem 1rem;
}

ul.team-list li a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.4rem;
  border-radius: 4px;
  color: var(--text);
  text-decoration: none;
}

ul.team-list li a:hover { background: var(--surface-2); text-decoration: none; }

/* A team's standings rank, leading the row so a division reads top-down in
 * table order. Fixed width and tabular figures keep the team names in a column
 * whether the rank is one digit or two. Unranked teams render no badge, so the
 * row simply starts at the colour dot. */
ul.team-list .team-rank {
  flex: none;
  min-width: 1.15rem;
  text-align: right;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}

/* The team's primary colour as a small dot, so the index reads as a colour
 * chart of the league. */
.team-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--primary, #777);
  flex: none;
}

ul.team-list .abbr {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  flex: none;
}

/* The team's home region, after the abbreviation. It is the text the search
 * box matches on, so it has to be visible enough to explain a hit — but it is
 * secondary to the name, so it truncates rather than wrapping the row. */
ul.team-list .team-region {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 9rem;
  font-size: 0.7rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The name itself must not be squeezed out by the region: it takes the space
 * that is left and wraps if it has to. */
ul.team-list li a > :not(.team-rank):not(.team-dot):not(.abbr):not(.team-region) {
  min-width: 0;
}

/* Team names inside a schedule row are links now; keep them looking like the
 * text they replaced rather than like a blue hyperlink. */
.game .team a { color: inherit; text-decoration: none; }
.game .team a:hover { text-decoration: underline; }

/* ---------- error ---------- */

.error { text-align: center; padding-top: 4rem; }

/* ---------- game flow viewer ---------- */

.flow {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.1rem;
  margin-bottom: 1.5rem;
}

/* The viewer body is the field plus its caption, and the side column holding
 * the transport controls and the play log. On a wide screen they stack; a
 * landscape phone turns them into two columns so the log is visible without
 * scrolling past the field. Both wrappers are plain blocks by default so the
 * markup degrades to the same stack on any engine without grid. */
.flow-body {
  display: block;
}

.flow-view,
.flow-side {
  min-width: 0;
}

.flow-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
}

.flow-head h2 {
  font-size: 1.05rem;
  margin: 0;
}

/* The scorebug. Two team pills with the score in tabular numerals and a
 * team-coloured bar on the outer edge, with the clock and the possession dot
 * between them. It replaces the old `AWY @ HOM` text, which named the teams
 * but never showed the score. */
.flow-bug {
  display: inline-flex;
  align-items: stretch;
  gap: 0.4rem;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.bug-side {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.5rem;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.2;
}

/* The bar is the team's colour, on the outer edge of its pill, so the two
 * sides read as a mirrored pair. */
.bug-bar {
  display: block;
  width: 3px;
  align-self: stretch;
  border-radius: 2px;
  background: var(--team, #777);
  flex: none;
}

.bug-abbr { letter-spacing: 0.02em; }

.bug-score {
  font-size: 1.15rem;
  font-weight: 800;
  min-width: 1ch;
  text-align: center;
}

.bug-mid {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-width: 3.5rem;
}

.bug-mid .flow-clock {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.1;
}

/* The possession dot: a small filled circle in the possessing team's colour.
 * Hidden when the feed does not report possession, rather than showing a
 * meaningless neutral dot. */
.bug-poss {
  font-size: 0.6rem;
  line-height: 1;
  color: var(--text-dim);
}

.bug-poss[hidden] { display: none; }

.flow-score {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.05rem;
}

.flow-score[hidden] { display: none; }

.flow-score .swatch {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--primary, #777);
  box-shadow: inset 0 0 0 1px var(--dot-ring);
  flex: none;
}

.flow-clock {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* The status row: the refresh countdown and the LIVE/REPLAY/FINAL chip share
 * one flex row that is in the markup from the first paint.
 *
 * Both used to be `hidden` until there was something to say, so the header grew
 * a line the first time a poll landed — the page shifted exactly once the viewer
 * had settled into it. Keeping the row laid out with a placeholder removes that
 * shift: the header, the stage and the controls below it never move again. */
.flow-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 1.4rem;
  font-size: 0.7rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* An idle countdown keeps its slot but stops pretending to count: the bar
 * empties and the chip keeps saying why there is nothing to wait for. */
.flow-refresh[data-state="idle"] .flow-refresh-bar i { animation: none; transform: scaleX(0); }
.flow-refresh[data-state="idle"] { opacity: 0.5; }

/* Refresh countdown: a hairline bar that drains over one poll interval plus a
 * dimmed label. It sits under the clock and is deliberately quiet — it exists
 * to show the page is still following the game, not to draw the eye. */
.flow-refresh {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  color: var(--text-dim);
  opacity: 0.75;
  white-space: nowrap;
}

.flow-refresh[hidden] { display: none; }

.flow-refresh-bar {
  display: block;
  width: 2.5rem;
  height: 2px;
  border-radius: 1px;
  background: var(--border);
  overflow: hidden;
}

/* The bar drains over exactly one poll interval. It is a CSS animation rather
 * than a per-frame script write so the drain is smooth and costs nothing: the
 * duration comes from `--flow-poll-ms`, which `flow.js` sets from the same
 * `data-poll-ms` the refresh timer uses, so the bar empties as the request
 * goes out. `flow.js` restarts the animation on every poll. */
.flow-refresh-bar i {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--accent);
  transform-origin: left center;
  animation: flow-drain var(--flow-poll-ms, 10000ms) linear forwards;
}

@keyframes flow-drain {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

.flow-refresh-text { font-variant-numeric: tabular-nums; }

/* The stage is a fixed-aspect box so the SVG scales without layout shift on
 * any viewport. `aspect-ratio` is supported everywhere the site targets. */
/* The stage keeps its sport's shape at every width. Capping the *width*
 * against the visible viewport height (rather than capping the height) is what
 * keeps the box from letterboxing: `aspect-ratio` then derives the height, so
 * the SVG always fills the box exactly. `dvh` rather than `vh` because a phone
 * browser's URL bar shrinks the visible area, and `vh` would push the controls
 * off the bottom of the screen. */
.flow-stage {
  position: relative;
  width: min(100%, calc(62dvh * var(--flow-ratio, 1.5)));
  aspect-ratio: var(--flow-aspect, 3 / 2);
  margin: 0 auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.flow-stage svg {
  display: block;
  width: 100%;
  height: 100%;
}

.flow-stage .field-line {
  stroke: var(--text-dim);
  stroke-width: 0.35;
  fill: none;
  opacity: 0.45;
}

.flow-stage .field-fill {
  fill: var(--surface-2);
}

/* The ball marker glides between plays. `flow.js` writes the transform as a
 * CSS property (not the SVG attribute) precisely so this transition applies,
 * and sets `--flow-move-ms` per step so the glide lasts about as long as the
 * gap before the next play — a fixed duration either lags behind a fast
 * stream or snaps ahead of a slow one. */
.flow-stage .marker {
  transition: transform var(--flow-move-ms, 450ms) cubic-bezier(0.4, 0, 0.2, 1);
}

.flow-stage .marker-dot {
  stroke: var(--surface);
  stroke-width: 0.5;
}

/* The ball glyph is a sport-true shape (laces, seams, stitches, a pentagon
 * panel) filled with the possessing team's colour. It is drawn at the origin
 * and moved by the marker's transform, so it inherits the glide. */
.flow-stage .ball-glyph {
  pointer-events: none;
}

/* Team labels drawn on the stage itself. The halo is a surface-coloured
 * stroke painted under the fill, so a label stays legible over a field line
 * without needing a background box. */
.flow-stage .endzone-label text,
.flow-stage .goal-label text,
.flow-stage text {
  paint-order: stroke;
  stroke-linejoin: round;
}

/* The possession bar under the basketball court: a broadcast possession arrow
 * turned into a first-class visual, because a half court has no territory to
 * colour. The lit half glows softly so it reads at a glance. */
.flow-stage .poss-half {
  transition: opacity 0.25s ease;
}

.flow-stage .poss-half[opacity="0.95"] {
  filter: drop-shadow(0 0 1.2px currentColor);
}

/* The paint and the infield dirt are tinted with the *defending* team's
 * colour, and the batter's box with the batting team's. Both fade rather than
 * snap when possession changes. */
.flow-stage .paint,
.flow-stage .infield-dirt,
.flow-stage .batters-box,
.flow-stage .endzone,
.flow-stage .goal-end {
  transition: opacity 0.3s ease, fill 0.3s ease;
}

.flow-stage .trail {
  fill: none;
  stroke-width: 0.7;
  stroke-linecap: round;
  opacity: 0.85;
}

/* The effect layer: the trail, the flight arc and the play badge for the
 * current play. The trail is drawn with `stroke-dashoffset`, normalised by
 * `pathLength="1"` on the path, so one keyframe animates a 5-yard run and a
 * 60-yard punt alike. The colour comes from `--flow-fx`, which `render` sets to
 * the possessing team's colour (or the scoring colour on a score). */
.flow-stage .fx path {
  fill: none;
  stroke-linecap: round;
  stroke-width: 0.6;
}

.flow-stage .fx-gain,
.flow-stage .fx-arc {
  stroke: var(--flow-fx, var(--accent));
}

.flow-stage .fx-return {
  stroke: var(--text-dim);
  stroke-width: 0.45;
  opacity: 0.5;
}

.flow-stage .fx-arc {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: flow-fx-draw var(--fx-ms, 600ms) ease-out forwards;
}

@keyframes flow-fx-draw {
  to { stroke-dashoffset: 0; }
}

/* The badge names the play in one token over the grass, near the spot. */
.flow-stage .fx-badge-bg {
  fill: var(--surface);
  stroke: var(--border);
  stroke-width: 0.12;
}

.flow-stage .fx-badge-text {
  fill: var(--text);
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 0.3;
}

.flow-stage .fx-badge[data-tone="score"] .fx-badge-bg {
  fill: var(--accent);
  stroke: var(--accent);
}

.flow-stage .fx-badge[data-tone="score"] .fx-badge-text {
  fill: var(--accent-contrast);
  stroke: none;
}

/* A score flashes the end zone it crossed and bumps the number that changed.
 * The flash is a `filter`, not an `opacity`, so it rides on top of the tint
 * the stage sets as an attribute and reads in both themes. */
.flow-stage .endzone.flash {
  animation: flow-zone-flash 900ms ease-out;
}

@keyframes flow-zone-flash {
  0% { filter: brightness(1); }
  30% { filter: brightness(2.4); }
  100% { filter: brightness(1); }
}

.flow-stage .endzone-score.bump {
  animation: flow-score-bump 800ms ease-out;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes flow-score-bump {
  0%, 100% { transform: scale(1); }
  35% { transform: scale(1.35); }
}

/* A frame-driven arc owns the marker's transform. The CSS transition has to
 * stand down for the duration or the two would fight over the same property. */
.flow-stage .marker.tweening {
  transition: none;
}

.flow-stage .pulse {
  animation: flow-pulse 1.6s ease-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes flow-pulse {
  0% { opacity: 0.75; transform: scale(0.6); }
  100% { opacity: 0; transform: scale(2.2); }
}

.flow-caption {
  margin: 0.7rem 0 0;
  font-size: 0.85rem;
  color: var(--text-dim);
  min-height: 2.6em;
}

.flow-caption strong { color: var(--text); font-weight: 600; }

/* Controls: transport buttons plus a scrubber. Wraps on phones so the
 * scrubber gets its own full-width row instead of being squeezed. */
.flow-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.flow-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.flow-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.flow-btn:disabled { opacity: 0.45; cursor: default; }
.flow-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.flow-btn.playing { border-color: var(--accent); color: var(--accent); }

/* The Live toggle is a stateful control, so it gets a filled treatment when
 * pressed rather than only a border change: `aria-pressed` is the source of
 * truth and the class mirrors it. */
.flow-btn-live[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

/* Jump to live is the one-shot escape hatch and only appears when the viewer
 * is behind the edge. It is deliberately quieter than the toggle. */
.flow-btn-jump {
  border-style: dashed;
  font-weight: 600;
}

.flow-btn-jump[hidden] { display: none; }

.flow-scrub {
  flex: 1 1 10rem;
  min-width: 0;
  accent-color: var(--accent);
  height: 2.25rem;
  cursor: pointer;
}

.flow-progress {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* LIVE / REPLAY / FINAL. The Live toggle is the control; this is the label
 * that makes its state legible without reading the button. */
.flow-status {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 0.14rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  white-space: nowrap;
}

.flow-status[hidden] { display: none; }

.flow-status[data-state="live"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.flow-status[data-state="replay"] {
  border-color: var(--accent);
  color: var(--accent);
}

/* The play log: a compact, scrollable strip under the controls. It is
 * deliberately short — enough rows to give context, never enough to push the
 * field off a phone screen. `position: relative` makes it the rows' offset
 * parent, so the auto-scroll maths is a plain `offsetTop`.
 *
 * The height is reserved rather than grown into. With `max-height` the panel
 * was one row tall until the first plays arrived and then expanded, moving
 * everything below it; a fixed height means the first payload fills a box that
 * was already there. */
.flow-plays {
  position: relative;
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  height: clamp(6.5rem, 22dvh, 10rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  scrollbar-width: thin;
}

.flow-plays[hidden] { display: none; }

/* The empty state is a row like any other, so the panel is never a blank box:
 * it says what it is waiting for and disappears the moment a play lands. */
.flow-play-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0.5rem;
  color: var(--text-dim);
  font-size: 0.75rem;
}

/* Off-screen rows cost no layout or paint, which is what keeps a 500-row
 * window cheap on a phone. */
.flow-plays li {
  content-visibility: auto;
  contain-intrinsic-size: auto 2.6rem;
}

.flow-plays button {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: baseline;
  gap: 0.45rem;
  width: 100%;
  min-height: 2.6rem;
  padding: 0.4rem 0.55rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: none;
  color: inherit;
  font: inherit;
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
}

.flow-plays li:last-child button { border-bottom: 0; }

.flow-plays button:hover { background: var(--surface); }
.flow-plays button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.flow-plays li[data-active="true"] button {
  background: var(--surface);
  box-shadow: inset 3px 0 0 var(--accent);
}

.play-meta {
  color: var(--text-dim);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.play-text {
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* The chip is the play's type in one token: RUN, PASS, PUNT, FG, TD. Only
 * scores and turnovers are filled, so they stand out in a long log. */
.chip {
  min-width: 2.4rem;
  padding: 0.08rem 0.3rem;
  border: 1px solid currentColor;
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  white-space: nowrap;
}

.chip-empty { border-color: transparent; }

.chip[data-tone="pass"] { color: var(--chip-pass); }
.chip[data-tone="run"] { color: var(--chip-run); }
.chip[data-tone="incomplete"] { color: var(--chip-incomplete); }
.chip[data-tone="sack"] { color: var(--chip-sack); }
.chip[data-tone="punt"] { color: var(--chip-punt); }
.chip[data-tone="kick"] { color: var(--chip-kick); }
.chip[data-tone="penalty"] { color: var(--chip-penalty); }

.chip[data-tone="score"],
.chip[data-tone="turnover"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.flow-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* ---------- responsive ---------- */

/* Tablet: the five-column game row is still readable, but the fixed network
 * column is the first thing to give. */
@media (max-width: 900px) {
  main { padding: 1.25rem 1rem 3rem; }

  .game {
    grid-template-columns: 4.5rem minmax(0, 1fr) 5rem 5.5rem 6rem auto;
    gap: 0.6rem;
  }
}

/* Below 640px the five-column row collapses to a stacked card: time and
 * status on the first line, the matchup in the middle, score and network
 * pill on the last line. The `extra` area holds the also-on/venue/odds
 * lines that span the full width. */
@media (max-width: 640px) {
  .site-header {
    padding: 0.6rem 0.75rem;
    gap: 0.6rem;
  }

  .brand { font-size: 1rem; }

  main { padding: 1rem 0.75rem 3rem; }

  h1 { font-size: 1.35rem; }

  .home-hero { padding: 2.5rem 0.5rem 2rem; }

  .home-section { padding: 1.75rem 0; }

  .sports-grid { grid-template-columns: 1fr; }

  .week-nav {
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 0.5rem;
  }

  .week-range { order: -1; width: 100%; text-align: center; }

  /* A phone row is a stack, not the desktop five-column grid. Every element
   * gets its own explicit row: the desktop layout puts score, network, and the
   * extra lines in separate columns, and collapsing them into one shared area
   * made them overlap. Time and status share the first row. */
  .game {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.3rem 0.5rem;
    padding: 0.6rem 0.7rem;
  }

  .time { grid-column: 1; grid-row: 1; }
  .status { grid-column: 2; grid-row: 1; justify-self: end; }
  .game .matchup { grid-column: 1 / -1; grid-row: 2; }
  .score { grid-column: 1 / -1; grid-row: 3; justify-self: start; }
  .network { grid-column: 1 / -1; grid-row: 4; justify-self: start; }
  .also-on { grid-column: 1 / -1; grid-row: 5; }
  .venue { grid-column: 1 / -1; grid-row: 6; }
  .odds { grid-column: 1 / -1; grid-row: 7; }
  /* The matchup button gets its own full-width row so it is a comfortable
   * tap target rather than a chip squeezed beside the score. */
  .game-cta { grid-column: 1 / -1; grid-row: 8; justify-self: start; }

  /* Team names are the one thing that must not truncate on a phone: the
   * matchup row has the full width, so let it wrap instead. */
  .game .matchup { flex-wrap: wrap; }
  .team { white-space: normal; overflow: visible; }

  .team-cards { grid-template-columns: 1fr; }

  .stat-columns { grid-template-columns: 1fr; }

  /* Wide stat tables scroll inside their panel rather than pushing the page
   * sideways. */
  .panel { overflow-x: auto; }

  table.stats { min-width: 20rem; }

  /* On a phone the stage keeps its sport's shape but is capped so the
   * controls stay reachable without scrolling. */
  .flow-stage { width: min(100%, calc(42dvh * var(--flow-ratio, 1.5))); }

  .flow-controls { gap: 0.4rem; }

  .flow-scrub { flex-basis: 100%; order: 10; }

  .flow-clock { margin-left: 0; }

  /* The scorebug takes the full width on a phone and the heading moves above
   * it, so the two team pills stay legible instead of being squeezed. */
  .flow-head { gap: 0.4rem; }
  .flow-bug { margin-left: 0; width: 100%; justify-content: space-between; }
  .bug-side { flex: 1 1 0; justify-content: center; }
  .bug-mid { min-width: 3rem; }

  /* The status row keeps its own line on a phone rather than tucking under
   * the away pill, where the countdown read as part of that team's chip. It is
   * always present, so this line is always the same height. */
  .flow-meta { flex-basis: 100%; order: 10; }
}

/* A landscape phone is wide and short. Stacking the field above the log would
 * mean scrolling past the field to reach the log, so the body becomes two
 * columns: the field on the left, the controls and log on the right. The stage
 * is capped against the *visible height* so it never pushes the log off. */
@media (orientation: landscape) and (max-height: 500px) {
  .flow {
    padding: 0.7rem 0.8rem 0.8rem;
  }

  .flow-body {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(15rem, 1fr);
    gap: 0.7rem;
    align-items: start;
  }

  .flow-stage {
    width: min(100%, calc((100dvh - 8rem) * var(--flow-ratio, 2)));
  }

  .flow-plays {
    height: max(4.5rem, calc(100dvh - 14rem));
    min-height: 4.5rem;
  }

  .flow-head {
    margin-bottom: 0.4rem;
  }

  .flow-caption {
    margin-top: 0.45rem;
  }
}

/* Very narrow phones (iPhone SE and similar). */
@media (max-width: 380px) {
  .brand { font-size: 0.95rem; }
  .nav-link { padding: 0.3rem 0.55rem; font-size: 0.85rem; }
  .flow-btn { padding: 0 0.45rem; font-size: 0.75rem; }
}

/* Respect a reduced-motion preference: the viewer still steps through plays,
 * it just stops animating the transitions. */
@media (prefers-reduced-motion: reduce) {
  .flow-stage .marker { transition: none; }
  .flow-stage .pulse { animation: none; }
  /* The trail is still drawn — it is information, not decoration — but it
   * arrives complete instead of being traced. The frame-driven arcs are
   * skipped in `flow.js`; the marker is placed directly. */
  .flow-stage .fx-arc { animation: none; stroke-dashoffset: 0; }
  .flow-stage .endzone.flash { animation: none; }
  .flow-stage .endzone-score.bump { animation: none; }
  .flow-stage .poss-half { transition: none; filter: none; }
  .flow-stage .paint,
  .flow-stage .infield-dirt,
  .flow-stage .batters-box,
  .flow-stage .endzone,
  .flow-stage .goal-end { transition: none; }
  .flow-refresh-bar i { animation: none; }
  .live-badge { animation: none; }
  .sport-card:hover .sport-card-image img { transform: none; }
  .home-cta:hover, .sport-card:hover, .card:hover { transform: none; }
}

/* ---------- global globe page ----------
 *
 * The globe is a WebGL canvas from Globe.GL, vendored under /static/vendor so
 * it satisfies `script-src 'self'`. Everything here is layout and chrome: the
 * sphere, atmosphere, and rings are drawn by the library, and the only colours
 * it takes from us are the tokens below.
 *
 * The page is a two-column layout on desktop (globe left, hub list right) and
 * a stacked one on a phone, where the globe is capped so the list stays
 * reachable without scrolling past a full-screen sphere.
 */

:root {
  /* Globe chrome. The sphere itself is a texture, not a colour: the dark theme
   * uses the night-lights image and the light theme the day image, because a
   * night sphere on a pale page reads as a black hole. These tokens cover
   * everything drawn around and over it. */
  --globe-bg: #0b0e14;
  --globe-atmosphere: #4f9cf9;
  --globe-ring-live: #e5484d;
  --globe-ring-soon: #4f9cf9;
  --globe-label-bg: rgba(12, 15, 26, 0.86);
  --globe-label-text: #e6e8ec;
  --globe-label-border: rgba(255, 255, 255, 0.14);
  /* Country outlines. A pale hairline over the night texture: bright enough to
   * read against black oceans, faint enough not to compete with the pills. */
  --globe-border: rgba(255, 255, 255, 0.2);
}

:root[data-theme="light"] {
  --globe-bg: #dfe6f2;
  --globe-atmosphere: #1f6feb;
  --globe-ring-live: #c2262b;
  --globe-ring-soon: #1f6feb;
  --globe-label-bg: rgba(255, 255, 255, 0.92);
  --globe-label-text: #14171c;
  --globe-label-border: rgba(16, 24, 40, 0.16);
  /* Over the day texture the outlines have to be darker, not lighter. */
  --globe-border: rgba(16, 24, 40, 0.34);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --globe-bg: #dfe6f2;
    --globe-atmosphere: #1f6feb;
    --globe-ring-live: #c2262b;
    --globe-ring-soon: #1f6feb;
    --globe-label-bg: rgba(255, 255, 255, 0.92);
    --globe-label-text: #14171c;
    --globe-label-border: rgba(16, 24, 40, 0.16);
    --globe-border: rgba(16, 24, 40, 0.34);
  }
}

/* The page opts out of the shared `main` max-width: a globe squeezed into
 * 60rem is a postage stamp. */
main.globe-page {
  max-width: none;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(22rem, 30rem);
  align-items: start;
  gap: 0;
}

.globe-stage {
  position: sticky;
  top: 3.5rem;
  height: calc(100vh - 3.5rem);
  min-height: 26rem;
  background: var(--globe-bg);
  overflow: hidden;
}

.globe-canvas {
  position: absolute;
  inset: 0;
}

/* Globe.GL injects its own canvas; make sure it fills the stage and never
 * introduces a scrollbar of its own. */
.globe-canvas canvas { display: block; outline: none; }

/* The overlay sits above the canvas but must not swallow drags, so it is
 * pointer-events: none with the interactive children opting back in. */
.globe-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.9rem;
  gap: 0.75rem;
}

.globe-toolbar {
  display: flex;
  gap: 0.5rem;
  pointer-events: auto;
  flex-wrap: wrap;
}

.globe-btn {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--globe-label-border);
  background: var(--globe-label-bg);
  color: var(--globe-label-text);
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: border-color 0.15s, color 0.15s;
}

.globe-btn:hover { border-color: var(--accent); color: var(--accent); }
.globe-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.globe-btn[aria-busy="true"] { opacity: 0.6; cursor: progress; }

.globe-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  pointer-events: auto;
  align-content: flex-end;
}

.globe-chip {
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--globe-label-border);
  background: var(--globe-label-bg);
  color: var(--globe-label-text);
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: border-color 0.15s, background 0.15s;
}

.globe-chip:hover { border-color: var(--accent); }
.globe-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.globe-chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
}

/* A live hub gets a dot, so the chip row reads as a status board rather than
 * a list of place names. */
.globe-chip.is-live .globe-chip-label::before {
  content: "";
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  margin-right: 0.35rem;
  border-radius: 999px;
  background: var(--globe-ring-live);
  vertical-align: middle;
}

.globe-chip-count {
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
  font-weight: 500;
}

/* ---------- hub panel ---------- */

.globe-panel {
  padding: 1.5rem 1.25rem 4rem;
  border-left: 1px solid var(--border);
  min-height: calc(100vh - 3.5rem);
}

.globe-panel-head h1 { margin-bottom: 0.25rem; }
.globe-panel-head .lede { margin-bottom: 1.5rem; }

.globe-live-count {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--globe-ring-live);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  vertical-align: middle;
}

.globe-hub {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 0.9rem;
  overflow: hidden;
}

.globe-hub.is-live { border-color: var(--accent); }

.globe-hub-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  padding: 0.7rem 0.9rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.globe-hub-head h2 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.globe-hub-region {
  grid-column: 1;
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.globe-hub-clock {
  grid-column: 2;
  grid-row: 1 / span 2;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  white-space: nowrap;
}

.globe-hub-zone { font-size: 0.7rem; opacity: 0.75; }

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

.globe-game {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "sport teams score"
    "sport status status"
    "sport meta meta";
  gap: 0.15rem 0.6rem;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  align-items: center;
}

.globe-game:last-child { border-bottom: 0; }
.globe-game.is-live { background: linear-gradient(to right, transparent, var(--surface-2)); }
.globe-game.is-final { opacity: 0.8; }

.globe-sport {
  grid-area: sport;
  align-self: start;
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.3rem;
  white-space: nowrap;
}

/* The row's sport glyph. Sized in em so it tracks the chip's font size, and
 * `currentColor` so it follows the chip's colour in both themes. */
.globe-sport svg {
  width: 0.85em;
  height: 0.85em;
  flex: none;
  display: block;
}

.globe-teams {
  grid-area: teams;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  flex-wrap: wrap;
}

/* Both teams are always shown. The abbreviation is the scannable part; the
 * full name is there for a reader who does not know the codes. */
.globe-team {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  min-width: 0;
}

.globe-team::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: var(--primary, var(--text-dim));
  box-shadow: 0 0 0 1px var(--dot-ring);
  flex: none;
  align-self: center;
}

.globe-abbr { font-weight: 700; font-size: 0.85rem; }
.globe-name {
  font-size: 0.75rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 9rem;
}

.globe-team.is-winner .globe-abbr { color: var(--win); }
.globe-team.is-loser { opacity: 0.65; }

.globe-at { color: var(--text-dim); font-size: 0.75rem; }

.globe-score {
  grid-area: score;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 1.05rem;
  white-space: nowrap;
}

.globe-status {
  grid-area: status;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.globe-kickoff { font-variant-numeric: tabular-nums; }

.globe-venue,
.globe-network {
  grid-area: meta;
  font-size: 0.7rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.globe-venue { grid-column: 2; }
.globe-network { grid-column: 3; text-align: right; }

.globe-link {
  grid-area: meta;
  grid-column: 3;
  justify-self: end;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

/* The unplaced section is deliberately styled like a hub so it does not read
 * as an error, but muted so it does not compete with real regions. */
.globe-unplaced { border-style: dashed; }
.globe-unplaced .globe-hub-head { background: transparent; }

/* ---------- globe labels ----------
 *
 * Globe.GL renders htmlElementsData as absolutely-positioned divs inside its
 * own container. These rules style those labels; the class names are ours.
 */
.globe-label {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.14rem 0.42rem;
  border-radius: 999px;
  border: 1px solid var(--globe-label-border);
  background: var(--globe-label-bg);
  color: var(--globe-label-text);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  cursor: pointer;
  transform: translate(-50%, -50%);
  /* Globe.GL writes the positioning transform inline, so the stagger has to
   * come from the box model instead. --label-shift is set per hub to keep
   * neighbouring pills off each other's line at world zoom. */
  margin-top: var(--label-shift, 0px);
  backdrop-filter: blur(6px);
  transition: border-color 0.15s, transform 0.15s;
}

.globe-label:hover { border-color: var(--accent); }
.globe-label.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

/* The sport glyph leads the pill, so a glance tells you what is being played
 * before you read a single code. Sized in em against the pill's own font size
 * and given a little breathing room, because at 0.72rem the strokes were too
 * fine to read against the globe. */
.globe-label-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  /* Deliberately larger than the pill's own text. At 1em the glyph was the
   * same size as a capital letter and read as a speck; the icon has to be the
   * thing you notice first, because it is what tells you the sport. */
  width: 1.45em;
  height: 1.45em;
  margin-right: 0.1em;
  opacity: 0.95;
}
.globe-label-icon svg { width: 100%; height: 100%; display: block; }

/* The glyphs carry `stroke-width="1.4"` as a presentation attribute, which
 * beats an inherited value, so the override has to land on the shapes
 * themselves. At pill size a 1.4 stroke on a 16-unit viewBox is a hairline
 * that reads as a smudge; 2.1 keeps the silhouette legible. */
.globe-label-icon svg * { stroke-width: 2.1; }

/* Team codes carry their brand colour as a leading dot rather than as the text
 * colour: a team's primary is often too dark (or too light) to read as type on
 * a translucent pill, but it is unmistakable as a dot. */
.globe-label-team {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.globe-label-team::before {
  content: "";
  width: 0.34rem;
  height: 0.34rem;
  border-radius: 999px;
  background: var(--team, var(--text-dim));
  box-shadow: 0 0 0 1px var(--dot-ring);
  flex: none;
}

.globe-label-at { opacity: 0.55; font-weight: 500; }

/* The score once a game is live, otherwise the local kickoff. Tabular figures
 * keep the pill from resizing as a clock ticks. */
.globe-label-tail {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  opacity: 0.9;
}

.globe-label.is-live .globe-label-tail { color: var(--globe-ring-live); }

/* How many further games sit in this hub. Muted, so it reads as a footnote to
 * the matchup rather than competing with it. */
.globe-label-more {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  opacity: 0.6;
  padding-left: 0.1em;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  main.globe-page {
    grid-template-columns: 1fr;
  }

  /* On a phone the globe is capped rather than full-height, so the hub list
   * starts within reach. */
  .globe-stage {
    position: relative;
    top: 0;
    height: min(58vh, 26rem);
    min-height: 18rem;
  }

  .globe-panel {
    border-left: 0;
    border-top: 1px solid var(--border);
    min-height: 0;
    padding: 1.25rem 1rem 3rem;
  }

  .globe-name { max-width: 6rem; }
}

@media (max-width: 480px) {
  .globe-overlay { padding: 0.6rem; }
  .globe-btn { font-size: 0.72rem; padding: 0.32rem 0.6rem; }
  .globe-chip { font-size: 0.68rem; padding: 0.25rem 0.5rem; }
  .globe-name { display: none; }
  .globe-game { padding: 0.5rem 0.7rem; }
}

/* Reduced motion: the globe still renders and still responds to clicks, but
 * the rings stop pulsing and the camera cuts instead of tweening. The script
 * reads the same media query, so this is belt and braces. */
@media (prefers-reduced-motion: reduce) {
  .globe-label { transition: none; }
  .globe-chip { transition: none; }
  .globe-btn { transition: none; }
}

/* ==========================================================================
 * Footer
 *
 * Every page carries it. It is the only path to the legal pages from a deep
 * page, and an ad reviewer looks for exactly those links there.
 * ========================================================================== */

.site-footer {
  margin-top: 2.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.6;
}

.footer-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}

/* The wordmark repeats in the footer, as it did on the original site: the
 * footer is the one place a reader lands after scrolling past the nav. */
.footer-brand {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  margin-bottom: 0.9rem;
}

.footer-link {
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}

.footer-link:hover,
.footer-link:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.footer-consent { text-align: left; }

.footer-note {
  margin: 0 0 0.6rem;
  max-width: 60rem;
}

.footer-copy {
  margin: 0;
  font-size: 0.76rem;
  opacity: 0.8;
}

/* ==========================================================================
 * Ad units
 *
 * The container reserves its height before the ad arrives. Cumulative Layout
 * Shift is a ranking signal and a visible jank: a scoreboard that jumps when a
 * creative loads is worse than one with no ad at all. The reserved height is
 * the standard leaderboard (90px) and rectangle (250px) so the common case
 * fills exactly.
 * ========================================================================== */

.ad-unit {
  position: relative;
  display: block;
  margin: 1.25rem auto;
  padding: 0;
  max-width: 100%;
  overflow: hidden;
  background: transparent;
}

.ad-label {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-dim);
  opacity: 0.7;
  margin-bottom: 0.25rem;
}

.ad-unit .adsbygoogle {
  display: block;
  width: 100%;
}

/* A leaderboard sits above the fold on wide screens and is the tallest thing
 * on a phone, so it reserves 90px and grows. */
.ad-header {
  min-height: 90px;
}

/* In-content units sit between panels; 250px is the rectangle height. */
.ad-infeed {
  min-height: 250px;
}

/* The lower unit on matchup and team pages. */
.ad-sidebar {
  min-height: 250px;
}

@media (max-width: 640px) {
  .ad-header { min-height: 100px; }
  .ad-infeed,
  .ad-sidebar { min-height: 250px; }
}

/* ==========================================================================
 * Editorial prose
 *
 * The preview panels and the FAQ block are what make a page read as content
 * rather than as a database dump. They are server-rendered, so a crawler that
 * never runs JavaScript still sees them.
 * ========================================================================== */

.overview p {
  margin: 0;
  max-width: 68ch;
  line-height: 1.7;
}

.faq {
  display: block;
}

.faq-item {
  border-top: 1px solid var(--border);
  padding: 0.7rem 0;
}

.faq-item:first-of-type {
  border-top: 0;
}

.faq-item > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.faq-item > summary::-webkit-details-marker { display: none; }

.faq-item > summary::before {
  content: "+";
  color: var(--accent);
  font-weight: 700;
  width: 0.9rem;
  flex: 0 0 auto;
}

.faq-item[open] > summary::before { content: "\2212"; }

.faq-item > p {
  margin: 0.5rem 0 0 1.4rem;
  max-width: 66ch;
  line-height: 1.65;
  color: var(--text-dim);
}

.muted {
  color: var(--text-dim);
}

/* ---------- sports by state ----------
 *
 * The map is an inline SVG whose regions are links. Everything here is about
 * making that legible in both themes and usable with a keyboard: the fill has
 * to read as "clickable" without looking like a button, the count badge has to
 * stay readable over a team-coloured fill, and the selected state has to be
 * obvious without relying on colour alone.
 */

.states-page { max-width: 72rem; }

.states-head h1 { margin-bottom: 0.35rem; }

/* Day navigation. Same shape as the schedule pages' week nav, so the two
 * read as the same control in different units. */
.day-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 1.5rem;
  padding: 0.6rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.day-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.day-link:hover { text-decoration: underline; }
.day-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.day-range {
  color: var(--text-dim);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

/* Pushes the date jump to the right end of the row on a wide screen, and wraps
 * onto its own line on a narrow one. */
.day-jump {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}

.day-input {
  font: inherit;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.45rem;
  color-scheme: inherit;
}

.day-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.day-go {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-contrast);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
}

.day-go:hover { filter: brightness(1.08); }
.day-go:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Two columns: the map takes the space, the state list sits beside it. Below
 * 56rem the list moves under the map, because a 51-region SVG squeezed into a
 * third of a phone screen is not tappable.
 *
 * The list is capped and scrolls on its own. A busy Saturday puts games in 30+
 * states, and letting that list set the row height would push the selected
 * state's slate a full screen below the map — the two things the page exists to
 * show would never be visible together. */
.states-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(15rem, 20rem);
  align-items: start;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.states-side {
  max-height: 34rem;
  overflow-y: auto;
  padding-right: 0.25rem;
  scrollbar-width: thin;
}

.states-map-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
}

.states-map {
  display: block;
  width: 100%;
  height: auto;
  /* The map's own coordinate space is 1016x594, so this keeps the aspect ratio
   * without a wrapper hack. */
  aspect-ratio: 1016 / 594;
}

/* Every region is a link. The default fill is the page surface so the map
 * reads as a map rather than a block of buttons; a state with games gets the
 * accent tint, which is the only signal the map needs to carry. */
.state-shape path {
  fill: var(--surface-2);
  stroke: var(--border);
  stroke-width: 1;
  stroke-linejoin: round;
  transition: fill 120ms ease, stroke 120ms ease;
}

.state-shape.has-games path {
  fill: color-mix(in srgb, var(--accent) 26%, var(--surface-2));
  stroke: color-mix(in srgb, var(--accent) 55%, var(--border));
}

.state-shape:hover path,
.state-shape:focus-visible path {
  fill: color-mix(in srgb, var(--accent) 45%, var(--surface-2));
  stroke: var(--accent);
}

.state-shape:focus-visible { outline: none; }
.state-shape:focus-visible path { stroke-width: 2.5; }

/* The selected state is the one whose slate is on the page. It gets the full
 * accent fill and a heavier outline, so "where am I" is answerable at a glance
 * even in a screenshot with no hover state. */
.state-shape.is-selected path {
  fill: var(--accent);
  stroke: var(--accent-contrast);
  stroke-width: 2;
}

/* Count badges. `pointer-events: none` is what keeps the badge from stealing
 * the click from the link underneath it — without it, tapping the number on a
 * state would do nothing. */
.state-badge {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  fill: var(--text);
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 2.5px;
  stroke-linejoin: round;
  pointer-events: none;
  user-select: none;
}

/* The badge on the selected state sits on the accent fill, so it needs the
 * contrasting text colour. The halo is dropped rather than recoloured: at 11px
 * a 2.5px stroke swallows most of the glyph, and white on the accent fill is
 * already well past the contrast threshold without one. */
.state-badge.is-selected {
  fill: var(--accent-contrast);
  stroke: none;
}

.states-map-note {
  margin: 0.6rem 0 0;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--text-dim);
}

.states-side-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

/* The state list. A grid of chips rather than a list of rows: 51 states in a
 * single column would be a scroll, and the chips are short enough to pair up. */
.state-chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.4rem;
}

.state-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--text);
  min-width: 0;
}

.state-chip:hover { border-color: var(--accent); }
.state-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.state-chip.is-selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
}

.state-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.state-chip-count {
  flex: none;
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}

.state-chip.is-selected .state-chip-count { color: var(--accent); }

.state-chip-none {
  grid-column: 1 / -1;
  color: var(--text-dim);
  font-size: 0.875rem;
  padding: 0.4rem 0;
}

/* The selected state's slate. */
.state-detail {
  margin-bottom: 2rem;
  scroll-margin-top: 1rem;
}

.state-detail-head h2 {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
}

.state-detail-count {
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}

.state-detail-head .lede { margin-bottom: 1rem; }

.state-detail-empty {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.state-detail-empty h2 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.state-detail-empty .lede { margin: 0; }

/* Games the map could not place. Collapsed, because it is a footnote to the
 * map rather than the point of the page. */
.state-unplaced {
  margin-bottom: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.state-unplaced > summary {
  cursor: pointer;
  padding: 0.7rem 0.9rem;
  font-weight: 600;
  font-size: 0.95rem;
  list-style: none;
  display: flex;
  align-items: baseline;
}

.state-unplaced > summary::-webkit-details-marker { display: none; }
.state-unplaced > summary::marker { content: ""; }
.state-unplaced > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius); }

.state-unplaced > summary::before {
  content: "+";
  color: var(--accent);
  font-weight: 700;
  width: 0.9rem;
  flex: 0 0 auto;
}

.state-unplaced[open] > summary::before { content: "\2212"; }

.state-unplaced .games { padding: 0 0.9rem 0.9rem; }

/* The map's regions are links, so the pointer should say so. Set on the anchor
 * rather than the path so the whole region responds. */
.state-shape { cursor: pointer; }

@media (max-width: 56rem) {
  .states-layout { grid-template-columns: minmax(0, 1fr); }
  /* Stacked, the list is below the map rather than beside it, so the cap would
   * only hide states behind a scroll for no benefit. */
  .states-side { max-height: none; overflow: visible; }
  .day-jump { margin-left: 0; }
}

/* A 51-region map is not tappable at phone width: the smallest states are a few
 * pixels across. Below 40rem the map stays as an overview and the chip list
 * becomes the primary control, so the chips get bigger targets. */
@media (max-width: 40rem) {
  .state-chips { grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); }
  .state-chip { padding: 0.55rem 0.7rem; }
  .state-badge { font-size: 13px; }
}
