*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100dvw;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  background: #1a1a1c;
  color: #f2f0ea;
  font-family: "Segoe UI", system-ui, sans-serif;
}

#app,
.screen {
  width: 100%;
  height: 100%;
}

.screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 1.5rem;
}

.screen.hidden {
  display: none;
}

#screen-board {
  display: block;
  padding: 0;
  position: relative;
}

#screen-board.hidden {
  display: none;
}

.screen-title {
  margin: 0;
  font-size: clamp(1.4rem, 5vw, 2rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
}

.btn-primary {
  appearance: none;
  border: none;
  border-radius: 0.75rem;
  padding: 1rem 2.25rem;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #1a1a1c;
  background: #e8e4d8;
  cursor: pointer;
}

.btn-primary:active {
  transform: scale(0.98);
}

.player-count-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  max-width: 20rem;
}

.player-count-buttons button {
  appearance: none;
  width: 3.5rem;
  height: 3.5rem;
  border: 2px solid #e8e4d8;
  border-radius: 0.6rem;
  background: transparent;
  color: #e8e4d8;
  font-size: 1.35rem;
  font-weight: 600;
  cursor: pointer;
}

.player-count-buttons button:active {
  background: #e8e4d8;
  color: #1a1a1c;
}

#board-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.life-label {
  fill: #f2f0ea;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  user-select: none;
}

.life-control {
  cursor: pointer;
  pointer-events: auto;
}

.life-control-hit {
  fill: rgba(242, 240, 234, 0.12);
  pointer-events: all;
}

.life-control:active .life-control-hit {
  fill: rgba(242, 240, 234, 0.28);
}

.life-control-label {
  fill: #f2f0ea;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  user-select: none;
}

.seat-wedge {
  transition: filter 0.15s ease;
}

.seat-wedge.seat-active {
  filter: brightness(1.35);
  stroke: #f2f0ea;
  stroke-width: 4;
}

.timer-hub {
  fill: #1a1a1c;
  stroke: #000000;
  stroke-width: 2;
  pointer-events: none;
}

.timer-hub.timer-paused {
  fill: #2a2a2e;
}

.timer-turn-hit,
.timer-game-hit {
  fill: transparent;
  cursor: pointer;
  pointer-events: all;
}

.timer-turn-label,
.timer-round-label,
.timer-game-label {
  fill: #f2f0ea;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  user-select: none;
}

.timer-round-label {
  fill: #c8c4b8;
  font-weight: 600;
}

.timer-game-label {
  fill: #b8b4a8;
  font-weight: 600;
}

.timer-hub.timer-paused ~ .timer-hub-group .timer-turn-label,
.timer-hub.timer-paused ~ .timer-hub-group .timer-round-label,
.timer-hub.timer-paused ~ .timer-hub-group .timer-game-label {
  fill: #8a867c;
}

.player-name-hit {
  fill: rgba(242, 240, 234, 0.1);
  cursor: pointer;
  pointer-events: all;
}

.player-name-hit:active {
  fill: rgba(242, 240, 234, 0.22);
}

.player-name {
  fill: #f2f0ea;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  user-select: none;
}

.player-name.player-name-placeholder {
  fill: rgba(242, 240, 234, 0.55);
  font-weight: 500;
}

.cmd-damage-track {
  fill: rgba(0, 0, 0, 0.45);
  stroke: rgba(242, 240, 234, 0.35);
  stroke-width: 1;
  pointer-events: none;
}

.cmd-damage-fill {
  opacity: 0.9;
  pointer-events: none;
}

.cmd-damage-hit {
  fill: transparent;
  cursor: pointer;
  pointer-events: all;
}

.cmd-damage-value {
  fill: #f2f0ea;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  user-select: none;
}

.cmd-damage-lethal .cmd-damage-track {
  stroke: #e8b4b4;
  stroke-width: 1.5;
}

.cmd-damage-lethal .cmd-damage-value {
  fill: #ffe0e0;
}

.cmd-damage-control {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.cmd-damage-open .cmd-damage-control {
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
}

.cmd-damage-control-hit {
  fill: rgba(242, 240, 234, 0.14);
  pointer-events: all;
}

.cmd-damage-open .cmd-damage-control:active .cmd-damage-control-hit {
  fill: rgba(242, 240, 234, 0.3);
}

.cmd-damage-control-label {
  fill: #f2f0ea;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  user-select: none;
}

.cmd-damage-open .cmd-damage-track {
  stroke: rgba(242, 240, 234, 0.7);
}

.name-editor {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.55);
}

.name-editor.hidden {
  display: none;
}

.name-editor-panel {
  width: min(18rem, 100%);
  padding: 1.25rem;
  background: #1a1a1c;
  border: 1px solid #e8e4d8;
  border-radius: 0.75rem;
}

.name-editor-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-align: center;
  color: #f2f0ea;
}

#name-editor-input {
  display: block;
  width: 100%;
  margin: 0 0 1rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid #e8e4d8;
  border-radius: 0.5rem;
  background: #121214;
  color: #f2f0ea;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
}

#name-editor-input:focus {
  outline: 2px solid #e8e4d8;
  outline-offset: 1px;
}

.name-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

#name-editor-cancel {
  appearance: none;
  border: 1px solid #e8e4d8;
  border-radius: 0.6rem;
  padding: 0.65rem 1rem;
  background: transparent;
  color: #e8e4d8;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

#name-editor-done {
  padding: 0.65rem 1.1rem;
  font-size: 0.95rem;
}

.nic-song-toggle {
  appearance: none;
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  border: 1px solid #e8e4d8;
  border-radius: 999px;
  padding: 0.65rem 1.35rem;
  background: rgba(26, 26, 28, 0.92);
  color: #f2f0ea;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.nic-song-toggle.hidden {
  display: none;
}

.nic-song-toggle:active {
  transform: translateX(-50%) scale(0.98);
}
