:root {
  --navy: #1e3778;
  --navy-deep: #152a5c;
  --tint: #eef1f8;
  --page: #f5f6fa;
  --ink: #1a1f2e;
  --muted: #5b6478;
  --line: #dde2ec;
  --white: #fff;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--page);
}

a { color: var(--navy); }
:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; border-radius: 4px; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Masthead */
.masthead { background: var(--navy); color: var(--white); }
.masthead-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding-top: 18px; padding-bottom: 18px;
}
.brand { color: var(--white); text-decoration: none; display: flex; flex-direction: column; line-height: 1; }
.brand-org { font-weight: 600; font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.8; }
.brand-title {
  font-family: 'Anton', Impact, 'Arial Narrow', sans-serif; font-size: 34px;
  letter-spacing: 0.02em; text-transform: uppercase; margin-top: 6px;
}
.season-picker select {
  font: 600 15px 'Barlow', system-ui, sans-serif; letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--navy); background-color: var(--white); border: 0; border-radius: 20px;
  padding: 9px 38px 9px 16px; cursor: pointer; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231e3778' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}

/* Division pills */
.divisions {
  display: flex; gap: 10px; padding: 20px 0 4px; overflow-x: auto; scrollbar-width: none;
}
.divisions::-webkit-scrollbar { display: none; }
.pill {
  flex: none; font-weight: 600; font-size: 14px; letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--navy); background: var(--white); border: 1.5px solid var(--navy); border-radius: 20px;
  padding: 9px 20px; text-decoration: none;
}
.pill:hover { background: var(--tint); }
.pill[aria-current="page"] { background: var(--navy); color: var(--white); }
.pill.empty { border-style: dashed; opacity: 0.6; }

/* Category tabs */
.tabs {
  display: flex; gap: 4px; margin-top: 14px; border-bottom: 2px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; font-weight: 600; font-size: 14px; letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--muted); padding: 12px 14px; text-decoration: none;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tab:hover { color: var(--navy); }
.tab[aria-current="page"] { color: var(--navy); border-bottom-color: var(--navy); }

/* Page heading */
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 26px 0 16px; }
h1, h2, h3 { font-family: 'Anton', Impact, 'Arial Narrow', sans-serif; font-weight: 400; text-transform: uppercase; letter-spacing: 0.02em; color: var(--navy); }
.page-head h1 { font-size: 30px; margin: 0; line-height: 1.1; }
.status { color: var(--muted); font-size: 14px; }

.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.notice { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--muted); margin: 26px 0; }

