/* ---------- tokens ---------- */
:root {
  --bg: #f4f4f1; --panel: #ffffff; --panel-2: #f7f7f5; --line: #e5e5e1; --line-2: #d3d3ce;
  --ink: #131417; --ink-2: #34373e; --muted: #6f7380; --faint: #a3a7b0;
  --accent: #e8b100; --accent-ink: #1a1300;
  --win: #178a45; --loss: #c8303f; --win-bg: rgba(23,138,69,.1); --loss-bg: rgba(200,48,63,.1);
  --shadow: 0 1px 2px rgba(20,22,28,.05), 0 8px 24px -16px rgba(20,22,28,.18);
  --row-hover: rgba(20,22,28,.03); --row-open: rgba(20,22,28,.045);
  --topbar: rgba(244,244,241,.86);
  color-scheme: light;
  --display: "Barlow Condensed", "Inter", system-ui, sans-serif;
  --body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; color: var(--ink); background: var(--bg); font: 14.5px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
.page { max-width: 1280px; margin: 0 auto; padding: 0 24px 72px; }
button, select, input { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }
.show-sm { display: none; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--topbar); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: 0 24px; height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.wordmark { font: 800 22px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.brand-sub { font-size: 12px; color: var(--muted); white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
select {
  appearance: none; -webkit-appearance: none; height: 34px; background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8f99' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center;
  border: 1px solid var(--line); border-radius: 8px; padding: 0 28px 0 11px; font-weight: 600; font-size: 13.5px; color: var(--ink); cursor: pointer;
}
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; font-weight: 600; font-size: 13px; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--panel-2); border-color: var(--line-2); }
.btn[disabled] { opacity: .55; cursor: progress; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: transparent; }
.btn.icon { width: 34px; padding: 0; justify-content: center; }
.btn svg { flex: none; }

/* ---------- page head ---------- */
.pagehead { padding: 36px 0 24px; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font: 700 12px/1 var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.eyebrow .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .7; }
h1 { font: 800 clamp(40px, 6vw, 60px)/1 var(--display); letter-spacing: -.005em; text-transform: uppercase; margin: 8px 0 8px; }
.lede { margin: 8px 0 0; color: var(--muted); max-width: 64ch; font-size: 14px; }
.weeks { margin-top: 22px; }
.weeks-track { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.weeks-track::-webkit-scrollbar { display: none; }
.wk { flex: none; min-width: 46px; height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); font: 700 15px/1 var(--display); letter-spacing: .04em; cursor: pointer; color: var(--ink-2); position: relative; transition: all .12s; }
.wk:hover { border-color: var(--line-2); color: var(--ink); }
.wk.active { background: var(--ink); color: var(--bg); border-color: transparent; }
.wk.pre { font-size: 12.5px; letter-spacing: .12em; }
.wk.live::after { content: ""; position: absolute; top: -3px; right: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--loss); border: 2px solid var(--bg); }

