/* Fair Americano: big targets, high contrast, readable in sunlight. System fonts only (no third-party requests). */
:root {
  --bg: #f4f6f2; --card: #ffffff; --ink: #0d1b14; --muted: #4a5a51; --line: #cdd6cf;
  --brand: #0f3d2e; --brand-ink: #ffffff; --accent: #e8ff3a; --ok: #0a7a3d; --warn: #9a5b00; --bad: #b3261e;
  --focus: #1a4fd6; --radius: 14px; --tap: 56px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1410; --card: #13211b; --ink: #f1f6f2; --muted: #b5c4ba; --line: #2c3d34;
    --brand: #1f6b4f; --accent: #e8ff3a; --ok: #49d17f; --warn: #ffc25a; --bad: #ff8a80; --focus: #8fb8ff; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1410; --card: #13211b; --ink: #f1f6f2; --muted: #b5c4ba; --line: #2c3d34;
  --brand: #1f6b4f; --accent: #e8ff3a; --ok: #49d17f; --warn: #ffc25a; --bad: #ff8a80; --focus: #8fb8ff; color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 18px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.top :focus-visible, body.tv :focus-visible { outline-color: #fff; }
h2.h3 { font-size: 19px; margin: 16px 0 8px; }

.top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--brand); color: var(--brand-ink);
  padding-top: max(10px, env(safe-area-inset-top)); }
