/* Double Elimination Bracket Generator. Design notes in DESIGN.md (version 2). */

@font-face {
  font-family: "Geist";
  src: url("/fonts/geist-latin-wght-normal.woff2") format("woff2-variations"), url("/fonts/geist-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* ---------- Theme tokens: light by default, dark from the device or the switch ---------- */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f2f6f4;
  --tint: #eef4f1;
  --border: #dbe4df;
  --border-strong: #bfcdc6;
  --ink: #12372a;
  --text: #2a3a34;
  --muted: #5b6b64;
  --accent: #1f6b4c;
  --accent-hover: #17573d;
  --accent-ink: #ffffff;
  --accent-soft: #e2f0e8;
  --lb: #b4662a;
  --footer-bg: #12372a;
  --footer-text: #c5d8cf;
  --footer-ink: #ffffff;
  --shadow: 0 1px 2px rgba(18, 55, 42, 0.05), 0 10px 30px rgba(18, 55, 42, 0.06);
  --shadow-hover: 0 2px 4px rgba(18, 55, 42, 0.06), 0 14px 34px rgba(18, 55, 42, 0.09);
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --bg: #0e1613;
  --surface: #141e1a;
  --surface-2: #1a2621;
  --tint: #111b17;
  --border: #24342d;
  --border-strong: #3a4d44;
  --ink: #e6f0eb;
  --text: #c9d8d1;
  --muted: #93a59d;
  --accent: #6cc39a;
  --accent-hover: #88d1ad;
  --accent-ink: #0b1611;
  --accent-soft: #183126;
  --lb: #e2a15a;
  --footer-bg: #0a100d;
  --footer-text: #93a59d;
  --footer-ink: #e6f0eb;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 2px 6px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1613;
  --surface: #141e1a;
  --surface-2: #1a2621;
  --tint: #111b17;
  --border: #24342d;
  --border-strong: #3a4d44;
  --ink: #e6f0eb;
  --text: #c9d8d1;
  --muted: #93a59d;
  --accent: #6cc39a;
  --accent-hover: #88d1ad;
  --accent-ink: #0b1611;
  --accent-soft: #183126;
  --lb: #e2a15a;
  --footer-bg: #0a100d;
  --footer-text: #93a59d;
  --footer-ink: #e6f0eb;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 2px 6px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

/* ---------- Base ---------- */
::selection { background: var(--accent-soft); color: var(--ink); }
input, textarea { caret-color: var(--accent); }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
/* Links inside running text need more than colour to stand out */
main :is(p:not(.crumbs), td, dd) a,
main :is(ul, ol):not(.count-cards) > li a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
main :is(p:not(.crumbs), td, dd) a:hover,
main :is(ul, ol):not(.count-cards) > li a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.icon { width: 16px; height: 16px; flex: none; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip-link:focus { left: 8px; }

/* ---------- Header ---------- */
.site-header .wrap { display: flex; align-items: center; gap: 24px; padding-top: 18px; padding-bottom: 18px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-name { display: block; font-weight: 600; font-size: 16px; line-height: 1.2; letter-spacing: -0.01em; }
.brand-sub { display: block; font-size: 12px; color: var(--muted); line-height: 1.3; }
.nav { margin-left: auto; display: flex; gap: 22px; font-size: 15px; }
.nav a { color: var(--muted); }
.nav a:hover { color: var(--ink); text-decoration: none; }
@media (max-width: 640px) {
  .nav, .site-header .brand-sub { display: none; }
  .site-header .theme-toggle { margin-left: auto; }
  .site-header .brand-name { font-size: 15px; }
  .hero { padding: 28px 20px 24px; }
  .lede { font-size: 17px; }
}

.header-cta { padding: 8px 14px; min-height: 36px; }
@media (max-width: 640px) { .site-header .header-cta { display: none; } }
.theme-toggle { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.theme-toggle button {
  width: 30px; height: 30px; border: 0; border-radius: 999px; background: transparent;
  color: var(--muted); display: grid; place-items: center; cursor: pointer;
}
.theme-toggle button:hover { color: var(--ink); }
.theme-toggle button[aria-pressed="true"] { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--border); }

/* ---------- Hero ---------- */
.hero { max-width: 820px; margin: 0 auto; padding: 36px 20px 36px; text-align: center; }
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.pill {
  display: inline-block; font-size: 13px; font-weight: 550; color: var(--ink);
  padding: 5px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
}
h1, h2, h3 { color: var(--ink); }
h1 {
  font-size: clamp(38px, 5.6vw, 58px);
  line-height: 1.08;
  font-weight: 500;
  letter-spacing: -0.035em;
  margin: 18px 0 16px;
  text-wrap: balance;
}
h1 span { color: var(--accent); }
.lede { font-size: 19px; line-height: 1.55; color: var(--text); max-width: 640px; margin: 0 auto; text-wrap: pretty; }
.badges { list-style: none; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; margin-top: 22px; font-size: 14px; color: var(--muted); }
.badges li { display: inline-flex; align-items: center; gap: 6px; }
.badges .icon { color: var(--accent); width: 15px; height: 15px; }

/* ---------- Tool card ---------- */
.tool-outer { padding: 0 20px; }
.tool {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
@media (min-width: 1080px) {
  .tool { grid-template-columns: 280px minmax(0, 1fr); }
  .setup { border-right: 1px solid var(--border); }
}
@media (max-width: 1079px) { .setup { border-bottom: 1px solid var(--border); } }

/* Teams panel */
.setup { background: var(--surface); }
.setup > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 6px; font-weight: 600; font-size: 16px;
}
.setup:not([open]) > summary { padding-bottom: 18px; }
.setup > summary::-webkit-details-marker { display: none; }
.setup > summary::after {
  content: ""; width: 8px; height: 8px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg); margin-top: -4px; transition: transform 0.15s;
}
.setup[open] > summary::after { transform: rotate(225deg); margin-top: 4px; }
@media (min-width: 1080px) { .setup > summary { pointer-events: none; } .setup > summary::after { display: none; } }
.setup-body { padding: 10px 20px 22px; display: grid; gap: 18px; }
.label { display: block; font-size: 13px; font-weight: 550; color: var(--ink); margin-bottom: 6px; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.link-btn { border: 0; background: none; padding: 6px 4px; margin: -6px -4px; font-size: 13px; color: var(--muted); cursor: pointer; }
.link-btn:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.hint { font-size: 13px; color: var(--muted); line-height: 1.45; margin-top: 6px; }

.stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--bg); }
.stepper button { width: 42px; border: 0; background: transparent; font-size: 18px; color: var(--muted); cursor: pointer; }
.stepper button:hover { color: var(--ink); background: var(--surface-2); }
.stepper input {
  width: 56px; text-align: center; border: 0; border-inline: 1px solid var(--border);
  font-weight: 650; font-size: 18px; background: var(--surface); padding: 6px 0;
  -moz-appearance: textfield; appearance: textfield; font-variant-numeric: tabular-nums;
}
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.names-wrap { position: relative; }
.gutter { position: absolute; top: 1px; left: 1px; bottom: 1px; width: 30px; overflow: hidden; pointer-events: none; }
.gutter-inner { padding-top: 10px; font-size: 12px; line-height: 26px; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.gutter-inner span { display: block; }
textarea {
  display: block;
  width: 100%;
  min-height: 224px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px 10px 36px;
  font-size: 14px;
  line-height: 26px;
  background: var(--bg);
  color: var(--ink);
  white-space: pre;
  overflow-x: auto;
}
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  font-size: 14px; font-weight: 500; padding: 8px 13px; border-radius: 10px; cursor: pointer;
  line-height: 1.2; min-height: 38px; white-space: nowrap;
}
.btn { transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; background: var(--surface); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary { box-shadow: 0 1px 2px rgba(18, 55, 42, 0.15), 0 4px 12px rgba(31, 107, 76, 0.18); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: 0 1px 2px rgba(18, 55, 42, 0.15); transform: translateY(1px); }
.btn-ghost { border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--ink); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

.switch { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; cursor: pointer; color: var(--ink); }
.switch input { appearance: none; flex: none; width: 34px; height: 20px; border-radius: 999px; background: var(--border-strong); position: relative; cursor: pointer; margin-top: 1px; transition: background 0.15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(14px); }
.switch small { display: block; color: var(--muted); font-size: 13px; }

/* Board */
.board { min-width: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.seg button { border: 0; background: transparent; min-height: 32px; padding: 6px 12px; border-radius: 9px; color: var(--muted); }
.seg button:hover { background: transparent; color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), inset 0 0 0 1px var(--border); }
@media (max-width: 560px) { .toolbar .hide-sm { display: none; } }
.status-line { padding: 14px 18px 0; font-size: 14px; color: var(--muted); }
.status-line strong { color: var(--ink); font-weight: 600; }
.podium { list-style: none; padding: 8px 18px 0; display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 15px; font-weight: 550; }
.podium span { color: var(--muted); font-weight: 500; margin-right: 4px; }
.podium li:first-child span { color: var(--accent); }

.scroller {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 18px 22px;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: var(--border-strong) transparent;
  background:
    linear-gradient(to right, var(--surface) 30%, transparent) left / 40px 100% no-repeat local,
    linear-gradient(to left, var(--surface) 30%, transparent) right / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.12), transparent) left / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.12), transparent) right / 12px 100% no-repeat scroll;
}
.swipe-hint { display: none; font-size: 13px; color: var(--muted); padding: 8px 18px 0; }
@media (max-width: 760px) { .swipe-hint { display: block; } }

