:root {
  --bg: #f3f5f2;
  --card: #ffffff;
  --ink: #14201b;
  --muted: #64736c;
  --line: #e1e7e3;
  --brand: #0f3d2e;
  --brand-ink: #ffffff;
  --ball: #d7f23c;
  --ok: #1f8a4c;
  --ok-bg: #e5f5ec;
  --warn: #a15c00;
  --warn-bg: #fff2dc;
  --bad: #b3261e;
  --bad-bg: #fde8e6;
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1411;
    --card: #16201c;
    --ink: #e8efeb;
    --muted: #93a39b;
    --line: #26332d;
    --brand: #d7f23c;
    --brand-ink: #0f1a14;
    --ok: #5fd08f;
    --ok-bg: #173325;
    --warn: #f2b45a;
    --warn-bg: #352812;
    --bad: #ff8a80;
    --bad-bg: #3a1a18;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 8px; align-items: center; font-weight: 800; font-size: 20px; text-decoration: none; letter-spacing: -.02em; }
.ball { width: 18px; height: 18px; border-radius: 50%; background: var(--ball); box-shadow: inset -3px -3px 0 rgba(0,0,0,.12); border: 2px solid var(--brand); }
nav { display: flex; gap: 4px; }
nav a { text-decoration: none; padding: 6px 12px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 15px; }
nav a.active { background: var(--card); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }

main { max-width: 560px; margin: 0 auto; padding: 16px; }
h1 { font-size: 26px; letter-spacing: -.02em; margin: 8px 0 16px; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 24px 0 8px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: 14px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
}
a.card { display: block; text-decoration: none; }
.game-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.game-when { font-weight: 750; font-size: 18px; letter-spacing: -.01em; }
.game-where { color: var(--muted); font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.slots { display: flex; gap: 4px; flex-shrink: 0; }
.slot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); }
.slot.on { background: var(--ball); border-color: var(--brand); }

.btn {
  appearance: none; border: 0; border-radius: 12px; padding: 13px 16px;
  font: inherit; font-weight: 700; cursor: pointer; text-align: center; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--brand); color: var(--brand-ink);
}
.btn.secondary { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn.danger { background: transparent; color: var(--bad); box-shadow: inset 0 0 0 1px var(--line); }
.btn.small { padding: 8px 12px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: .5; }
.row { display: flex; gap: 8px; }
.row > .btn { flex: 1; }
.stack > * + * { margin-top: 8px; }

.fab {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom));
  background: var(--brand); color: var(--brand-ink); text-decoration: none; font-weight: 800;
  padding: 15px 26px; border-radius: 999px; box-shadow: 0 8px 24px rgba(0,0,0,.18); z-index: 6;
}

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-weight: 650; font-size: 14px; margin-bottom: 6px; }
input[type=text], input[type=tel], input[type=password], input[type=date], input[type=time], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-height: 48px;
}
textarea { min-height: 70px; resize: vertical; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.seg { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg label { flex: 1; text-align: center; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 9px 6px; border-radius: 9px; font-weight: 650; font-size: 14px; color: var(--muted); }
.seg input:checked + span { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.seg input:focus-visible + span { outline: 2px solid var(--brand); }

.pick { display: flex; flex-direction: column; gap: 6px; }
.pick label {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line); cursor: pointer;
}
.pick input { width: 20px; height: 20px; accent-color: var(--brand); }
.pick .order { margin-left: auto; font-size: 13px; color: var(--muted); }

.check { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; font-weight: 600; }
.check input { width: 22px; height: 22px; accent-color: var(--brand); }

.plist { list-style: none; margin: 0; padding: 0; }
.plist li { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.plist li:first-child { border-top: 0; }

.banner { border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.banner.ok { background: var(--ok-bg); color: var(--ok); }
.banner .btn { margin-top: 10px; }

#toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600;
  opacity: 0; transition: .2s; pointer-events: none; z-index: 10; max-width: calc(100% - 32px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.court { border-radius: 12px; padding: 12px 14px; margin: -2px 0 14px; background: var(--bg); border: 1px solid var(--line); }
.court:empty { display: none; }
.court.ok { background: var(--ok-bg); border-color: transparent; }
.court.ok b { color: var(--ok); }
.court.bad { background: var(--bad-bg); border-color: transparent; }
.court.bad b { color: var(--bad); }
.court .chip { text-decoration: none; color: var(--ink); background: var(--card); font: inherit; font-size: 13px; cursor: pointer; }
.linkbtn { appearance: none; border: 0; background: none; padding: 0; font: inherit; font-weight: 700; text-decoration: underline; color: inherit; cursor: pointer; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .big { font-size: 44px; }
.link-box { display: flex; gap: 6px; margin-top: 8px; }
.link-box input { font-size: 13px; min-height: 38px; padding: 8px; }

@media (max-width: 400px) {
  .brand { font-size: 17px; gap: 6px; }
  .ball { width: 15px; height: 15px; }
  nav a { padding: 6px 9px; font-size: 14px; }
}

.onb { border-color: color-mix(in srgb, var(--ball) 55%, var(--line)); }
.steps { list-style: none; margin: 12px 0 4px; padding: 0; }
.steps li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; }
.steps .num {
  flex: 0 0 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 14px; background: var(--bg); border: 2px solid var(--line); color: var(--muted);
}
.steps li.current .num { border-color: var(--brand); color: var(--ink); }
.steps li.done .num { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.steps li.done b { color: var(--muted); font-weight: 600; }
.steps p { margin: 2px 0 8px; }
