:root {
  --bg: #f7f5f0;
  --fg: #1f2328;
  --muted: #5b6370;
  --accent: #2f6fde;
  --accent-fg: #fff;
  --surface: #fff;
  --border: #d9d5cc;
  --mark: #ffd166;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171b;
    --fg: #e8e6e3;
    --muted: #9aa1ab;
    --accent: #6c9ef8;
    --accent-fg: #0d1117;
    --surface: #1e2127;
    --border: #343842;
    --mark: #b8860b;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--fg);
}
header, main, footer { max-width: 900px; margin: 0 auto; padding: 16px; }
h1 { margin: 24px 0 0; font-size: 2rem; }
.tagline { color: var(--muted); margin-top: 4px; }
label { display: block; margin: 12px 0; }
input {
  font: inherit; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--surface); color: var(--fg);
}
#code { width: 9em; text-transform: uppercase; letter-spacing: 0.1em; }
button {
  font: inherit; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-fg); cursor: pointer;
}
button.secondary { background: transparent; color: var(--accent); }
button.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.or { color: var(--muted); }
.error { color: #d1242f; min-height: 1.5em; }
.soon { color: var(--muted); }
#game { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 16px; align-items: start; }
.game-head { grid-column: 1 / -1; }
.banner { font-weight: 600; min-height: 1.5em; }
.card { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.cell {
  min-width: 0; min-height: 5.5rem; padding: 4px; font-size: 0.8rem; line-height: 1.2;
  background: var(--surface); color: var(--fg); border: 1px solid var(--border);
  overflow-wrap: anywhere;
}
.cell.marked { background: var(--mark); color: #1f2328; border-color: var(--mark); }
.cell.free { font-weight: 700; }
#players { padding-left: 1.2em; }
footer { color: var(--muted); font-size: 0.9rem; }
footer a { color: var(--accent); }
@media (max-width: 640px) {
  #game { grid-template-columns: 1fr; }
  .cell { font-size: 0.65rem; min-height: 4.5rem; }
}
.back { margin: 0; }
.back a, .result a, .entries a { color: var(--accent); }
.hint { color: var(--muted); font-size: 0.9rem; }
.status { color: var(--muted); min-height: 1.5em; }
textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--fg); width: 100%; resize: vertical;
}
.games { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; padding: 0; list-style: none; }
.games a {
  display: block; height: 100%; padding: 14px 16px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--fg); text-decoration: none;
}
.games a:hover { border-color: var(--accent); }
.games strong { display: block; color: var(--accent); }

.lunch { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; align-items: start; }
.setup label { margin-top: 0; }
.setup .row input { flex: 1 1 12em; min-width: 0; }
#count { width: 6em; display: block; }
.wheel-area { text-align: center; }
.wheel-wrap { position: relative; max-width: 420px; margin: 0 auto; }
#wheel { width: 100%; height: auto; display: block; cursor: pointer; }
.pointer {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
  border-left: 16px solid transparent; border-right: 16px solid transparent; border-top: 30px solid #d1242f;
}
.spin { margin-top: 12px; font-size: 1.2rem; padding: 10px 32px; }
button:disabled { opacity: 0.5; cursor: default; }
.result { font-size: 1.25rem; font-weight: 600; min-height: 1.6em; }
.entries { text-align: left; font-size: 0.9rem; color: var(--muted); padding-left: 1.2em; }

.court-wrap { position: relative; }
#court { width: 100%; height: auto; display: block; border-radius: 8px; border: 1px solid var(--border); touch-action: none; }
.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 24px; align-items: end; margin-top: 12px; }
.controls label { margin: 0; }
.controls input[type="range"] { width: 100%; }
.controls output { font-weight: 600; }
.level-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: space-between; }
.levels { display: flex; flex-wrap: wrap; gap: 6px; }
.levels button { padding: 4px 10px; font-size: 0.9rem; }
.levels button[aria-current="true"] { outline: 3px solid var(--mark); outline-offset: 1px; }
.shot-info { font-weight: 600; min-height: 1.5em; }
@media (max-width: 760px) {
  .lunch { grid-template-columns: 1fr; }
}
