:root {
  --bg: #0b1712;
  --panel: #14251d;
  --panel2: #1b3026;
  --line: #2c4538;
  --text: #f2f6f2;
  --muted: #a7b8ad;
  --accent: #b8d7a5;
  --danger: #e17d76;
  --gold: #e5c77b;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #183528 0, var(--bg) 55%);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, Segoe UI, sans-serif;
}
button,
input {
  font: inherit;
}
.app {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 24px 16px 48px;
}
header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 22px;
}
header .headingTitle {
  text-align: center;
}
.eyebrow {
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: 11px;
  font-weight: 700;
}
h1 {
  font-size: clamp(30px, 5vw, 46px);
  margin: 0;
  letter-spacing: -0.8px;
  font-family: Georgia, serif;
  font-weight: 500;
}
.subtitle {
  color: var(--muted);
  margin-top: 4px;
  font-size: 14px;
}
.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--accent);
  font-size: 12px;
  white-space: nowrap;
}
.panel {
  background: rgba(20, 37, 29, 0.94);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 12px 35px #0002;
}
.setup {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
input {
  min-width: 0;
  background: #0d1c15;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px 13px;
  outline: none;
}
input:focus {
  border-color: var(--accent);
}
.setup input {
  flex: 1;
}
button {
  border: 0;
  border-radius: 11px;
  padding: 11px 14px;
  cursor: pointer;
  color: var(--text);
  background: var(--panel2);
  transition: transform 0.08s, opacity 0.15s, background 0.15s;
}
button:active {
  transform: scale(0.98);
}
button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}
.primary {
  background: var(--accent);
  color: #102017;
  font-weight: 750;
}
.subtle {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}
.danger {
  color: #ffd9d6;
  border: 1px solid #74413e;
  background: #3a211f;
}
.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.section-title {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-size: 11px;
  font-weight: 750;
  margin: 0 0 12px;
}
.players {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.player {
  text-align: left;
  border: 1px solid var(--line);
  background: #102018;
  padding: 13px;
  border-radius: 14px;
  min-width: 0;
}
.player.active {
  border: 1px solid var(--accent);
  background: #1b3427;
  box-shadow: inset 0 0 0 1px #b8d7a533;
}
.player-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.player-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.turn-tag {
  color: var(--accent);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}
.score {
  font-size: 34px;
  line-height: 1.15;
  font-weight: 800;
  margin: 9px 0 3px;
  font-variant-numeric: tabular-nums;
}
.player-meta {
  color: var(--muted);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
}
.game-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
}
.current-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.stat {
  background: #0e1d16;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px;
}
.stat-label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.stat-value {
  font-size: 27px;
  font-weight: 800;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.balls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}
.ball {
  min-height: 91px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid #ffffff14;
  background: #20352b;
}
.ball-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  box-shadow: inset -4px -5px 8px #0004, inset 3px 3px 5px #fff4, 0 2px 5px #0005;
}
.ball-name {
  font-size: 12px;
  font-weight: 700;
}
.ball-points {
  font-size: 11px;
  color: var(--muted);
}
.red-dot {
  background: #c93434;
}
.yellow-dot {
  background: #f0d33c;
}
.green-dot {
  background: #25834b;
}
.brown-dot {
  background: #805334;
}
.blue-dot {
  background: #2876c8;
}
.pink-dot {
  background: #e79bb7;
}
.black-dot {
  background: #161616;
  border: 1px solid #666;
}
.turn-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 12px;
}
.turn-actions button {
  min-height: 46px;
}
.wide {
  grid-column: 1/-1;
}
.status {
  min-height: 22px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}
.status.good {
  color: var(--accent);
}
.status.warn {
  color: var(--gold);
}
.status.bad {
  color: #ffaaa3;
}
.history {
  max-height: 330px;
  overflow: auto;
}
.history-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #ffffff10;
  font-size: 13px;
}
.history-row:last-child {
  border: 0;
}
.history-detail {
  color: var(--muted);
}
.history-points {
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.empty {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0;
}
.winner {
  display: none;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid #7b7045;
  border-radius: 14px;
  background: #3a321b;
  color: #ffe7a0;
  font-weight: 750;
}
.footnote {
  color: var(--muted);
  font-size: 11px;
  margin-top: 16px;
}
@media (max-width: 700px) {
  .app {
    padding: 18px 12px 34px;
  }
  header {
    align-items: center;
    flex-direction: column;
  }
  .game-grid {
    grid-template-columns: 1fr;
  }
  .panel {
    padding: 14px;
  }
  .balls {
    grid-template-columns: repeat(4, 1fr);
  }
  .ball {
    min-height: 82px;
  }
}
@media (max-width: 380px) {
  .balls {
    grid-template-columns: repeat(3, 1fr);
  }
}
.screenonswitchWrapper {
  margin-bottom: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.screenonswitchWrapper .screenOnOuter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.screenonswitchWrapper .screenOnOuter .title {
  font-size: 12px;
  font-weight: 400;
}
.screenonswitchWrapper .screenOnOuter .switchOuter .hk-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.screenonswitchWrapper .screenOnOuter .switchOuter .hk-toggle input {
  display: none;
}
.screenonswitchWrapper .screenOnOuter .switchOuter .hk-toggle label {
  width: 42px;
  height: 22px;
  border-radius: 40px;
  position: relative;
  cursor: pointer;
  background: #4f4f4f;
  box-shadow: 0 3px 3px rgba(0, 0, 0, 0.2);
}
.screenonswitchWrapper .screenOnOuter .switchOuter .hk-toggle label::after {
  content: "";
  width: 16px;
  height: 16px;
  position: absolute;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  transition: 0.35s;
  background: #9aa0a6;
}
.screenonswitchWrapper .screenOnOuter .switchOuter .hk-toggle input:checked + label {
  background: #008d23;
}
.screenonswitchWrapper .screenOnOuter .switchOuter .hk-toggle input:checked + label::after {
  transform: translateX(20px);
  background: #fff;
}