/* ---------- champion banner (seasons with a title game) ---------- */
.champion { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.champion:empty { display: none; }
.champ { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); cursor: pointer; position: relative; overflow: hidden; }
.champ::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
.champ.runner::before { background: var(--muted); }
.champ.runner .champ-trophy, .champ.runner .champ-label { color: var(--muted); }
.champ:hover { border-color: var(--line-2); }
.champ-trophy { color: var(--accent); flex: none; display: flex; }
.champ-logo { width: 44px; height: 44px; object-fit: contain; flex: none; }
.champ-text { flex: 1; min-width: 0; }
.champ-label { font: 700 11px/1 var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.champ-name { font: 700 22px/1.1 var(--display); text-transform: uppercase; margin-top: 3px; }
.champ-rec { font: 600 14px var(--body); text-transform: none; color: var(--muted); margin-left: 6px; }
.champ-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.champ-stats { display: flex; gap: 18px; flex: none; }
.champ-stats .stat b { font-size: 22px; }
.trophy { font-size: 13px; margin-left: 4px; }
@media (max-width: 1000px) { .champion { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .champ { flex-wrap: wrap; } .champ-stats { width: 100%; justify-content: space-between; padding-top: 10px; border-top: 1px solid var(--line); } }

/* ---------- spotlight ---------- */
.spotlight { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 26px; }
.spotlight:empty { display: none; }
.spot { position: relative; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); padding: 18px 18px 16px; cursor: pointer; box-shadow: var(--shadow); transition: border-color .12s, transform .12s; overflow: hidden; }
.spot::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--team); }
.spot:hover { border-color: var(--line-2); transform: translateY(-1px); }
.spot-top { display: flex; justify-content: space-between; align-items: center; }
.spot-rank { font: 800 44px/1 var(--display); color: var(--team); letter-spacing: -.02em; }
.spot-logo { width: 52px; height: 52px; object-fit: contain; }
.spot-name { font: 700 24px/1.05 var(--display); text-transform: uppercase; letter-spacing: .01em; margin-top: 12px; }
.spot-sub { display: flex; gap: 10px; align-items: center; margin-top: 4px; font-size: 13px; color: var(--muted); }
.spot-sub b { color: var(--ink); font-weight: 600; }
.spot-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.spot-rating span, .spot-note span { display: block; font: 700 10.5px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.spot-rating b { font: 700 28px/1 var(--display); font-variant-numeric: tabular-nums; }
.spot-note { min-width: 0; text-align: right; }
.spot-note b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spot-note i { font-style: normal; color: var(--muted); font-weight: 500; }
.spot-pre { grid-column: 1 / -1; padding: 20px; border-radius: 14px; border: 1px dashed var(--line-2); color: var(--muted); text-align: center; }

/* ---------- view toggle ---------- */
.pagehead-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; }
.pagehead-row h1 { margin-bottom: 0; }
.pagehead-controls { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.pagehead-controls .seg { display: grid; grid-template-columns: 1fr 1fr; }
.pagehead-controls .seg button { white-space: nowrap; }
.slider { display: flex; flex-direction: column; gap: 2px; padding: 8px 14px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.slider-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--muted); }
.slider-head b { color: var(--ink); font-variant-numeric: tabular-nums; }
.slider input { width: 100%; margin: 4px 0 0; accent-color: var(--ink); cursor: pointer; }
.slider-ends { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.seg button { height: 36px; padding: 0 16px; border: 0; background: transparent; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.active { background: var(--ink); color: var(--bg); }
body.conf-mode .champion { display: none; }
.conf-badge { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); font: 700 10.5px/1 var(--display); letter-spacing: .04em; color: var(--ink-2); flex: none; }
.gref .conf-badge { width: 24px; height: 24px; font-size: 9px; }
.conf-badge.big { width: 52px; height: 52px; font-size: 16px; border-radius: 12px; }
.conf-logo { width: 34px; height: 30px; object-fit: contain; flex: none; }
.conf-logo.small { width: 24px; height: 22px; }
.conf-logo.big { width: 72px; height: 52px; object-fit: contain; object-position: right center; }

/* ---------- table ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: clip; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); }
td.c-rating.dim b.rating { color: var(--muted); font-weight: 600; }
.card-title { font: 700 12px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.search { display: flex; align-items: center; gap: 8px; height: 34px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; color: var(--muted); }
.search input { border: 0; background: transparent; width: 180px; outline: none; color: var(--ink); }
.search:focus-within { border-color: var(--line-2); color: var(--ink); }
.status { color: var(--muted); font-size: 13px; padding: 10px 16px 0; }
body.loading .status { color: var(--accent); font-weight: 600; }
body.loading .card table, body.loading .spotlight { opacity: .45; transition: opacity .2s; }
.status:empty { display: none; }
.status.error { color: var(--loss); }
table.rankings { width: 100%; border-collapse: collapse; table-layout: fixed; }
.rankings th { text-align: left; padding: 13px 12px; font: 700 11px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line-2); background: var(--panel); position: sticky; top: 58px; z-index: 2; }
.spotlight { margin-bottom: 18px; }
.rankings td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.rankings tbody tr:last-child td { border-bottom: 0; }
.rankings tr.team { cursor: pointer; }
.rankings tr.team:hover td { background: var(--row-hover); }
.rankings tr.team.open td { background: var(--row-open); border-bottom-color: transparent; }
.c-rank, .c-delta, .c-rec, .c-rating, .c-sos, .c-sosr { text-align: right !important; white-space: nowrap; }
.c-rank { width: 56px; } .c-delta { width: 62px; } .c-rating { width: 96px; } .c-rec { width: 84px; } .c-sos { width: 100px; } .c-str { width: 100px; } .c-win, .c-loss { width: 72px; white-space: nowrap; }
.rankings th.c-win, .rankings th.c-loss { white-space: normal; line-height: 1.25; } .c-week { width: 110px; }
.c-win .gref, .c-loss .gref, .c-week .gref { cursor: help; gap: 6px; }
.gref .loc { color: var(--muted); font-size: 12px; font-weight: 600; flex: none; min-width: 14px; text-align: right; }
.c-win .logo, .c-loss .logo, .c-week .logo { width: 26px; height: 26px; }
body.conf-mode .c-win { width: 34%; }
body.conf-mode .c-win .logo { width: 20px; height: 20px; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
/* Sort arrow sits in the cell's padding zone so header text lines up with the column's values. */
th.sortable::after { content: "▼"; font-size: 8px; position: absolute; top: 50%; transform: translateY(-50%); opacity: 0; transition: opacity .12s; }
th.c-rating::after, th.c-rec::after, th.c-sos::after { right: 1px; }
th.c-win::after, th.c-loss::after, th.c-week::after { position: static; transform: none; margin-left: 5px; }
th.sortable:hover::after { opacity: .4; }
th.sortable.sorted { color: var(--ink); }
th.sortable.sorted::after { opacity: 1; }
th.sortable.sorted.asc::after { content: "▲"; }
.rankings th.c-sos { white-space: normal; line-height: 1.25; }
.rankings th.c-team { padding-left: 67px; }   /* bar + logo + gaps, so "Team" sits over the names */
td.c-rank { font: 700 19px/1 var(--display); color: var(--ink); font-variant-numeric: tabular-nums; }
td.c-rank .tie { font-size: 11px; color: var(--muted); font-family: var(--body); font-weight: 600; margin-right: 2px; }
td.c-team { padding-left: 10px; }
.teamcell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.teamcell > div { min-width: 0; }
.teambar { width: 3px; height: 28px; border-radius: 2px; background: var(--team); flex: none; }
.logo { width: 30px; height: 30px; object-fit: contain; flex: none; }
.logo.ph { border-radius: 50%; background: var(--line-2); }
.tname { font-weight: 600; font-size: 15px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tconf { font-size: 11.5px; color: var(--muted); line-height: 1.2; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
td.c-rec { font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
b.rating { font: 700 18px/1 var(--display); font-variant-numeric: tabular-nums; }
.se { font-size: 10.5px; color: var(--faint); font-weight: 500; margin-left: 5px; font-variant-numeric: tabular-nums; font-family: var(--body); }
.stat b .se { font-size: 11px; }
.bar { width: 48px; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; flex: none; display: inline-block; }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--faint); }
.delta { display: inline-block; min-width: 34px; text-align: center; padding: 3px 6px; border-radius: 6px; font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--win); background: var(--win-bg); }
.delta.down { color: var(--loss); background: var(--loss-bg); }
.delta.flat { color: var(--faint); }
.sos { font-variant-numeric: tabular-nums; font-weight: 600; }
.sos small { color: var(--faint); font-weight: 500; font-size: 11px; margin-left: 5px; }
.gref { display: flex; align-items: center; gap: 8px; white-space: nowrap; min-width: 0; }
.gref > span:not(.r):not(.res) { overflow: hidden; text-overflow: ellipsis; }
.gref .res { flex: none; }
.gref .logo { width: 20px; height: 20px; }
.gref .r { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; flex: none; }
.gref .nf { color: var(--muted); font-size: 11px; }
.gref .res { margin: 0 0 0 2px; }
.gref.upcoming { color: var(--muted); }
.none { color: var(--faint); }
.pos { color: var(--win); } .neg { color: var(--loss); }

/* ---------- detail ---------- */
tr.detail td { padding: 0; background: var(--row-open); overflow: hidden; }
.detail-inner { padding: 4px 20px 22px 20px; display: grid; gap: 14px; min-width: 0; }
.stats { display: flex; flex-wrap: wrap; gap: 10px; }
.stat { display: flex; flex-direction: column; justify-content: center; padding: 8px 12px; min-width: 96px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.stat span { font: 700 10px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; white-space: nowrap; }
.stat b { font: 700 20px/1 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat b .se { font-size: 11px; }
.stat-ref .gref { gap: 5px; } .stat-ref .logo { width: 22px; height: 22px; } .stat-ref .loc { font-size: 11px; } .stat-ref .r { font: 600 12px var(--body); }
.detail-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; align-items: start; }
.logwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
table.log { width: 100%; border-collapse: collapse; font-size: 13px; }
table.log th { text-align: left; padding: 8px 10px; font: 700 10.5px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--panel-2); position: static; }
table.log td { padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.log tr:last-child td { border-bottom: 0; }
table.log .num { text-align: right; font-variant-numeric: tabular-nums; }
table.log .date { color: var(--muted); font-size: 12px; }
table.log tr.future td { color: var(--muted); }
table.log tr.future .logo { opacity: .55; }
table.log tr.future .res { opacity: .55; }
table.log tr.log-divider td { padding: 5px 10px; font: 700 10px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); background: var(--panel-2); }
.res { display: inline-block; min-width: 20px; text-align: center; padding: 2px 6px; border-radius: 6px; font-weight: 800; font-size: 11.5px; margin-right: 6px; }
.res.W { color: var(--win); background: var(--win-bg); } .res.L { color: var(--loss); background: var(--loss-bg); }
.pct { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.pct .bar { width: 48px; height: 5px; }
.pct .bar i { background: var(--faint); }
.pct.quality b { color: var(--win); } .pct.bad b { color: var(--loss); }
.chg { display: inline-flex; align-items: baseline; gap: 5px; font-variant-numeric: tabular-nums; }
.chg b { font-weight: 700; }
.chg.pos b { color: var(--win); } .chg.neg b { color: var(--loss); } .chg.flat b { color: var(--muted); }
.chg small { font-size: 10.5px; font-weight: 700; }
.spark-wrap { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 4px; background: var(--panel); position: relative; }
.spark-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; min-height: 40px; }
.spark-head .stat { border: 0; padding: 0; min-width: 0; background: transparent; }
.spark-tip { font-size: 12px; line-height: 1.35; text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.spark-tip b { color: var(--ink); }
.spark { width: 100%; height: auto; aspect-ratio: 520 / 150; display: block; cursor: crosshair; }
.spark .marker { stroke: var(--ink); stroke-width: 1; opacity: .35; pointer-events: none; }
.spark .path { fill: none; stroke: var(--team, var(--accent)); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
.spark .area { fill: var(--team, var(--accent)); opacity: .1; pointer-events: none; }
.spark .pt { fill: var(--team, var(--accent)); stroke: var(--panel); stroke-width: 2; transition: r .1s; }
.spark .pt.hot { r: 5.5; stroke: var(--ink); }
.spark .grid { stroke: var(--line); stroke-width: 1; }
.spark .grid.zero { stroke: var(--muted); stroke-dasharray: 2 3; }
.spark .band { fill: var(--team, var(--accent)); opacity: .14; pointer-events: none; }
.spark .cursor { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.spark text { font: 600 10px var(--body); fill: var(--muted); pointer-events: none; }
.spark .axis-title { font-size: 9px; fill: var(--faint); }

/* ---------- modals ---------- */
.modal { border: 0; padding: 0; background: transparent; max-width: min(92vw, 560px); width: 100%; color: var(--ink); }
.modal:has(.wide) { max-width: min(92vw, 720px); }
.modal::backdrop { background: rgba(0,0,0,.5); backdrop-filter: blur(3px); }
.modal-inner { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 60px -20px rgba(0,0,0,.5); margin: 0; display: flex; flex-direction: column; max-height: 86vh; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font: 700 26px/1 var(--display); text-transform: uppercase; letter-spacing: .02em; }
.modal-body { padding: 16px 20px; overflow: auto; }
.modal-foot { display: flex; justify-content: space-between; gap: 10px; padding: 12px 20px 18px; border-top: 1px solid var(--line); }
.prose p, .prose li { color: var(--ink-2); }
.prose h3 { font: 700 15px/1.2 var(--display); letter-spacing: .08em; text-transform: uppercase; margin: 18px 0 6px; color: var(--ink); }
.prose h3:first-child { margin-top: 4px; }
.prose ul { padding-left: 20px; }
.prose b { color: var(--ink); }
.prose ol { padding-left: 20px; }

/* ---------- footer ---------- */
.foot { color: var(--muted); font-size: 12px; margin-top: 16px; padding: 0 4px; }
.foot b { color: var(--ink-2); }

/* ---------- responsive ---------- */
@media (max-width: 1000px) { .hide-md { display: none; } }
@media (max-width: 640px) {
  .page, .topbar-inner { padding-left: 14px; padding-right: 14px; }
  .hide-sm { display: none; } .show-sm { display: inline; }
  .brand-sub { display: none; } .wordmark { font-size: 18px; letter-spacing: .04em; } .topbar-actions { gap: 4px; } select { min-width: 0; padding-right: 24px; }
  .btn.ghost { padding: 0 10px; }
  .pagehead { padding-top: 24px; }
  .spotlight { grid-template-columns: 1fr; gap: 10px; }
  .spot { padding: 14px; }
  .spot-rank { font-size: 34px; } .spot-logo { width: 42px; height: 42px; } .spot-name { font-size: 20px; margin-top: 8px; }
  .rankings th { top: 58px; }
  .rankings th, .rankings td { padding-left: 8px; padding-right: 8px; }
  .rankings th.c-team { padding-left: 55px; }
  .rankings th:last-child, .rankings td:last-child { padding-right: 14px; }
  .rankings th.c-rec, .rankings td.c-rec { padding-right: 16px; }
  .c-rating { width: 70px; } .c-rec { width: 56px; } .c-rank { width: 40px; } .c-delta { width: 46px; }
  td.c-rec { font-size: 14px; }
  body.conf-mode .c-rec { width: 66px; } body.conf-mode .c-rating { width: 64px; }
  .tname { white-space: normal; font-size: 14px; line-height: 1.2; }
  .tconf { white-space: normal; }
  .teamcell { gap: 8px; } .logo { width: 26px; height: 26px; }
  .stats { gap: 8px; } .stat { min-width: 0; flex: 1 1 calc(33.333% - 8px); padding: 8px 10px; } .stat b { font-size: 18px; }
  .detail-inner { padding: 8px 10px 16px; }
  .detail-charts, .detail-cols { grid-template-columns: 1fr; }
  .card-head { flex-wrap: wrap; padding: 10px 12px; }
  .search { flex: 1 1 100%; } .search input { width: 100%; }
}

/* ---------- hover card ---------- */
.tip { position: fixed; z-index: 50; pointer-events: none; min-width: 190px; padding: 10px 12px; border-radius: 10px; background: var(--ink); color: var(--bg); font-size: 12.5px; line-height: 1.4; box-shadow: var(--shadow); }
.tip .tip-head { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.tip .tip-head .res { margin: 0; }
.tip .tip-sub { color: var(--faint); font-size: 11px; margin-bottom: 6px; }
.tip .tip-row { display: flex; gap: 8px; align-items: baseline; font-variant-numeric: tabular-nums; }
.tip .tip-row span { color: var(--faint); min-width: 58px; }
.tip .tip-head .res { padding: 0 6px; min-width: 0; width: auto; }
.tip b { font-weight: 700; }
.tip i { font-style: normal; color: var(--faint); font-size: 11px; }
[data-tip] { cursor: default; }

/* ---------- team detail (two-layer) ---------- */
.detail-inner.tm { gap: 12px; padding-top: 10px; }
.tm-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tm-tile { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tm-tile > span { font: 700 10px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.tm-tile b { font: 700 30px/1 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tm-tile b small { font: 600 13px var(--body); color: var(--faint); margin-left: 8px; }
.tm-tile em { font-style: normal; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-tile.main { border-color: var(--team, var(--line-2)); box-shadow: inset 3px 0 0 var(--team, var(--accent)); }
.tm-story { margin: 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
.tm-story b { color: var(--ink); } .tm-story b.pos { color: var(--win); } .tm-story b.neg { color: var(--loss); }
.tm-legend { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.tm-legend .sw { width: 14px; height: 0; border-top: 2.5px solid var(--team, var(--accent)); margin-left: 6px; }
.tm-legend .sw.str { border-top: 2px dashed var(--faint); }
.spark .path.str { stroke: var(--faint); stroke-width: 1.8; stroke-dasharray: 4 3; }
.spark .pt.str { fill: var(--faint); }
.tm-bars svg { cursor: default; }
.tm-bars .bar rect { fill: var(--faint); }
.tm-bars .bar.pos rect { fill: var(--win); opacity: .85; } .tm-bars .bar.neg rect { fill: var(--loss); opacity: .85; }
.tm-bars .bar .val { font: 700 9.5px var(--body); fill: var(--ink-2); }
.tm-bars .bar:hover rect { opacity: 1; }
.tm-log td { vertical-align: middle; }
.tm-log .tm-wk { line-height: 1.15; } .tm-log .tm-wk small { display: block; color: var(--faint); font-size: 10.5px; }
.tm-opp { gap: 8px !important; } .tm-opp .logo { width: 24px; height: 24px; }
.tm-opp > span { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.tm-opp small { color: var(--faint); font-size: 10.5px; }
.tm-val { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; font-variant-numeric: tabular-nums; }
.tm-val .track { position: relative; width: 70px; height: 6px; border-radius: 3px; background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line); }
.tm-val .track::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--line-2); }
.tm-val .track i { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: var(--faint); }
.tm-val.pos .track i { background: var(--win); } .tm-val.neg .track i { background: var(--loss); }
.tm-val b { min-width: 40px; text-align: right; } .tm-val.pos b { color: var(--win); } .tm-val.neg b { color: var(--loss); } .tm-val.flat b { color: var(--muted); }
.tm-stakes { font-variant-numeric: tabular-nums; color: var(--faint); white-space: nowrap; }
.tm-stakes i { font-style: normal; }
.tm-stakes .pos { color: var(--win); } .tm-stakes .neg { color: var(--loss); }
@media (max-width: 760px) {
  .tm-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tm-tile b { font-size: 24px; }
  .tm-log th:nth-child(1), .tm-log td:nth-child(1), .tm-log .tm-g1, .tm-log .tm-g2, .tm-log .tm-mg, .tm-log tr.tm-groups { display: none; }
  .tm-log tr.log-divider td { display: table-cell; }
  .tm-log td, .tm-log th { padding: 7px 6px; }
  .tm-val .track { display: none; }
  .tm-val b { min-width: 0; }
  .tm-stakes { font-size: 12px; display: inline-flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
  .tm-stakes i { display: none; }
  .tm-opp > span { max-width: 84px; overflow: hidden; }
  .detail-inner.tm { padding: 8px 8px 16px; }
  .tm-log th { letter-spacing: .04em; padding: 7px 5px; }
  .detail-inner.tm > * { min-width: 0; }
  .tm-opp .logo { width: 20px; height: 20px; }
  .tm-log .res { margin-right: 4px; padding: 2px 4px; }
  .tm-opp small, .tm-oppname { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* chart hover readout floats over the head instead of growing it */
.spark-head { position: relative; }
.spark-tip { position: absolute; top: -2px; right: 0; z-index: 3; padding: 6px 9px; border-radius: 8px; background: var(--panel); box-shadow: 0 0 0 1px var(--line), var(--shadow); white-space: nowrap; }
.spark .ylab.str { fill: var(--faint); }

.tm-log tr.tm-groups th { padding: 8px 10px 0; border-bottom: 0; background: var(--panel-2); }
.tm-log th.tm-grp { text-align: right; color: var(--ink-2); border-top: 2px solid var(--line-2); }
.tm-log th.tm-grp small { font: 500 10.5px var(--body); letter-spacing: 0; text-transform: none; color: var(--faint); margin-left: 6px; }
.tm-log td.tm-g1, .tm-log th.tm-g1, .tm-log td.tm-g2, .tm-log th.tm-g2 { padding-left: 26px; }
.tm-log tr.tm-total td { background: var(--panel-2); font-weight: 700; border-top: 1px solid var(--line-2); }

/* the column driving the order gets a soft gray fill */
.rankings td.col-on { background-color: rgba(20, 22, 28, .04); }
.rankings th.col-on { background-color: #f5f5f5; }   /* solid: the header is sticky and rows scroll under it */

/* ---------- detail modal ---------- */
.modal.detail-modal { max-width: min(96vw, 1180px); }
.detail-modal .modal-inner { max-height: 92vh; border-top: 4px solid var(--team, var(--accent)); }
.detail-modal .modal-head { padding: 14px 18px 12px; gap: 12px; }
.detail-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.detail-title .logo, .detail-title .conf-logo { width: 40px; height: 40px; }
.detail-title h2 { margin: 0; font: 700 26px/1 var(--display); text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-title .sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.detail-modal .modal-body { padding: 14px 18px 18px; background: var(--bg); }
.detail-modal .detail-inner, .detail-modal .detail-inner.tm { padding: 0; }
@media (max-width: 760px) {
  .modal.detail-modal { max-width: 100vw; }
  .detail-modal .modal-body { padding: 10px; }
  .detail-title h2 { font-size: 20px; }
}

/* small rank movement inside the ranked cells; fixed slot so numbers stay aligned */
.sos .mv { display: inline-block; min-width: 30px; margin-left: 6px; font: 700 9.5px/1 var(--body); font-style: normal; text-align: center; padding: 2px 4px; border-radius: 4px; vertical-align: 1px; }
.sos .mv.up { color: var(--win); background: var(--win-bg); }
.sos .mv.down { color: var(--loss); background: var(--loss-bg); }
.sos .mv.flat { color: var(--faint); background: rgba(20, 22, 28, .05); }

/* lock the page behind any open modal, and keep modal scrolling from chaining to the page */
html:has(dialog[open]), body:has(dialog[open]) { overflow: hidden; }
.modal-body { overscroll-behavior: contain; }

.tm-log td.tm-mg { font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* ---------- superlatives ---------- */
.sup-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.sup-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 8px; min-width: 0; }
.sup-card h3 { margin: 0; font: 700 15px/1.1 var(--display); letter-spacing: .08em; text-transform: uppercase; }
.sup-card p { margin: 3px 0 8px; font-size: 11.5px; color: var(--muted); }
.sup-card ol { list-style: none; margin: 0; padding: 0; }
.sup-card li { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-top: 1px solid var(--line); cursor: pointer; border-radius: 6px; }
.sup-card li:first-child { border-top: 0; }
.sup-card li:hover { background: var(--row-hover); }
.sup-card li .logo { width: 24px; height: 24px; }
.sup-name { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.sup-name b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sup-name small { font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sup-val { font: 700 16px/1 var(--display); font-variant-numeric: tabular-nums; color: var(--win); white-space: nowrap; }
.sup-val.neg { color: var(--loss); }
.sup-modal .modal-inner { border-top-color: var(--accent); }
@media (max-width: 1000px) { .sup-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .sup-grid { grid-template-columns: 1fr; } }
.tm-pct { font-variant-numeric: tabular-nums; font-weight: 700; }
.tm-log tr.future .tm-pct { font-weight: 600; }

/* ---------- team modal: hero + polish ---------- */
.detail-modal.is-team .modal-inner { border-top: 0; overflow: hidden; }
.detail-modal .modal-head { position: relative; }
.detail-modal .modal-head form { position: absolute; top: 14px; right: 14px; z-index: 2; }
.detail-modal.is-team .modal-head { padding: 26px 28px 22px; border-bottom: 1px solid var(--line); overflow: hidden; background: var(--panel); }
.detail-modal.is-team .modal-head::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--team); }
.detail-modal.is-team .detail-title { flex: 1; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; position: relative; padding-right: 36px; }
.hero-id { display: flex; align-items: center; gap: 18px; min-width: 0; }
.hero-logo { width: 76px; height: 76px; object-fit: contain; flex: none; filter: drop-shadow(0 6px 14px rgba(20,22,28,.18)); }
.detail-modal.is-team .detail-title h2 { font: 800 44px/0.95 var(--display); letter-spacing: .01em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line); }
.chip.strong { color: var(--panel); background: var(--team); box-shadow: none; font-variant-numeric: tabular-nums; }
.chip.ghost { background: transparent; color: var(--muted); }
.hero-stats { display: flex; gap: 10px; position: relative; }
.hs { min-width: 118px; padding: 12px 16px 12px; border-radius: 14px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.hs > span { display: block; font: 700 10.5px/1 var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.hs b { display: block; margin-top: 6px; font: 800 42px/0.9 var(--display); font-variant-numeric: tabular-nums; color: var(--ink); }
.hs b small { font: 600 13px var(--body); color: var(--faint); margin-left: 3px; }
.hs.main { background: var(--panel); box-shadow: inset 0 0 0 2px var(--team), 0 10px 24px -14px color-mix(in srgb, var(--team) 70%, transparent); }
.hs.main b { color: var(--team); }
.hs-sub { margin-top: 6px; display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.hs-sub .mv { display: inline-block; min-width: 28px; font: 700 9.5px/1 var(--body); font-style: normal; text-align: center; padding: 3px 4px; border-radius: 4px; }
.hs-sub .mv.up { color: var(--win); background: var(--win-bg); } .hs-sub .mv.down { color: var(--loss); background: var(--loss-bg); } .hs-sub .mv.flat { color: var(--faint); background: rgba(20,22,28,.05); }
.detail-modal .modal-body { padding: 18px 24px 26px; }
.tm-sec { font: 700 11px/1 var(--display); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin: 4px 2px -2px; display: flex; align-items: center; gap: 10px; }
.tm-sec::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.detail-modal .spark-wrap, .detail-modal .logwrap { border-color: transparent; box-shadow: 0 0 0 1px var(--line), 0 10px 30px -22px rgba(20,22,28,.45); border-radius: 14px; }
.detail-modal .spark-wrap { padding: 14px 16px 6px; }
.detail-modal .spark .area { opacity: .08; }
.tm-log tbody tr td:first-child { box-shadow: inset 3px 0 0 transparent; }
.tm-log tbody tr.r-W td:first-child { box-shadow: inset 3px 0 0 var(--win); }
.tm-log tbody tr.r-L td:first-child { box-shadow: inset 3px 0 0 var(--loss); }
.tm-log tbody tr:not(.log-divider):hover td { background: var(--row-hover); }
.tm-log td.tm-res b { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tm-log tr.future td.tm-res b { font-weight: 500; }
.tm-log thead th { background: var(--panel); padding-top: 11px; padding-bottom: 11px; }
.tm-log tr.log-divider td { background: var(--panel-2); color: var(--muted); }
@media (max-width: 760px) {
  .detail-modal.is-team .modal-head { padding: 20px 16px 16px; }
  .hero-logo { width: 54px; height: 54px; }
  .detail-modal.is-team .detail-title h2 { font-size: 30px; }
  .hero-stats { width: 100%; }
  .hs { flex: 1; min-width: 0; padding: 10px 10px; }
  .hs b { font-size: 32px; }
  .detail-modal .modal-body { padding: 12px 10px 18px; }
}
.detail-modal .modal-head { flex: none; }
.detail-modal .modal-body { flex: 1 1 auto; min-height: 0; }
@media (max-width: 760px) {
  .detail-modal .detail-charts { grid-template-columns: minmax(0, 1fr); }
  .detail-modal .detail-charts > * { min-width: 0; }
  .detail-modal.is-team .detail-title { gap: 14px; padding-right: 44px; }
  .hs-sub { font-size: 11.5px; flex-wrap: wrap; }
}

/* ---------- team modal: cleanup pass ---------- */
/* the modal focuses its body on open, so no focus ring lands on the close button */
.detail-modal .modal-body:focus { outline: none; }

/* hero: center the name block against the stat cards, and line the close button up with them */
.detail-modal.is-team .detail-title { align-items: center; }
.detail-modal.is-team .modal-head form { top: 26px; right: 22px; }

/* body: flat cards, consistent rhythm */
.detail-modal .modal-body { padding: 20px 28px 28px; }
.detail-inner.tm { gap: 14px; }
.tm-sec { margin: 6px 0 -4px; font-size: 10.5px; letter-spacing: .16em; }
.tm-sec:first-child { margin-top: 0; }
.detail-modal .spark-wrap, .detail-modal .logwrap { box-shadow: 0 0 0 1px var(--line); border-radius: 12px; }
.detail-modal .detail-charts { gap: 14px; }

/* schedule table: lighter header, calmer rows */
.tm-log thead th { padding-top: 10px; padding-bottom: 10px; font-size: 10.5px; color: var(--muted); border-bottom: 1px solid var(--line); }
.tm-log tbody td { border-top-color: var(--line); }
.tm-log tr.log-divider td { font: 700 10px/1 var(--display); letter-spacing: .16em; text-transform: uppercase; padding-top: 9px; padding-bottom: 9px; }
.tm-log tr.future td { color: var(--muted); }
.tm-log tr.future .tm-oppname { color: var(--ink-2); }

@media (max-width: 760px) {
  /* stats wrap under the name, so only the name row needs room for the close button */
  .detail-modal.is-team .detail-title { padding-right: 0; }
  .detail-modal.is-team .hero-id { padding-right: 44px; }
  .detail-modal.is-team .modal-head form { top: 20px; right: 14px; }
  .detail-modal .modal-body { padding: 14px 12px 20px; }
}

/* opponent ranks get their own columns on desktop; the subline carries them on mobile */
.tm-log td.tm-or { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.tm-log tr.future td.tm-or { color: var(--muted); }
.tm-log td.tm-or, .tm-log th.tm-or { padding-left: 14px; }
.tm-opp small { display: none; }
.tm-val b { min-width: 0; }
@media (max-width: 760px) {
  .tm-log .tm-or { display: none; }
  .tm-opp small { display: block; }
}

/* schedule table: fixed column widths and one padding so the columns sit on an even rhythm */
@media (min-width: 761px) {
  .tm-log { table-layout: fixed; min-width: 940px; }
  .tm-log th, .tm-log td,
  .tm-log td.tm-g1, .tm-log th.tm-g1, .tm-log td.tm-g2, .tm-log th.tm-g2,
  .tm-log td.tm-or, .tm-log th.tm-or{ padding-left: 14px; padding-right: 14px; }
  .tm-log th.tm-wkh { width: 64px; }
  .tm-log th.tm-or { width: 92px; }
  .tm-log th.tm-resh { width: 124px; }
  .tm-log th.tm-mg, .tm-log th.tm-g1 { width: 92px; }
  .tm-log th.tm-g2 { width: 104px; }
  .tm-log th.tm-d { width: 112px; }
  .tm-log th.tm-d:last-child { width: 112px; }
  .tm-opp > span { min-width: 0; } .tm-oppname { display: block; overflow: hidden; text-overflow: ellipsis; }
}

/* rank column: number then a fixed-width movement slot, so numbers line up row to row */
.tm-log td:last-child .sos { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; }
.tm-log td:last-child .sos .mv { margin-left: 0; min-width: 32px; }
/* result: fixed-width score so the W/L badges line up */
.tm-log td.tm-res b { display: inline-block; min-width: 50px; text-align: left; }
.tm-log tr.future td.tm-res .none { display: inline-block; min-width: 50px; text-align: left; margin-left: 28px; }
/* upcoming rank dash sits under the rank numbers */
.tm-log .tm-rk { font-weight: 700; font-variant-numeric: tabular-nums; }
