:root {
  --focus: #2f6fed;
  --navy: #0d1d3b;
  --navy-soft: #17305c;
  --brand: var(--navy);
  --brand-soft: var(--navy-soft);
  --heading: var(--navy);
  --ink: #122033;
  --muted: #5b6b80;
  --faint: #c5cedd;
  --line: #d7deea;
  --line-soft: #edf1f7;
  --paper: #f6f8fb;
  --card: #ffffff;
  --tint: #eef3fb;
  --tint-2: #f3f6fb;
  --chip: #e6ebf3;
  --accent: #c8102e;
  --accent-tint: #f8e6ea;
  --accent-line: #e8b4be;
  --good: #1b6b3a;
  --good-bg: #e7f6ed;
  --bad: #9b1c3a;
  --bad-bg: #fde8ec;
  --gold: #f2b705;
  --gold-tint: #fff8e1;
  --glow-1: #dfe8f7;
  --glow-2: #f3d6dc;
  --header-bg: rgba(246, 248, 251, 0.92);
  --nav-bg: rgba(255, 255, 255, 0.94);
  --shadow: 13 29 59;
  --logo-bg: #ffffff;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --focus: #8ab4ff;
  --brand: #2d5ba6;
  --brand-soft: #3a6bc0;
  --heading: #dbe6f7;
  --ink: #e2e8f1;
  --muted: #9aa9bd;
  --faint: #4b5b73;
  --line: #2a3a52;
  --line-soft: #223149;
  --paper: #0d1522;
  --card: #152032;
  --tint: #1b2a40;
  --tint-2: #182538;
  --chip: #23334b;
  --accent: #ff6b7d;
  --accent-tint: #3a1c27;
  --accent-line: #7a3445;
  --good: #7fd89d;
  --good-bg: #16331f;
  --bad: #ff9fb0;
  --bad-bg: #3b1a23;
  --gold: #f5c518;
  --gold-tint: #342c12;
  --glow-1: #14264a;
  --glow-2: #351a27;
  --header-bg: rgba(13, 21, 34, 0.9);
  --nav-bg: rgba(21, 32, 50, 0.94);
  --shadow: 0 0 0;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0 auto;
  max-width: 1100px;
  padding: 28px 20px 64px;
  color: var(--ink);
  background:
    radial-gradient(1200px 400px at 10% -10%, var(--glow-1) 0%, transparent 60%),
    radial-gradient(900px 320px at 100% 0%, var(--glow-2) 0%, transparent 55%),
    var(--paper);
  background-repeat: no-repeat;
  font: 16px/1.45 "Titillium Web", "Trebuchet MS", "Segoe UI", sans-serif;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 24px;
}

.top-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  justify-content: flex-end;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--card);
}

.main-nav a,
.main-nav a.tab {
  padding: 10px 18px;
  border-radius: 0;
  color: var(--heading);
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  border-right: 1px solid var(--line);
}

.main-nav a:last-child {
  border-right: none;
}

.main-nav a.active,
.main-nav a:hover {
  background: var(--brand);
  color: white;
}

.sub-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.sub-nav a,
.sub-nav .sub-nav-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.sub-nav a.active,
.sub-nav a:hover,
.sub-nav .sub-nav-btn.active,
.sub-nav .sub-nav-btn:hover {
  background: var(--tint);
  color: var(--heading);
}

.brand-logo {
  flex: none;
  display: block;
  line-height: 0;
}

.brand-logo img {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 10px;
}

.site-foot {
  margin-top: 40px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.site-foot a {
  color: inherit;
}

.kicker {
  margin: 0 0 4px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--brand);
  color: white;
  font-weight: 700;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

#main:focus,
#page-title:focus {
  outline: none;
}

.th-sort,
.ct-toggle {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

h1 {
  margin: 0;
  color: var(--heading);
  font-size: 42px;
  letter-spacing: -0.03em;
}

h2 {
  margin: 0 0 8px;
  color: var(--heading);
  font-size: 28px;
}

.source {
  color: var(--heading);
  font-size: 14px;
}

.top-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--heading);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.theme-label {
  min-width: 2.6em;
  text-align: left;
}

.theme-toggle svg {
  display: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.theme-toggle .icon-auto path,
.theme-toggle .icon-dark path {
  fill: currentColor;
}

.theme-toggle[data-choice="auto"] .icon-auto,
.theme-toggle[data-choice="light"] .icon-light,
.theme-toggle[data-choice="dark"] .icon-dark {
  display: block;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

/* Author `display:grid` otherwise overrides the HTML hidden attribute. */
.filters[hidden],
form.filters[hidden] {
  display: none !important;
}

.schedule-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 0;
}

.league-picker {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.league-picker summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--heading);
  padding: 8px 0;
}

.schedule-list button {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--heading);
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.schedule-list button:hover,
.schedule-list button.active {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.search-form {
  align-items: end;
}

.search-form .grow {
  grid-column: span 2;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

select,
input[type="date"],
input[type="search"],
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
.btn {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}

.btn {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
  cursor: pointer;
  font-weight: 700;
}

.status {
  color: var(--muted);
  margin: 0 0 16px;
}

.status[data-loading="hidden"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skeleton {
  display: grid;
  gap: 12px;
}

.sk {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--line) 25%, color-mix(in srgb, var(--line) 45%, var(--card)) 50%, var(--line) 75%);
  background-size: 300% 100%;
  animation: sk-shimmer 1.4s ease-in-out infinite;
}

@keyframes sk-shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sk {
    animation: none;
  }
}

