:root {
  --court: #1d4ea0;      /* hall floor blue */
  --court-deep: #143a7a;
  --paint: #ffffff;      /* court line paint */
  --tape: #f6c90e;       /* marking-tape yellow, used for Slaymar only */
  --ink: #16202e;
  --floor: #eef1f5;      /* page background */
  --muted: #5b6777;
  --rule: #d5dbe3;
  --win: #1f8a4c;
  --loss: #c23b2b;
  --draw: #7a8494;
  --display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--floor);
  color: var(--ink);
  font: 400 1rem/1.5 var(--body);
}
a { color: inherit; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--tape); outline-offset: 2px; }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* ---------- Hero: the court ---------- */
.court {
  position: relative;
  overflow: hidden;
  background: var(--court);
  color: var(--paint);
  padding: 40px 0 32px;
}
.lines {
  position: absolute; inset: 0; width: 100%; height: 100%;
  fill: none; stroke: rgba(255,255,255,.16); stroke-width: 1.5;
}
.hero { position: relative; }

.brand { display: flex; align-items: center; gap: clamp(10px, 3vw, 24px); }
.brand-logo { width: clamp(84px, 20vw, 170px); height: auto; flex: none; filter: drop-shadow(0 6px 14px rgba(0,0,0,.35)); }
.crest {
  margin: 0;
  font: 900 clamp(4rem, 17vw, 9.5rem)/.82 var(--display);
  letter-spacing: -.01em;
  text-transform: uppercase;
}
.crest span {
  display: inline-block;
  margin-left: .12em;
  font-size: .32em;
  vertical-align: top;
  margin-top: .2em;
  padding: .05em .25em;
  background: var(--tape);
  color: var(--ink);
}
.tagline { margin: 14px 0 28px; font-size: 1.05rem; color: rgba(255,255,255,.85); }

.board {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  border: 2px solid var(--paint);
}
.board section { padding: 18px 20px; }
.board .last { border-left: 2px solid var(--paint); background: var(--court-deep); }
.board h2 {
  margin: 0 0 6px;
  font: 600 1rem/1.2 var(--display);
  letter-spacing: .04em;
  color: rgba(255,255,255,.75);
}
.opp, .score {
  margin: 0;
  font: 800 clamp(2rem, 7vw, 3.2rem)/1 var(--display);
  text-transform: uppercase;
}
.opp::before { content: "vs "; font-weight: 600; opacity: .7; }
.opp.bye::before, .opp.tbc::before { content: none; }
.score { font-variant-numeric: tabular-nums; }
.when { margin: 8px 0 0; color: rgba(255,255,255,.85); }
.countdown {
  margin: 12px 0 0;
  display: inline-block;
  padding: 2px 8px;
  background: var(--tape);
  color: var(--ink);
  font-weight: 700;
}
.countdown:empty { display: none; }
.result-tag { font-weight: 700; }