/* ---------- Bracket ---------- */
.bsec { margin-top: 18px; width: max-content; }
.bsec-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 8px; position: sticky; left: 0; width: max-content; max-width: calc(100vw - 80px); }
.bsec-head h2 { font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.bsec-head h2::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.bsec-l .bsec-head h2::before { background: var(--lb); }
.bsec-head p { font-size: 13px; color: var(--muted); }
.bsec-l { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--border); }

.bsec-canvas { position: relative; }
.lines { position: absolute; inset: 0; overflow: visible; }
.lines path { fill: none; stroke: var(--border-strong); stroke-width: 1.25; }
.lines path.dash { stroke-dasharray: 3 4; }
.round {
  position: absolute; top: 4px; width: 172px;
  font-size: 12px; font-weight: 550; color: var(--muted);
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
}

.game {
  position: absolute; width: 172px; height: 58px; display: flex;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 1px 2px rgba(27, 28, 25, 0.04);
}
.game { transition: border-color 0.15s, box-shadow 0.15s; }
.game:hover { border-color: var(--border-strong); box-shadow: var(--shadow-hover); }
.game.done { border-color: var(--border-strong); }
.gnum {
  flex: none; width: 30px; display: grid; place-items: center;
  font-size: 11px; font-weight: 600; color: var(--muted);
  border-right: 1px solid var(--border); font-variant-numeric: tabular-nums;
}
.final .gnum { color: var(--accent); }
.slots { flex: 1; min-width: 0; display: grid; grid-template-rows: 1fr 1fr; }
.slot {
  display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0; height: 28px;
  padding: 0 8px 0 6px; border: 0; background: transparent; text-align: left;
  font-size: 13.5px; font-weight: 500; color: var(--ink); line-height: 1;
}
.slot + .slot { border-top: 1px solid var(--border); }
.slots .slot:first-child { border-radius: 0 9px 0 0; }
.slots .slot:last-child { border-radius: 0 0 9px 0; }
.slot .seed { flex: none; width: 16px; text-align: right; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.slot .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot.tbd .name { color: var(--muted); font-weight: 400; font-size: 13px; }
button.slot { cursor: pointer; }
button.slot:hover { background: var(--surface-2); }
button.slot:focus-visible { outline-offset: -2px; }
.slot.won { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
button.slot.won:hover { background: var(--accent-soft); }
.slot.won::after {
  content: ""; margin-left: auto; flex: none; width: 9px; height: 5px;
  border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg) translateY(-2px);
}
/* Bye tag: this team skipped round 1 */
.slot .bye {
  flex: none; margin-left: auto; font-size: 11px; font-weight: 550; line-height: 1;
  color: var(--muted); border: 1px solid var(--border-strong); border-radius: 999px; padding: 2px 6px 3px;
}
.slot.won .bye { color: var(--accent); border-color: currentColor; opacity: 0.8; }
.slot.has-bye::after { margin-left: 2px; }
.slot.lost { color: var(--muted); }
.game.skipped { opacity: 0.45; }

.fcap { position: absolute; font-size: 12px; font-weight: 550; line-height: 1; color: var(--muted); white-space: nowrap; }
.champ {
  position: absolute; width: 172px; height: 58px; border: 1.5px dashed var(--border-strong); border-radius: 10px;
  background: transparent; padding: 0 14px; display: flex; align-items: center;
}
.champ-name { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.champ:not(.crowned) .champ-name { color: var(--muted); font-weight: 400; font-size: 13px; }
.champ.crowned { border: 1.5px solid var(--accent); background: var(--accent-soft); color: var(--accent); }

/* Game list view */
.game-list { list-style: none; padding: 14px 18px 22px; display: grid; gap: 10px; }
.lg {
  display: grid; grid-template-columns: 44px 1fr auto; grid-template-areas: "num round status" "num teams teams";
  gap: 4px 12px; align-items: center; padding: 10px 12px 12px 0;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
}
.lg-num { grid-area: num; align-self: stretch; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--muted); border-right: 1px solid var(--border); margin: -10px 0 -12px; }
.lg-round { grid-area: round; font-size: 13px; font-weight: 550; color: var(--muted); }
.lg-status { grid-area: status; font-size: 13px; color: var(--muted); }
.lg.done .lg-status { color: var(--accent); font-weight: 600; }
.lg-teams { grid-area: teams; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.lg-teams .slot { border: 1px solid var(--border); border-radius: 8px; height: 38px; }
.lg-teams .slot + .vs + .slot { border-top: 1px solid var(--border); }
.lg-teams .slot.won { border-color: transparent; }
.lg .vs { font-size: 12px; color: var(--muted); }
.lg.skipped { opacity: 0.5; }

/* ---------- Content ---------- */
.content { max-width: 720px; margin: 0 auto; padding: 96px 20px 0; }
.content > section { padding: 0 0 96px; }
/* Full-width tinted band behind a section inside the narrow column */
.content > section.band-tint {
  background: var(--tint);
  box-shadow: 0 0 0 100vmax var(--tint);
  clip-path: inset(0 -100vmax);
  padding-top: 96px;
  margin-bottom: 96px;
}
.content h2 { font-size: clamp(28px, 3.6vw, 38px); line-height: 1.15; font-weight: 500; letter-spacing: -0.025em; margin-bottom: 16px; text-wrap: balance; }
.content h3 { font-size: 19px; font-weight: 550; margin: 32px 0 8px; }
.content p, .content li { color: var(--text); font-size: 17px; line-height: 1.7; }
.content p { margin-bottom: 14px; }
.content strong { color: var(--ink); font-weight: 600; }
.content ol, .content ul { padding-left: 1.25em; margin-bottom: 14px; }
.content li { margin-bottom: 8px; padding-left: 4px; }
.content li::marker { color: var(--accent); font-weight: 600; }

/* ---------- Cards ---------- */
.content .step-cards, .content .count-cards { list-style: none; padding: 0; }
.content .count-cards li { margin: 0; padding: 0; }
.content .step-cards li { margin: 0; padding: 20px; }
/* Three-up card rows get more room than the 720px text column on desktop */
@media (min-width: 1040px) {
  .content .step-cards, .content .info-cards:not(.stack) { margin-left: -120px; margin-right: -120px; }
}
.step-cards, .info-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 22px 0; }
.info-cards.stack { grid-template-columns: 1fr; }
.step-cards { counter-reset: step; }
.step-cards li, .info-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 20px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.step-cards li:hover, .info-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-hover); }
.step-cards li { counter-increment: step; }
.step-cards li::before {
  content: counter(step); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 14px; margin-bottom: 14px;
}
.content .step-cards h3, .content .info-card h3 { font-size: 17px; font-weight: 550; margin: 0 0 6px; }
.content .step-cards p, .content .info-card p { font-size: 15.5px; line-height: 1.6; margin: 0; }
.info-card h3 { display: flex; align-items: center; gap: 8px; }
.info-card h3::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--accent); }
.info-l h3::before { background: var(--lb); }
.info-f h3::before { background: var(--ink); }

