/* APM. One family, Archivo, used at two widths: expanded and heavy for names and
   ratings (jersey lettering), normal width for reading and tables. Quiet cool neutrals,
   hairlines instead of boxes, and one diverging pair: teal adds value, vermilion costs it. */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #0d1420;
  --ink-2: #4b5565;
  --ink-3: #8b93a3;
  --line: #e3e6eb;
  --line-2: #d3d7de;
  --pos: #0b8a68;
  --neg: #d6452a;
  --pos-soft: #dff2ec;
  --neg-soft: #fbe6e1;
  --accent: #2f45e0;
  --o: #2f6fe0;
  --d: #e0782f;
  --box: #7a5af0;
  --onoff: #0b8a68;
  --row: #eceef2;
  --font: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0d12; --surface: #10141b; --ink: #edf0f4; --ink-2: #a7afbc; --ink-3: #6c7484;
    --line: #1e242e; --line-2: #2a313d; --pos: #3cc79c; --neg: #ff6f50;
    --pos-soft: rgba(60, 199, 156, 0.14); --neg-soft: rgba(255, 111, 80, 0.14);
    --accent: #8696ff; --o: #5a92f0; --d: #f0904a; --box: #a28cff; --onoff: #3cc79c; --row: #131821;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0d12; --surface: #10141b; --ink: #edf0f4; --ink-2: #a7afbc; --ink-3: #6c7484;
  --line: #1e242e; --line-2: #2a313d; --pos: #3cc79c; --neg: #ff6f50;
  --pos-soft: rgba(60, 199, 156, 0.14); --neg-soft: rgba(255, 111, 80, 0.14);
  --accent: #8696ff; --o: #5a92f0; --d: #f0904a; --box: #a28cff; --onoff: #3cc79c; --row: #131821;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--font); font-stretch: 100%; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
td, .tnum { font-variant-numeric: tabular-nums; }

/* Expanded display face */
.x { font-stretch: 125%; font-weight: 800; letter-spacing: -0.015em; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.dim { color: var(--ink-3); }
.soft { color: var(--ink-2); }

/* Frame */
.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }
.masthead { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: saturate(1.4) blur(12px); position: sticky; top: 0; z-index: 30; }
.masthead .wrap { display: flex; align-items: center; gap: 40px; height: 64px; }
.wordmark { display: flex; align-items: baseline; gap: 10px; }
.wordmark b { font-size: 21px; font-stretch: 125%; font-weight: 800; letter-spacing: -0.02em; }
.wordmark span { font-size: 13px; color: var(--ink-3); }
nav { display: flex; gap: 28px; overflow-x: auto; scrollbar-width: none; }
nav a { font-size: 14px; color: var(--ink-2); padding: 21px 0 19px; border-bottom: 2px solid transparent; white-space: nowrap; }
nav a:hover { color: var(--ink); }
nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
.freshness { margin-left: auto; font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.freshness i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--pos); margin-right: 8px; vertical-align: 1px; }

main { padding-block: 64px 112px; outline: none; }
.page { display: grid; gap: 72px; }
footer { border-top: 1px solid var(--line); padding-block: 28px 48px; color: var(--ink-3); font-size: 13px; }
footer p { max-width: 72ch; }
footer a { text-decoration: underline; text-underline-offset: 2px; }
.loading, .empty { color: var(--ink-3); padding: 40px 0; }

/* Page intro */
.intro { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 64px; align-items: end; }
.intro h1 { font-size: clamp(36px, 4.6vw, 58px); line-height: 0.98; }
.intro p { color: var(--ink-2); font-size: 16px; max-width: 46ch; }

/* Section header */
.sec-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.sec-head h2 { font-size: 22px; font-stretch: 125%; font-weight: 800; letter-spacing: -0.015em; }
.sec-head p { color: var(--ink-3); font-size: 13px; max-width: 60ch; }
.note { color: var(--ink-3); font-size: 13px; margin-top: 14px; max-width: 72ch; }

/* League ribbon */
.ribbon { position: relative; }
.ribbon svg { display: block; width: 100%; height: auto; overflow: visible; }
.ribbon .dot { cursor: pointer; }
.ribbon .lbl { font: 600 12px var(--font); fill: var(--ink); }
.ribbon .lbl-v { font: 500 12px var(--font); fill: var(--ink-3); }
.ribbon .tick { font: 12px var(--font); fill: var(--ink-3); font-variant-numeric: tabular-nums; }

