:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--app-text, #182c40);
  background: var(--app-background, #f2f5f8);
  --accent: #185b94;
  --line: #becbd6;
  --surface: #fff;
  --muted: #425c73;
  --hover: #e3ebf3;
  --focus: #c47908;
}
:root[data-theme=dark] {
  color-scheme: dark;
  --app-background: #17212c;
  --app-text: #e4edf5;
  --accent: #9acaf5;
  --line: #617386;
  --surface: #253545;
  --muted: #c1d1df;
  --hover: #314b63;
  --focus: #f6c15d;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
main { max-width: 980px; min-height: var(--app-height, 100dvh); margin: auto;
  padding: 24px max(18px, env(safe-area-inset-right)) 40px; }
header { display: flex; align-items: center; gap: 12px; }
h1 { font-size: 1.5rem; margin: 0; letter-spacing: -.025em; }
h2 { font-size: 1.4rem; line-height: 1.3; margin: 28px 0 16px; text-wrap: balance; }
h3 { font-size: 1.1rem; margin: 32px 0 12px; }
p { line-height: 1.55; max-width: 70ch; }
.brand-ball { display: grid; place-items: center; background: #f2be38; color: #182c40;
  border: 6px solid #fff; width: 42px; height: 42px; border-radius: 50%; font-weight: 800; }
#status { color: var(--muted); min-height: 1.5em; font-size: .9rem; }
#error { background: #fbe9e7; color: #8d2420; padding: 14px; border-radius: 6px; }
#menu, #lobby { max-width: 480px; }
label { display: block; font-weight: 600; margin: 16px 0 6px; }
button, input, select { font: inherit; min-height: 46px; border-radius: 6px; }
button, select, input:not([type=range]) { border: 1px solid var(--line); padding: 10px 14px; }
input, select { width: 100%; background: var(--surface); color: inherit; }
button { cursor: pointer; background: var(--surface); color: var(--accent); font-weight: 600;
  margin-top: 12px; transition: background-color 140ms ease-out; }
button:hover { background: var(--hover); }
button.primary { color: #fff; border-color: var(--accent); background: var(--accent); }
button.primary:hover { background: #104673; }
:root[data-theme=dark] button.primary { color: #17212c; }
:root[data-theme=dark] button.primary:hover { background: #c0e0fc; }
button:disabled { opacity: .5; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, canvas:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 3px;
}
#menu > button, #joinForm > button, #lobby > button, #shoot { width: 100%; }
#joinForm { margin-top: 28px; padding-top: 8px; border-top: 1px solid var(--line); }
.actions { display: flex; gap: 12px; }
.actions > * { flex: 1; min-width: 0; }
.quiet { background: transparent; border: 0; text-decoration: underline; color: var(--muted); }
ol { padding-left: 24px; }
li { line-height: 1.65; padding: 5px 0; overflow-wrap: anywhere; }
.players { display: flex; flex-wrap: wrap; gap: 8px 28px; list-style: none; padding: 0;
  border-block: 1px solid var(--line); margin: 14px 0; }
.players li { flex: 1 1 180px; }
.players .active { font-weight: 750; }
.match-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.match-heading h2 { margin-top: 12px; }
#timer { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.table-wrap { position: relative; background: #263f38; padding: 12px; border-radius: 12px; }
#gesturePower { position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  padding: 6px 12px; background: #0c2925; color: #fff; border-radius: 6px;
  font-weight: 700; font-variant-numeric: tabular-nums; pointer-events: none; }
canvas { display: block; width: 100%; touch-action: none; user-select: none;
  background: #17664f; border-radius: 6px; }
#controls { max-width: 560px; margin: auto; }
input[type=range] { accent-color: var(--accent); cursor: pointer; }
fieldset { margin: 16px 0; padding: 14px; border: 1px solid var(--line); border-radius: 6px; }
legend { padding: 0 6px; line-height: 1.5; }
#leave { margin-top: 24px; }
#result { padding: 4px 0 20px; }
@media (max-width: 520px) {
  main { padding-top: max(16px, env(safe-area-inset-top)); }
  .table-wrap { padding: 7px; margin-inline: -8px; }
  .players { font-size: .85rem; gap: 4px 12px; }
  .players li { flex-basis: 130px; }
  .match-heading { flex-wrap: wrap; gap: 0 12px; }
}
@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
}
