/* Layout: one narrow column, phone-first; the court's red tin line and the ball's double yellow dot are the only ornaments. */
:root {
  --bg: #F3F5F8;
  --surface: #FFFFFF;
  --ink: #14213D;
  --muted: #5B6478;
  --line: #D9DEE7;
  --red: #C8102E;
  --red-ink: #FFFFFF;
  --dot: #F5C400;
  --good: #1E7A4C;
  --good-bg: #E3F3EA;
  --warn-bg: #FCE8EB;
  --sel: #14213D;
  --sel-ink: #FFFFFF;
  --font-display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --font-body: "Figtree", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1422; --surface: #172036; --ink: #E8ECF4; --muted: #9AA3B5; --line: #2A3550;
    --red: #FF4D5E; --red-ink: #1A0508; --dot: #F5C400; --good: #4CC38A; --good-bg: #14301F; --warn-bg: #3A1820;
    --sel: #F5C400; --sel-ink: #14213D; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1422; --surface: #172036; --ink: #E8ECF4; --muted: #9AA3B5; --line: #2A3550;
  --red: #FF4D5E; --red-ink: #1A0508; --dot: #F5C400; --good: #4CC38A; --good-bg: #14301F; --warn-bg: #3A1820;
  --sel: #F5C400; --sel-ink: #14213D; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 var(--font-body);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.wrap, .topbar {
  max-width: 560px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.wrap { padding-block: 8px 64px; }
.topbar { padding-block: 16px 8px; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 15px; letter-spacing: .01em; }
.brand b { color: var(--red); font-weight: 700; }
.ball { width: 26px; height: 26px; border-radius: 50%; background: #14213D; box-shadow: 0 0 0 1px var(--line); display: inline-flex; align-items: center; justify-content: center; gap: 3px; }
.ball i { width: 6px; height: 6px; border-radius: 50%; background: var(--dot); }

h1, h2 { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .01em; line-height: .95; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(52px, 15vw, 84px); font-weight: 900; }
h2 { font-size: 34px; font-weight: 800; }
.lede { font-size: 19px; color: var(--muted); margin: 10px 0 0; }
.eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--red); margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.hero { padding-block: 28px 8px; }
.tin { height: 4px; background: var(--red); border-radius: 2px; margin: 22px 0 26px; width: 72px; }

.stack { display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }

label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
label.field span.hint { font-weight: 400; color: var(--muted); }
input[type="text"], input[type="email"], input[type="search"], input[type="password"], textarea {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
input:focus-visible, textarea:focus-visible { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot) 55%, transparent); }