/* Controls */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; margin-bottom: 6px; }
.search { position: relative; }
.search input { font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: 999px; padding: 8px 14px 8px 34px; width: 240px; max-width: 100%; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
select { font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: 999px; padding: 8px 14px; }
.pills { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-2); }
.pills button { border: 0; background: none; font-size: 13px; font-weight: 500; color: var(--ink-2); padding: 6px 13px; border-radius: 999px; cursor: pointer; }
.pills button:hover { color: var(--ink); }
.pills button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.count { margin-left: auto; font-size: 13px; color: var(--ink-3); }

/* Leaderboard */
.board { width: 100%; border-collapse: collapse; }
.board th { font-size: 12px; font-weight: 500; color: var(--ink-3); text-align: right; padding: 12px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.board th.l, .board td.l { text-align: left; }
.board th button { all: unset; cursor: pointer; }
.board th[aria-sort="descending"], .board th[aria-sort="ascending"] { color: var(--ink); }
.board th[aria-sort="descending"] button::after { content: "↓"; margin-left: 3px; }
.board th[aria-sort="ascending"] button::after { content: "↑"; margin-left: 3px; }
.board td { padding: 10px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; font-size: 14px; }
.board tbody tr { cursor: pointer; }
.board tbody tr:hover td { background: var(--row); }
.board .rank { width: 44px; text-align: left; font-stretch: 125%; font-weight: 700; color: var(--ink-3); font-size: 15px; }
.board .rating { font-size: 19px; font-stretch: 125%; font-weight: 800; letter-spacing: -0.015em; }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who .name { font-weight: 600; font-size: 15px; display: block; }
.who .sub { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.chip { display: inline-block; width: 8px; height: 8px; border-radius: 2px; flex: none; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--line); overflow: hidden; flex: none; position: relative; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--ink-3); }
.avatar img { position: absolute; left: -15%; top: 4%; width: 130%; height: auto; }
.bar { display: inline-block; position: relative; width: 108px; height: 6px; vertical-align: middle; }
.bar::before { content: ""; position: absolute; left: 50%; top: -5px; bottom: -5px; width: 1px; background: var(--line-2); }
.bar span { position: absolute; top: 0; height: 6px; border-radius: 3px; }
.delta { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; min-width: 46px; text-align: center; }
.delta.pos { background: var(--pos-soft); }
.delta.neg { background: var(--neg-soft); }
.spark { display: block; margin-left: auto; }

