@font-face { font-family: "Saira Condensed"; src: url("fonts/saira-condensed-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #ffffff;
  --ink: #14161a;
  --muted: #545b64;
  --line: #dde1e5;
  --line-strong: #858c95;
  --wash: #f2f4f6;          /* gym-floor grey behind the rounds */
  --orange: #c2410c;        /* court line / ball orange, AA on white */
  --orange-fill: #f26b1d;   /* decoration only */
  --orange-soft: #fdebdf;
  --on-orange: #ffffff;
  --focus: #1d63d6;
  --radius: 6px;
  --head: "Saira Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101418;
    --ink: #e8ebee;
    --muted: #a6aeb8;
    --line: #2a3138;
    --line-strong: #6b747e;
    --wash: #181d22;
    --orange: #ff8f4f;
    --orange-fill: #f26b1d;
    --orange-soft: #33221a;
    --on-orange: #14161a;
    --focus: #7fb0ff;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--orange); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 5; }
.skip:focus { left: 8px; }

.top { border-top: 6px solid var(--orange-fill); }
.top, main, .foot { max-width: 880px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.brand { display: inline-flex; align-items: center; gap: 8px; padding: 14px 0 4px; color: var(--ink); text-decoration: none; font: 700 22px/1 var(--head); letter-spacing: .01em; }
.brand .logo { color: var(--orange-fill); }

h1, h2, h3 { font-family: var(--head); font-weight: 700; line-height: 1.1; letter-spacing: .005em; }
h1 { font-size: clamp(34px, 7vw, 50px); margin: 14px 0 8px; max-width: 18ch; }
h2 { font-size: 30px; margin: 40px 0 10px; }
h3 { font-size: 22px; margin: 22px 0 6px; }
.lede { margin: 0 0 18px; max-width: 62ch; color: var(--ink); font-size: 18px; }
p { max-width: 68ch; }
.crumbs { font-size: 15px; color: var(--muted); padding-top: 6px; }
.crumbs a { color: var(--muted); }

/* ---------- form ---------- */
.form { display: grid; gap: 14px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend, label, .focus-label { font-weight: 600; font-size: 15px; }
.seg legend { margin-bottom: 6px; }
.seg-row { display: flex; gap: 6px; flex-wrap: wrap; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.seg span {
  display: grid; place-items: center; min-width: 48px; height: 48px; padding: 0 10px;
  border: 2px solid var(--line-strong); border-radius: var(--radius); cursor: pointer;
  font: 700 24px/1 var(--head); font-variant-numeric: tabular-nums;
}
.seg input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--bg); box-shadow: inset 0 -4px 0 var(--orange-fill); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.seg input:disabled + span { opacity: .35; cursor: not-allowed; }
.seg[hidden] { display: none; }
.row { display: flex; flex-wrap: wrap; gap: 12px; }
.field { display: grid; gap: 4px; }
.field.grow { flex: 1 1 260px; }
input[type="text"], input[type="number"], input[type="time"], select {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--bg);
  border: 1.5px solid var(--line-strong); border-radius: var(--radius); padding: 0 10px; height: 46px; min-width: 0;
}
#minutes { width: 8.5em; }
#start { width: 9.5em; }
select { padding-right: 6px; max-width: 100%; }
.more summary, .entry summary { cursor: pointer; font-weight: 600; padding: 8px 0; color: var(--orange); }
.more-body { display: grid; gap: 14px; padding: 6px 0 4px; }
.name-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 14px; margin-top: 6px; }
.name-grid label { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.name-grid span { font: 700 20px/1 var(--head); width: 1.2em; text-align: right; color: var(--muted); }
.name-grid input { flex: 1; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 400; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--orange); }

/* ---------- result ---------- */
.result { margin-top: 22px; border-top: 3px solid var(--ink); padding-top: 4px; }
.res-title { margin: 14px 0 4px; font-size: 32px; }
.res-facts { margin: 0 0 10px; }
.pool-list { list-style: none; padding: 0; margin: 0 0 10px; }
.pool-list li { margin: 2px 0; }
.note { background: var(--orange-soft); padding: 10px 12px; border-radius: var(--radius); margin: 10px 0; }
.linkish { font: inherit; color: var(--orange); background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; text-align: left; min-height: 24px; }
.focus { margin: 14px 0 6px; }
.focus-label { margin: 0 0 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: 15px; color: var(--ink); background: var(--bg); border: 1.5px solid var(--line-strong); border-radius: 999px; padding: 0 14px; min-height: 40px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.focus-text { margin: 8px 0 0; min-height: 1.55em; }

.sched { list-style: none; margin: 12px 0 0; padding: 0; }
.round { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.round:first-child { border-top: 1px solid var(--line); }
.when { display: grid; align-content: start; }
.time { font: 700 22px/1.1 var(--head); font-variant-numeric: tabular-nums; }
.rnd { font-size: 14px; color: var(--muted); }
.games { display: grid; gap: 6px; }
.game { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; padding: 4px 8px; margin-left: -8px; border-radius: var(--radius); border-left: 4px solid transparent; }
.court { font: 700 16px/1.4 var(--head); color: var(--orange); min-width: 4.3em; }
.teams { font-weight: 600; font-size: 18px; }
.v { color: var(--muted); font-weight: 400; padding: 0 2px; }
.work { color: var(--muted); font-size: 15px; display: inline-flex; gap: 5px; align-items: center; }
.ico { flex: none; }
.focusing .game { opacity: .45; }
.focusing .game.is-play, .focusing .game.is-work { opacity: 1; }
.game.is-play { border-left-color: var(--orange-fill); background: var(--wash); }
.game.is-work { background: var(--orange-soft); }
.game.is-work .work { color: var(--ink); font-weight: 600; }
.game.later .teams { font-weight: 500; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 18px 0 6px; }
.btn { font: inherit; font-weight: 600; min-height: 46px; padding: 0 16px; border-radius: var(--radius); border: 1.5px solid var(--line-strong); background: var(--bg); color: var(--ink); cursor: pointer; }
.btn.primary { background: var(--orange); border-color: var(--orange); color: var(--on-orange); }
.toast { font-size: 15px; color: var(--muted); overflow-wrap: anywhere; }
.alt { margin: 12px 0 0; padding-left: 12px; border-left: 3px solid var(--line-strong); }

/* ---------- scores ---------- */
.scores .hint, .hint { color: var(--muted); font-size: 15px; margin: 4px 0 10px; }
#method { width: 100%; max-width: 560px; }
.standings { border-collapse: collapse; width: 100%; margin-top: 14px; font-variant-numeric: tabular-nums; }
.standings th, .standings td { padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--line); }
.standings thead th { font-size: 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid var(--ink); }
.standings tbody th { font-weight: 600; overflow-wrap: anywhere; }
.standings .pl { width: 3.5em; font: 700 20px/1 var(--head); }
.standings thead .pl { font: 600 14px/1.2 system-ui, sans-serif; }
.standings tr.tied .pl { color: var(--orange); }
.standings caption { text-align: left; font: 700 22px/1.2 var(--head); padding: 10px 0 2px; }
#standings .standings + .standings { margin-top: 18px; }
.tb { margin: 10px 0 0; padding-left: 20px; font-size: 15px; }
.tb li { margin: 4px 0; max-width: 68ch; }
.entry { margin-top: 14px; }
.entry summary { font-size: 18px; }
.sc { padding: 12px 0; border-bottom: 1px solid var(--line); }
.sc-h { margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.sc-h .no { font: 700 18px/1 var(--head); }
.sc-meta { color: var(--muted); font-size: 15px; }
.res { font-weight: 600; color: var(--orange); font-size: 15px; }
.sc-g { display: grid; grid-auto-flow: column; grid-template-rows: auto minmax(44px, auto) minmax(44px, auto); grid-template-columns: minmax(0, 8.5em) repeat(3, 3.4em); gap: 6px; align-items: center; }
.sc-g.sets-2 { grid-template-columns: minmax(0, 8.5em) repeat(2, 3.4em); }
.sc-g.sets-1 { grid-template-columns: minmax(0, 8.5em) 4.2em; }
.sc-s { font-size: 14px; color: var(--muted); font-weight: 600; }
.sc-n { color: var(--ink); font-size: 16px; font-weight: 700; overflow-wrap: anywhere; padding-right: 4px; }
.sc-g input { width: 100%; height: 44px; text-align: center; padding: 0 4px; font-variant-numeric: tabular-nums; }
.warn { margin: 4px 0 0; font-size: 15px; color: var(--orange); }
.warn:empty { display: none; }
.saved-line { font-size: 15px; color: var(--muted); margin-top: 14px; }

/* ---------- content ---------- */
.content p, .content li { max-width: 68ch; }
.bracket { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; max-width: 560px; }
.bracket li { display: grid; grid-template-columns: 7.5em 1fr; gap: 0 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.bracket .m { font: 700 18px/1.3 var(--head); grid-row: span 2; }
.bracket .w { color: var(--muted); font-size: 15px; }
.faq h3 { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 18px; font-weight: 700; margin: 20px 0 4px; line-height: 1.3; }
.faq p { margin: 0; }
.sizes h2 { font-size: 24px; }
.sizes ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.sizes li { min-height: 32px; }

.foot { margin-top: 48px; padding-top: 18px; padding-bottom: 32px; border-top: 1px solid var(--line); font-size: 15px; color: var(--muted); }
.foot a { color: var(--muted); }

.sheet { display: none; }

@media (max-width: 560px) {
  .round { grid-template-columns: 76px 1fr; gap: 8px; }
  .time { font-size: 19px; }
  .standings .opt { display: none; }
  .standings th, .standings td { padding: 8px 4px; }
  .bracket li { grid-template-columns: 1fr; }
  .bracket .m { grid-row: auto; }
}
@media (max-width: 360px) {
  .seg span { min-width: 42px; }
  .seg-row { gap: 5px; }
  .round { grid-template-columns: 1fr; gap: 2px; }
  .when { display: flex; gap: 10px; align-items: baseline; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* ---------- print: the pool sheet only ---------- */
@page { margin: 12mm; }
@media print {
  :root { --ink: #000; --bg: #fff; --muted: #333; --line: #999; }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  .top, .crumbs, h1, .lede, .tool, .scores, .content, .sizes, .foot, .skip { display: none !important; }
  main { max-width: none; padding: 0; }
  .sheet { display: block; }
  .sh-head h2 { font: 700 20pt/1.1 var(--head); margin: 0 0 2pt; }
  .sh-head p { margin: 0 0 3pt; max-width: none; }
  .sh-blanks { display: flex; gap: 18pt; margin-top: 6pt !important; }
  .sh-blanks span { flex: 1; border-bottom: 1px solid #000; padding-bottom: 1pt; max-width: 2.6in; }
  .sh-table { width: 100%; border-collapse: collapse; margin-top: 8pt; font-variant-numeric: tabular-nums; }
  .sh-table th, .sh-table td { border: 1px solid #555; padding: 3pt 5pt; text-align: left; }
  .sh-table thead th { background: #eee; font-size: 9pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sh-table tbody.m { break-inside: avoid; page-break-inside: avoid; }
  .sh-table td.no { font: 700 13pt/1 var(--head); text-align: center; width: 0.35in; }
  .sh-table td.t { white-space: nowrap; width: 0.8in; }
  .sh-table td.ct, .sh-table th.ct { text-align: center; width: 0.5in; }
  .sh-table td.tn { font-weight: 600; height: 0.3in; }
  .sh-table .box { width: 0.6in; text-align: center; font-size: 12pt; }
  .sh-table td.wk { width: 1.3in; }
  .sh-table thead th.box { font-size: 9pt; }
  .sh-table.dense th, .sh-table.dense td { padding-top: 1.5pt; padding-bottom: 1.5pt; }
  .sh-table.dense td.tn { height: 0.22in; }
  .sh-table.dense td.no { font-size: 11pt; }
  .sh-table.xdense th, .sh-table.xdense td { padding-top: 0.5pt; padding-bottom: 0.5pt; font-size: 9.5pt; }
  .sh-table.xdense td.tn { height: 0.2in; }
  .sheet .standings thead .pl { font: 600 8.5pt/1.2 system-ui, sans-serif; }
  .sh-bottom { display: grid; grid-template-columns: 1fr 1.35fr; gap: 14pt; margin-top: 10pt; break-inside: avoid; page-break-inside: avoid; }
  .sh-key, .sheet .standings { width: 100%; border-collapse: collapse; font-size: 9.5pt; margin: 0; }
  .sh-key th, .sh-key td, .sheet .standings th, .sheet .standings td { border: 1px solid #555; padding: 2pt 4pt; text-align: left; }
  .sh-key thead th, .sheet .standings thead th { background: #eee; color: #000; font-size: 8.5pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sheet .standings td { height: 0.23in; }
  .sheet .standings .opt { display: table-cell; }
  .sheet .standings .pl { font: 700 11pt/1 var(--head); width: 0.45in; }
  .sh-standings h3 { display: none; }
  .sheet .standings caption { font: 700 11pt/1.2 var(--head); padding: 0 0 1pt; }
  .sheet .standings + .standings { margin-top: 5pt; }
  .sh-table td.tbd { font-weight: 400; font-style: italic; }
  .sh-table tr.stage th { background: none; border-left: 0; border-right: 0; padding: 6pt 0 2pt; font: 700 12pt/1.1 var(--head); }
  .sh-tb { font-size: 8.5pt; margin: 3pt 0 0; max-width: none; }
}