.sk-card,
.sk-table {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

.sk-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sk-logo {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.sk-logo-lg {
  width: 44px;
  height: 44px;
}

.sk-header {
  padding: 4px 0 12px;
}

.sk-head {
  height: 10px;
  width: 100%;
  opacity: 0.6;
}

.sk-num {
  flex: none;
  width: 24px;
}

.sk-score {
  flex: none;
  width: 22px;
  margin-left: auto;
}

.sk-grow {
  flex: 1;
}

.sk-w30 {
  width: 30%;
}

.sk-w40 {
  width: 40%;
}

.sk-w50 {
  width: 50%;
}

.sk-thin {
  height: 8px;
}

.sk-tall {
  height: 18px;
}

.games {
  display: grid;
  gap: 12px;
}

.game {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px 24px;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.game.compact {
  padding: 12px 14px;
}

.meta {
  color: var(--muted);
  font-size: 13px;
}

.title {
  margin: 4px 0 6px;
  font-size: 18px;
  font-weight: 700;
}

.team-with-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.team-with-logo:hover .team-name {
  color: var(--accent);
  text-decoration: underline;
}

.team-name {
  min-width: 0;
}

.team-logo {
  flex: 0 0 auto;
  object-fit: contain;
  background: var(--logo-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.team-logo-sm {
  width: 22px;
  height: 22px;
}

.team-logo-md {
  width: 28px;
  height: 28px;
}

.team-logo-lg {
  width: 44px;
  height: 44px;
}

.team-logo-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--tint);
  color: var(--heading);
  font-weight: 700;
  font-size: 12px;
}

.team-logo-lg.team-logo-fallback {
  font-size: 18px;
}

.team-heading,
.title.matchup {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.title.matchup {
  gap: 10px;
  font-size: 18px;
}

.title.matchup .at {
  color: var(--muted);
  font-weight: 600;
}

.recap-scoreboard {
  display: grid;
  gap: 10px;
  max-width: 560px;
}

.recap-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
}

.recap-pts {
  font-variant-numeric: tabular-nums;
  color: var(--heading);
  font-size: 30px;
  font-weight: 700;
  min-width: 1.4em;
  text-align: right;
}

.recap-row.is-loser .recap-pts {
  color: var(--muted);
}

td .team-with-logo {
  max-width: 320px;
}

td .team-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title a,
.detail-header a:not(.sheet),
.table-wrap a,
.result strong {
  color: var(--heading);
  text-decoration: none;
}

.title a:hover,
.table-wrap a:hover,
.result:hover strong {
  color: var(--accent);
  text-decoration: underline;
}

.venue {
  color: var(--ink);
}

.score {
  font-variant-numeric: tabular-nums;
  color: var(--heading);
  font-weight: 700;
}

.scoreboard {
  display: grid;
  gap: 3px;
  margin-top: 6px;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.scoreboard-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px 12px;
  align-items: center;
}

.scoreboard-compact.scoreboard .scoreboard-row {
  grid-template-columns: auto auto auto;
  justify-content: end;
}

.scoreboard-team {
  min-width: 0;
}

.scoreboard-team .team-with-logo {
  max-width: 100%;
}

.scoreboard-team .team-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}

.scoreboard-ha {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.scoreboard-pts {
  font-weight: 800;
  font-size: 16px;
  color: var(--heading);
  text-align: right;
  min-width: 1.6ch;
}

.scoreboard-row.is-self .scoreboard-team .team-name {
  color: var(--accent);
}

.game.compact .scoreboard {
  margin-top: 4px;
}

.favorite-game .scoreboard,
.my-team-game .scoreboard {
  margin: 6px 0 4px;
}

.side .scoreboard {
  margin-top: 0;
  margin-bottom: 6px;
}

.officials {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--tint);
  color: var(--heading);
  font-size: 13px;
}

.chip.none {
  background: var(--tint-2);
  color: var(--muted);
}

.chip .pos {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chip.need {
  background: var(--bad-bg);
  color: var(--bad);
}

.chip.mine {
  background: var(--good-bg);
  color: var(--good);
}

.chip.pay {
  background: var(--good-bg);
  color: var(--good);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.refs-pay-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.refs-pay-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.refs-pay-card.total {
  border-color: var(--brand);
  background: var(--tint);
}

.refs-pay-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.refs-pay-card strong {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  color: var(--heading);
}

.refs-login-card {
  max-width: 420px;
  padding: 22px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.refs-login-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.refs-login-form button.sheet {
  justify-self: start;
  border: 0;
  cursor: pointer;
}

.refs-session {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 20px;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.refs-session-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.refs-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.filters .grow {
  grid-column: span 2;
}

.refs-multi {
  grid-row: span 2;
}

.refs-multi select[multiple] {
  min-height: 120px;
}

@media (min-width: 720px) {
  .refs-multi.wide {
    grid-column: span 2;
  }
}

.field-hint {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

@media (max-width: 720px) {
  .filters .grow {
    grid-column: span 1;
  }
}

.side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.sheet {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--brand);
  color: white;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.sheet.ghost {
  background: transparent;
  color: var(--heading);
  border: 1px solid var(--line);
}

.sheet:hover {
  background: var(--brand-soft);
  color: white;
}

.update-banner {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 24px);
  padding: 8px 8px 8px 16px;
  border-radius: 999px;
  background: var(--brand);
  color: white;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgb(0 0 0 / 25%);
  transform: translateX(-50%);
}

.update-banner[hidden] {
  display: none;
}

.update-banner button {
  flex: none;
  padding: 7px 14px;
  border: 0;
  border-radius: 999px;
  background: white;
  color: var(--brand);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 720px) {
  .update-banner {
    bottom: calc(74px + env(safe-area-inset-bottom));
    width: max-content;
  }
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--heading);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.share-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.team-heading-row .share-btn {
  margin-left: auto;
  flex: none;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
}

.pager button {
  min-width: 40px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--heading);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.pager button[disabled] {
  opacity: 0.4;
  cursor: default;
}

.pager .current {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

.pager-ellipsis {
  min-width: 28px;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}

.list-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 4px 0 12px;
}

.page-size {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.page-size select {
  min-width: 72px;
}

.section-title {
  margin: 28px 0 12px;
  font-size: 20px;
  color: var(--heading);
}

.section-heading-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin: 28px 0 12px;
}

.section-heading-row .section-title {
  margin: 0;
}

.btn-export {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--heading);
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
}

.btn-export:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.detail-header {
  margin-bottom: 8px;
}

[data-colored] {
  --team-shown: var(--team);
  --away-shown: var(--away, var(--line));
  --home-shown: var(--home, var(--line));
}

@supports (color: oklch(from red l c h)) {
  :root[data-theme="dark"] [data-colored] {
    --team-shown: oklch(from var(--team) max(l, 0.55) c h);
    --away-shown: oklch(from var(--away, var(--line)) max(l, 0.55) c h);
    --home-shown: oklch(from var(--home, var(--line)) max(l, 0.55) c h);
  }
}

#team-header[data-colored] {
  padding: 12px 16px 12px 18px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--team-shown);
  border-radius: 14px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--team-shown) 16%, var(--card)), var(--card) 75%);
}

