:root {
  --bg: #f4f6f2;
  --card: #ffffff;
  --ink: #16201a;
  --muted: #5f6f63;
  --line: #e0e6dc;
  --accent: #14532d;
  --accent-ink: #ffffff;
  --accent-soft: #e4f1e8;
  --live: #b42318;
  --live-soft: #fde8e6;
  --win: #0e3d21;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1410; --card: #161e18; --ink: #e8efe9; --muted: #93a598; --line: #253028;
    --accent: #5fbf85; --accent-ink: #0a1f12; --accent-soft: #1b2e22; --live: #ff8a7c;
    --live-soft: #3a1a17; --win: #ffffff;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
main { max-width: 960px; margin: 0 auto; padding: 16px 14px 48px; }
h1 { font-size: 1.7rem; line-height: 1.15; margin: 6px 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; margin: 0 0 10px; }
h2.sect { margin: 26px 0 10px; font-size: 1.05rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
h3 { margin: 0; font-size: 1rem; }
.sub { color: var(--muted); margin: 0 0 16px; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* header */
.top { background: var(--accent); color: var(--accent-ink); position: sticky; top: 0; z-index: 20; padding: 8px 14px 10px; }
.top-row { max-width: 960px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { color: var(--accent-ink); font-weight: 800; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.mark { width: 14px; height: 14px; background: var(--accent-ink); transform: rotate(45deg); border-radius: 2px; display: inline-block; opacity: .95; }
.top nav { display: flex; gap: 4px; }
.top nav a { color: var(--accent-ink); padding: 8px 10px; border-radius: 8px; font-weight: 600; font-size: .95rem; opacity: .85; }
.top nav a[aria-current] { background: rgba(255,255,255,.18); opacity: 1; }
.search { max-width: 960px; margin: 8px auto 0; position: relative; }
.search input { width: 100%; padding: 12px 14px; border-radius: 10px; border: 0; font-size: 16px; background: rgba(255,255,255,.96); color: #16201a; }
#results { position: absolute; left: 0; right: 0; top: 100%; margin-top: 6px; background: var(--card); color: var(--ink); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.25); overflow: hidden; max-height: 60vh; overflow-y: auto; }
#results a { display: flex; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--ink); }
#results a:hover, #results a.sel { background: var(--accent-soft); text-decoration: none; }
#results small { color: var(--muted); }
#results .tag { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-right: 8px; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 14px; }
.card.live { border-color: var(--accent); }
.cardhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.cardhead h2 { margin: 0; font-size: 1.25rem; }
.livegrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-top: 6px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.quick a { padding: 12px 16px; border-radius: 10px; background: var(--accent-soft); font-weight: 700; min-height: 44px; display: inline-flex; align-items: center; }
.status { display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.status.live { background: var(--live-soft); color: var(--live); }
.seasonhead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.seasonhead h1 { display: inline-block; margin-right: 10px; }
.switch select { font-size: 16px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); min-height: 44px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 6px 0 16px; padding-bottom: 2px; }
.tabs a { padding: 10px 16px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--ink); font-weight: 600; white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center; }
.tabs a[aria-current] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tabs a:hover { text-decoration: none; }
.crumb { color: var(--muted); margin: 4px 0; font-size: .92rem; }

/* tables */
.tablewrap { overflow-x: auto; margin: 0 -14px; padding: 0 14px; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: .95rem; }
th, td { padding: 9px 8px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); position: sticky; top: 0; background: var(--card); }
th:first-child, td:first-child { text-align: left; }
td:first-child, th:first-child { position: sticky; left: 0; background: var(--card); z-index: 1; }
table.sortable th { cursor: pointer; user-select: none; }
table.sortable th.asc::after { content: " ▲"; font-size: .6rem; }
table.sortable th.desc::after { content: " ▼"; font-size: .6rem; }
table.standings td:nth-child(2), table.standings th:nth-child(2) { text-align: left; }
table.standings td:first-child { color: var(--muted); width: 1%; }
tr.total td { font-weight: 800; border-top: 2px solid var(--line); background: var(--accent-soft); }
tr.total td:first-child { background: var(--accent-soft); }
td a { font-weight: 600; }

/* games */
.games { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.day h3 { margin: 18px 0 8px; font-size: .95rem; color: var(--muted); }
.game { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.gmeta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .82rem; margin-bottom: 6px; flex-wrap: wrap; }
.tm { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: 1.02rem; }
.tm .sc { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 1.6em; text-align: right; }
.tm.win { font-weight: 800; color: var(--win); }
.tm.win .sc { font-weight: 800; }
.gloc { font-size: .85rem; margin-top: 4px; }
.tags { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.chip { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.chip.po { background: var(--live-soft); color: var(--live); }
.chip.link:hover { text-decoration: none; filter: brightness(.95); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 14px; }
.chipbtn { font: inherit; font-weight: 700; padding: 10px 16px; min-height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.chipbtn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.more { margin-top: 24px; }

/* leaders */
.leadergrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.leader { margin: 0; }
.leader h3 small { color: var(--muted); font-weight: 500; margin-left: 6px; }
.leader ol { list-style: none; margin: 10px 0 0; padding: 0; }
.leader li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.leader .rk { color: var(--muted); width: 1.4em; text-align: right; font-variant-numeric: tabular-nums; }
.leader .who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.leader .who small { color: var(--muted); }
.leader .val { font-weight: 800; font-variant-numeric: tabular-nums; }

/* seasons index */
.yrgrid { display: grid; gap: 8px; }
.yrrow { display: grid; grid-template-columns: 70px 1fr 1fr; gap: 8px; align-items: center; }
.yr { font-weight: 800; font-size: 1.2rem; }
.pill { text-align: center; padding: 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-weight: 700; }
.pill.off { color: var(--muted); background: transparent; border-style: dashed; }

footer { max-width: 960px; margin: 0 auto; padding: 0 14px 40px; color: var(--muted); font-size: .8rem; }
@media (min-width: 720px) { h1 { font-size: 2.1rem; } main { padding-top: 24px; } }

/* all-time picker */
.controls { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin: 6px 0 14px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field[hidden] { display: none; }
.lbl { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.field select { font-size: 16px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); min-height: 44px; width: 100%; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.seg button { flex: 1; font: inherit; font-weight: 700; padding: 10px 8px; white-space: nowrap; min-height: 44px; border: 0; background: transparent; color: var(--ink); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
table.alltime td:nth-child(2), table.alltime th:nth-child(2) { text-align: left; }
table.alltime td:first-child { color: var(--muted); width: 1%; }
