/* One phone-width column under a sports-hall header. The next session is drawn
   as a real court plan, because the court number is what people look for. */
:root {
  --bg: #e9f0ed; --surface: #ffffff; --surface-2: #dde8e3; --fg: #10302a; --muted: #4f6b64; --hairline: #c6d5cf;
  --court: #0f6b58; --court-ink: #ffffff; --court-line: rgba(255,255,255,.82); --court-soft: rgba(255,255,255,.76);
  --action: #0f6b58; --action-ink: #ffffff;
  --owe: #a34a06; --owe-bg: #fbe9d4; --wait: #5a4aa3; --wait-bg: #e8e4f8; --ok: #17694b; --ok-bg: #d9f0e4;
  --display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --body: "Barlow", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #0c1a17; --surface: #142623; --surface-2: #1d332e; --fg: #e4f0ec; --muted: #9db5ae; --hairline: #2b4640;
  --court: #12705d; --court-line: rgba(255,255,255,.8); --court-soft: rgba(255,255,255,.8);
  --action: #4cc7a6; --action-ink: #06211b;
  --owe: #f5b26b; --owe-bg: #40290f; --wait: #c3b8f7; --wait-bg: #2c2650; --ok: #7fdcb4; --ok-bg: #143a2c;
  color-scheme: dark;
} }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 16px; line-height: 1.4; -webkit-tap-highlight-color: transparent; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--action); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

.app { max-width: 480px; margin: 0 auto; padding-block: env(safe-area-inset-top, 0px) calc(96px + env(safe-area-inset-bottom, 0px)); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 16px; }
header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg); padding-block: 12px 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { min-width: 0; flex: 1; }
.mark { font-family: var(--display); font-weight: 700; font-size: 25px; letter-spacing: .01em; text-transform: uppercase; line-height: 1; }
.group { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.icon-btn { border: 1px solid var(--hairline); background: var(--surface); border-radius: 10px; min-width: 44px; min-height: 44px; display: grid; place-items: center; }
main { display: grid; gap: 16px; min-width: 0; }

.court-card { background: var(--court); color: var(--court-ink); border-radius: 14px; padding: 16px; display: grid; gap: 12px; }
.court-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
/* Venues and names are typed by people and can be one long word. */
.court-card > div, .court-top > div { min-width: 0; overflow-wrap: anywhere; }
.eyebrow { font-family: var(--display); font-weight: 600; font-size: 15px; letter-spacing: .07em; text-transform: uppercase; }
.court-card .eyebrow, .court-card .sub { color: var(--court-soft); }
.when { font-family: var(--display); font-weight: 700; font-size: 44px; line-height: 1; text-wrap: balance; }
.away { font-family: var(--display); font-weight: 600; font-size: 17px; white-space: nowrap; border: 1px solid var(--court-line); border-radius: 6px; padding: 2px 8px; }
.court-plan { width: 100%; display: block; }
.court-plan .l { fill: none; stroke: var(--court-line); stroke-width: .7; }
.court-plan .net { stroke-dasharray: 2 1.4; stroke-width: 1; }
.court-plan .mask { fill: var(--court); }
.court-plan .cap { fill: var(--court-soft); font: 600 5.4px var(--display); letter-spacing: .5px; text-anchor: middle; }
.court-plan .num { fill: var(--court-ink); font: 700 24px var(--display); text-anchor: middle; }

.btn { min-height: 46px; border-radius: 10px; border: 1px solid var(--hairline); background: var(--surface); color: var(--fg); padding: 8px 14px; font-weight: 600; text-decoration: none; display: inline-grid; place-items: center; text-align: center; }
.btn.primary { background: var(--action); color: var(--action-ink); border-color: var(--action); }
.btn.small { min-height: 40px; padding: 4px 12px; font-size: 14px; white-space: nowrap; }
.btn.danger { color: var(--owe); }
.btn.full { width: 100%; }
.btn:disabled { opacity: .6; cursor: progress; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions .wide { grid-column: 1 / -1; }

.notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px; padding: 12px 14px; width: 100%; text-align: left; }
.notice strong { font-family: var(--display); font-size: 25px; font-weight: 700; display: block; line-height: 1.1; font-variant-numeric: tabular-nums; }
.notice.owe strong { color: var(--owe); }
.notice.stack-notice { display: grid; gap: 10px; }
.sub { color: var(--muted); font-size: 14px; }
.chev { color: var(--muted); font-size: 21px; }

.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: none; border-radius: 8px; min-height: 40px; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); }

