/* FairDink. Mobile first: organizers run this from a phone or tablet at the court, often in sun. */

:root {
  --bg: #f2f4f8;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --ink: #101a30;
  --muted: #566076;
  --line: #dde2ec;
  --navy: #0f1d3a;
  --ball: #d4f01e;
  --ball-hole: #7d9300;
  --primary: #14336f;
  --primary-ink: #ffffff;
  --team-a: #1b5fd0;
  --team-a-bg: #e7effc;
  --team-b: #c84a12;
  --team-b-bg: #fdeee5;
  --good: #116b3d; --good-bg: #dff5e7;
  --warn: #7a4d00; --warn-bg: #fff1cf;
  --bad: #a3231c; --bad-bg: #fde5e3;
  --info: #1d4f9c; --info-bg: #e6eefb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 26, 48, 0.06), 0 6px 20px rgba(16, 26, 48, 0.06);
  --chip-s: 68%; --chip-bg-l: 91%; --chip-fg-l: 24%;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a111e;
    --surface: #131c2d;
    --surface-2: #0f1726;
    --ink: #e9eef8;
    --muted: #9ba8c0;
    --line: #27334b;
    --navy: #0b1424;
    --primary: #d4f01e;
    --primary-ink: #141a00;
    --team-a: #7fb0ff;
    --team-a-bg: #14284b;
    --team-b: #ff9d6c;
    --team-b-bg: #40200f;
    --good: #7fe0a6; --good-bg: #0f3321;
    --warn: #ffd27a; --warn-bg: #3b2c08;
    --bad: #ff9b93; --bad-bg: #431512;
    --info: #9cc2ff; --info-bg: #13294a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --chip-s: 45%; --chip-bg-l: 22%; --chip-fg-l: 84%;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; }
code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; font-size: 0.9em; }
:focus-visible { outline: 3px solid var(--team-a); outline-offset: 2px; }

