:root {
  --bg: #e9eef3;
  --card: #fff;
  --card-sub: #f3f6f9;
  --sub-line: #e1e7ee;
  --ink: #0f1c2e;
  --ink-2: #33465f;
  --muted: #556477;
  --line: #c9d3de;
  --accent: #ffb547;
  --accent-btn: #ffe3b3;
  --accent-text: #9a5b00;
  --highlight: #fff4e0;
  --danger: #b42318;
  --win: #0f1c2e;
  --loss: #0f1c2e;
  --font: Archivo, system-ui, -apple-system, "Segoe UI", sans-serif;
  --num: Oswald, Archivo, system-ui, sans-serif;
  --shadow: 0 1px 2px #0f1c2e14, 0 4px 14px #0f1c2e0f;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
svg { display: block; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .wrap { padding: 0 24px; } }
main.wrap { flex: 1; padding-top: 24px; padding-bottom: 48px; }

/* --- top bar --- */
.topbar { background: var(--card); border-bottom: 1px solid var(--sub-line); padding-top: env(safe-area-inset-top); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 68px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 800; letter-spacing: .02em; line-height: 1.05; font-size: 18px; }
.brand small { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.brand-mark { width: auto; height: 44px; }

/* --- buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 700; font-size: 15px; text-decoration: none; white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #22324a; }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover { background: var(--card-sub); }
.btn-box {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 12px; border-radius: 4px; border: 1px solid var(--line);
  background: var(--card); font-weight: 700; font-size: 14px; text-decoration: none;
  min-width: 0; overflow: hidden;
}
.btn-box span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-box:hover { background: var(--card-sub); }
.icon-btn { border: 0; background: transparent; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 999px; }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--card-sub); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.eyebrow { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.loading, .empty { padding: 48px 0; text-align: center; color: var(--muted); }
.notice { background: var(--highlight); border: 1px solid var(--accent-btn); padding: 10px 14px; border-radius: 4px; font-size: 14px; margin-bottom: 16px; }

/* --- landing --- */
.hero { display: grid; gap: 32px; padding: 16px 0 8px; }
.hero h1 { font-size: clamp(38px, 9vw, 64px); font-weight: 800; letter-spacing: -.035em; line-height: 1; }
.hero ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; font-size: 18px; color: var(--ink-2); font-weight: 500; }
.hero li { display: flex; gap: 12px; align-items: baseline; }
.hero li::before { content: ""; flex: none; width: 16px; height: 9px; border-radius: 50%; background: var(--ink-2); transform: translateY(-2px); }
.div-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-width: 420px; }
.div-pick button {
  min-height: 64px; border: 1px solid var(--line); background: var(--card); border-radius: 4px;
  font: 600 22px var(--num); letter-spacing: .02em;
}
.div-pick button:hover { border-color: var(--ink); }

/* --- sections --- */
.section-title { font-size: 22px; font-weight: 800; margin: 32px 0 12px; }
.section-title:first-child { margin-top: 0; }

