* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #111;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: 'Courier New', monospace;
  color: #ffe135;
  overflow: hidden;
}

#game-container {
  position: relative;
}

#game-canvas {
  display: block;
  background: #000;
  border: 2px solid #ffe135;
  box-shadow: 0 0 20px rgba(255, 225, 53, 0.15), inset 0 0 30px rgba(0, 0, 0, 0.5);
}

#hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px;
  font-size: 16px;
  background: #000;
  border: 2px solid #ffe135;
  border-top: none;
  flex-wrap: wrap;
  gap: 4px;
}

#powerup-timers {
  font-size: 13px;
  display: flex;
  gap: 6px;
}

#combo-display {
  font-size: 12px;
}

#music-btn, #voice-btn, #settings-btn {
  font-family: inherit;
  font-size: 12px;
  padding: 2px 10px;
  background: transparent;
  color: #ffe135;
  border: 1px solid #ffe135;
  cursor: pointer;
  white-space: nowrap;
}

#music-btn:hover, #voice-btn:hover, #settings-btn:hover {
  background: #ffe13533;
}

#settings-btn {
  font-size: 16px;
  padding: 2px 8px;
}

/* ── Settings panel ──────────────────────────────────────────────────────── */

#settings-panel {
  position: absolute;
  top: 0;
  right: -260px;
  width: 250px;
  background: rgba(0, 0, 0, 0.95);
  border: 2px solid #ffe135;
  padding: 12px;
  z-index: 20;
  transition: right 0.25s ease;
  max-height: 100%;
  overflow-y: auto;
}

#settings-panel.open {
  right: 0;
}

#settings-panel h3 {
  margin-bottom: 10px;
  font-size: 16px;
  color: #ffe135;
  text-align: center;
}

.settings-section {
  margin-bottom: 12px;
  border-bottom: 1px solid #333;
  padding-bottom: 8px;
}

.settings-section:last-child {
  border-bottom: none;
}

.settings-section > label {
  display: block;
  font-size: 13px;
  color: #ffe135;
  margin-bottom: 6px;
  font-weight: bold;
}

.perf-group {
  display: flex;
  gap: 4px;
}

.perf-btn {
  flex: 1;
  font-family: inherit;
  font-size: 11px;
  padding: 4px 6px;
  background: transparent;
  color: #ccc;
  border: 1px solid #555;
  cursor: pointer;
}

.perf-btn.active {
  background: #ffe135;
  color: #111;
  border-color: #ffe135;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 11px;
  color: #ccc;
}

.slider-row span {
  width: 42px;
  flex-shrink: 0;
}

.slider-row input[type="range"] {
  flex: 1;
  height: 4px;
  accent-color: #ffe135;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 11px;
  color: #ccc;
}

.check-row input[type="checkbox"] {
  accent-color: #ffe135;
}

.check-row label {
  cursor: pointer;
}

/* ── Overlay ─────────────────────────────────────────────────────────────── */

#overlay {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10;
  padding: 16px;
  overflow-y: auto;
}

#overlay.visible {
  display: flex;
}

#overlay h1 {
  font-size: 32px;
  margin-bottom: 16px;
}

#overlay h3 {
  font-size: 15px;
}

#overlay p {
  font-size: 14px;
  margin-bottom: 24px;
  color: #ccc;
  text-align: center;
}

#overlay button {
  font-family: inherit;
  font-size: 20px;
  padding: 12px 32px;
  background: #ffe135;
  color: #111;
  border: none;
  cursor: pointer;
}

#overlay button:hover {
  background: #fff176;
}

#overlay table {
  font-family: inherit;
}

#overlay table th, #overlay table td {
  padding: 2px 8px;
  text-align: left;
}

/* ── Touch controls ──────────────────────────────────────────────────────── */

#touch-controls {
  display: none;
  justify-content: center;
  gap: 12px;
  padding: 10px 0;
}

#touch-controls button {
  font-size: 28px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid #ffe135;
  background: rgba(255, 225, 53, 0.12);
  color: #ffe135;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#touch-controls button:active {
  background: rgba(255, 225, 53, 0.35);
}

#touch-fire {
  width: 88px;
  height: 88px;
  font-size: 36px;
  align-self: center;
}

/* ── Large UI mode ───────────────────────────────────────────────────────── */

body.large-ui #hud {
  font-size: 20px;
  padding: 10px 6px;
}

body.large-ui #music-btn,
body.large-ui #voice-btn,
body.large-ui #settings-btn {
  font-size: 16px;
  padding: 4px 12px;
}

body.large-ui #overlay h1 {
  font-size: 38px;
}

body.large-ui #overlay p {
  font-size: 17px;
}

body.large-ui #overlay button {
  font-size: 24px;
  padding: 14px 36px;
}

body.large-ui #touch-controls button {
  width: 88px;
  height: 88px;
  font-size: 34px;
}

body.large-ui #touch-fire {
  width: 100px;
  height: 100px;
  font-size: 42px;
}

/* ── Touch media query ───────────────────────────────────────────────────── */

@media (pointer: coarse) {
  body {
    align-items: stretch;
  }

  #touch-controls {
    display: flex;
  }

  #game-container {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  #game-canvas {
    width: 100%;
    flex: 1 1 0;
    min-height: 0;
    object-fit: contain;
  }

  #hud {
    flex-wrap: wrap;
    gap: 4px;
    font-size: 13px;
    flex-shrink: 0;
    padding: 6px 4px;
  }

  #touch-controls {
    flex-shrink: 0;
    padding: 10px 16px;
    gap: 24px;
  }

  #touch-controls button {
    width: 68px;
    height: 68px;
    font-size: 26px;
  }

  #touch-fire {
    width: 80px;
    height: 80px;
    font-size: 32px;
  }

  #settings-panel {
    width: 220px;
    right: -230px;
  }

  #settings-panel.open {
    right: 0;
  }
}