#game-header[data-colored] {
  position: relative;
  overflow: hidden;
  padding: 16px 16px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

#game-header[data-colored]::before,
.game[data-colored]::before {
  content: "";
  position: absolute;
  background: linear-gradient(90deg, var(--away-shown) 50%, var(--home-shown) 50%);
}

#game-header[data-colored]::before {
  inset: 0 0 auto;
  height: 5px;
}

.game[data-colored] {
  position: relative;
  overflow: hidden;
}

.game[data-colored]::before {
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--away-shown) 50%, var(--home-shown) 50%);
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overscroll-behavior-x: contain;
}

.data-table {
  min-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  background: var(--tint);
  position: sticky;
  top: 0;
  z-index: 1;
}

th.num,
td.num {
  text-align: right;
}

tr.clickable {
  cursor: pointer;
}

tr.clickable:hover {
  background: var(--tint-2);
}

.card-label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 6px;
}

.tag {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.leaders-grid {
  display: grid;
  gap: 8px;
}

.leader-board .table-wrap {
  margin-bottom: 8px;
}

.splits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 12px 0 8px;
}

.split {
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.search-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.result-list {
  display: grid;
  gap: 8px;
}

.result {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
}

.result.result-with-fav {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.result.result-with-fav > a,
.result.result-with-fav > .result-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
  text-decoration: none;
  color: inherit;
}

.result.result-with-fav > a.team-result {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
}

.result-schedules {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.result .sched-tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--tint);
  color: var(--heading);
  font-size: 12px;
  white-space: nowrap;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  color: var(--muted);
  font-size: 13px;
}

.result-meta .team-name {
  font-size: 13px;
  font-weight: 600;
}

.result span {
  color: var(--muted);
  font-size: 13px;
}

.vs-prefix {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  margin-right: 2px;
}

.section-title .team-with-logo {
  display: inline-flex;
  vertical-align: middle;
}

.section-title .scoreboard-ha {
  margin-left: 6px;
  vertical-align: middle;
}

.lineups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

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

.follow-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--faint);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  padding: 0;
}

.follow-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.follow-btn.on {
  background: var(--accent-tint);
  border-color: var(--accent-line);
  color: var(--accent);
}

.follow-btn.lg {
  width: 42px;
  height: 42px;
  font-size: 20px;
}

td.follow-cell,
th.follow-cell {
  width: 44px;
  padding-left: 8px;
  padding-right: 4px;
}

.team-heading-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.my-teams-list,
.favorites-list {
  display: grid;
  gap: 14px;
}

.favorites-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 22px;
}

.favorites-section-title {
  margin: 8px 0 10px;
  font-size: 18px;
  color: var(--heading);
}

.my-team-card,
.favorite-card {
  display: grid;
  gap: 14px;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.my-team-card-top,
.favorite-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.my-team-card-top .team-with-logo,
.favorite-card-top .team-with-logo {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--heading);
}

.favorite-player-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--heading);
  text-decoration: none;
}

.favorite-player-name:hover {
  color: var(--accent);
  text-decoration: underline;
}

.my-team-meta,
.favorite-meta {
  color: var(--muted);
  font-size: 14px;
}

.my-team-games,
.favorite-games {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.my-team-game,
.favorite-game {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--tint-2);
}

.my-team-game .label,
.favorite-game .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 4px;
}

.my-team-game .score,
.favorite-game .score {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--heading);
}

.home-card[data-colored] {
  border-left: 6px solid var(--team-shown);
}

.home-card .favorite-meta b {
  color: var(--heading);
}

.home-games {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.home-next,
.home-recent {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--tint-2);
}

.home-recent {
  gap: 12px;
}

.home-last {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.home-card .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
}

.home-next-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.countdown {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.home-when {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--heading);
}

.home-opp {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.home-opp .team-with-logo {
  min-width: 0;
}

.home-opp .team-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-vs {
  flex: none;
  color: var(--muted);
  font-weight: 600;
}

.home-arena,
.game-venue,
.arena-address {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  min-height: 24px;
  margin: 0;
  color: var(--heading);
  font-size: 14px;
}

.home-arena svg,
.game-venue svg,
.arena-address svg {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
}

.venue-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-underline-offset: 2px;
}