.list { display: grid; background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px; overflow: hidden; }
.list > * + * { border-top: 1px solid var(--hairline); }
.item { display: flex; gap: 10px; justify-content: space-between; align-items: center; padding: 12px 14px; min-height: 58px; width: 100%; border: 0; background: none; text-align: left; }
.item-main { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.item-title { font-weight: 600; }
.pill { display: inline-block; font-size: 13px; font-weight: 600; border-radius: 6px; padding: 3px 8px; white-space: nowrap; }
.pill.owe { color: var(--owe); background: var(--owe-bg); }
.pill.wait { color: var(--wait); background: var(--wait-bg); }
.pill.ok { color: var(--ok); background: var(--ok-bg); }
.pill.plain { color: var(--muted); background: var(--surface-2); }
.section-title { font-family: var(--display); font-weight: 600; font-size: 17px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.stack { display: grid; gap: 8px; min-width: 0; }

.total { display: grid; gap: 2px; }
.total b { font-family: var(--display); font-size: 56px; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.person-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 12px 14px 4px; font-weight: 600; }
.person-head > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.person-head .amt { flex: none; font-family: var(--display); font-size: 23px; font-weight: 700; color: var(--owe); font-variant-numeric: tabular-nums; }
.person { padding-bottom: 6px; }
.debt { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 14px; min-height: 52px; font-size: 15px; font-variant-numeric: tabular-nums; }
.debt-actions { flex: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.confirm-row { display: grid; gap: 10px; padding: 10px 14px 12px; background: var(--owe-bg); overflow-wrap: anywhere; }

.reg-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px; }
.reg { border-collapse: separate; border-spacing: 0; font-size: 15px; font-variant-numeric: tabular-nums; }
.reg th, .reg td { padding: 0; text-align: center; border-bottom: 1px solid var(--hairline); }
.reg tr:last-child td, .reg tr:last-child th { border-bottom: 0; }
.reg th:first-child { position: sticky; left: 0; background: var(--surface); text-align: left; padding: 8px 12px; font-weight: 600; max-width: 110px; overflow-wrap: anywhere; }
.reg thead button { border: 0; background: none; width: 52px; min-height: 48px; font-size: 13px; font-weight: 600; line-height: 1.15; color: var(--muted); }
.reg td { width: 52px; height: 44px; }
.mk { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-weight: 700; font-size: 14px; font-style: normal; }
.mk.ok { background: var(--ok-bg); color: var(--ok); }
.mk.owe { background: var(--owe-bg); color: var(--owe); }
.mk.wait { background: var(--wait-bg); color: var(--wait); }
.mk.no { color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 14px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface); border-top: 1px solid var(--hairline); padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
nav > div { max-width: 448px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); }
nav button { border: 0; background: none; min-height: 60px; font-family: var(--display); font-weight: 600; font-size: 18px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
nav button[aria-current="page"] { color: var(--fg); box-shadow: inset 0 3px 0 var(--action); }
.badge { background: var(--owe-bg); color: var(--owe); font-family: var(--body); font-size: 12px; border-radius: 6px; padding: 1px 6px; letter-spacing: 0; margin-left: 2px; vertical-align: 2px; }

.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(5,20,17,.55); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 480px; max-height: 90%; overflow-y: auto; border-radius: 16px 16px 0 0; padding-block: 16px calc(20px + env(safe-area-inset-bottom, 0px)); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 14px; outline: none; }
.sheet-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.sheet-head > :first-child { min-width: 0; overflow-wrap: anywhere; }
.sheet-head h2 { font-family: var(--display); font-weight: 700; font-size: 32px; line-height: 1.05; }
.close { border: 1px solid var(--hairline); background: var(--surface); border-radius: 10px; min-width: 44px; min-height: 44px; font-size: 21px; line-height: 1; }
.attend { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; border: 0; background: none; text-align: left; padding: 0; min-height: 44px; }
.box { flex: none; width: 26px; height: 26px; border-radius: 7px; border: 2px solid var(--muted); display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.attend[aria-pressed="true"] .box { background: var(--action); border-color: var(--action); color: var(--action-ink); }
.attend span:last-child { overflow-wrap: anywhere; }
form { display: grid; gap: 12px; }
label { display: grid; gap: 4px; font-size: 14px; font-weight: 600; min-width: 0; }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 15px; min-height: 44px; }
label.check input { width: 22px; height: 22px; min-height: 0; flex: none; accent-color: var(--action); }
input, textarea { background: var(--surface); border: 1px solid var(--hairline); border-radius: 8px; min-height: 46px; padding: 8px 10px; width: 100%; min-width: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.add { display: flex; gap: 8px; }
.add input { flex: 1; }
.code { font-family: var(--display); font-size: 30px; font-weight: 700; letter-spacing: .12em; }

.screen { display: grid; gap: 16px; padding-top: 8px; }
.screen h1 { font-family: var(--display); font-size: 40px; line-height: 1.05; text-wrap: balance; overflow-wrap: anywhere; }
.link { border: 0; background: none; color: var(--action); font-weight: 600; text-decoration: underline; min-height: 44px; padding: 0; justify-self: start; }
.error { color: var(--owe); font-size: 14px; }
.pin { letter-spacing: .5em; font-size: 22px; font-variant-numeric: tabular-nums; }

.group-row .item-title { font-family: var(--display); font-size: 23px; font-weight: 700; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice button { min-height: 46px; border-radius: 10px; border: 1px solid var(--hairline); background: var(--surface); font-weight: 600; }
.choice button[aria-pressed="true"] { background: var(--action); color: var(--action-ink); border-color: var(--action); }
.card { background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px; padding: 12px 14px; display: grid; gap: 10px; min-width: 0; overflow-wrap: anywhere; }
.names { font-size: 15px; overflow-wrap: anywhere; }

.qr { background: #ffffff; border-radius: 12px; padding: 12px; width: min(240px, 100%); justify-self: center; }
.qr svg { display: block; width: 100%; height: auto; }
.qr svg rect[fill="white"], .qr svg path[fill="white"] { fill: #ffffff; }

#toast { position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom, 0px)); background: var(--fg); color: var(--bg); padding: 8px 14px; border-radius: 8px; font-size: 14px; font-weight: 600; max-width: calc(100% - 32px); text-align: center; pointer-events: none; }
/* With a sheet open, the bottom of the screen is the sheet's buttons. */
body.sheet-open #toast { bottom: auto; top: calc(12px + env(safe-area-inset-top, 0px)); }
