:root {
  --navy: #07101f;
  --ink: #0b1b3a;
  --card: #12233f;
  --line: rgba(255, 225, 53, 0.18);
  --yellow: #ffe135;
  --cream: #fff6c2;
  --muted: #b7c3d8;
  --live: #ff3b4a;
  --ok: #3ee0a0;
  --tab: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --page: 100%;
  --gutter: 14px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Bebas Neue", "Arial Narrow", sans-serif;
}

* { box-sizing: border-box; }

/* Scrollable areas stay scrollable; bars hidden everywhere */
*,
*::before,
*::after {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
*::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
  background: transparent;
}

html, body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: #07101f;
  color: var(--cream);
  font-family: var(--font);
}
body {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0;
  width: 100%;
  overflow: hidden;
}
img { max-width: 100%; }
a { color: inherit; }
button, input, select { font: inherit; }
.skip { position: absolute; left: -999px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.topbar {
  flex: 0 0 auto;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + var(--safe-t)) max(var(--gutter), calc((100% - var(--page)) / 2 + var(--gutter))) 10px;
  background: var(--yellow);
  color: #1a1400;
}
.brand { display: flex; align-items: center; text-decoration: none; min-width: 0; }
.brand img {
  width: auto;
  height: 52px;
  max-width: min(200px, 52vw);
  background: transparent;
  object-fit: contain;
  object-position: left center;
  padding: 0;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.topbar-link,
.icon-btn {
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  color: #1a1400;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(26, 20, 0, 0.2);
  background: transparent;
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  cursor: pointer;
}
.icon-btn[aria-expanded="true"] {
  background: #1a1400;
  color: var(--yellow);
}
.topbar .stamp {
  flex: 0 0 auto;
  justify-content: flex-end;
  text-align: right;
  white-space: nowrap;
  color: #1a1400;
  font-size: 11px;
}
@media (max-width: 420px) {
  .stamp-label { display: none; }
}
.card-wrap { min-width: 0; max-width: 100%; }
.card-wrap.live .card { border-color: rgba(255, 59, 74, 0.55); }
.card-wrap .card-link { display: block; text-decoration: none; color: inherit; }
.watch-bar {
  display: block;
  margin-top: -6px;
  margin-bottom: 2px;
  padding: 8px 12px;
  text-align: center;
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #1a1400;
  background: rgba(255, 225, 53, 0.92);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 18px 18px;
}
.watch-bar-block { margin-top: 10px; border-radius: 14px; border-top: 1px solid var(--line); }
.season-chips { margin-bottom: 4px; }
.season-chips .chip { cursor: pointer; border: 0; font: inherit; }
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.pager-meta { flex: 1 1 100%; margin: 0; }
.footer-note { margin-top: 12px; line-height: 1.45; }
.footer-note a { color: var(--yellow); }
.rules-card h2 {
  margin: 16px 0 8px;
  font-family: var(--display);
  font-size: 24px;
  letter-spacing: 0.04em;
  color: var(--yellow);
}
.rules-card h2:first-child { margin-top: 0; }
.rules-card {
  counter-reset: bbcl-rule;
}
.rules-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
  margin: 0 0 8px;
}
.rules-columns ol.rules-official {
  margin: 0;
}
.rules-card ol.rules-official,
.rules-card ol {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  color: var(--cream);
  line-height: 1.35;
  font-size: 14px;
}
.rules-card ol li {
  counter-increment: bbcl-rule;
  position: relative;
  padding-left: 28px;
  margin-bottom: 8px;
}
.rules-card ol li::before {
  content: counter(bbcl-rule) ".";
  position: absolute;
  left: 0;
  font-weight: 800;
  color: var(--yellow);
}
.watch-team-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 4px;
}
.watch-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
  text-decoration: none;
  color: var(--cream);
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.15s, background 0.15s;
}
.watch-team:hover,
.watch-team:focus-visible {
  border-color: var(--yellow);
  background: rgba(255, 225, 53, 0.08);
}
.watch-team img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}
.watch-team span {
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  line-height: 1.2;
}

.chip, .search-bar button {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--cream);
  border-radius: 999px;
  padding: 8px 12px;
}

.search-bar,
.search-results {
  flex: 0 0 auto;
  gap: 8px;
  padding: 8px max(var(--gutter), calc((100% - var(--page)) / 2 + var(--gutter)));
  background: #0d1830;
}
.search-bar { display: flex; }
.search-bar[hidden] { display: none !important; }
.search-results { display: none; }
.search-results.is-open {
  display: grid;
  max-height: min(50vh, 360px);
  overflow-y: auto;
  padding: 0 14px 8px;
  gap: 8px;
}
.search-bar input {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--navy);
  color: var(--cream);
  border-radius: 12px;
  padding: 10px 12px;
}