.count-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 18px 0 20px; }
.count-cards a {
  display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.count-cards a:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.count-cards strong { color: var(--ink); font-size: 17px; font-weight: 600; margin-bottom: 2px; }
.count-cards span { font-size: 13.5px; color: var(--muted); line-height: 1.4; }
.count-cards a[aria-current="page"] { border-color: var(--accent); background: var(--accent-soft); }
.count-cards a[aria-current="page"] strong { color: var(--accent); }

.table-wrap { overflow-x: auto; margin: 18px 0 20px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: 0; }
th { font-size: 12.5px; font-weight: 550; color: var(--muted); background: var(--surface-2); }
td { color: var(--ink); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.note { border: 1px solid var(--border); background: var(--surface); padding: 14px 18px; border-radius: 14px; margin: 20px 0; font-size: 15px; color: var(--muted); }
.faq h2 { margin-bottom: 20px; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; margin-bottom: 10px; }
.faq summary {
  cursor: pointer; list-style: none; padding: 16px 48px 16px 18px; font-weight: 550; font-size: 16px; color: var(--ink); position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before, .faq summary::after {
  content: ""; position: absolute; right: 20px; top: 50%; width: 12px; height: 1.5px; background: var(--accent);
  transition: transform 0.2s;
}
.faq summary::after { transform: rotate(90deg); }
.faq details[open] summary::after { transform: rotate(0deg); }
.faq details { transition: border-color 0.15s; }
.faq details:hover { border-color: var(--border-strong); }
.faq details p { padding: 0 18px 16px; margin: 0; font-size: 16px; }

/* Text for screen readers only */
.vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---------- Footer: dark band closes the page ---------- */
.site-footer { background: var(--footer-bg); color: var(--footer-text); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; padding-top: 44px; padding-bottom: 52px; font-size: 14px; }
.site-footer .brand { color: var(--footer-ink); }
.site-footer .brand-mark { background: var(--footer-ink); color: var(--footer-bg); }
.site-footer p { margin-top: 12px; max-width: 46ch; }
.site-footer a { color: var(--footer-ink); }
.site-footer p a { text-decoration: underline; text-underline-offset: 3px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: flex-start; }
.site-footer nav a { color: var(--footer-text); }
.site-footer nav a:hover { color: var(--footer-ink); }
.legal .site-footer, .notfound + .site-footer { margin-top: 96px; }

/* ---------- Legal and 404 ---------- */
.legal main { max-width: 720px; margin: 0 auto; padding: 32px 20px 0; }
.legal h1 { font-size: clamp(32px, 5vw, 44px); margin-top: 8px; }
.legal h2 { font-size: 21px; font-weight: 550; margin: 32px 0 8px; }
.legal p, .legal li { color: var(--text); font-size: 16.5px; line-height: 1.65; margin-bottom: 10px; }
.legal ul { padding-left: 1.25em; }
.notfound { max-width: 640px; margin: 0 auto; padding: 72px 20px; text-align: center; }
.notfound p { color: var(--text); font-size: 18px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(8px);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px;
  font-size: 14px; z-index: 20; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.print-only { display: none; }

/* Touch screens: bigger targets for every control except the bracket slots
   (the Game list view has large slots for running an event on a phone). */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .seg button { min-height: 40px; }
  .theme-toggle button { width: 40px; height: 40px; }
  .stepper button { width: 48px; }
  .stepper input { min-height: 44px; }
  .lg-teams .slot { height: 44px; }
  .site-footer nav a { padding: 10px 0; }
  button, a, summary, input { touch-action: manipulation; }
}
@media (max-width: 480px) {
  .badges { display: none; }
  .lg-teams { grid-template-columns: 1fr; }
  .lg .vs { text-align: center; }
}

/* ---------- Print: only the bracket, black on white, landscape ---------- */
@page { size: landscape; margin: 10mm; }
@media print {
  :root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
    --bg: #fff; --surface: #fff; --surface-2: #fff; --border: #999; --border-strong: #666;
    --ink: #000; --muted: #444; --accent: #000; --accent-soft: #fff; --lb: #000; color-scheme: light;
  }
  html, body { background: #fff; color: #000; }
  body > *:not(main), main > *:not(.tool-outer), .tool > *:not(.board), .board > *:not(.print-area),
  .skip-link, .toolbar, .status-line, .swipe-hint, .game-list-wrap, .podium { display: none !important; }
  .tool-outer, .tool { display: block; padding: 0; margin: 0; border: 0; box-shadow: none; border-radius: 0; max-width: none; overflow: visible; }
  .print-area, .print-area[hidden] { display: block !important; }
  .print-only { display: block; }
  .print-title { font-size: 20pt; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 2pt; }
  .print-sub { font-size: 10pt; color: #444; margin-bottom: 8pt; }
  .scroller { overflow: visible; padding: 0; background: none; }
  .bsec { break-inside: avoid; width: auto; margin-top: 8pt; }
  .bsec-l { border-top: 1px dashed #999; }
  body.print-split .bsec-l { break-before: page; border-top: 0; }
  .print-svg { display: block; overflow: visible; }
  .game { box-shadow: none; border-color: #777; }
  .slot.won { font-weight: 700; }
  .slot.blank .name { font-size: 10px; color: #777; margin-left: auto; }
  .slot.blank.has-bye .name { margin-left: 0; }
  .slot .bye { color: #444; border-color: #777; }
  .champ { border: 1.5px solid #000; }
}
