/* CentreBowl Bowler Portal */
:root {
  --bg: #f3f4f7;
  --card: #ffffff;
  --text: #1a1a2e;
  --muted: #6b7083;
  --line: #e1e3ea;
  --accent: #c8102e;        /* bowling-pin red */
  --accent-text: #ffffff;
  --good: #1f8a4c;
  --bad: #b3261e;
  --chip: #eef0f5;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12131a;
    --card: #1c1e28;
    --text: #eceef4;
    --muted: #9aa0b4;
    --line: #2d3040;
    --accent: #e0334f;
    --good: #4cc27f;
    --bad: #ff6b60;
    --chip: #262938;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[hidden] { display: none !important; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.brand .muted { font-weight: 400; }
.pin-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }

main { max-width: 760px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.4rem; margin: 0 0 12px; }
h2 { font-size: 1.15rem; margin: 0; }
.muted { color: var(--muted); }
.center { text-align: center; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px;
}
.narrow { max-width: 420px; margin: 24px auto; }

label { display: block; margin-bottom: 12px; font-weight: 600; font-size: .92rem; }
label small { display: block; font-weight: 400; color: var(--muted); }
input {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px;
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button {
  font: inherit; cursor: pointer; border: 0; border-radius: 8px;
  padding: 10px 16px; background: var(--accent); color: var(--accent-text); font-weight: 600;
}
button[type=submit] { width: 100%; }
button:disabled { opacity: .55; cursor: default; }
button.link { background: none; color: var(--accent); padding: 4px 0; font-weight: 600; }
button.ghost { background: var(--chip); color: var(--text); }
.alt { display: flex; justify-content: space-between; margin-top: 12px; }

.msg { min-height: 1.2em; margin: 4px 0 10px; color: var(--bad); font-size: .92rem; }
.msg.ok { color: var(--good); }

.hello h1 { margin-bottom: 8px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-bottom: 16px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px;
}
.stat b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.stat span { font-size: .8rem; color: var(--muted); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button {
  background: none; color: var(--muted); border-radius: 0; padding: 10px 14px;
  border-bottom: 3px solid transparent;
}
.tabs button[aria-selected=true] { color: var(--text); border-bottom-color: var(--accent); }

.league h2 { margin-bottom: 2px; }
.league .sub { margin: 0 0 12px; }
.league .stat-row { margin-bottom: 12px; }
.league .stat { background: var(--bg); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.chips li { background: var(--chip); border-radius: 999px; padding: 3px 10px; font-size: .85rem; }
.note { font-size: .85rem; color: var(--muted); margin: 6px 0 0; }

.games { list-style: none; margin: 0; padding: 0; }
.games li {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; margin-bottom: 8px; cursor: pointer;
}
.games .score { font-size: 1.4rem; font-weight: 700; min-width: 3ch; text-align: right; font-variant-numeric: tabular-nums; }
.games .what { flex: 1; min-width: 0; }
.games .what div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.games .star { color: var(--accent); font-size: 1.1rem; }
.games li button { flex: none; }
.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }

dialog {
  width: min(720px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; background: var(--card); color: var(--text);
}
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.scorecard-wrap { overflow-x: auto; margin-bottom: 12px; }
.scorecard { border-collapse: collapse; width: 100%; min-width: 520px; font-variant-numeric: tabular-nums; }
.scorecard th, .scorecard td { border: 1px solid var(--line); text-align: center; padding: 4px 2px; font-size: .9rem; }
.scorecard th { color: var(--muted); font-weight: 600; font-size: .75rem; }
.scorecard .balls { letter-spacing: .5px; height: 1.8em; }
.scorecard .total { font-weight: 700; height: 1.8em; }

/* ── Multi-alley ─────────────────────────────────────────────────────────── */
select {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px;
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px;
}
.alt { flex-wrap: wrap; gap: 8px; }
.section-title { margin: 4px 0 12px; }
.alley-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.alley-btn {
  display: block; width: 100%; text-align: left; padding: 16px;
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius);
}
.alley-btn b { display: block; font-size: 1.05rem; margin-bottom: 4px; }
.alley-btn span { color: var(--muted); font-size: .88rem; font-weight: 400; }
.alley-btn:hover, .alley-btn:focus-visible { border-color: var(--accent); }
.alley-btn.add { border-style: dashed; color: var(--accent); }
.alley-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.alley-head .link { align-self: flex-start; }
