:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #0f1b2b;
  --muted: #5b6b80;
  --line: #dde3eb;
  --brand: #0d1b2e;
  --brand-ink: #e8f4ff;
  --accent: #1f6fd1;
  --accent-soft: #e3effd;
  --win: #157a45;
  --win-soft: #e2f5ea;
  --loss: #b42318;
  --loss-soft: #fdecea;
  --tie: #8a6100;
  --tie-soft: #fff4d6;
  --mine: #fff8dc;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 27, 43, .06), 0 2px 8px rgba(15, 27, 43, .04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b121c;
    --surface: #121c2a;
    --surface-2: #1a2636;
    --text: #e6edf5;
    --muted: #93a3b8;
    --line: #243246;
    --brand: #07101b;
    --accent: #6cb2ff;
    --accent-soft: #15304f;
    --win: #4cd08a;
    --win-soft: #12301f;
    --loss: #ff8a7f;
    --loss-soft: #3a1714;
    --tie: #f2c14e;
    --tie-soft: #3a2d0b;
    --mine: #2b2610;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--font);
}
a { color: var(--accent); }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.loading { padding: 48px 0; text-align: center; }

/* ---------- header ---------- */
.top {
  background: var(--brand);
  color: var(--brand-ink);
  position: sticky; top: 0; z-index: 10;
}
.top-inner { display: flex; align-items: center; gap: 16px; min-height: 56px; flex-wrap: wrap; }
.brand {
  display: flex; align-items: center; gap: 10px;
  color: inherit; text-decoration: none; font-weight: 700; font-size: 18px; letter-spacing: .2px;
}
.brand small { font-weight: 600; opacity: .6; font-size: 13px; margin-left: 2px; }
.puck {
  width: 22px; height: 12px; border-radius: 50%;
  background: #e8f4ff; box-shadow: 0 3px 0 #7cc4ff;
}
.tabs { display: flex; gap: 4px; margin-left: auto; }
.tabs a {
  color: inherit; text-decoration: none; opacity: .75;
  padding: 8px 12px; border-radius: 999px; font-weight: 600; font-size: 15px;
}
.tabs a:hover { opacity: 1; }
.tabs a.on { opacity: 1; background: rgba(255,255,255,.14); }
@media (max-width: 560px) {
  .top-inner { gap: 0; padding-top: 6px; }
  .tabs { margin: 0 -8px; width: calc(100% + 16px); justify-content: space-between; padding-bottom: 6px; }
  .tabs a { flex: 1; text-align: center; padding: 8px 4px; font-size: 14px; }
}

.banner {
  background: var(--tie-soft); color: var(--text);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px; text-align: center; font-size: 14px;
}

/* ---------- generic blocks ---------- */
h1 { font-size: 26px; line-height: 1.2; margin: 24px 0 4px; }
h2 { font-size: 18px; margin: 28px 0 10px; }
.sub { margin: 0 0 16px; color: var(--muted); }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.pad { padding: 16px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grow { flex: 1; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: 999px; font: 600 14px var(--font);
  text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #06121f; } }
.star { font-size: 18px; line-height: 1; padding: 6px 10px; }
.star.on { color: #e0a100; border-color: #e0a100; }

select, input[type="search"] {
  font: 15px var(--font); color: var(--text);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 10px; min-width: 0; max-width: 100%;
}
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 12px 0 8px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.seg button {
  border: 0; background: transparent; color: var(--muted);
  font: 600 14px var(--font); padding: 7px 14px; border-radius: 999px; cursor: pointer;
}
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- team chips ---------- */
.teamgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.chip {
  display: block; padding: 10px 12px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
}
.chip:hover { border-color: var(--accent); }
button.chip { text-align: left; font: inherit; cursor: pointer; width: 100%; }
.chip b { display: block; font-size: 15px; }
.chip span { font-size: 13px; color: var(--muted); }
.chip.fav { border-color: #e0a100; }

/* ---------- games ---------- */
.day { margin: 18px 0 6px; font-weight: 700; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.day.today { color: var(--accent); }
.games { display: grid; gap: 8px; }
.game {
  display: grid; grid-template-columns: 76px 1fr auto; gap: 4px 12px; align-items: center;
  padding: 12px 14px;
}
.game .when { font-weight: 700; font-size: 15px; white-space: nowrap; }
.game .when small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.game .teams { min-width: 0; }
.game .t { display: flex; align-items: center; gap: 8px; min-width: 0; }
.game .t a { color: var(--text); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game .t a:hover { text-decoration: underline; }
.game .t .ha { font-size: 11px; color: var(--muted); width: 28px; flex: none; text-transform: uppercase; }
.game .t.won a { font-weight: 700; }
.game .t.mine a { background: var(--mine); border-radius: 4px; padding: 0 3px; margin-left: -3px; }
.game .score { display: grid; gap: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 17px; }
.game .score .lo { color: var(--muted); font-weight: 500; }
.game .meta { grid-column: 2 / 4; font-size: 13px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.game .meta a { color: var(--muted); }
.pill { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.W { background: var(--win-soft); color: var(--win); }
.pill.L { background: var(--loss-soft); color: var(--loss); }
.pill.T { background: var(--tie-soft); color: var(--tie); }
@media (max-width: 480px) {
  .game { grid-template-columns: 66px 1fr auto; gap: 4px 10px; padding: 12px; }
  .game .when { font-size: 14px; }
  .game .t .ha { width: 24px; font-size: 10px; }
  .game .meta { grid-column: 1 / 4; }
}

/* ---------- team page ---------- */
.hero { padding: 18px 16px; display: grid; gap: 14px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: clamp(16px, 5vw, 22px); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.next { border-left: 4px solid var(--accent); }
.next .label { font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .5px; }
.next .big { font-size: 20px; font-weight: 700; margin: 2px 0; }

/* ---------- standings ---------- */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 14px; }
th, td { padding: 9px 8px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; font-weight: 700; background: var(--surface-2); }
th:nth-child(2), td:nth-child(2) { text-align: left; }
th:first-child, td:first-child { text-align: center; width: 36px; color: var(--muted); }
td a { color: var(--text); text-decoration: none; font-weight: 600; }
td a:hover { text-decoration: underline; }
tr.mine td { background: var(--mine); }
tr:last-child td { border-bottom: 0; }
td.pts { font-weight: 700; }
.hide-sm { }
@media (max-width: 560px) { .hide-sm { display: none; } }

.empty { padding: 24px; text-align: center; color: var(--muted); }

.foot { padding: 32px 16px 48px; font-size: 13px; color: var(--muted); }
.foot p { margin: 0 0 6px; }
.foot a { color: var(--muted); }

.cal-help { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