.venue-link:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.home-directions {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.game-venue {
  margin: 2px 0 8px;
}

.arena-filter input {
  width: 100%;
  max-width: 420px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
}

.arenas-list,
.arena-games {
  display: grid;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.arena-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "name busy"
    "meta busy";
  column-gap: 12px;
  padding: 10px 14px;
  color: var(--ink);
  text-decoration: none;
}

.arena-row + .arena-row,
.arena-game + .arena-game {
  border-top: 1px solid var(--line-soft);
}

.arena-row:hover .arena-row-name {
  color: var(--accent);
  text-decoration: underline;
}

.arena-row-name {
  grid-area: name;
  font-weight: 700;
  color: var(--heading);
}

.arena-row-meta {
  grid-area: meta;
  color: var(--muted);
  font-size: 13px;
}

.arena-row-busy {
  grid-area: busy;
  align-self: center;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.arena-rinks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.arena-day-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.arena-day-head .section-title {
  text-align: center;
}

.arena-day-nav {
  min-height: 24px;
  color: var(--heading);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.arena-day-nav[rel="next"] {
  justify-self: end;
}

.arena-day-nav:hover {
  color: var(--accent);
  text-decoration: underline;
}

.arena-game {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  grid-template-areas:
    "when teams outcome"
    "when league outcome";
  align-items: center;
  column-gap: 12px;
  row-gap: 2px;
  padding: 10px 14px;
}

.arena-game.is-cancelled .arena-game-teams {
  opacity: 0.6;
  text-decoration: line-through;
}

.arena-game-when {
  grid-area: when;
  display: grid;
  color: var(--muted);
  font-size: 13px;
}

.arena-game-when b {
  color: var(--heading);
}

.arena-game-teams {
  grid-area: teams;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  min-width: 0;
  font-weight: 600;
}

.arena-game-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.arena-game-league {
  grid-area: league;
  color: var(--muted);
  font-size: 13px;
}

.arena-game-outcome {
  grid-area: outcome;
}

.arena-score {
  color: var(--heading);
  font-size: 1.05rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}

.arena-score:hover {
  text-decoration: underline;
}

.arena-cancelled {
  color: var(--bad);
  font-size: 13px;
  font-weight: 700;
}

.arena-home-teams {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}

.arena-home-team {
  display: grid;
  gap: 2px;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.arena-home-team small {
  color: var(--muted);
}

@media (max-width: 720px) {
  .arena-game {
    grid-template-columns: 64px minmax(0, 1fr) auto;
    padding: 10px 12px;
  }

  .arena-game-teams {
    flex-direction: column;
    align-items: flex-start;
  }
}

.home-cancelled {
  margin: 0;
  color: var(--bad);
  font-size: 13px;
}

.home-last-score {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  color: var(--heading);
  text-decoration: none;
}

.home-last-score .score {
  font-size: 1.25rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.home-last-score:hover .score {
  text-decoration: underline;
}

.wlt {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  background: var(--chip);
  color: var(--muted);
}

.wlt-w {
  background: var(--good-bg);
  color: var(--good);
}

.wlt-l {
  background: var(--bad-bg);
  color: var(--bad);
}

.home-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.form-strip {
  display: inline-flex;
  gap: 4px;
}

.home-agenda {
  margin-bottom: 8px;
}

.agenda-list {
  display: grid;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.agenda-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  grid-template-areas:
    "when team countdown"
    "when match countdown"
    "when where countdown";
  align-items: center;
  column-gap: 12px;
  row-gap: 2px;
  padding: 10px 14px;
}

.agenda-item + .agenda-item {
  border-top: 1px solid var(--line-soft);
}

.agenda-when {
  grid-area: when;
  display: grid;
  color: var(--muted);
  font-size: 13px;
}

.agenda-when b {
  color: var(--heading);
}

.agenda-team {
  grid-area: team;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.agenda-team .team-logo {
  width: 18px;
  height: 18px;
}

.agenda-match {
  grid-area: match;
  font-weight: 700;
  color: var(--heading);
}

.agenda-team span,
.agenda-match,
.agenda-where {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-where {
  grid-area: where;
  color: var(--muted);
  font-size: 13px;
}

.agenda-item .countdown {
  grid-area: countdown;
}

@media (max-width: 720px) {
  .agenda-item {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "when countdown"
      "team team"
      "match match"
      "where where";
    padding: 10px 12px;
  }

  .agenda-when {
    display: flex;
    gap: 6px;
  }
}

.my-team-actions,
.favorite-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.my-team-actions a,
.favorite-actions a {
  color: var(--heading);
  font-weight: 600;
  text-decoration: none;
}

.my-team-actions a:hover,
.favorite-actions a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.my-teams-empty,
.favorites-empty {
  padding: 28px 22px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: var(--card);
  display: grid;
  gap: 10px;
}

.my-teams-empty h2,
.favorites-empty h2 {
  margin: 0;
  font-size: 24px;
}

.my-teams-empty p,
.favorites-empty p {
  margin: 0;
  color: var(--muted);
  max-width: 36rem;
}

.favorites-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.my-teams-empty a.btn-link,
.favorites-empty a.btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 42px;
  padding: 8px 16px;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.favorites-empty a.btn-link.secondary {
  background: var(--card);
  color: var(--heading);
  border: 1px solid var(--line);
}

@media (max-width: 720px) {
  body {
    padding: 16px 12px 56px;
  }

  .game,
  .side {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  h1 {
    font-size: 28px;
  }

  .top {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
  }

  .top-right {
    align-items: flex-start;
    width: 100%;
  }

  .main-nav {
    width: 100%;
  }

  .main-nav a,
  .main-nav a.tab {
    flex: 1;
    text-align: center;
    padding: 10px 12px;
    font-size: 14px;
  }

  .filters {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
  }

  #standings-filters label:nth-child(4) {
    grid-column: 1 / -1;
  }

  select {
    text-overflow: ellipsis;
  }

  .search-form .grow {
    grid-column: span 2;
  }

  th,
  td {
    padding: 8px 8px;
    font-size: 13px;
  }

  th {
    font-size: 11px;
  }

  /* Sticky team column so stats stay comparable while scrolling sideways */
  th:first-child,
  td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--card);
    max-width: min(46vw, 180px);
    box-shadow: 4px 0 8px -6px rgb(var(--shadow) / 0.35);
  }

  th:first-child {
    z-index: 3;
    background: var(--tint);
  }

  /* When follow column is first, sticky the team column (2nd) instead */
  th.follow-cell,
  td.follow-cell {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--card);
    max-width: none;
    box-shadow: none;
  }

  th.follow-cell {
    z-index: 3;
    background: var(--tint);
  }

  th.follow-cell + th,
  td.follow-cell + td {
    position: sticky;
    left: 44px;
    z-index: 2;
    background: var(--card);
    max-width: min(42vw, 160px);
    box-shadow: 4px 0 8px -6px rgb(var(--shadow) / 0.35);
  }

  th.follow-cell + th {
    z-index: 3;
    background: var(--tint);
  }

  tr.clickable:hover td:first-child,
  tr:nth-child(even) td:first-child {
    background: var(--card);
  }

  tr.clickable:active {
    background: var(--tint-2);
  }

  td .team-with-logo {
    max-width: min(42vw, 160px);
  }

  td .team-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .status {
    font-size: 13px;
    margin: 0 0 10px;
  }

  .section-title {
    font-size: 17px;
    margin: 20px 0 10px;
  }
}

.standings-stack + .standings-stack {
  margin-top: 1.75rem;
}

.standings-stack .section-title {
  margin-bottom: 0.5rem;
}

/* ---- Phone app layout --------------------------------------------------- */

.top-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.phone-only,
.nav-back,
.bottom-nav,
.filter-bar,
.sheet-head,
.ptr,
.sheet-backdrop {
  display: none;
}

@media (max-width: 720px) {
  html,
  body {
    overscroll-behavior-y: contain;
  }

  body {
    padding: 0 12px calc(84px + env(safe-area-inset-bottom));
    -webkit-tap-highlight-color: transparent;
  }

  body.sheet-lock {
    overflow: hidden;
  }

  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    font-size: 16px;
  }

  .refs-auth button[type="submit"] {
    min-height: 44px;
    padding: 0 20px;
  }

  /* Compact sticky header */
  .top {
    position: sticky;
    top: 0;
    z-index: 40;
    flex-direction: row;
    align-items: center;
    margin: 0 -12px 12px;
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
    background: var(--header-bg);
    backdrop-filter: saturate(1.6) blur(14px);
    -webkit-backdrop-filter: saturate(1.6) blur(14px);
    border-bottom: 1px solid var(--line);
  }

  .top .kicker,
  .top .main-nav,
  .top .source {
    display: none;
  }

  .brand-logo img {
    width: 30px;
    height: 30px;
    border-radius: 7px;
  }

  .top-title {
    flex: 1;
  }

  .top-right {
    flex: none;
    width: auto;
  }

  .theme-toggle {
    padding: 0 8px 0 6px;
    gap: 4px;
    border-color: transparent;
    background: transparent;
    font-size: 12px;
  }

  .top h1 {
    font-size: 21px;
    line-height: 1.2;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .top-title > div {
    min-width: 0;
  }

  .nav-back:not([hidden]) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 36px;
    height: 36px;
    margin-left: -8px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--heading);
  }

  .nav-back:active {
    background: var(--chip);
  }

  .nav-back svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .detail-header .crumb {
    display: none;
  }

  .detail-header .team-heading-row {
    flex-wrap: nowrap;
    gap: 10px;
    margin-top: 4px;
  }

  .team-heading-row .share-btn {
    padding: 9px;
  }

  .team-heading-row .share-btn span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .detail-header .team-heading-row h2 {
    min-width: 0;
    margin: 0;
    font-size: 20px;
    line-height: 1.2;
  }

  .detail-header .meta {
    margin: 0;
  }

  .detail-header .recap-scoreboard {
    font-size: 16px;
  }

  .recap-pts {
    font-size: 26px;
  }

  body[data-view="team"] .sub-nav,
  body[data-view="player"] .sub-nav,
  body[data-view="game"] .sub-nav {
    display: none;
  }

  /* Bottom tab bar */
  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: var(--nav-bg);
    backdrop-filter: saturate(1.6) blur(14px);
    -webkit-backdrop-filter: saturate(1.6) blur(14px);
    border-top: 1px solid var(--line);
  }

  .bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 0;
    color: var(--muted);
    text-decoration: none;
    font-size: 11px;
    font-weight: 700;
  }

  .bottom-nav svg {
    width: 25px;
    height: 25px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .bottom-nav a.active {
    color: var(--heading);
  }

  .bottom-nav a.active svg {
    stroke-width: 2.4;
  }

  .bottom-nav a[data-nav="favorites"].active svg {
    fill: var(--accent);
    stroke: var(--accent);
  }

  /* Sub-tabs as a segmented control */
  .sub-nav {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 2px;
    padding: 3px;
    margin: 0 0 12px;
    background: var(--chip);
    border-radius: 10px;
  }

  .sub-nav a,
  .sub-nav .sub-nav-btn {
    padding: 7px 4px;
    text-align: center;
    font-size: 13px;
    border-radius: 8px;
    white-space: nowrap;
  }

  .sub-nav a.active,
  .sub-nav .sub-nav-btn.active,
  .sub-nav a:hover,
  .sub-nav .sub-nav-btn:hover {
    background: var(--card);
    color: var(--heading);
    box-shadow: 0 1px 3px rgb(var(--shadow) / 0.12);
  }

  /* Filter bar + bottom sheet */
  .filter-bar:not([hidden]) {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    cursor: pointer;
  }

  .filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    color: var(--heading);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
  }

  .filter-toggle svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
  }

  .filter-chips {
    display: flex;
    gap: 6px;
    overflow: hidden;
    mask-image: linear-gradient(to right, #000 85%, transparent);
    -webkit-mask-image: linear-gradient(to right, #000 85%, transparent);
  }

  .fchip {
    flex: none;
    max-width: 150px;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--chip);
    color: var(--heading);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .fchip.more {
    background: transparent;
    color: var(--muted);
  }

  form.filters:not(.search-form) {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    grid-template-columns: 1fr;
    gap: 12px;
    max-height: 82vh;
    margin: 0;
    padding: 0 16px calc(20px + env(safe-area-inset-bottom));
    overflow-y: auto;
    background: var(--card);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 40px rgb(var(--shadow) / 0.25);
    transform: translateY(105%);
    visibility: hidden;
    transition: transform 0.25s ease, visibility 0s linear 0.25s;
  }

  form.filters.sheet-open {
    transform: none;
    visibility: visible;
    transition: transform 0.25s ease;
  }

  form.filters .sheet-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 -16px;
    padding: 16px 16px 10px;
    background: var(--card);
    color: var(--heading);
    font-size: 18px;
  }

  form.filters .sheet-head::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 50%;
    width: 38px;
    height: 4px;
    margin-left: -19px;
    border-radius: 2px;
    background: var(--line);
  }

  .sheet-done {
    padding: 6px 14px;
    border: 0;
    border-radius: 999px;
    background: var(--brand);
    color: white;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
  }

  form.filters select,
  form.filters input {
    min-height: 44px;
    font-size: 16px;
  }

  .filters .field-hint {
    display: none;
  }

  #standings-filters label:nth-child(4) {
    grid-column: auto;
  }

  .sheet-backdrop:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: block;
    background: rgb(var(--shadow) / 0.35);
  }

  .search-form {
    grid-template-columns: 1fr auto;
  }

  .search-form label:not(.grow) {
    display: none;
  }

  .search-form .grow {
    grid-column: auto;
  }

  .search-form input[type="search"] {
    min-height: 44px;
    font-size: 16px;
  }

  .search-form .btn {
    align-self: end;
    min-height: 44px;
  }

  /* Card lists (tables on phones) */
  .table-wrap {
    overflow: visible;
    background: transparent;
    border: 0;
    border-radius: 0;
  }

  .card-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    margin: -4px 0 6px;
    font-size: 12px;
    color: var(--muted);
  }

  .card-toolbar label {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
  }

  .card-toolbar select {
    width: auto;
    min-height: 30px;
    padding: 2px 6px;
    font-size: 13px;
  }

  .card-toolbar button {
    width: 30px;
    height: 30px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    color: var(--heading);
    font-weight: 700;
  }

  .card-list {
    overflow: hidden;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
  }

  .card-list > .muted {
    margin: 0;
    padding: 14px;
  }

  .card-group {
    padding: 8px 14px 6px;
    background: var(--tint);
    color: var(--heading);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
  }

  .row-card {
    padding: 10px 14px;
    border-top: 1px solid var(--line-soft);
  }

  .row-card:first-child,
  .card-group + .row-card {
    border-top: 0;
  }

  .row-card.clickable:active {
    background: var(--tint-2);
  }

  .row-card-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }

  .row-card-actions {
    display: flex;
    flex: none;
    gap: 4px;
  }

  .row-card-text {
    flex: 1;
    min-width: 0;
  }

  .row-card-title {
    color: var(--heading);
    font-weight: 700;
    font-size: 15px;
    line-height: 1.25;
  }

  .row-card-title a {
    color: inherit;
    text-decoration: none;
  }

  .row-card-title .team-with-logo {
    max-width: none;
  }

  .row-card-title .team-name {
    white-space: normal;
    overflow: visible;
  }

  .row-card-sub {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 6px;
    margin-top: 2px;
    color: var(--muted);
    font-size: 12.5px;
  }

  .row-card-sub a {
    color: var(--heading);
  }

  .row-card-sub .dot {
    opacity: 0.6;
  }

  .row-card-stats {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(31px, 1fr);
    gap: 2px;
    margin-top: 8px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .row-card-stats::-webkit-scrollbar {
    display: none;
  }

  .row-card-stats .stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 2px;
    border-radius: 8px;
    background: var(--tint-2);
    font-variant-numeric: tabular-nums;
  }

  .row-card-stats .stat b {
    color: var(--ink);
    font-size: 15px;
    line-height: 1.1;
  }

  .row-card-stats .stat small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.03em;
  }

  .row-card-stats .stat.on {
    background: var(--brand);
  }

  .row-card-stats .stat.on b,
  .row-card-stats .stat.on small {
    color: white;
  }

  .leader-board .section-title {
    margin-top: 16px;
  }

  /* Game cards */
  .game {
    gap: 8px;
    padding: 12px 14px;
  }

  .game .meta {
    font-size: 12px;
    line-height: 1.35;
  }

  .phone-only {
    display: block;
  }

  #games .title.matchup,
  #games .side > .scoreboard {
    display: none;
  }

  #games .phone-only .scoreboard {
    margin: 6px 0 4px;
  }

  .title.matchup {
    display: grid;
    gap: 2px;
    margin: 6px 0 4px;
    font-size: 15px;
    line-height: 1.25;
  }

  .title.matchup .at {
    font-size: 11px;
    line-height: 1;
    padding-left: 2px;
  }

  .game .venue {
    color: var(--muted);
    font-size: 12.5px;
  }

  .officials {
    gap: 4px;
  }

  .officials .chip {
    padding: 3px 8px;
    font-size: 12px;
  }

  .list-toolbar .page-size {
    white-space: nowrap;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    text-transform: none;
    letter-spacing: 0;
  }

  .list-toolbar select {
    min-height: 30px;
    padding: 2px 6px;
  }

  .game .side {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .sheet {
    min-height: 36px;
  }

  .splits {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .split {
    padding: 10px 12px;
    font-size: 13px;
  }

  .search-results {
    gap: 16px;
  }

  .list-toolbar {
    margin: 0 0 8px;
  }

  /* Pull to refresh */
  .ptr {
    position: fixed;
    top: calc(8px + env(safe-area-inset-top));
    left: 50%;
    z-index: 45;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--card);
    box-shadow: 0 2px 10px rgb(var(--shadow) / 0.2);
    opacity: 0;
    transform: translate(-50%, -60px);
    pointer-events: none;
  }

  .ptr span {
    width: 18px;
    height: 18px;
    border: 2.5px solid var(--line);
    border-top-color: var(--brand);
    border-radius: 50%;
    transition: transform 0.2s;
  }

  .ptr.ready span {
    border-color: var(--brand);
    border-top-color: var(--accent);
  }

  .ptr.refreshing span {
    animation: ptr-spin 0.8s linear infinite;
  }

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

/* ---- Standings ---------------------------------------------------------- */

.stnd-group + .stnd-group {
  border-top: 1px solid var(--line);
}

.stnd-group-title {
  margin: 0;
  padding: 10px 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--heading);
  background: var(--chip);
  border-bottom: 1px solid var(--line);
}