/* --- team cards --- */
.cards { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1080px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card { background: var(--card); box-shadow: var(--shadow); border-top: 4px solid var(--team, var(--ink)); display: flex; flex-direction: column; min-width: 0; }
.card-head { padding: 20px 20px 18px; display: grid; gap: 4px; }
.card-head h2 { font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.card-head h2 a { text-decoration: none; }
.card-stats { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-top: 12px; }
.rank { display: flex; align-items: flex-start; font-family: var(--num); font-weight: 600; line-height: .85; }
.rank b { font-size: 96px; font-weight: 600; letter-spacing: -.02em; }
.rank sup { font-size: 36px; align-self: flex-end; margin-left: 2px; }
.rank .tie { font-size: 30px; margin-left: 4px; }
.rank .of-n { align-self: flex-end; font-size: 18px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.rank.none b { font-size: 56px; color: var(--muted); }
.kv { display: grid; grid-template-columns: auto auto; gap: 10px 28px; text-align: right; }
.kv dt { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.kv dd { margin: 0; font: 600 26px/1 var(--num); }
.kv div { display: grid; gap: 4px; }

.next { background: var(--card-sub); padding: 20px; border-top: 1px solid var(--sub-line); display: flex; flex-direction: column; gap: 6px; flex: 1; }
.next .actions { margin-top: auto; padding-top: 6px; }
.next-top { display: flex; justify-content: space-between; align-items: center; }
.tag { display: inline-block; padding: 3px 8px; background: var(--accent-btn); border: 1px solid var(--accent); border-radius: 2px; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.when { color: var(--accent-text); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; font-size: 14px; margin-top: 6px; }
.opp { display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.opp a { text-decoration: none; }
.ha { flex: none; display: grid; place-items: center; min-width: 26px; height: 26px; padding: 0 4px; border-radius: 3px; background: var(--ink); color: #fff; font: 600 14px var(--num); }
.opp-meta { font-size: 14px; color: var(--ink-2); }
.opp-meta b { font-weight: 700; }
.actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 12px; }
.status { color: var(--danger); font-weight: 700; font-size: 14px; }

.last { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--sub-line); font-size: 15px; }
.last .when-sm { margin-left: auto; color: var(--muted); white-space: nowrap; }
.res { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 3px; background: var(--ink); color: #fff; font-weight: 800; font-size: 14px; }
.res.L { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.res.T { background: var(--line); color: var(--ink); }
.h2h-games { margin-top: 2px; }
.h2h-games ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.h2h-games li { display: grid; grid-template-columns: 20px 52px minmax(0, 1fr); align-items: center; gap: 8px; font-size: 14px; }
.h2h-games li b { font: 600 15px var(--num); }
.h2h-games li.upcoming { color: var(--muted); }
.h2h-games li.is-next b { color: var(--accent-text); font-family: var(--font); font-weight: 800; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.res.sm { width: 20px; height: 20px; font-size: 11px; border-radius: 2px; }
.res.U { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.card-foot { margin-top: auto; padding: 14px 20px; border-top: 1px solid var(--sub-line); font-weight: 700; font-size: 15px; text-decoration: none; }
.card-foot:hover { background: var(--card-sub); }

/* --- schedule list --- */
.panel { background: var(--card); box-shadow: var(--shadow); }
.day { padding: 14px 20px 10px; font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--sub-line); }
.day.today { color: var(--accent-text); }
.row { display: grid; grid-template-columns: 80px minmax(0, 1fr); align-items: center; gap: 4px 16px; padding: 14px 20px 14px 16px; border-left: 4px solid var(--team, var(--line)); border-bottom: 1px solid var(--sub-line); }
.row-time { font: 600 17px var(--num); }
.row-teams { font-size: 15px; }
.row-teams b { font-weight: 800; }
.row-where { grid-column: 2; font-size: 13px; color: var(--muted); }
.row-where a { text-decoration: none; }
.row-where a:hover { text-decoration: underline; }
@media (min-width: 720px) {
  .row { grid-template-columns: 80px minmax(0, 1fr) minmax(0, 260px); }
  .row-where { grid-column: auto; text-align: right; }
}
.more { display: block; width: 100%; border: 0; background: transparent; padding: 14px; font-weight: 700; }
.more:hover { background: var(--card-sub); }

/* --- team page --- */
.back { display: inline-flex; gap: 6px; align-items: center; margin-bottom: 14px; font-weight: 700; text-decoration: none; font-size: 15px; }
.team-layout { display: grid; gap: 20px; }
.team-layout .col { display: grid; gap: 20px; align-content: start; min-width: 0; }
@media (min-width: 960px) { .team-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.team-head { padding: 20px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.team-head h1 { font-size: 30px; font-weight: 800; letter-spacing: -.015em; margin-top: 4px; }
.follow { flex: none; }
.follow[aria-pressed="true"] { background: var(--card-sub); }
.rank-band { background: var(--highlight); padding: 18px 20px; display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.rank-band .rank b { font-size: 88px; }
.rank-band .of { font-size: 14px; color: var(--muted); margin-top: 6px; }
.gap { text-align: right; font-size: 14px; color: var(--ink-2); }
.gap b { font: 600 26px var(--num); color: var(--ink); display: block; }
.block { padding: 20px; border-top: 1px solid var(--sub-line); }
.block h3 { font-size: 22px; font-weight: 800; }
.h2h { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; }
.h2h th { text-align: right; font-size: 12px; font-weight: 700; color: var(--ink-2); padding: 0 0 8px; width: 30%; overflow: hidden; text-overflow: ellipsis; }
.h2h th:first-child { text-align: left; width: 40%; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.h2h td { padding: 9px 0; border-top: 1px solid var(--sub-line); text-align: right; font: 600 20px var(--num); }
.h2h td:first-child { text-align: left; font: 500 14px var(--font); color: var(--ink-2); }
.h2h td.better { color: var(--ink); }
.h2h td.worse { color: var(--muted); }

.tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--sub-line); margin: 0 -20px; }
.tabs button { border: 0; background: transparent; padding: 14px 8px; font-weight: 600; border-bottom: 3px solid transparent; }
.tabs button[aria-selected="true"] { border-bottom-color: var(--ink); font-weight: 800; }
.tabs .count { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--card-sub); font-size: 12px; }

.games { list-style: none; margin: 0; padding: 0; }
.games li { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 16px 0; border-bottom: 1px solid var(--sub-line); }
.games li:last-child { border-bottom: 0; }
.dbox { text-align: center; background: var(--card-sub); border-radius: 4px; padding: 6px 0; }
.dbox b { display: block; font: 600 26px/1 var(--num); }
.dbox small { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.g-sub { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.g-score { display: flex; gap: 8px; align-items: baseline; font: 600 26px/1.1 var(--num); }
.g-score small { font: 700 11px var(--font); letter-spacing: .1em; color: var(--muted); }
.g-opp { font-size: 17px; font-weight: 800; margin-top: 2px; }
.g-opp a { text-decoration: none; }
.g-meta { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.g-where { font-size: 13px; color: var(--muted); margin-top: 6px; display: flex; gap: 6px; align-items: center; }
.g-where a { text-decoration: none; }
.g-where a:hover { text-decoration: underline; }
.g-where svg { width: 14px; height: 14px; flex: none; }
.today-line { display: flex; align-items: center; gap: 10px; padding: 14px 0; color: var(--accent-text); font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.today-line::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.today-line::after { content: ""; flex: 1; height: 1px; background: var(--accent); }

/* standings table */
.table-wrap { overflow-x: auto; margin: 12px -20px 0; }
.standings { width: 100%; border-collapse: collapse; font-size: 15px; }
.standings th { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); text-align: right; padding: 8px 8px; white-space: nowrap; }
.standings td { padding: 11px 8px; border-top: 1px solid var(--sub-line); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.standings th:first-child, .standings td:first-child { padding-left: 20px; text-align: left; width: 44px; font-weight: 700; }
.standings th:nth-child(2), .standings td:nth-child(2) { text-align: left; width: 100%; }
.standings th:last-child, .standings td:last-child { padding-right: 20px; }
.standings td:nth-child(2) a { text-decoration: none; font-weight: 600; }
.standings td:nth-child(2) a:hover { text-decoration: underline; }
.standings tr.me td { background: var(--highlight); font-weight: 800; }
.standings .pts { font-weight: 800; }
@media (max-width: 559px) { .standings .wide { display: none; } }

/* --- picker sheet --- */
.sheet { border: 0; padding: 0; width: min(520px, 100vw); max-height: min(720px, 92dvh); background: var(--card); color: var(--ink); box-shadow: 0 20px 50px #0f1c2e40; }
.sheet::backdrop { background: #0f1c2e66; }
@media (max-width: 559px) {
  .sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 14px 14px 0 0; max-height: 88dvh; }
}
.sheet-in { padding: 18px 20px calc(24px + env(safe-area-inset-bottom)); display: grid; gap: 4px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sheet-head h2 { font-size: 22px; font-weight: 800; }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); margin-bottom: 18px; }
.seg button { border: 0; background: var(--card); padding: 12px; font-weight: 700; min-height: 46px; }
.seg button[aria-selected="true"] { background: var(--ink); color: #fff; }
.team-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.team-list button {
  width: 100%; min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 14px; border: 1px solid var(--line); background: var(--card); border-radius: 4px; font-weight: 700; text-align: left;
}
.team-list button:hover { border-color: var(--ink); }
.team-list button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.team-list svg { width: 16px; height: 16px; flex: none; }

/* --- footer --- */
.foot { background: #f1f4f7; border-top: 1px solid var(--sub-line); padding: 18px 0 calc(18px + env(safe-area-inset-bottom)); text-align: center; font-size: 13px; color: var(--muted); }
.foot a { color: var(--ink-2); }

/* narrow phones: keep the brand on two lines */
@media (max-width: 419px) {
  .brand { font-size: 16px; gap: 10px; }
  .brand-mark { height: 38px; }
  .hide-sm { display: none; }
  .topbar .btn { padding: 0 16px; }
}

/* --- header actions / bell --- */
.top-actions { display: flex; align-items: center; gap: 8px; }
.bell { position: relative; width: 44px; height: 44px; border: 1px solid var(--line); background: var(--card); }
.bell svg { width: 20px; height: 20px; }
.bell-dot { position: absolute; top: 8px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--card); }

/* --- single-team dashboard (select): card beside the schedule --- */
.dash-single { display: grid; gap: 4px 24px; grid-template-columns: minmax(0, 1fr); }
.dash-single .card { height: auto; }
.dash-single .section-title:first-child { margin-top: 32px; }
@media (min-width: 900px) {
  .dash-single { grid-template-columns: minmax(0, 400px) minmax(0, 1fr); align-items: start; }
  .dash-single .section-title:first-child { margin-top: 0; }
}

/* --- alerts sheet --- */
.alerts-help { margin: 0 0 14px; color: var(--ink-2); font-size: 15px; }
.alerts-steps { margin: 0 0 12px; padding-left: 22px; display: grid; gap: 6px; color: var(--ink-2); }
.alerts-msg { margin: 12px 0 0; padding: 10px 12px; background: var(--highlight); border: 1px solid var(--accent-btn); border-radius: 4px; font-size: 14px; }
.switches { list-style: none; margin: 0; padding: 0; border: 1px solid var(--sub-line); border-radius: 4px; }
.switches li + li { border-top: 1px solid var(--sub-line); }
.switches label { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; cursor: pointer; }
.switches label span { display: grid; gap: 2px; }
.switches small { color: var(--muted); font-size: 13px; }
.switches input {
  appearance: none; -webkit-appearance: none; flex: none; margin: 0;
  width: 46px; height: 28px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background .15s;
}
.switches input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px #0f1c2e33; transition: transform .15s; }
.switches input:checked { background: var(--ink); }
.switches input:checked::after { transform: translateX(18px); }
.alerts-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