/* --- Shell --- */
.shell { min-height: 100vh; padding-bottom: 96px; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--navy); color: #fff;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.15rem; letter-spacing: -0.01em; text-decoration: none; margin-right: auto; }
.logo { width: 28px; height: 28px; }
.status { font-size: 0.78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); }
.status.live { background: var(--ball); color: #1a2200; }
.status.preview { background: #ffb020; color: #2b1a00; }
.undo { background: transparent; border: 1px solid rgba(255, 255, 255, 0.35); color: #fff; border-radius: 999px; padding: 6px 14px; font-weight: 600; min-height: 36px; }
.undo:disabled { opacity: 0.4; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 56px; text-decoration: none; font-weight: 650; font-size: 0.95rem; color: var(--muted);
  border-top: 3px solid transparent;
}
.tabs a.on { color: var(--ink); border-top-color: var(--primary); }
@media (max-width: 430px) {
  .tabs a { font-size: 0.8rem; gap: 3px; letter-spacing: -0.01em; }
  .tabs .count { min-width: 0; padding: 0 5px; font-size: 0.72rem; }
}

.page { max-width: 1120px; margin: 0 auto; padding: 16px; }
.page-alert { max-width: 1088px; margin: 12px auto 0; }
.page-notice { max-width: 1120px; margin: 12px auto 0; padding: 0 16px; }
.page-notice:empty { display: none; }
.page.narrow { max-width: 560px; }
.stack { display: grid; gap: 16px; }
.stack.tight { gap: 10px; }

@media (min-width: 800px) {
  .shell { padding-bottom: 32px; }
  .tabs { position: sticky; top: 52px; bottom: auto; display: flex; justify-content: center; gap: 4px; border-top: 0; border-bottom: 1px solid var(--line); }
  .tabs a { min-height: 46px; padding: 0 22px; border-top: 0; border-bottom: 3px solid transparent; }
  .tabs a.on { border-bottom-color: var(--primary); }
  .page { padding: 24px; }
}

/* --- Building blocks --- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.card.center { text-align: center; justify-items: center; padding: 28px 16px; }
.card h2, .section-title { font-size: 1.05rem; font-weight: 750; letter-spacing: -0.005em; }
.section-title { margin: 4px 0 10px; }
section + .section-title, .staged-list + .hint + .section-title, .empty + .section-title { margin-top: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head .section-title { margin: 0; }
.count { display: inline-block; min-width: 1.6em; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 0.8rem; font-weight: 700; text-align: center; vertical-align: 1px; }
.muted, .meta { color: var(--muted); }
.meta { display: block; font-size: 0.85rem; }
.hint { color: var(--muted); font-size: 0.9rem; }
.lead { font-size: 1.02rem; margin-bottom: 16px; }
.error { color: var(--bad); font-weight: 600; font-size: 0.92rem; }
.warn-text { color: var(--warn); font-weight: 600; }
.pname { font-weight: 650; overflow-wrap: anywhere; }

.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 16px; }
.row.between { justify-content: space-between; margin-top: 16px; }
.row.center { justify-content: center; }
.grow { flex: 1 1 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 16px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  font-weight: 650; text-decoration: none; text-align: center; line-height: 1.2;
}
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn:disabled { opacity: 0.45; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.12); }
.btn.big { min-height: 52px; padding: 10px 26px; font-size: 1.05rem; }
.btn.small { min-height: 36px; padding: 5px 12px; font-size: 0.88rem; border-radius: 8px; }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger-ghost { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn.win-a { background: var(--team-a-bg); border-color: var(--team-a); color: var(--team-a); }
.btn.win-b { background: var(--team-b-bg); border-color: var(--team-b); color: var(--team-b); }
.link { background: none; border: 0; padding: 6px 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; font-size: 0.9rem; justify-self: start; }
.link:hover { color: var(--ink); }
.icon-btn { background: none; border: 0; width: 40px; height: 40px; border-radius: 10px; font-size: 1.1rem; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); }

.input {
  width: 100%; min-height: 44px; padding: 9px 12px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line);
}
.input:focus { border-color: var(--team-a); }
textarea.input { resize: vertical; font-family: inherit; }
.input.score { font-size: 1.5rem; font-weight: 700; text-align: center; max-width: 140px; }
.field { display: grid; gap: 6px; }
.field > span:first-child { font-weight: 600; font-size: 0.92rem; }
.field.inline { grid-template-columns: 1fr auto; align-items: center; }
.field > .seg { justify-self: start; }
form .field + .field, .sheet-body .field + .field, .sheet-body .field { margin-top: 12px; }

.seg { display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.seg button { min-height: 38px; padding: 5px 13px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; font-size: 0.92rem; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line), 0 1px 3px rgba(16, 26, 48, 0.12); }

.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-size: 1.3rem; font-weight: 600; }
.stepper button:disabled { opacity: 0.4; }
.stepper output { min-width: 2.4em; text-align: center; font-size: 1.4rem; font-weight: 750; font-variant-numeric: tabular-nums; }

.chip {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.76rem; font-weight: 700; white-space: nowrap; vertical-align: 1px;
  background: hsl(var(--h) var(--chip-s) var(--chip-bg-l)); color: hsl(var(--h) 75% var(--chip-fg-l));
}
.lv1 { --h: 145; } .lv2 { --h: 185; } .lv3 { --h: 215; } .lv4 { --h: 265; } .lv5 { --h: 328; } .lv6 { --h: 28; }

.tag { display: inline-block; padding: 1px 6px; border-radius: 6px; font-size: 0.68rem; font-weight: 750; text-transform: uppercase; letter-spacing: 0.04em; background: var(--warn-bg); color: var(--warn); white-space: nowrap; }
.done-list { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.queue + .section-title { margin-top: 22px; }
.done-list + .hint { margin-top: 8px; }
.badges { display: inline-flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 7px; font-size: 0.76rem; font-weight: 700; white-space: nowrap; }
.badge.even { background: var(--good-bg); color: var(--good); }
.badge.close { background: var(--info-bg); color: var(--info); }
.badge.uneven { background: var(--bad-bg); color: var(--bad); }
.badge.note { background: var(--warn-bg); color: var(--warn); }

.alert { display: grid; gap: 8px; padding: 12px 14px; border-radius: 12px; font-size: 0.93rem; justify-items: start; }
.alert ul { display: grid; gap: 6px; }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.bad { background: var(--bad-bg); color: var(--bad); }
.alert.ok { background: var(--good-bg); color: var(--good); }
.alert.info { background: var(--info-bg); color: var(--info); grid-template-columns: 1fr auto; align-items: center; }
.alert .btn { color: var(--ink); }

.empty { display: grid; gap: 4px; padding: 22px 16px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); }
.empty strong { color: var(--ink); }

/* --- Setup --- */
.choices { display: grid; gap: 10px; }
@media (min-width: 620px) { .choices { grid-template-columns: 1fr 1fr; } }
.choice { display: grid; gap: 4px; text-align: left; padding: 14px; border-radius: 12px; background: var(--surface); border: 2px solid var(--line); }
.choice span { color: var(--muted); font-size: 0.9rem; }
.choice.on { border-color: var(--primary); background: var(--surface-2); }
.div-list { display: grid; gap: 8px; }
.div-list li { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tally { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.tally-item b { font-variant-numeric: tabular-nums; }
.action-bar {
  position: sticky; bottom: 68px; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: 0 8px 28px rgba(16, 26, 48, 0.16);
}
@media (min-width: 800px) { .action-bar { bottom: 16px; } }

/* --- Live --- */
.live-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.live-head h2 { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.01em; }
.live-grid { display: grid; gap: 22px; }
@media (min-width: 900px) { .live-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; } }
.courts { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.court-tools { margin-top: 10px; }

.court, .staged { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; box-shadow: var(--shadow); align-content: start; }
.court header, .staged header { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.court h3 { font-size: 1.05rem; font-weight: 800; }
.staged h3 { font-size: 0.82rem; font-weight: 750; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.court-state { font-size: 0.85rem; font-weight: 650; color: var(--muted); font-variant-numeric: tabular-nums; }
.court.busy { border-top: 4px solid var(--primary); }
.court.open { border-style: dashed; box-shadow: none; }
.court.closed { opacity: 0.7; box-shadow: none; }
.staged-list { display: grid; gap: 10px; }
.staged { box-shadow: none; }

.versus { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; }
.vs { font-size: 0.75rem; font-weight: 800; color: var(--muted); text-transform: uppercase; }
.team { display: grid; gap: 6px; padding: 10px; border-radius: 10px; border-left: 4px solid; align-content: center; min-height: 100%; }
.team li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.team-a { background: var(--team-a-bg); border-color: var(--team-a); }
.team-b { background: var(--team-b-bg); border-color: var(--team-b); }
.pick { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; background: none; border: 0; padding: 2px 0; text-align: left; border-bottom: 1px dashed var(--muted); }
.result-hint { font-size: 0.85rem; font-weight: 650; color: var(--muted); }
.result-row { display: flex; gap: 8px; }
.result-row .btn { min-height: 50px; font-size: 0.95rem; }

.queue { display: grid; gap: 6px; }
.queue li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 9px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.queue li.is-staged { border-left: 4px solid var(--primary); }
.queue li.is-resting { opacity: 0.65; border-style: dashed; }
.queue-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 430px) { .queue-actions { flex-direction: column; align-items: stretch; } }
.pos { display: inline-grid; place-items: center; min-width: 1.9em; height: 1.9em; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 0.82rem; font-weight: 750; font-variant-numeric: tabular-nums; }

/* --- Players --- */
.add-form { display: grid; gap: 8px; }
@media (min-width: 680px) { .add-form { grid-template-columns: 1.4fr 1fr auto; } }
.toolbar { display: grid; gap: 8px; }
@media (min-width: 680px) { .toolbar { grid-template-columns: 1fr auto; align-items: center; } }
.roster, .suggest, .log { display: grid; }
.roster li, .suggest li, .log li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.roster li:first-child, .suggest li:first-child, .log li:first-child { border-top: 0; }
.roster .who { flex: 1; min-width: 0; background: none; border: 0; padding: 0; text-align: left; }
.roster li:not(.here) .pname { color: var(--muted); }
.suggest li { flex-wrap: wrap; }
.log li > span { display: grid; gap: 4px; min-width: 0; justify-items: start; }

/* --- Standings --- */
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { min-height: 36px; padding: 4px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 0.9rem; color: var(--muted); }
.pill.on { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td:first-child, .table th:first-child { text-align: left; width: 2.5em; }
.winners { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); align-items: start; }
.podium { display: grid; gap: 10px; }
.podium li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; font-size: 1.02rem; }
.podium .who { min-width: 0; }
.podium li:first-child .pname { font-size: 1.12rem; }
.rank { display: inline-grid; place-items: center; width: 1.9em; height: 1.9em; border-radius: 999px; background: var(--ball); color: #1a2200; font-weight: 800; }

/* --- Settings --- */
.levels { display: grid; gap: 8px; }
.level-row { display: grid; grid-template-columns: 4.6em minmax(0, 1.5fr) minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 8px; align-items: center; }
.level-row.two { grid-template-columns: minmax(0, 1fr) auto; }
@media (max-width: 560px) {
  .level-row { grid-template-columns: 4.6em 1fr 1fr; }
  .level-row select { grid-column: 2 / -1; }
  .level-row.two { grid-template-columns: 1fr auto; }
}
.how { display: grid; gap: 8px; list-style: decimal; padding-left: 1.3em; color: var(--muted); }
.how li::marker { font-weight: 700; color: var(--ink); }

/* --- Dialogs and toasts --- */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(8, 14, 26, 0.55); display: grid; align-items: end; justify-items: center; }
.sheet { width: 100%; max-width: 520px; max-height: 92vh; display: grid; grid-template-rows: auto 1fr; background: var(--surface); border-radius: 18px 18px 0 0; box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.3); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 10px 6px 18px; }
.sheet-head h2 { font-size: 1.1rem; font-weight: 750; overflow-wrap: anywhere; }
.sheet-body { overflow-y: auto; padding: 6px 18px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 620px) {
  .scrim { align-items: center; padding: 24px; }
  .sheet { border-radius: 18px; }
}
.pick-list { display: grid; gap: 6px; margin: 12px 0; }
.pick-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; min-height: 48px; padding: 8px 12px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.pick-row.on { border-color: var(--primary); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--primary); }
.pick-row > span:first-child { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.toast {
  position: fixed; left: 50%; bottom: 74px; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 24px);
  padding: 11px 16px; border-radius: 12px; background: #0f1d3a; color: #fff; font-weight: 600; font-size: 0.93rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35); animation: rise 0.18s ease-out;
}
.toast button { background: none; border: 0; color: var(--ball); font-weight: 800; padding: 4px 2px; }
@media (min-width: 800px) { .toast { bottom: 24px; } }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* --- Live view: share dialog and the page on players' phones --- */
.btn.sharing { border-color: var(--good); color: var(--good); }
.btn.sharing.trouble { border-color: var(--warn); color: var(--warn); }
.btn .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.share { display: grid; gap: 12px; justify-items: center; margin: 4px 0 12px; }
.share .alert { justify-self: stretch; }
.qr { width: min(100%, 300px); height: auto; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.link-box { text-align: center; font-size: 0.9rem; }
.share-card { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 16px; }
.share-card .qr { width: 136px; display: block; }
.share-card .link-box { text-align: left; }
.share-info { display: grid; gap: 8px; min-width: 0; }
.qr-btn { padding: 0; border: 0; background: none; border-radius: 12px; line-height: 0; }
@media (max-width: 430px) {
  .share-card { gap: 12px; align-items: start; }
  .share-card .qr { width: 104px; }
  .share-card .hint { display: none; }
}
.hint.center { text-align: center; }
.me-pick select { font-weight: 650; }
.my-card { display: grid; gap: 4px; padding: 16px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface); }
.my-card strong { font-size: 1.25rem; letter-spacing: -0.01em; }
.my-card.now { background: var(--good-bg); border-color: var(--good); color: var(--good); }
.my-card.soon { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.my-card.done { background: var(--info-bg); border-color: var(--info); color: var(--info); }
.is-me .pname { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 3px; text-decoration-color: var(--ball-hole); }
.queue li.is-me { border-color: var(--ball-hole); box-shadow: inset 0 0 0 1px var(--ball-hole); }
tr.is-me td { background: var(--surface-2); font-weight: 650; }
.viewer { padding-bottom: 32px; }
.board-qr { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; font-weight: 650; line-height: 1.25; }
.board-qr .qr { width: 96px; border-radius: 8px; }

/* --- Club account, plans and the owner's page --- */
.facts { display: grid; gap: 10px; margin: 0; }
.facts div { display: grid; gap: 2px; }
.facts dt { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
@media (min-width: 620px) { .facts div { grid-template-columns: 9.5em minmax(0, 1fr); align-items: baseline; gap: 12px; } }
.prices { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; }
.prices li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); }
.prices li:first-child { border-top: 0; }
.prices strong { font-variant-numeric: tabular-nums; }
.notice { white-space: pre-line; padding: 10px 14px; border-radius: 12px; background: var(--info-bg); color: var(--info); font-size: 0.93rem; overflow-wrap: anywhere; }
.sheet-body .notice, .sheet-body .hint + .hint, .sheet-body .join-form { margin-top: 10px; }
.join-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.join-form .error { grid-column: 1 / -1; }
.card.center .hint { max-width: 34em; }
.link-box.left { text-align: left; }
.grid-2 { display: grid; gap: 10px; }
@media (min-width: 620px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.input.date { width: auto; }
.club-link { display: grid; gap: 10px; justify-items: center; }
.club-link .qr { width: 180px; }
.club-link .link-box { justify-self: stretch; }
.subhead { font-size: 1rem; font-weight: 750; }
.prose { gap: 10px; line-height: 1.55; }
.prose h3 { font-size: 1rem; font-weight: 750; margin-top: 8px; }
.bullets { list-style: disc; padding-left: 1.3em; display: grid; gap: 4px; }
.promo-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.log.promos li { display: grid; gap: 6px; justify-content: stretch; }
.log.results li.is-me { box-shadow: inset 3px 0 0 var(--ball-hole); padding-left: 10px; }
.latest-head { margin-top: 18px; }
.extend-box { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.now-list { display: grid; gap: 12px; }
.now-card h2 { overflow-wrap: anywhere; }
.who-can-find { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.table.activity td:first-child, .table.activity th:first-child { width: auto; white-space: nowrap; }
.plan-cards { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.plan-card { display: grid; gap: 4px; align-content: start; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.plan-card.pro { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.plan-card strong { font-size: 1.05rem; }
.plan-price { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.01em; }
.plan-price small { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.table.plans td { font-size: 0.92rem; }
.table.plans .plan-col { text-align: center; width: 5.5em; white-space: nowrap; }
.table.plans td:first-child, .table.plans th:first-child { width: auto; }

/* --- Payments --- */
.ticks { display: grid; gap: 6px; }
.ticks li { position: relative; padding-left: 26px; }
.ticks li::before { content: "✓"; position: absolute; left: 4px; top: 0; color: var(--good); font-weight: 800; }
.money-tiles { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 620px) { .money-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.money-tile { display: grid; gap: 2px; align-content: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.money-tile span { font-size: 0.82rem; color: var(--muted); }
.money-tile strong { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.money-tile.warn { background: var(--warn-bg); border-color: transparent; }
.money-tile.warn strong, .money-tile.warn span { color: var(--warn); }
.peso-input { position: relative; display: block; }
.peso-input > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 650; pointer-events: none; }
.peso-input .input { padding-left: 28px; font-variant-numeric: tabular-nums; }
.peso-input.fee { width: 9.5em; }
.pay-list li.is-paid .pname { color: var(--muted); }
.pay-list li > span:first-child { flex: 1; }
/* A row's buttons stay on one line beside the name (.log li > span would make them a column). */
.pay-actions, .log li > .pay-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: nowrap; justify-content: flex-end; align-items: center; }
@media (max-width: 430px) { .pay-actions .btn.small { padding: 5px 10px; } }
.cost-form { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr) 7.5em auto; align-items: center; }
.money-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.money-facts dd { font-weight: 750; font-variant-numeric: tabular-nums; }
.link.warn-link { color: var(--warn); font-weight: 650; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.93rem; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; flex-shrink: 0; accent-color: var(--primary); }
.yes { color: var(--good); font-weight: 800; }
.no { color: var(--muted); }
.promo-details summary { cursor: pointer; font-weight: 650; padding: 6px 0; }
.page.narrow.wide-ish { max-width: 720px; }
@media (max-width: 430px) {
  .plan-cards { grid-template-columns: 1fr; }
  .table.plans .plan-col { width: 4.4em; white-space: normal; }
}
.promo-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.05rem; font-weight: 750; letter-spacing: 0.04em; }

/* --- Board (TV / player-facing) --- */
.board { padding: 20px; display: grid; gap: 20px; font-size: 1.12rem; }
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.board-head h1 { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.01em; }
.board .courts { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.board .court h3 { font-size: 1.35rem; }
.board .pname { font-size: 1.15rem; }
.board-cols { display: grid; gap: 20px; }
@media (min-width: 900px) { .board-cols { grid-template-columns: 1fr 1fr; align-items: start; } }
@media print { .topbar, .tabs, .toast, .btn, .link { display: none !important; } }
