:root {
  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-2: #eef2ec;
  --text: #15201b;
  --muted: #5d6b64;
  --line: #dde3dc;
  --brand: #0f3d2e;
  --brand-ink: #ffffff;
  --accent: #c9e84a;
  --accent-ink: #1f2a07;
  --win: #1b7a4b;
  --win-bg: #e3f3e9;
  --warn-bg: #fff6d6;
  --warn-ink: #6b5200;
  --me-bg: #fff3b0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 32, 24, .06), 0 2px 10px rgba(16, 32, 24, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1411;
    --surface: #151f1a;
    --surface-2: #1c2822;
    --text: #e7eee9;
    --muted: #97a69e;
    --line: #26332c;
    --brand: #0b2d22;
    --accent: #c9e84a;
    --win: #6fd39d;
    --win-bg: #173326;
    --warn-bg: #3a3212;
    --warn-ink: #f2dc8a;
    --me-bg: #4a4214;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: inherit; }
.wrap { max-width: 880px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }

/* Header */
.top { background: var(--brand); color: var(--brand-ink); position: sticky; top: 0; z-index: 5; }
.top-inner { display: flex; align-items: center; padding-top: 12px; padding-bottom: 8px; }
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; }
.brand strong { display: block; font-size: 17px; letter-spacing: .2px; }
.brand small { display: block; font-size: 12px; opacity: .75; }
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs-inner { display: flex; gap: 4px; padding-bottom: 8px; }
.tabs a {
  white-space: nowrap; text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 7px 12px; border-radius: 999px; opacity: .8;
}
.tabs a:hover { opacity: 1; background: rgba(255,255,255,.08); }
.tabs a.on { background: var(--accent); color: var(--accent-ink); opacity: 1; }

main { padding-top: 18px; padding-bottom: 24px; min-height: 60vh; }
h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.2px; }
h2 { font-size: 17px; margin: 28px 0 10px; }
.sub { color: var(--muted); margin: 0 0 16px; font-size: 14px; }
.loading, .empty { color: var(--muted); padding: 24px 0; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.grid2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }

.match { padding: 14px 16px; }
.match-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.court { font-weight: 700; }
.time { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.team { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 10px; }
.team + .vs { text-align: center; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; margin: 2px 0; }
.team .names { font-size: 17px; font-weight: 600; }
.team .score { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 1.5em; text-align: right; }
.team.won { background: var(--win-bg); }
.team.won .score { color: var(--win); }
.team.lost .names, .team.lost .score { color: var(--muted); }
.duty { margin-top: 10px; font-size: 14px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.duty b { color: var(--text); }

.bench { margin-top: 12px; padding: 12px 16px; font-size: 14px; color: var(--muted); }
.bench b { color: var(--text); font-weight: 600; }

.banner { padding: 12px 16px; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn-ink); margin-bottom: 14px; font-size: 15px; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); vertical-align: middle; margin-left: 6px; }
.me { background: var(--me-bg); border-radius: 4px; padding: 0 3px; margin: 0 -3px; }

/* Schedule */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
select, .btn {
  font: inherit; font-size: 15px; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.btn { cursor: pointer; font-weight: 600; }
label.chk { display: flex; gap: 6px; align-items: center; font-size: 14px; color: var(--muted); }
.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.stat { padding: 10px 12px; }
.stat .v { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 12px; color: var(--muted); }
@media (max-width: 420px) { .stat .v { font-size: 19px; } .stat { padding: 8px 9px; } }

.night { padding: 12px 14px; margin-bottom: 10px; scroll-margin-top: 110px; }
.night.past { opacity: .78; }
.night.current { border-color: var(--brand); box-shadow: 0 0 0 2px var(--accent); }
.night-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.night-head .d { font-weight: 700; }
.night-head .w { color: var(--muted); font-size: 13px; }
.row { display: grid; grid-template-columns: 74px 1fr auto; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 15px; align-items: center; }
.row:first-of-type { border-top: 0; }
.row .ct { color: var(--muted); font-size: 13px; line-height: 1.25; }
.row .res { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row .res.w { color: var(--win); }
.row .bb { display: block; color: var(--muted); font-size: 12px; }
.off { font-size: 13px; color: var(--muted); padding-top: 6px; border-top: 1px solid var(--line); }
.status-sit { font-size: 13px; color: var(--muted); font-style: italic; }

/* Standings */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 15px; }
th, td { padding: 10px 8px; text-align: right; white-space: nowrap; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--line); }
td { border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
th:nth-child(2), td:nth-child(2) { text-align: left; }
td.rk { color: var(--muted); width: 2em; }
td.pl { font-weight: 600; }
td.big { font-weight: 800; }
tr.q td.pl::after { content: "Q"; font-size: 10px; font-weight: 800; background: var(--accent); color: var(--accent-ink); border-radius: 4px; padding: 1px 4px; margin-left: 6px; vertical-align: 2px; }
.muted { color: var(--muted); }
.notes { font-size: 14px; color: var(--muted); margin-top: 14px; }
.notes p { margin: 6px 0; }
@media (max-width: 520px) { .hide-sm { display: none; } th, td { padding: 9px 6px; } }

/* Format */
.fmt { padding: 6px 16px; }
.fmt dl { margin: 0; }
.fmt .item { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.fmt .item:first-child { border-top: 0; }
.fmt dt { color: var(--muted); font-size: 14px; font-weight: 600; }
.fmt dd { margin: 0; }
@media (max-width: 480px) { .fmt .item { grid-template-columns: 1fr; gap: 2px; } }

.foot { color: var(--muted); font-size: 12px; padding-top: 8px; padding-bottom: 32px; }
.error { padding: 16px; }