/* ---------- Tabs ---------- */
.tabs {
  position: sticky; top: 0; z-index: 5;
  background: var(--ink);
}
.tabs-inner { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs-inner::-webkit-scrollbar { display: none; }
.tabs a {
  flex: none; padding: 12px 12px 9px;
  font: 700 1.15rem/1 var(--display); text-transform: uppercase; letter-spacing: .02em;
  color: rgba(255,255,255,.7); text-decoration: none;
  border-bottom: 3px solid transparent;
}
.tabs a:hover { color: #fff; }
.tabs a[aria-current] { color: #fff; border-bottom-color: var(--tape); }
.panel > .block:first-child { padding-top: 28px; }
.head .sub a { font-weight: 700; color: var(--ink); }

/* ---------- Sections ---------- */
main { padding-top: 8px; }
.block { padding: 40px 0 8px; }
.head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px;
  border-bottom: 3px solid var(--ink);
  padding-bottom: 6px; margin-bottom: 16px;
}
.head h2 { margin: 0; font: 800 2.2rem/1 var(--display); text-transform: uppercase; }
.sub { margin: 0; color: var(--muted); font-size: .95rem; }

/* ---------- Head to head ---------- */
.h2h-rec { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0 0 14px; }
.h2h-rec b { font: 800 1.6rem/1 var(--display); margin-right: 4px; font-variant-numeric: tabular-nums; }
.h2h-rec .w b { color: var(--win); }
.h2h-rec .l b { color: var(--loss); }
.h2h-games { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.h2h-games li {
  display: grid; justify-items: center; min-width: 3.6rem; padding: 6px 8px; color: #fff;
}
.h2h-games li.W { background: var(--win); }
.h2h-games li.L { background: var(--loss); }
.h2h-games li.D { background: var(--draw); }
.h2h-games .s { font: 800 1.15rem/1.1 var(--display); font-variant-numeric: tabular-nums; }
.h2h-games .d { font-size: .75rem; opacity: .9; }
.h2h-all { margin-top: 14px; }
.h2h-all summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
.h2h-all .ladder td:first-child { white-space: normal; }

/* ---------- Ladder ---------- */
.table-scroll { overflow-x: auto; }
.ladder { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ladder th {
  font: 600 .95rem/1 var(--display);
  letter-spacing: .03em;
  color: var(--muted);
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--rule);
}
.ladder td { padding: 10px 6px; border-bottom: 1px solid var(--rule); }
.ladder .num { text-align: right; width: 2.6em; }
.ladder td.pts { font-weight: 700; }
.ladder tr.us td { background: var(--tape); font-weight: 700; border-bottom-color: var(--tape); }
.ladder tr.next-opp td:nth-child(2)::after {
  content: "Next"; margin-left: 8px; padding: 1px 6px;
  font-size: .75rem; font-weight: 700; background: var(--court); color: #fff; vertical-align: 1px;
}
.gd-pos { color: var(--win); }
.gd-neg { color: var(--loss); }
.ladder tr.us .gd-pos, .ladder tr.us .gd-neg { color: inherit; }

/* ---------- Results ---------- */
.results { list-style: none; margin: 0; padding: 0; }
.results li {
  display: grid;
  grid-template-columns: 2.4rem 7.5rem 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
}
.badge {
  display: grid; place-items: center;
  width: 2rem; height: 2rem;
  font: 800 1.1rem/1 var(--display); color: #fff;
}
.badge.W { background: var(--win); }
.badge.L { background: var(--loss); }
.badge.D { background: var(--draw); }
.r-date { color: var(--muted); font-size: .9rem; }
.r-score { font: 800 1.6rem/1 var(--display); font-variant-numeric: tabular-nums; }
.r-watch { grid-column: 3 / 5; font-size: .9rem; margin-top: -4px; }

/* Expandable results */
.results li.r-item { display: block; padding: 0; }
.r-item summary {
  display: grid; grid-template-columns: 2.4rem 7.5rem 1fr auto; align-items: center; gap: 12px;
  padding: 10px 0; cursor: pointer; list-style: none;
}
.r-item summary::-webkit-details-marker { display: none; }
.r-item summary:hover .r-opp { text-decoration: underline; text-underline-offset: 3px; }
.r-item details[open] summary { border-bottom: 0; }

.ball { width: 1em; height: 1em; flex: none; display: inline-block; vertical-align: -0.12em; }

.mc { margin: 2px 0 14px; background: var(--ink); color: #fff; }
.mc-top {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: 16px 14px; background: var(--court);
}
.mc-W .mc-top { box-shadow: inset 0 -4px 0 var(--win); }
.mc-L .mc-top { box-shadow: inset 0 -4px 0 var(--loss); }
.mc-D .mc-top { box-shadow: inset 0 -4px 0 var(--draw); }
.mc-team { font: 800 1.15rem/1.1 var(--display); text-transform: uppercase; }
.mc-team:first-child { text-align: right; }
.mc-score { display: grid; justify-items: center; padding: 6px 14px; background: var(--ink); }
.mc-score b { font: 900 2rem/1 var(--display); font-variant-numeric: tabular-nums; }
.mc-score small { font-size: .75rem; opacity: .75; margin-top: 2px; }
.mc-goals {
  display: grid; grid-template-columns: minmax(0, 1fr) 1.5rem minmax(0, 1fr); gap: 0 12px;
  padding: 16px 16px 6px; max-width: 560px; margin: 0 auto;
}
.mc-goals ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; align-content: start; }
.results .mc-goals li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0 10px; border: 0; padding: 0; line-height: 1.25; }
.mc-n { font-weight: 700; white-space: nowrap; }
.mc-us .mc-m { margin-left: auto; }
.mc-m {
  font: 800 1.1rem/1.25 var(--display); letter-spacing: .03em; font-variant-numeric: tabular-nums;
  color: rgba(255,255,255,.75); text-align: right; word-spacing: .15em;
}
.mc-them .mc-m { text-align: left; }
.results .mc-goals li.mc-miss { justify-content: flex-end; font-size: .8rem; color: rgba(255,255,255,.5); }
.mc-them li.mc-miss { justify-content: flex-start !important; }
.mc-ball { display: flex; justify-content: center; padding-top: 1px; }
.mc-ball .ball { width: 1.25rem; height: 1.25rem; }
.mc-meta { max-width: 528px; margin: 8px auto 0; padding: 10px 0 14px; border-top: 1px solid rgba(255,255,255,.1); text-align: center; font-size: .85rem; opacity: .7; }
.mc-watch {
  display: block; max-width: 528px; margin: 0 auto 14px; width: calc(100% - 28px); padding: 10px; text-align: center;
  background: var(--tape); color: var(--ink); font-weight: 700; text-decoration: none;
}
.scorers-line { display: flex; gap: 8px; align-items: baseline; margin: -4px 0 12px; color: var(--muted); }
.scorers-line b { color: var(--ink); }
.last-scorers { display: flex; gap: 6px; align-items: center; margin: 6px 0 0; font-size: .9rem; color: rgba(255,255,255,.85); }

.r-item details[open] > .mc { animation: mc-in .22s ease-out; }
@keyframes mc-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .r-item details[open] > .mc { animation: none; } }

/* ---------- Video ---------- */
.video-frame { position: relative; aspect-ratio: 16 / 9; background: var(--ink); }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-title { margin: 10px 0 0; font-weight: 700; }
.empty {
  padding: 24px; border: 2px dashed var(--rule); color: var(--muted);
}
.more-videos { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.more-videos:empty { display: none; }
.more-videos a { display: flex; gap: 12px; align-items: center; text-decoration: none; }
.more-videos img { width: 120px; aspect-ratio: 16/9; object-fit: cover; flex: none; }
.more-videos span { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Squad ---------- */
.squad {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 24px;
}
.squad li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--rule);
}
.squad .g { color: var(--muted); font-variant-numeric: tabular-nums; }

.cards {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px 12px;
}
.cards.small { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.card { display: grid; justify-items: center; gap: 4px; }
.card img { width: 100%; height: auto; display: block; }
.card.former img, .card.former .c-photo { position: relative; display: block; width: 100%; aspect-ratio: 427 / 440; overflow: hidden; background: linear-gradient(180deg, transparent 20%, rgba(29,78,160,.25)); }
.c-photo img { position: absolute; left: 50%; bottom: 13%; transform: translateX(-50%); height: 78%; width: auto; }
.c-photo span {
  position: absolute; left: 0; right: 0; bottom: 4%; padding: 4px 0; text-align: center;
  background: #1e9be0; color: #fff; font: 900 1.4rem/1 var(--display); text-transform: uppercase;
  transform: skewX(-12deg);
}
.cards.small .c-photo span { font-size: 1rem; }
.p-hero .p-photo { width: 100%; height: auto; max-height: 300px; object-fit: contain; object-position: bottom; }
.c-name { filter: grayscale(.85); opacity: .8; }
.c-games { color: var(--muted); font-size: .95rem; }
.c-photo { position: relative; display: block; width: 100%; aspect-ratio: 427 / 440; overflow: hidden; background: linear-gradient(180deg, transparent 20%, rgba(29,78,160,.25)); }
.c-photo img { position: absolute; left: 50%; bottom: 13%; transform: translateX(-50%); height: 78%; width: auto; }
.c-photo span {
  position: absolute; left: 0; right: 0; bottom: 4%; padding: 4px 0; text-align: center;
  background: #1e9be0; color: #fff; font: 900 1.4rem/1 var(--display); text-transform: uppercase;
  transform: skewX(-12deg);
}
.cards.small .c-photo span { font-size: 1rem; }
.p-hero .p-photo { width: 100%; height: auto; max-height: 300px; object-fit: contain; object-position: bottom; }
.c-name {
  display: grid; place-items: center; width: 100%; aspect-ratio: 427 / 440;
  font: 900 1.6rem/1 var(--display); text-transform: uppercase; color: #fff;
  background: linear-gradient(transparent 62%, #1e9be0 62%, #1e9be0 82%, transparent 82%), var(--court);
  clip-path: inset(18% 4% 18% 4%);
}
.c-career { color: var(--muted); font-size: .8rem; margin-top: -2px; }
.c-games b { font: 800 1.3rem/1 var(--display); color: var(--ink); margin-right: 2px; }
.sq-h { font: 800 1.4rem/1 var(--display); text-transform: uppercase; margin: 32px 0 12px; }
.sq-h.first { margin-top: 4px; }

/* Leaderboards */
.boards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 8px; }
.boards.one { grid-template-columns: minmax(0, 460px); }
.lb { background: var(--ink); color: #fff; padding: 14px 14px 6px; }
.lb h3 { margin: 0 0 8px; font: 800 1.4rem/1 var(--display); text-transform: uppercase; }
.lb ol { list-style: none; margin: 0; padding: 0; }
.lb li button {
  width: 100%; display: grid; grid-template-columns: 1.6rem 48px 1fr auto; align-items: center; gap: 10px;
  padding: 7px 0; background: none; border: 0; border-top: 1px solid rgba(255,255,255,.1);
  color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.lb li:first-child button { border-top: 0; }
.lb li button:hover .b-name { text-decoration: underline; text-underline-offset: 3px; }
.b-rank { opacity: .7; text-align: center; font-variant-numeric: tabular-nums; }
.lb img, .t-init { width: 48px; height: 48px; display: block; object-fit: cover; }
.t-init { background: var(--court); }
.t-init { display: grid; place-items: center; font: 800 1.3rem/1 var(--display); }
.b-name { font-weight: 700; display: grid; }
.b-name small { font-weight: 400; opacity: .65; font-size: .8rem; }
.b-val { font: 900 1.6rem/1 var(--display); font-variant-numeric: tabular-nums; }
.lb-empty { opacity: .7; margin: 4px 0 12px; }
.sq-hint { margin: -6px 0 14px; color: var(--muted); font-size: .9rem; }
.card button { display: grid; justify-items: center; gap: 4px; width: 100%; padding: 0; background: none; border: 0; font: inherit; color: inherit; cursor: pointer; }
.card button:hover img { transform: translateY(-3px); }
.card img { transition: transform .15s ease; }

/* Player dialog */
.pdlg {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0;
  background: var(--floor); color: var(--ink); overflow: auto; position: fixed;
}
.pdlg form { margin: 0; }
.pdlg::backdrop { background: rgba(10,20,40,.7); }
.pdlg-x {
  position: absolute; top: 0; right: 0; z-index: 2; width: 44px; height: 44px; border: 0;
  background: var(--ink); color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer;
}
#pdlg-body { padding: 0 16px 20px; }
.p-hero { display: grid; grid-template-columns: 42% 1fr; gap: 16px; align-items: start; background: var(--court); color: #fff; margin: 0 -16px 8px; padding: 16px; }
.p-hero img { width: 100%; height: auto; display: block; }
.p-hero h2 { margin: 0; font: 900 2.4rem/1 var(--display); text-transform: uppercase; }
.p-status { margin: 2px 0 10px; opacity: .8; font-size: .9rem; }
.p-hero h3 { margin: 10px 0 4px; font: 700 .95rem/1 var(--display); letter-spacing: .03em; opacity: .8; }
.p-stats { display: flex; gap: 16px; flex-wrap: wrap; }
.p-stat { display: grid; }
.p-stat b { font: 900 1.9rem/1 var(--display); font-variant-numeric: tabular-nums; }
.p-stat span { font-size: .8rem; opacity: .8; }
#pdlg-body > h3 { font: 800 1.3rem/1 var(--display); text-transform: uppercase; margin: 18px 0 8px; }
.p-goals, .p-seasons { list-style: none; margin: 0; padding: 0; }
.p-goals li { display: grid; grid-template-columns: minmax(0, 1fr) auto 3rem; gap: 4px 14px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--rule); }
.p-opp { font-weight: 700; display: grid; }
.p-opp small { font-weight: 400; color: var(--muted); font-size: .8rem; }
.p-mins { font: 800 1.05rem/1.2 var(--display); letter-spacing: .03em; word-spacing: .15em; color: var(--muted); text-align: right; }
.p-count { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.p-count b { font: 900 1.4rem/1 var(--display); }
.p-seasons li { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--rule); }

.mc-mvp { margin: 6px 0 0; text-align: center; font-size: .85rem; color: rgba(255,255,255,.7); }
.mc-mvp b { color: var(--tape); font-weight: 700; margin-left: 4px; }
.p-num { display: inline-block; margin-right: 10px; padding: 0 8px; background: var(--tape); color: var(--ink); font-size: .8em; vertical-align: .1em; }
.p-honours { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.p-honours li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--ink); color: #fff; }
.p-honours img { width: 36px; height: 36px; flex: none; }
.p-honours span { display: grid; }
.p-honours b { color: var(--tape); font-weight: 700; }
.p-honours small { font-size: .8rem; opacity: .75; }
.p-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.p-table th { text-align: left; font: 600 .9rem/1 var(--display); color: var(--muted); padding: 6px 0; border-bottom: 1px solid var(--rule); }
.p-table td { padding: 8px 0; border-bottom: 1px solid var(--rule); }
.p-table .num { text-align: right; width: 4.2rem; }
.p-table td.num { font-weight: 700; }
.p-foot { margin: 8px 0 0; color: var(--muted); font-size: .8rem; }
.h-body .scorers-line { margin: 12px 0 0; }

/* ---------- History ---------- */
.history { list-style: none; margin: 0; padding: 0; }
.history > li { border-bottom: 1px solid var(--rule); }
.history > li > details > summary {
  display: grid; grid-template-columns: 9rem 1fr auto; gap: 2px 16px;
  padding: 12px 0; cursor: pointer; list-style: none;
}
.history > li > details > summary::-webkit-details-marker { display: none; }
.history > li > details > summary::before { content: "+"; grid-row: 1 / 3; grid-column: 3; justify-self: end; font: 800 1.4rem/1 var(--display); }
.history > li > details[open] > summary::before { content: "–"; }
.h-season { font: 800 1.2rem/1.2 var(--display); text-transform: uppercase; }
.h-comp { grid-column: 2; color: var(--muted); }
.h-pos { grid-column: 1; grid-row: 2; font-weight: 700; }
.h-rec { grid-column: 2; grid-row: 2; font-variant-numeric: tabular-nums; }
.h-body { padding: 4px 0 20px; }
.h-body .results { margin-top: 16px; }
.h-squad { color: var(--muted); font-size: .9rem; margin: 12px 0 0; }

/* ---------- Footer ---------- */
.foot { padding-top: 40px; padding-bottom: 40px; color: var(--muted); font-size: .9rem; }
.foot p { margin: 0 0 4px; }

@media (max-width: 640px) {
  .court { padding: 22px 0 18px; }
  .tagline { margin: 8px 0 16px; font-size: .95rem; }
  .board section { padding: 12px 14px; }
  .board .when { margin-top: 4px; }
  .countdown { margin-top: 8px; }
  .tabs-inner { justify-content: space-between; gap: 0; padding: 0 4px; }
  .tabs a { padding: 12px 6px 9px; font-size: 1.05rem; }
  .board { grid-template-columns: 1fr; }
  .board .last { border-left: 0; border-top: 2px solid var(--paint); }
  .ladder .opt { display: none; }
  .results li { grid-template-columns: 2.2rem 1fr auto; }
  .r-date { grid-column: 2; grid-row: 2; margin-top: -8px; }
  .r-opp { grid-column: 2; grid-row: 1; }
  .r-score { grid-column: 3; grid-row: 1 / 3; }
  .r-watch { grid-column: 2 / 4; }
  .r-item summary { grid-template-columns: 2.2rem 1fr auto; }
  .mc-team { font-size: 1rem; }
  .mc-score b { font-size: 1.7rem; }
  .mc-goals { grid-template-columns: minmax(0, 1.7fr) 1.4rem minmax(0, 1fr); gap: 0 10px; padding: 14px 14px 6px; }
  .history > li > details > summary { grid-template-columns: 1fr auto; }
  .boards { grid-template-columns: 1fr; }
  .p-hero { grid-template-columns: 38% 1fr; }
  .p-hero h2 { font-size: 2rem; }
  .p-goals li { grid-template-columns: minmax(0, 1fr) 3rem; }
  .p-mins { grid-column: 1; grid-row: 2; text-align: left; }
  .p-count { grid-column: 2; grid-row: 1 / 3; }
  .h-season { grid-column: 1; }
  .h-comp, .h-pos, .h-rec { grid-column: 1; grid-row: auto; }
  .history > li > details > summary::before { grid-row: 1; grid-column: 2; }
}