.stnd-table th[data-key] {
  cursor: pointer;
}

.stnd-table .stnd-rank {
  width: 32px;
  padding-right: 4px;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}

.stnd-move {
  display: block;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}

.stnd-move.up {
  color: var(--good);
}

.stnd-move.down {
  color: var(--bad);
}

.stnd-table td.stnd-form {
  padding-left: 12px;
}

.stnd-form .form-strip {
  gap: 3px;
}

.stnd-form .wlt {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  font-size: 10px;
}

.stnd-detail-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.stnd-table .stnd-pts {
  font-weight: 800;
  color: var(--heading);
  border-right: 1px solid var(--line);
}

.stnd-table td.pos {
  color: var(--good);
}

.stnd-table td.neg {
  color: var(--accent);
}

.stnd-table .stnd-fav {
  width: 44px;
  padding: 4px 8px;
}

.stnd-row {
  cursor: pointer;
}

.stnd-row:hover {
  background: var(--tint-2);
}

.stnd-row.is-fav,
.stnd-row.is-fav:hover {
  background: var(--gold-tint);
}

.stnd-row.is-fav td.stnd-rank {
  box-shadow: inset 3px 0 0 var(--gold);
}

.stnd-star,
.stnd-detail {
  display: none;
}

.stnd-group:last-child tbody tr.stnd-row:last-of-type td {
  border-bottom: 0;
}