.brand { display: flex; align-items: center; gap: 8px; min-height: 44px; text-decoration: none; font-weight: 800; font-size: 19px; }
.brand img { border-radius: 8px; background: #fff; }
.sync { margin-left: auto; font-size: 14px; font-weight: 600; }
.sync.live::before { content: "● "; color: #6dff9e; }
.sync.offline::before, .sync.err::before { content: "● "; color: #ffb4a8; }
.sync.syncing::before { content: "● "; color: var(--accent); }
.lang select { min-height: 44px; font-size: 16px; border-radius: 10px; border: 0; padding: 0 8px; font-weight: 700; }

main { flex: 1; width: 100%; max-width: 820px; margin: 0 auto; padding: 16px; }
main:focus, h1[tabindex="-1"]:focus { outline: none; }
.foot { padding: 16px; font-size: 15px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; text-align: center; }
.foot-links { display: flex; flex-wrap: wrap; gap: 0 14px; justify-content: center; }
.foot-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; }

h1 { font-size: 28px; line-height: 1.15; margin: 8px 0 12px; }
h2 { font-size: 22px; margin: 22px 0 10px; }
h3 { font-size: 19px; margin: 16px 0 8px; }
p { margin: 8px 0; }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.center { text-align: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); min-width: var(--tap); padding: 0 18px; border-radius: 12px; border: 2px solid var(--brand);
  background: var(--card); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
button.primary, .btn.primary { background: var(--brand); color: var(--brand-ink); }
button.big, .btn.big { width: 100%; min-height: 68px; font-size: 21px; }
button.warn { border-color: var(--warn); }
button.danger { border-color: var(--bad); color: var(--bad); }
button.ghost { border-color: transparent; background: transparent; text-decoration: underline; min-height: 48px; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:active:not(:disabled) { transform: scale(.98); }

input, select, textarea {
  font: inherit; font-size: 18px; color: var(--ink); background: var(--card); border: 2px solid var(--line); border-radius: 12px;
  min-height: var(--tap); padding: 8px 12px; width: 100%;
}
textarea { min-height: 180px; line-height: 1.5; }
label.field { display: block; font-weight: 700; margin: 14px 0 6px; }
label.field.check { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.hint { font-size: 15px; color: var(--muted); font-weight: 400; }

.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.choice { display: block; position: relative; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice span { display: block; min-height: var(--tap); padding: 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); font-weight: 700; }
.choice small { display: block; font-weight: 400; color: var(--muted); font-size: 14px; margin-top: 2px; }
.choice input:checked + span { border-color: var(--brand); box-shadow: inset 0 0 0 2px var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--card)); }
.choice input:focus-visible + span { outline: 3px solid var(--focus); }

.stepper { display: flex; align-items: center; gap: 10px; }
.stepper output { min-width: 48px; text-align: center; font-size: 26px; font-weight: 800; }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 4px -16px 8px; padding: 0 16px 4px; scrollbar-width: none; }
.tabs button { flex: 0 0 auto; min-height: 48px; border-width: 2px; border-color: var(--line); border-radius: 999px; font-size: 16px; padding: 0 14px; }
.tabs button[aria-selected="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

.court { border: 2px solid var(--line); border-radius: var(--radius); background: var(--card); padding: 14px; margin: 12px 0; }
.court.mine { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand) inset; }
.court.conflict { border-color: var(--bad); }
.court-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.court-name { font-weight: 800; font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.score { font-size: 30px; font-weight: 900; font-variant-numeric: tabular-nums; }
.team { font-size: 21px; font-weight: 700; margin: 4px 0; overflow-wrap: anywhere; }
.vs { color: var(--muted); font-size: 15px; font-weight: 700; }
.sitting { padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 35%, var(--card)); color: var(--ink); }
.banner { border-radius: 12px; padding: 14px; margin: 12px 0; font-weight: 600; }
.banner.bad { background: color-mix(in srgb, var(--bad) 14%, var(--card)); border: 2px solid var(--bad); }
.banner.info { background: color-mix(in srgb, var(--brand) 10%, var(--card)); border: 2px solid var(--brand); }
.banner.warn { background: color-mix(in srgb, var(--warn) 14%, var(--card)); border: 2px solid var(--warn); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 14px; font-weight: 700; background: var(--line); }
.pill.launch { background: var(--accent); color: #111; }

table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 6px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
td.name { white-space: normal; }
th:nth-child(2), td:nth-child(2) { text-align: left; }
th { font-size: 14px; color: var(--muted); }
td.name { font-weight: 700; min-width: 6.5em; overflow-wrap: break-word; }
tr.out td { opacity: .55; }
.scroll { overflow-x: auto; }

.next { font-size: 22px; }
.next .big { font-size: 34px; font-weight: 900; }
.qr { width: min(280px, 80vw); background: #fff; padding: 8px; border-radius: 12px; }
.qr svg { display: block; width: 100%; height: auto; }
.linkbox { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; word-break: break-all; padding: 10px; border: 1px dashed var(--line); border-radius: 10px; }

/* score entry sheet: never closes on an outside tap */
.sheet { position: fixed; inset: 0; background: var(--bg); z-index: 50; display: flex; flex-direction: column; padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); overflow-y: auto; }
.sheet h2 { margin: 6px 0; }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.side { border: 3px solid var(--line); border-radius: var(--radius); padding: 10px; text-align: center; background: var(--card); min-height: 140px; }
.side[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand) inset; }
.side .names { font-size: 16px; font-weight: 700; min-height: 2.6em; overflow-wrap: anywhere; display: block; }
.side .num { font-size: 64px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; display: block; }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.pad button { min-height: 64px; font-size: 28px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: auto; }

.dialog { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 60; display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
.dialog .card { width: 100%; max-width: 520px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 70;
  background: var(--ink); color: var(--bg); border-radius: 14px; padding: 10px 12px 10px 18px; display: flex; gap: 12px; align-items: center;
  max-width: calc(100vw - 32px); font-weight: 600; }
.toast button { min-height: 48px; background: var(--accent); color: #111; border: 0; }

.timer { font-size: 40px; font-weight: 900; font-variant-numeric: tabular-nums; }
.timer.done { color: var(--bad); }

/* TV: readable at 4 m */
body.tv { background: #06120d; color: #fff; }
body.tv .top, body.tv .foot { display: none; }
body.tv main { max-width: none; padding: 2vh 2vw; }
.tv-grid { display: grid; grid-template-columns: 1fr minmax(28vw, 34vw); gap: 2vw; height: 96vh; }
.tv-head { display: flex; align-items: baseline; gap: 2vw; font-size: 4.2vh; font-weight: 900; }
.tv-head .tv-title { font-size: inherit; margin: 0; line-height: inherit; }
.tv-head .timer { font-size: 7vh; margin-left: auto; color: var(--accent); }
.tv-head .timer.done { color: #ff8a80; }
.tv-courts { display: grid; gap: 1.6vh; grid-template-columns: repeat(auto-fit, minmax(30vw, 1fr)); align-content: start; margin-top: 1.5vh; }
.tv-court { background: #10261d; border: 3px solid #2d5a47; border-radius: 2vh; padding: 1.4vh 1.6vh; }
.tv-court .cn { font-size: 2.6vh; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; }
.tv-court .tm { font-size: 4.2vh; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.tv-court .sc { font-size: 5vh; font-weight: 900; float: right; font-variant-numeric: tabular-nums; }
.tv-court .vs { color: #9fc2b2; font-size: 2.4vh; }
.tv-sit { font-size: 3.2vh; margin-top: 1.5vh; color: #d9f5e6; }
.tv-side { display: flex; flex-direction: column; gap: 1.5vh; min-height: 0; }
.tv-table { font-size: 3.1vh; }
.tv-table td, .tv-table th { border-color: #234436; padding: .5vh .6vw; }
.tv-table th { color: #9fc2b2; font-size: 2.2vh; }
.tv-join { display: flex; gap: 1.5vw; align-items: center; margin-top: auto; font-size: 2.6vh; }
.tv-join .qr { width: 22vh; }
.tv-start { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.7); z-index: 80; }
.tv-start button { font-size: 4vh; min-height: 12vh; padding: 0 6vw; background: var(--accent); color: #111; border: 0; }
@media (max-aspect-ratio: 1/1) { .tv-grid { grid-template-columns: 1fr; height: auto; } }

@media print {
  .top, .foot, .tabs, button, .no-print { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .card, .court { border: 1px solid #999; break-inside: avoid; }
}
.toast[hidden], [hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  button:active:not(:disabled) { transform: none; }
}

/* Printable schedule pages (en/…, sv/…), generated by tools/build_seo_pages.js */
.seo .top .seo-langlink { margin-left: auto; display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; font-weight: 700; }
.seo-facts li { margin: 6px 0; }
.seo-cta { margin: 18px 0 4px; }
.seo-scroll { overflow-x: auto; margin: 8px 0 16px; }
.seo-scroll:focus-visible { outline-offset: -3px; }
.seo-sched th, .seo-sched td { text-align: left; white-space: normal; }
.seo-team { white-space: nowrap; }
.seo-sched th[scope="row"] { text-align: center; width: 3.5em; }
.seo-per th, .seo-per td { text-align: center; white-space: normal; }
.seo-matrix { width: auto; }
.seo-matrix th, .seo-matrix td { text-align: center; padding: 6px 4px; min-width: 2.2em; font-size: 16px; }
.seo-matrix th { color: var(--ink); }
.seo-matrix td.seo-self { background: var(--line); }
@media print {
  .seo .seo-cta, .seo .seo-cta + p { display: none !important; }
  .seo-scroll { overflow: visible; }
  .seo th, .seo td { padding: 3px 4px; font-size: 10pt; color: #000; }
}