/* Leaderboards */
.leader-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 16px; }
.leader { padding: 16px 18px 10px; }
.leader h2 { font-size: 19px; margin: 0 0 8px; display: flex; align-items: baseline; gap: 8px; }
.leader h2 .abbr { font-family: 'Barlow', system-ui, sans-serif; font-weight: 700; font-size: 12px; letter-spacing: 0.06em; color: var(--white); background: var(--navy); border-radius: 4px; padding: 2px 6px; }
.lb { list-style: none; margin: 0; padding: 0; }
.lb-row {
  display: grid; grid-template-columns: 2.4rem 1fr auto; align-items: baseline; gap: 8px;
  padding: 8px 0; border-top: 1px solid var(--line);
}
.lb-row:first-child { border-top: 0; }
.lb-rank { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-row.first .lb-rank { color: var(--navy); }
.lb-who a { color: var(--ink); font-weight: 600; text-decoration: none; }
.lb-who a:hover { color: var(--navy); text-decoration: underline; }
.lb-team { display: block; font-size: 13px; color: var(--muted); }
.lb-val { font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.lb-row.first .lb-val { font-size: 18px; }
.lb-row details { grid-column: 2 / 4; }
.lb-row summary { display: grid; grid-template-columns: 1fr auto; gap: 8px; cursor: pointer; list-style: none; }
.lb-row summary::-webkit-details-marker { display: none; }
.lb-row summary .tied { font-weight: 600; }
.lb-row summary .tied::after { content: ' ▾'; color: var(--muted); font-size: 12px; }
.lb-row details[open] summary .tied::after { content: ' ▴'; }
.tie-list { list-style: none; margin: 6px 0 2px; padding: 0 0 0 10px; border-left: 2px solid var(--tint); }
.tie-list li { padding: 3px 0; }
.tie-list a { color: var(--ink); text-decoration: none; font-weight: 500; }
.tie-list a:hover { color: var(--navy); text-decoration: underline; }
.tie-list .lb-team { display: inline; margin-left: 6px; }
.lb-none { color: var(--muted); padding: 8px 0 12px; margin: 0; }
.footnote { color: var(--muted); font-size: 13px; margin: 14px 0 0; }

/* Player stats table */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.toolbar input, .toolbar select {
  font: 500 15px 'Barlow', system-ui, sans-serif; color: var(--ink); background: var(--white);
  border: 1.5px solid var(--line); border-radius: 20px; padding: 8px 14px; min-width: 0;
}
.toolbar input { flex: 1 1 220px; max-width: 340px; }
.toolbar input:focus, .toolbar select:focus { border-color: var(--navy); outline: none; }
.toolbar .reset { font: 600 13px 'Barlow', system-ui, sans-serif; text-transform: uppercase; letter-spacing: 0.03em; color: var(--navy); background: none; border: 0; cursor: pointer; padding: 8px 4px; }
.toolbar .count { color: var(--muted); font-size: 14px; margin-left: auto; }

.table-scroll { overflow-x: auto; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
table.stats { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 15px; font-variant-numeric: tabular-nums; }
.stats th, .stats td { padding: 8px 9px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
.stats thead th { background: var(--tint); color: var(--navy); font-weight: 700; font-size: 13px; letter-spacing: 0.03em; }
.stats thead .groups th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); text-align: center; border-bottom: 0; padding-bottom: 0; }
.stats .gs { border-left: 1px solid var(--line); }
.stats .name { position: sticky; left: 0; z-index: 1; text-align: left; background: var(--white); min-width: 160px; box-shadow: inset -1px 0 var(--line); }
.stats thead .name { background: var(--tint); z-index: 2; }
.stats td.num { text-align: right; }
.stats td.jersey, .stats th.jersey { text-align: right; color: var(--muted); }
.stats .dim { color: #a3aabb; }
.stats tbody tr:hover td { background: var(--page); }
.stats tbody tr:hover td.name { background: var(--page); }
.stats td.name a { color: var(--ink); font-weight: 600; text-decoration: none; }
.stats td.name a:hover { color: var(--navy); text-decoration: underline; }
.stats .team-row th {
  text-align: left; background: var(--page); color: var(--navy); font-weight: 700; font-size: 13px;
  text-transform: uppercase; letter-spacing: 0.05em; padding-top: 14px;
}
.stats .team-row th span { position: sticky; left: 10px; }
.stats .team-row small { color: var(--muted); font-weight: 500; text-transform: none; letter-spacing: 0; margin-left: 6px; }
.sort-btn { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 3px; }
.sort-btn:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; }
.sort-btn::after { content: ''; width: 0.7em; font-size: 10px; }
th[aria-sort="ascending"] .sort-btn::after { content: '▲'; }
th[aria-sort="descending"] .sort-btn::after { content: '▼'; }

/* Player page */
.back { display: inline-block; margin: 22px 0 0; font-weight: 600; text-decoration: none; }
.back:hover { text-decoration: underline; }
.player-head { padding: 22px 24px; margin: 12px 0 16px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; }
.player-head h1 { margin: 0; font-size: 36px; line-height: 1.05; }
.player-head .jersey-big { font-family: 'Anton', Impact, sans-serif; font-size: 36px; color: var(--muted); }
.player-head .meta { width: 100%; color: var(--muted); font-weight: 500; }
.player-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 16px; align-items: start; }
.player-sec { padding: 16px 18px 8px; }
.player-sec h2 { font-size: 19px; margin: 0 0 6px; }
.kv { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.kv th, .kv td { padding: 7px 0; border-top: 1px solid var(--line); text-align: left; font-weight: 500; }
.kv tr:first-child th, .kv tr:first-child td { border-top: 0; }
.kv th { color: var(--ink); }
.kv th abbr { text-decoration: none; color: var(--muted); font-size: 13px; margin-left: 4px; }
.kv td.v { text-align: right; font-weight: 700; color: var(--navy); width: 4.5rem; }
.kv td.r { text-align: right; color: var(--muted); font-size: 14px; width: 5.5rem; }
.kv td.r.top { color: var(--navy); font-weight: 700; }

.footer { color: var(--muted); font-size: 13px; padding-top: 28px; padding-bottom: 36px; }
.footer a { font-weight: 600; }

@media (max-width: 640px) {
  .wrap { padding-left: 14px; padding-right: 14px; }
  .masthead-inner { padding-top: 14px; padding-bottom: 14px; }
  .brand-title { font-size: 26px; }
  .brand-org { font-size: 11px; }
  .season-picker select { font-size: 13px; padding: 8px 32px 8px 12px; }
  .page-head h1 { font-size: 24px; }
  .stats th, .stats td { padding: 7px 8px; font-size: 14px; }
  .stats .name { min-width: 140px; }
  .player-head h1, .player-head .jersey-big { font-size: 28px; }
  .toolbar .count { width: 100%; margin-left: 0; }
}