.stnd-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 0;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.stnd-legend b {
  color: var(--ink);
}

@media (max-width: 720px) {
  .stnd {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
  }

  .stnd .stnd-extra,
  .stnd .stnd-fav,
  .stnd-legend .stnd-extra {
    display: none;
  }

  .stnd-table {
    table-layout: fixed;
  }

  .stnd-table th,
  .stnd-table td {
    padding: 11px 0;
    font-size: 14px;
  }

  .stnd-table th {
    font-size: 11px;
    position: static;
  }

  .stnd-table th:first-child,
  .stnd-table td:first-child {
    position: static;
    max-width: none;
    box-shadow: none;
    background: transparent;
  }

  .stnd-table th:first-child {
    background: var(--tint);
  }

  .stnd-table .num {
    width: 28px;
    text-align: center;
    color: var(--muted);
  }

  .stnd-table .stnd-rank {
    width: 30px;
    padding-left: 2px;
    font-size: 13px;
  }

  .stnd-table .stnd-pts {
    width: 44px;
    padding-right: 8px;
    font-size: 16px;
    color: var(--heading);
    border-right: 0;
  }

  .stnd-table td.stnd-team {
    white-space: normal;
    padding-right: 6px;
  }

  .stnd-team .team-with-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: none;
    color: var(--ink);
  }

  .stnd-team .team-with-logo:hover {
    text-decoration: none;
  }

  .stnd-team .team-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
  }

  .stnd-row.is-fav .stnd-star {
    display: inline;
    flex: none;
    color: var(--gold);
    font-size: 12px;
  }

  .stnd-row.is-fav td.stnd-rank {
    box-shadow: inset 3px 0 0 var(--gold);
  }

  .stnd-row:hover {
    background: transparent;
  }

  .stnd-row.is-open {
    background: var(--tint);
  }

  .stnd-row.is-open td {
    border-bottom-color: transparent;
  }

  .stnd-detail:not([hidden]) {
    display: table-row;
  }

  .stnd-table .stnd-detail td {
    padding: 0 12px 14px;
    white-space: normal;
    background: var(--tint);
  }

  .stnd-detail-name {
    font-weight: 700;
    color: var(--heading);
  }

  .stnd-detail-record {
    margin: 2px 0 10px;
    font-size: 13px;
    color: var(--muted);
  }

  .stnd-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
    gap: 6px;
  }

  .ct .stnd-table th.ct-sort {
    cursor: pointer;
  }

  .ct .stnd-table th.on,
  .ct .stnd-table td.on {
    color: var(--heading);
    font-weight: 800;
  }

  .ct .stnd-table td.on {
    font-size: 15px;
  }

  .ct .stnd-table .num.wide {
    width: 40px;
  }

  .ct .stnd-table td.num:last-child,
  .ct .stnd-table th.num:last-child {
    padding-right: 8px;
  }

  .ct .stnd-table td.stnd-team,
  .ct .stnd-table th.stnd-team {
    padding-left: 10px;
    padding-right: 6px;
  }

  .ct .stnd-table .stnd-rank {
    width: max(30px, calc(var(--ct-lead, 0ch) + 10px));
    white-space: nowrap;
  }

  .ct .stnd-table td.stnd-rank + td.stnd-team,
  .ct .stnd-table th.stnd-rank + th.stnd-team {
    padding-left: 0;
  }

  .ct-name {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
  }

  .ct-name > a,
  .ct-name > .ct-toggle {
    display: block;
    min-width: 0;
    padding: 4px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--ink);
  }

  .ct-name .team-with-logo {
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: none;
  }

  .ct-name .team-name {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .ct-sub {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
    overflow: hidden;
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
  }

  .ct-sub-inline {
    flex: none;
    display: flex;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
  }

  .ct-sub > span:not(.dot),
  .ct-sub .team-with-logo {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ct-sub .team-with-logo {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 24px;
    max-width: none;
    color: var(--muted);
    font-weight: 600;
  }

  .ct-sub .team-logo {
    width: 16px;
    height: 16px;
    flex: none;
  }

  .ct-sub .team-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ct-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    font-size: 13px;
  }

  .ct .stnd-detail .stnd-stats + .ct-facts {
    margin-top: 10px;
  }

  .ct .stnd-detail td {
    padding-top: 2px;
  }

  .stnd-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 2px;
    background: var(--card);
    border-radius: 10px;
    text-align: center;
  }

  .stnd-stat b {
    font-size: 16px;
    color: var(--ink);
  }

  .stnd-stat small {
    font-size: 10px;
    line-height: 1.15;
    color: var(--muted);
  }

  .stnd-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
  }

  .stnd-actions .favorite-btn {
    width: auto;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 700;
  }

  .stnd-actions .favorite-btn::after {
    content: " Favorite";
    color: var(--ink);
  }

  .stnd-actions .favorite-btn.on::after {
    content: " Favorited";
  }

  .table-wrap .stnd-open {
    margin-left: auto;
    font-weight: 700;
    color: var(--accent);
  }

  .stnd-legend {
    gap: 2px 10px;
    padding: 10px 4px 0;
    border-top: 0;
    font-size: 11px;
  }
}

