/* Fonts are self-hosted so the site makes no third-party requests besides Sleeper. */
@font-face { font-family: "Big Shoulders Display"; font-weight: 800; font-display: swap; src: url(fonts/big-shoulders-display-latin-800-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url(fonts/barlow-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 700; font-display: swap; src: url(fonts/barlow-latin-700-normal.woff2) format("woff2"); }

/* Scoreboard: dark stadium board, amber numbers */
:root {
  --bg: #0a0c0b; --panel: #141816; --ink: #f6f3e8; --muted: #a9a89c; --line: #343c37;
  --accent: #ffb000; --win: #3ddc84; --loss: #ff5a4d; --bar: #2a302c; --l: 36%;
  --display: "Big Shoulders Display", Impact, sans-serif; --body: "Barlow", Arial, sans-serif;
  --rule: 2px solid var(--accent);
  color-scheme: dark;
}

/* ---- Phone first; wider screens are adjusted at the bottom ---- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.45 var(--body); }
.sheet { max-width: 1180px; margin: 0 auto; padding-bottom: env(safe-area-inset-bottom); }
.wrap { padding: 0 max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left)); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--panel); padding: 8px; z-index: 3; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; text-transform: uppercase; letter-spacing: 0.01em; line-height: 1; margin: 0; }
h1 { font-size: clamp(2.1rem, 10vw, 5rem); }
h2 { font-size: 1.7rem; }
h3 { font-size: clamp(2rem, 5vw, 3rem); }
h4 { font: 700 0.8rem/1.2 var(--body); text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); margin: 26px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--ink); }
.kicker { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent); margin: 0 0 6px; }
.meta, .lede { color: var(--muted); margin: 8px 0 0; }
.fine { color: var(--muted); font-size: 0.82rem; max-width: 75ch; }

.mast { display: flex; gap: 12px; align-items: center; padding-top: 18px; padding-bottom: 16px; border-bottom: var(--rule); }
.logo { width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--ink); flex: none; }

.statusbar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; font-size: 0.85rem; color: var(--muted); margin: 12px 0; }
.btn { font: 700 0.9rem var(--body); color: var(--ink); background: none; border: 2px solid var(--ink); border-radius: 2px; padding: 0 16px; min-height: 44px; cursor: pointer; }
.btn.solid { background: var(--ink); color: var(--bg); }
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: 0.4; cursor: default; }

section { border-top: var(--rule); padding: 20px 0 26px; }
.rphead { display: grid; gap: 10px; }
.rphead label { font-size: 0.85rem; color: var(--muted); }
select { font: 400 1rem var(--body); color: var(--ink); background: var(--panel); border: 2px solid var(--ink); border-radius: 2px; padding: 0 8px; min-height: 44px; width: 100%; }

/* ---- Teams & games ---- */
.av { width: 28px; height: 28px; border-radius: 50%; background: var(--bar); object-fit: cover; flex: none; display: inline-block; }
.nm { font-weight: 700; overflow-wrap: anywhere; }
.pts { font-family: var(--display); font-weight: 800; font-size: 1.45rem; font-variant-numeric: tabular-nums; margin-left: auto; color: var(--accent); }
.side:not(.lead) .pts { opacity: 0.75; }
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 10px; margin-top: 14px; }
.game { background: var(--panel); border: 1px solid var(--line); border-radius: 2px; padding: 4px 14px; }
.side { display: flex; align-items: center; gap: 10px; padding: 8px 0; color: var(--muted); }
.side + .side { border-top: 1px solid var(--line); }
.side.lead { color: var(--ink); }
.side small { color: var(--muted); white-space: nowrap; }
.side .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); margin: 8px 0 0; }