.btn {
  font: inherit; font-weight: 700; font-size: 17px; border: 0; cursor: pointer;
  border-radius: 10px; padding: 15px 20px; width: 100%;
  background: var(--red); color: var(--red-ink); text-decoration: none; text-align: center; display: inline-block;
  transition: transform .08s ease, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.ghost { background: transparent; color: var(--muted); padding: 10px; font-size: 15px; font-weight: 600; width: auto; }
.btn:focus-visible, .chip:focus-visible, .slot:focus-visible, .who:focus-visible { outline: 3px solid var(--dot); outline-offset: 2px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }
.actions { position: sticky; bottom: 0; padding-block: 12px calc(12px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(to top, var(--bg) 70%, transparent); display: flex; flex-direction: column; gap: 6px; align-items: center; }

/* Date picker */
.dates { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.weekday { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); text-align: center; padding-bottom: 2px; }
.chip {
  font: inherit; cursor: pointer; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 10px; padding: 8px 2px; display: flex; flex-direction: column; align-items: center; gap: 0; min-height: 58px; justify-content: center;
}
.chip .d { font-family: var(--font-display); font-weight: 800; font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; }
.chip .m { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.chip[aria-pressed="true"] { background: var(--sel); color: var(--sel-ink); border-color: var(--sel); }
.chip[aria-pressed="true"] .m { color: inherit; opacity: .8; }
.chip.pad { visibility: hidden; }

/* Time slots */
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.slot {
  font: inherit; cursor: pointer; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 10px; padding: 14px 10px; text-align: left; display: flex; align-items: center; gap: 8px; min-width: 0;
}
.slot .lbl { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.slot .t { font-family: var(--font-mono); font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.slot .until { font-size: 12px; color: var(--muted); white-space: nowrap; }
/* Choosing the time to book */
.chooser { border: 1.5px solid var(--good); }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt {
  font: inherit; color: var(--ink); background: var(--surface); cursor: pointer; text-align: left;
  border: 1.5px solid var(--line); border-radius: 10px; padding: 14px 12px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.opt .when { font-weight: 600; flex: 1; min-width: 0; }
.opt .t { font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.opt .dot { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line); flex: none; display: grid; place-items: center; }
.opt[aria-checked="true"] { border-color: var(--sel); box-shadow: inset 0 0 0 1px var(--sel); }
.opt[aria-checked="true"] .dot { border-color: var(--sel); }
.opt[aria-checked="true"] .dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--sel); }
.opt:focus-visible { outline: 3px solid var(--dot); outline-offset: 2px; }
.banner.booked .eyebrow { display: block; color: var(--good); margin: 0 0 4px; }
.banner.booked strong { font-family: var(--font-display); font-size: 28px; text-transform: uppercase; letter-spacing: .01em; line-height: 1.05; }
.matrix tr.bookedrow td { background: var(--good-bg); }
.booknext { border: 1.5px solid var(--ink); }

/* Player-list autofill */
.namefield { position: relative; }
.suggest {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 15; margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1.5px solid var(--ink); border-radius: 10px;
  box-shadow: 0 10px 28px color-mix(in srgb, var(--ink) 18%, transparent); max-height: 300px; overflow-y: auto;
}
.suggest li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 11px 10px; border-radius: 7px; cursor: pointer; }
.suggest li[aria-selected="true"], .suggest li:hover { background: color-mix(in srgb, var(--dot) 28%, var(--surface)); }
.suggest .sname { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest .shint, .mono { font-family: var(--font-mono); font-size: 13px; color: var(--muted); white-space: nowrap; }
.linked { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; font-size: 14px; padding: 10px 12px; border-radius: 10px; background: var(--good-bg); }
.linked .tick { color: var(--good); font-weight: 700; }
.linked .btn.ghost { padding: 2px 0; font-size: 14px; }

/* Player list editor */
.plist { padding: 6px 12px; }
.prow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.prow:first-child { border-top: 0; }
.prow input { padding: 9px 10px; font-size: 15px; }
.rm { font: inherit; width: 36px; height: 36px; border-radius: 8px; border: 1.5px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.rm:hover { color: var(--red); border-color: var(--red); }
.rm:focus-visible { outline: 3px solid var(--dot); outline-offset: 2px; }
input.invalid { border-color: var(--red); }
@media (max-width: 480px) {
  .prow { grid-template-columns: minmax(0, 1fr) auto; }
  .prow input[data-ak="email"] { grid-column: 1; grid-row: 2; }
  .prow .rm { grid-row: 1 / span 2; grid-column: 2; }
}

/* Collapsible Morning / Afternoon / Evening */
.part { border-top: 1px solid var(--line); }
.part:first-child { border-top: 0; }
.part .slots { padding-bottom: 12px; }
.parthead {
  font: inherit; color: var(--ink); background: none; border: 0; cursor: pointer; width: 100%;
  display: flex; align-items: center; gap: 10px; padding: 14px 2px; text-align: left;
}
.partname { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; flex: 1; display: flex; align-items: center; gap: 8px; }
.partmeta { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.partmeta.on { color: var(--ink); font-weight: 600; }
.chev { width: 9px; height: 9px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-3px); transition: transform .15s ease; flex: none; }
.parthead[aria-expanded="true"] .chev { transform: rotate(-135deg) translate(-2px, 0); }
.parthead:focus-visible { outline: 3px solid var(--dot); outline-offset: 2px; border-radius: 6px; }
.newtag { font-family: var(--font-body); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: var(--dot); color: #14213D; border-radius: 999px; padding: 2px 6px; margin-left: auto; align-self: center; }
.partname .newtag { margin-left: 0; }
.pill.warn { background: color-mix(in srgb, var(--dot) 30%, var(--surface)); color: var(--ink); border-color: transparent; }
.matrix .pend { color: var(--muted); font-weight: 700; }
.who .done { opacity: .75; }
.chip[disabled] { opacity: .35; cursor: default; }
.slot .box { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line); flex: none; display: grid; place-items: center; }
.slot[aria-pressed="true"] { border-color: var(--sel); box-shadow: inset 0 0 0 1px var(--sel); }
.slot[aria-pressed="true"] .box { background: var(--sel); border-color: var(--sel); }
.slot[aria-pressed="true"] .box::after { content: ""; width: 6px; height: 10px; border: solid var(--sel-ink); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
.daygroup + .daygroup { margin-top: 18px; }
.daylabel { font-weight: 700; margin: 0 0 8px; }

.progress { display: flex; gap: 6px; margin: 14px 0 4px; }
.progress i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.progress i.on { background: var(--red); }

/* Who are you */
.whos { display: flex; flex-wrap: wrap; gap: 8px; }
.who { font: inherit; font-weight: 600; cursor: pointer; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 10px 16px; }
.who[aria-pressed="true"] { background: var(--sel); color: var(--sel-ink); border-color: var(--sel); }
.who[disabled] { opacity: .5; cursor: default; text-decoration: line-through; }

/* Status */
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.people li { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.people li:first-child { border-top: 0; padding-top: 0; }
.people .name { font-weight: 600; }
.people .meta { font-size: 14px; color: var(--muted); }
.people > li > div { min-width: 0; flex: 1; }
.pill { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 4px 9px; border-radius: 999px; white-space: nowrap; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.pill.good { background: var(--good-bg); color: var(--good); border-color: transparent; }
.pill.bad { background: var(--warn-bg); color: var(--red); border-color: transparent; }

.banner { border-radius: var(--radius); padding: 16px 18px; font-weight: 500; }
.banner.good { background: var(--good-bg); color: var(--ink); border-left: 4px solid var(--good); }
.banner.bad { background: var(--warn-bg); color: var(--ink); border-left: 4px solid var(--red); }
.banner strong { display: block; font-size: 18px; margin-bottom: 4px; }

.agreed { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 8px; }
.agreed li { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.agreed .t { font-family: var(--font-mono); font-weight: 600; }

.linkbox { display: flex; gap: 8px; align-items: stretch; }
.linkbox input { font-family: var(--font-mono); font-size: 14px; min-width: 0; }
.linkbox .btn { width: auto; flex: none; padding: 10px 16px; font-size: 15px; }

/* Organizer matrix */
.matrix-wrap { overflow-x: auto; }
table.matrix { border-collapse: collapse; width: 100%; font-size: 14px; }
.matrix th, .matrix td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.matrix td.t { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.matrix .yes { color: var(--good); font-weight: 700; }
.matrix .no { color: var(--muted); }
.matrix tr.open td:first-child { box-shadow: inset 3px 0 0 var(--good); padding-left: 10px; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; z-index: 20; max-width: calc(100% - 32px); }
.error { color: var(--red); font-weight: 600; font-size: 14px; min-height: 1em; margin: 0; }
.devnote { font-size: 13px; color: var(--muted); border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; }
.devnote a { color: inherit; }
a { color: var(--red); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