.app {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: min(var(--page), 100%);
  margin: 0 auto;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 14px var(--gutter) calc(18px + var(--tab) + var(--safe-b));
  display: grid;
  align-content: start;
  gap: 14px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.loading, .empty, .error { color: var(--muted); text-align: center; padding: 32px 12px; }
.error { color: #ffb4b8; }

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}
.hero h1 { margin: 0; font-family: var(--display); font-size: 42px; letter-spacing: 0.03em; line-height: 0.9; }
.hero p, .note { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

.stamp { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.dot.live { background: var(--live); box-shadow: 0 0 0 4px rgba(255, 59, 74, 0.2); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { transform: scale(1.15); } }

.card {
  background: linear-gradient(180deg, #162846, #101d36);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  min-width: 0;
  max-width: 100%;
}
.card:has(.standings) { overflow: visible; }
.table-scroll { max-width: 100%; overflow-x: auto; }
.card.live { border-color: rgba(255, 59, 74, 0.55); }

.game-top { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 4px; }
.game-body {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 6px 8px;
  align-items: center;
  min-width: 0;
}
.game-when {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
  text-align: center;
  line-height: 1.05;
}
.game-month,
.game-time {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.game-month { text-transform: uppercase; }
.game-day {
  font-family: var(--display);
  font-size: 26px;
  color: var(--cream);
  line-height: 0.9;
}
.game-time {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 2px;
  text-transform: lowercase;
  line-height: 1.1;
}
.game-ampm { font-size: 9px; letter-spacing: 0.04em; }
.game-matchup { min-width: 0; overflow: hidden; }
.event-title {
  margin: 0;
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: 0.03em;
  line-height: 0.95;
  color: var(--cream);
}
.game-matchup .note { white-space: normal; }
.season-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.season-field label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.season-field select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--cream);
  border-radius: 12px;
  padding: 10px 12px;
}
.game-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px; padding: 6px 0; min-width: 0; }
.game-row + .game-row { border-top: 1px solid rgba(255,255,255,0.05); }
.team-cell { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; }
.logo { width: 30px; height: 30px; object-fit: contain; flex: 0 0 auto; }
.logo.lg { width: 56px; height: 56px; }
.game-location {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.team-cell b {
  display: block;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.team-cell span { color: var(--muted); font-size: 12px; }
.score { font-family: var(--display); font-size: 26px; letter-spacing: 0.02em; min-width: 18px; text-align: right; }
.winner { color: var(--yellow); }
.meta {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  min-width: 0;
}
.game-box > span { white-space: nowrap; }
.game-box {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px 8px;
  min-width: 0;
}
.badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge.live { background: var(--live); color: white; }
.badge.final { background: #2a3d62; }
.badge.sched { background: #3a2f10; color: var(--yellow); }

.section-title { margin: 8px 2px 0; font-family: var(--display); font-size: 28px; letter-spacing: 0.04em; color: var(--yellow); }

.standings { width: 100%; border-collapse: collapse; font-size: 13px; }
.standings th { text-align: left; color: var(--muted); font-weight: 600; padding: 0 6px 8px; }
.standings td { padding: 8px 6px; border-top: 1px solid rgba(255,255,255,0.06); vertical-align: middle; }
.standings tr.cut td { border-top: 2px dashed rgba(255, 225, 53, 0.45); }
.team-mini { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.team-mini img { width: 32px; height: 32px; object-fit: contain; }
.team-hero .team-mini { align-items: flex-start; margin-top: 8px; }
.team-hero .team-mini img,
.team-youtube img { width: 56px; height: 56px; }
.back-link {
  color: var(--yellow);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}
.team-youtube {
  display: flex;
  flex: 0 0 auto;
  line-height: 0;
  border-radius: 12px;
}
.team-youtube:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 3px;
}
.team-history { max-width: 40rem; line-height: 1.4; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.crown {
  display: inline-block;
  color: var(--yellow);
  text-decoration: none;
}

.chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  min-width: 0;
  min-height: 42px;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.chip {
  flex: 0 0 auto;
  white-space: nowrap;
  text-decoration: none;
}
.chip.active, .tabs a.active { background: var(--yellow); color: #1a1400; border-color: var(--yellow); }

.player { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center; text-decoration: none; }
.avatar { width: 52px; height: 52px; border-radius: 14px; object-fit: cover; background: #08101e; }
.player b { display: block; }
.player small { color: var(--muted); }
.stat { text-align: right; font-family: var(--display); font-size: 28px; color: var(--yellow); line-height: 1; }
.stat em { display: block; font-style: normal; font-family: var(--font); font-size: 11px; color: var(--muted); font-weight: 700; }

.team-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.team-tile { text-decoration: none; text-align: center; padding: 14px 8px; }
.team-tile img { width: 88px; height: 88px; object-fit: contain; }
.team-tile strong { display: block; margin-top: 8px; }
.team-tile small { display: block; color: var(--muted); font-size: 12px; }

.profile { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; }
.profile img { width: 96px; height: 96px; border-radius: 20px; object-fit: cover; }
.player-page { display: grid; gap: 14px; align-content: start; }
.player-hero {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 4px;
}
.player-photo {
  width: 112px;
  height: 112px;
  border-radius: 22px;
  object-fit: cover;
  background: #08101e;
}
.player-hero h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(34px, 8vw, 48px);
  letter-spacing: 0.02em;
  line-height: 0.9;
}
.player-kicker { margin: 6px 0 8px; color: var(--muted); font-size: 13px; font-weight: 700; }
.player-hero .team-mini span { color: var(--cream); font-size: 14px; font-weight: 800; }
.player-section { display: grid; gap: 8px; }
.player-section .section-title { margin: 0; }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.stat-grid .stat-box { min-width: 0; width: auto; padding: 10px 6px; }
.stat-grid .stat-box b { font-size: 24px; }
.player-games { display: grid; gap: 10px; }
.player-game { text-decoration: none; color: inherit; }
.stat-scroll {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 8px;
  overflow-x: auto;
  min-width: 0;
  min-height: 78px;
  width: 100%;
  margin-inline: -14px;
  padding: 2px 14px 8px;
  -webkit-overflow-scrolling: touch;
}
.stat-box {
  flex: 0 0 auto;
  min-width: 92px;
  min-height: 68px;
  background: #0d1a30;
  border-radius: 14px;
  padding: 10px 14px;
  text-align: center;
  white-space: nowrap;
}
.stat-box b { display: block; font-family: var(--display); font-size: 28px; color: var(--yellow); line-height: 1; }
.stat-box span { color: var(--muted); font-size: 11px; font-weight: 700; }

.notes { white-space: pre-wrap; color: var(--muted); font-size: 13px; line-height: 1.45; }

.tabs {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: 0;
  width: min(var(--page), 100%);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px var(--gutter) calc(8px + var(--safe-b));
  background: #07101f;
  border-top: 1px solid var(--line);
  z-index: 30;
}
.tabs a {
  text-decoration: none;
  text-align: center;
  padding: 10px 4px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}

.banana-update {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 80;
  place-items: center;
  padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--tab) + var(--safe-b));
  background: rgba(4, 8, 16, 0.72);
  backdrop-filter: blur(8px);
}
.banana-update.is-open { display: grid; }
.banana-update-card {
  width: min(420px, 100%);
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 12px;
  padding: 22px 18px 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #1a2d52, #101d36);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.banana-update-card img {
  width: 180px;
  height: 80px;
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
  padding: 6px 8px;
}
.banana-update-card h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 32px;
  letter-spacing: 0.03em;
  color: var(--yellow);
}
.banana-update-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}
.banana-update-actions {
  display: flex;
  gap: 8px;
  width: 100%;
}
.banana-update-actions button {
  flex: 1;
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 800;
}
#banana-update-later {
  background: #2a3d62;
  color: var(--cream);
}
#banana-update-refresh {
  background: var(--yellow);
  color: #1a1400;
}

@media (min-width: 720px) {
  :root {
    --page: 760px;
    --gutter: 20px;
  }
  .hero h1 { font-size: 48px; }
  .team-grid { grid-template-columns: repeat(3, 1fr); }
  .standings { font-size: 14px; }
  .stat-scroll { margin-inline: 0; padding-inline: 0; }
  .tabs { border-radius: 16px 16px 0 0; }
  .game-body { grid-template-columns: 56px minmax(0, 1fr); gap: 10px 12px; }
  .game-month, .game-time { font-size: 11px; }
  .game-day { font-size: 34px; }
  .game-time { flex-direction: row; gap: 3px; margin-top: 4px; }
  .game-ampm { font-size: 11px; }
  .logo { width: 40px; height: 40px; }
  .team-cell { gap: 10px; }
  .team-cell b { font-size: 15px; }
  .score { font-size: 36px; min-width: 28px; }
  .game-location { flex: 0 1 auto; }
  .meta { font-size: 12px; gap: 10px; }
  .game-box { flex-wrap: nowrap; gap: 8px; }
  .badge { font-size: 11px; padding: 2px 8px; }
}

@media (min-width: 980px) {
  :root {
    --page: 1100px;
    --gutter: 24px;
  }
  .app {
    grid-template-columns: 1fr 1fr;
    gap: 16px 18px;
  }
  .app > .hero,
  .app > .section-title,
  .app > .chips,
  .app > .season-field,
  .app > .pager,
  .app > .note,
  .app > .loading,
  .app > .empty,
  .app > .error,
  .app > .stat-scroll,
  .app > .team-grid,
  .app > .card.profile,
  .app > .player-page,
  .app > .card:has(.standings) {
    grid-column: 1 / -1;
  }
  .app:not(:has(.section-title)) > .card:not(.player) {
    grid-column: 1 / -1;
  }
  .team-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  .team-tile img { width: 108px; height: 108px; }
  .player-games { grid-template-columns: 1fr 1fr; }
  .standings th, .standings td { padding: 10px 8px; }
}