/* Player */
.hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 36px; align-items: end; }
.player-top { display: grid; gap: 0; }
.portrait { width: 196px; height: 143px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; position: relative; display: grid; place-items: center; font-size: 48px; font-stretch: 125%; font-weight: 800; color: var(--line-2); }
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.team-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.hero h1 { font-size: clamp(36px, 5.6vw, 68px); line-height: 0.95; margin: 10px 0 0; }
.figures { display: flex; flex-wrap: wrap; gap: 10px 56px; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.fig .k { font-size: 12px; color: var(--ink-3); display: block; }
.fig .v { display: block; font-size: 40px; line-height: 1.05; font-stretch: 125%; font-weight: 800; letter-spacing: -0.02em; margin-top: 2px; }
.fig.lead .v { font-size: 56px; }
.fig .s { display: block; font-size: 12px; color: var(--ink-3); margin-top: 4px; }

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--line); }
.chart .zero { stroke: var(--line-2); }
.chart .tick { font: 12px var(--font); fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.chart .season { stroke: var(--line-2); }
.chart .season-label { font: 500 12px var(--font); fill: var(--ink-3); }
.chart .cross { stroke: var(--ink-3); stroke-width: 1; }
.legend { display: flex; gap: 18px; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; min-height: 20px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 16px; height: 2px; border-radius: 1px; display: inline-block; }

.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 56px; }
.blend h3 { font-size: 15px; font-weight: 600; display: flex; justify-content: space-between; align-items: baseline; }
.blend h3 b { font-size: 28px; font-stretch: 125%; font-weight: 800; letter-spacing: -0.015em; }
.seg-bar { display: flex; gap: 2px; height: 28px; margin: 14px 0 12px; }
.seg-bar span { border-radius: 4px; display: flex; align-items: center; padding: 0 10px; font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; min-width: 2px; }
.blend dl { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 10px; font-size: 13px; color: var(--ink-2); margin: 0; }
.blend dt { display: flex; align-items: center; gap: 7px; }
.blend dt i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.blend dd { margin: 0; text-align: right; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

.groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 56px; }
.group h3 { font-size: 12px; font-weight: 500; color: var(--ink-3); padding: 10px 0 8px; border-bottom: 1px solid var(--line-2); display: grid; grid-template-columns: minmax(0, 1fr) 64px 140px 34px; gap: 14px; }
.group h3 span:nth-child(n+2) { text-align: right; }
.group h3 span:nth-child(3) { text-align: center; }
.stat-row { display: grid; grid-template-columns: minmax(0, 1fr) 64px 140px 34px; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.stat-row .v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-row .p { text-align: right; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pctl { position: relative; height: 12px; }
.pctl::before { content: ""; position: absolute; left: 0; right: 0; top: 5px; height: 2px; border-radius: 1px; background: var(--line); }
.pctl .med { position: absolute; top: 0; width: 1px; height: 12px; background: var(--line-2); left: 50%; }
.pctl .dot { position: absolute; top: 1px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 2px var(--bg); }

.log { width: 100%; border-collapse: collapse; font-size: 13px; }
.log th { font-weight: 500; color: var(--ink-3); text-align: right; padding: 10px 8px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.log td { text-align: right; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.log .l { text-align: left; }
.scroll { overflow-x: auto; }

/* Teams */
.team-head, .team-row { display: grid; grid-template-columns: 44px minmax(140px, 1.3fr) minmax(0, 2.4fr) 64px 64px 76px; gap: 16px; align-items: center; }
.team-head { font-size: 12px; color: var(--ink-3); padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.team-head .n { text-align: right; }
.team-row { padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.team-row:hover { background: var(--row); }
.team-row .rank { font-stretch: 125%; font-weight: 700; color: var(--ink-3); padding-left: 4px; }
.team-name { display: flex; align-items: center; gap: 10px; font-weight: 600; min-width: 0; }
.team-name .chip { width: 10px; height: 10px; border-radius: 3px; }
.team-name small { font-weight: 400; color: var(--ink-3); font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-bar { position: relative; height: 22px; }
.team-bar::before { content: ""; position: absolute; left: 50%; top: -8px; bottom: -8px; width: 1px; background: var(--line-2); }
.team-bar span { position: absolute; top: 4px; height: 14px; border-radius: 4px; }
.team-bar b { position: absolute; top: 0; font-size: 14px; font-weight: 800; font-stretch: 125%; line-height: 22px; }
.team-row .n { text-align: right; font-size: 14px; font-variant-numeric: tabular-nums; }
.roster { display: none; padding: 8px 0 24px 60px; border-bottom: 1px solid var(--line); }
.roster.open { display: block; }
.roster table { width: 100%; max-width: 640px; border-collapse: collapse; font-size: 13px; }
.roster th { font-weight: 500; color: var(--ink-3); text-align: right; padding: 6px 8px; }
.roster td { text-align: right; padding: 7px 8px; border-top: 1px solid var(--line); }
.roster .l { text-align: left; }
.roster a:hover { text-decoration: underline; }

/* Prose */
.prose { display: grid; gap: 16px; max-width: 66ch; font-size: 16px; color: var(--ink-2); }
.prose h2 { color: var(--ink); font-size: 24px; font-stretch: 125%; font-weight: 800; letter-spacing: -0.015em; margin-top: 28px; }
.prose strong { color: var(--ink); font-weight: 600; }

/* Tooltip */
.tooltip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: var(--surface); border-radius: 10px; padding: 9px 12px; font-size: 13px; line-height: 1.45; max-width: 260px; box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.45); }
.tooltip b { font-weight: 600; }
.tooltip .row { display: flex; justify-content: space-between; gap: 14px; }
.tooltip i { display: inline-block; width: 10px; height: 2px; border-radius: 1px; margin-right: 6px; vertical-align: 3px; }
.tooltip .t { opacity: 0.7; }

@media (max-width: 860px) {
  .intro { grid-template-columns: 1fr; gap: 16px; }
  .split, .groups { grid-template-columns: 1fr; }
  .hide-md { display: none; }
  .team-head, .team-row { grid-template-columns: 32px minmax(100px, 1fr) minmax(0, 1.6fr) 60px; }
}
@media (max-width: 600px) {
  .freshness, .wordmark span { display: none; }
  .masthead .wrap { gap: 22px; }
  nav { gap: 18px; }
  main { padding-block: 40px 80px; }
  .page { gap: 48px; }
  .hero { grid-template-columns: 1fr; gap: 20px; }
  .portrait { width: 132px; height: 96px; }
  .figures { gap: 10px 32px; }
  .fig.lead .v { font-size: 44px; }
  .fig .v { font-size: 30px; }
  .hide-sm { display: none; }
  .stat-row, .group h3 { grid-template-columns: minmax(0, 1fr) 56px 90px 30px; }
  .roster { padding-left: 0; }
}