@media (max-width: 720px) and (display-mode: standalone) {
  .top {
    padding-top: calc(6px + env(safe-area-inset-top));
  }
}

.trend {
  margin: 4px 0 8px;
}

.trend-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.trend-legend {
  display: inline-flex;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.trend-legend .key::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--muted);
}

.trend-legend .key-w::before {
  background: var(--good);
}

.trend-legend .key-l::before {
  background: var(--bad);
}

.trend-legend .key-g::before,
.trend-legend .key-a::before {
  border-radius: 2px;
  background: var(--accent);
}

.trend-legend .key-a::before {
  opacity: 0.4;
}

.chart {
  display: block;
  width: 100%;
  height: auto;
  padding: 8px 4px 2px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.chart-grid {
  stroke: var(--line);
  stroke-width: 1;
}

.chart-tick {
  font-size: 11px;
  fill: var(--muted);
}

.chart-bar-g {
  fill: var(--accent);
}

.chart-bar-a {
  fill: var(--accent);
  opacity: 0.4;
}

.chart-bar-for {
  fill: var(--good);
}

.chart-bar-against {
  fill: var(--bad);
}

.team-tabs {
  display: flex;
  gap: 4px;
  margin: 4px 0 14px;
  border-bottom: 1px solid var(--line);
}

.team-tabs a {
  padding: 8px 14px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
}

.team-tabs a:hover {
  color: var(--heading);
}

.team-tabs a[aria-current="page"] {
  color: var(--heading);
  border-bottom-color: var(--accent);
}

.ts-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}