/* ---- Tables: swipe sideways, rank + team stay pinned ---- */
.scroll { overflow-x: auto; margin: 0 -14px; -webkit-overflow-scrolling: touch; --cell: var(--bg); }
#report .scroll { --cell: var(--panel); }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; font-size: 0.93rem; }
th, td { padding: 0 6px; height: 46px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
thead th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); border-bottom: 2px solid var(--ink); }
thead button { font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; background: none; border: 0; padding: 0; min-height: 44px; cursor: pointer; }
thead button:hover, th[aria-sort] button { color: var(--ink); }
.num { text-align: right; }
tbody th { font-weight: 400; }
tr > :first-child { position: sticky; left: 0; z-index: 1; background: var(--cell); width: 30px; min-width: 30px; padding: 0 6px 0 0; }
tr > :nth-child(2) { position: sticky; left: 30px; z-index: 1; background: var(--cell); padding-left: 4px; box-shadow: 1px 0 0 var(--line); }
.teambtn { display: inline-flex; align-items: center; gap: 8px; font: inherit; color: inherit; background: none; border: 0; padding: 0; min-height: 44px; text-align: left; }
.teambtn .nm { max-width: max(64px, calc(100vw - 300px)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.teambtn { cursor: pointer; }
button.teambtn:hover .nm, button.teambtn[aria-expanded="true"] .nm { text-decoration: underline; }
tr.in > td:first-child { box-shadow: inset 4px 0 0 var(--accent); }
.W { color: var(--win); }
.L { color: var(--loss); }
.pct { min-width: 56px; padding: 0 2px; }
.meter { display: block; position: relative; height: 30px; line-height: 30px; padding: 0 6px; border-radius: 2px; background: hsl(var(--h) 75% var(--l) / 0.2); overflow: hidden; }
.meter::before { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: hsl(var(--h) 75% var(--l)); }
.meter b { position: relative; }

tr.detail > td { position: static; width: auto; background: var(--panel); padding: 0; height: auto; box-shadow: none; }
.bars { position: sticky; left: 0; width: 100vw; max-width: 1180px; display: flex; gap: 6px; align-items: flex-end; list-style: none; margin: 0; padding: 10px 14px; height: 200px; overflow-x: auto; }
.bars li { flex: 1 0 56px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; font-size: 0.75rem; text-align: center; min-width: 0; }
.bars i { width: 100%; max-width: 44px; background: var(--win); margin: 3px 0; }
.bars i.L { background: var(--loss); }
.bars i.T { background: var(--muted); }
.bars .opp { color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Report ---- */
#report { margin: 18px -14px 0; background: var(--panel); border-block: 1px solid var(--line); padding: 20px 14px; }
.results { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 0 28px; }
.results li { border-bottom: 1px solid var(--line); padding: 2px 0; }
.results .side + .side { border-top: 0; padding-top: 0; }
.awards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 14px 28px; margin: 0; }
.awards dt { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 4px; }
.awards dd { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.note { flex-basis: 100%; color: var(--muted); font-size: 0.88rem; }
.printonly { display: none; }

footer { border-top: var(--rule); padding-top: 18px; padding-bottom: 28px; display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; justify-content: space-between; color: var(--muted); font-size: 0.85rem; }
footer p { margin: 0; }
.credit { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; color: var(--ink); text-decoration: none; font-size: 1rem; }
.credit:hover b { text-decoration: underline; }

/* ---- Wider screens ---- */
@media (min-width: 700px) {
  .wrap { padding: 0 20px; }
  .mast { gap: 18px; padding-top: 28px; padding-bottom: 22px; }
  .logo { width: 72px; height: 72px; }
  h2 { font-size: 1.9rem; }
  .kicker { font-size: 0.78rem; letter-spacing: 0.14em; }
  .rphead { display: flex; align-items: center; }
  .rphead h2 { margin-right: auto; }
  select { width: auto; }
  .scroll { margin: 0; }
  th, td { padding: 0 10px; }
  .pct { min-width: 84px; padding: 0 3px; }
  .teambtn .nm { max-width: none; }
  .bars { width: auto; padding: 10px 0; }
  #report { margin: 20px 0 0; border: 1px solid var(--line); border-radius: 2px; padding: 24px 20px; }
}

/* "Download report" prints just the report, in ink on white. */
@media print {
  :root { --bg: #fff; --panel: #fff; --ink: #000; --muted: #444; --line: #bbb; --accent: #000; --bar: #ddd; --win: #000; --loss: #000; --l: 68%; color-scheme: light; }
  .mast, .statusbar, main > section:not(#reports), .rphead, footer, .skip { display: none; }
  .sheet { max-width: none; }
  section, #report { border: 0; padding: 0; margin: 0; }
  .scroll { overflow: visible; margin: 0; }
  table { font-size: 0.72rem; }
  th, td { padding: 0 5px; height: 26px; }
  tr > :first-child, tr > :nth-child(2) { position: static; box-shadow: none; }
  tr.in > td:first-child { box-shadow: inset 3px 0 0 #000; }
  .teambtn { min-height: 0; }
  .teambtn .nm { max-width: none; }
  .pct { min-width: 0; padding: 0 2px; }
  .meter { height: 20px; line-height: 20px; }
  .meter, .meter::before { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .av { width: 18px; height: 18px; }
  h4 { margin-top: 16px; break-after: avoid; }
  h4, .awards div, .results li, tr { break-inside: avoid; }
  .printonly { display: block; }
}
