:root {
  color-scheme: dark;
  --bg: #060911;
  --panel: rgba(16, 23, 37, .94);
  --panel2: #172135;
  --line: #2a3850;
  --text: #f7f9fc;
  --muted: #93a2b9;
  --cyan: #21e2ba;
  --blue: #59a5ff;
  --yellow: #ffd166;
  --red: #ff6378;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0, rgba(33, 226, 186, .13), transparent 32rem),
    radial-gradient(circle at 100% 8%, rgba(89, 165, 255, .12), transparent 34rem),
    var(--bg);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }
button { touch-action: manipulation; }

.shell { width: min(1180px, calc(100% - 28px)); margin: auto; padding: 24px 0 48px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 20px; }
.brand { margin: 0; font-size: clamp(1.35rem, 3vw, 2rem); letter-spacing: .06em; }
.brand span { color: var(--cyan); }
.connection { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 14px currentColor; }
.dot.online { background: var(--cyan); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: 0 18px 60px rgba(0,0,0,.22); }
.panel + .panel { margin-top: 16px; }
.panel-title { margin: 0 0 18px; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .12em; }
.setup-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; gap: 7px; }
.field label { color: var(--muted); font-size: .86rem; }
.field input, .field select {
  width: 100%; border: 1px solid var(--line); background: #090f1b; color: var(--text);
  border-radius: 10px; padding: 11px 12px; outline: none;
}
.field input:focus, .field select:focus { border-color: var(--cyan); }
.check { display: flex; align-items: center; gap: 9px; min-height: 44px; color: var(--text); }
.check input { width: 18px; height: 18px; accent-color: var(--cyan); }
.players-editor { display: grid; gap: 10px; margin-top: 18px; }
.player-edit { display: grid; grid-template-columns: 55px 1fr 150px; gap: 10px; align-items: center; }
.player-number { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--panel2); color: var(--cyan); font-weight: 800; }
.notice { margin-top: 16px; padding: 13px 15px; border: 1px solid rgba(255,209,102,.42); background: rgba(255,209,102,.08); color: #ffe8aa; border-radius: 11px; line-height: 1.6; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.btn {
  border: 1px solid var(--line); background: var(--panel2); color: var(--text); border-radius: 11px;
  padding: 11px 16px; cursor: pointer; text-decoration: none; transition: transform .12s, border-color .12s;
}
.btn:hover { transform: translateY(-1px); border-color: var(--blue); }
.btn.primary { background: var(--cyan); border-color: var(--cyan); color: #02130f; font-weight: 800; }
.btn.danger { color: #ff9baa; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.game-head { display: flex; justify-content: space-between; gap: 15px; align-items: center; }
.game-name { font-size: 1.15rem; color: var(--muted); }
.round { font-size: 1rem; color: var(--muted); }
.scoreboard { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-top: 16px; }
.player-card { border: 1px solid var(--line); background: #0a101c; border-radius: 15px; padding: 15px; transition: .18s; }
.player-card.active { border-color: var(--cyan); background: rgba(33,226,186,.08); box-shadow: inset 0 0 22px rgba(33,226,186,.05); }
.player-card.winner { border-color: var(--yellow); }
.player-name { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-score { font-size: clamp(2.5rem, 7vw, 4.7rem); font-weight: 850; line-height: 1; margin-top: 8px; font-variant-numeric: tabular-nums; }

.turn { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; margin-top: 16px; }
.turn-message { font-size: clamp(1.15rem,3vw,1.8rem); font-weight: 750; }
.turn-sub { color: var(--muted); margin-top: 7px; line-height: 1.6; }
.darts { display: flex; gap: 9px; }
.dart { width: 78px; min-height: 68px; padding: 8px; display: grid; place-items: center; text-align: center; border-radius: 13px; border: 1px solid var(--line); background: #090f1b; }
.dart strong { font-size: 1.2rem; }
.dart span { display: block; color: var(--muted); font-size: .75rem; margin-top: 2px; }
.dart.hit { border-color: var(--blue); }
.dart.bust { border-color: var(--red); color: var(--red); }
.large-action { min-width: 240px; padding: 15px 20px; font-size: 1.05rem; }
.protocol-log { max-height: 160px; overflow: auto; padding: 12px; background: #070c15; border-radius: 10px; color: var(--muted); font: .78rem/1.55 ui-monospace, monospace; white-space: pre-wrap; }
.hidden { display: none !important; }

@media (max-width: 720px) {
  .setup-grid { grid-template-columns: 1fr; }
  .player-edit { grid-template-columns: 42px 1fr 110px; }
  .turn { grid-template-columns: 1fr; }
  .darts { justify-content: stretch; }
  .dart { width: auto; flex: 1; }
  .large-action { width: 100%; }
  .topbar { align-items: flex-start; flex-direction: column; }
}