.ts-card {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 13px;
}

.ts-big {
  font-size: 22px;
  font-weight: 800;
  color: var(--heading);
  font-variant-numeric: tabular-nums;
}

.ts-note {
  margin: 0 0 8px;
  font-size: 12px;
}

.ts-periods {
  display: grid;
  gap: 10px;
  margin: 0 0 8px;
  padding: 12px 14px;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.ts-period {
  display: grid;
  grid-template-columns: 36px 1fr;
  align-items: center;
  gap: 10px;
}

.ts-period-label {
  font-weight: 800;
  color: var(--heading);
}

.ts-bars {
  display: grid;
  gap: 3px;
}

.ts-bar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.ts-bar {
  display: inline-block;
  min-width: 2px;
  height: 10px;
  border-radius: 3px;
}

.ts-for {
  background: var(--good);
}

.ts-against {
  background: var(--bad);
}

.ts-pim-line {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
}

.ts-pim-line b {
  color: var(--heading);
}

.chart-bar-pim {
  fill: var(--accent);
}

.chart-bar-opp {
  fill: var(--muted);
  opacity: 0.5;
}

.trend-legend .key-pim::before,
.trend-legend .key-opp::before {
  border-radius: 2px;
  background: var(--accent);
}

.trend-legend .key-opp::before {
  background: var(--muted);
  opacity: 0.5;
}

.ts-lists {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.ts-list {
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.ts-list h3 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ts-list ol {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.ts-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.home-series {
  font-size: 13px;
  color: var(--muted);
}

.h2h-summary {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.h2h-side {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.h2h-side:last-child {
  flex-direction: row-reverse;
  text-align: right;
}

.h2h-side .team-with-logo {
  min-width: 0;
  font-weight: 700;
  color: var(--heading);
}

.h2h-side:last-child .team-with-logo {
  flex-direction: row-reverse;
}

.h2h-wins {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  color: var(--heading);
  font-variant-numeric: tabular-nums;
}

.h2h-mid {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.h2h-detail {
  margin: 6px 0 12px;
  text-align: center;
  font-size: 13px;
}

.h2h-subtitle {
  margin: 14px 0 8px;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.h2h-upcoming,
.h2h-meetings {
  display: grid;
  gap: 6px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.h2h-upcoming .is-cancelled b {
  text-decoration: line-through;
}

@media (max-width: 720px) {
  .h2h-summary {
    padding: 12px;
    gap: 8px;
  }

  .h2h-side {
    flex-direction: column-reverse;
    align-items: flex-start;
  }

  .h2h-side:last-child {
    flex-direction: column-reverse;
    align-items: flex-end;
  }

  .h2h-side .team-name {
    font-size: 13px;
  }
}

.stnd-row.is-current,
.stnd-row.is-current:hover {
  background: var(--accent-tint);
}

.stnd-row.is-current td.stnd-rank {
  box-shadow: inset 3px 0 0 var(--accent);
}

.stnd-row.is-current .team-name {
  font-weight: 800;
}
