* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  touch-action: none;
  overscroll-behavior: none;
}

body {
  background: #0d0d0d;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  font-family: 'Press Start 2P', monospace;
  -webkit-user-select: none;
  user-select: none;
}

#gameWrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  width: 100%;
}

#gameCanvas {
  display: block;
  cursor: crosshair;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  /* CSS sizing handled by JS for adaptive scaling */
  border: 2px solid #444;
  box-shadow: 0 0 32px rgba(255, 220, 0, 0.18), 0 0 4px #000;
}

/* ── Touch controls (hidden on desktop) ──────────────────────────────────── */
#touchControls {
  display: none;
  width: 100%;
  padding: 10px 20px 16px;
  justify-content: space-between;
  align-items: flex-end;
  flex-shrink: 0;
}

/* ── D-Pad ───────────────────────────────────────────────────────────────── */
#dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.dpad-row {
  display: flex;
  align-items: center;
  gap: 0;
}

.dpad-center {
  width: 56px;
  height: 56px;
  background: #222;
}

.dpad-btn {
  width: 56px;
  height: 56px;
  background: #333;
  color: #ccc;
  border: 2px solid #555;
  border-radius: 8px;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  -webkit-touch-callout: none;
}

.dpad-btn:active,
.dpad-btn.pressed {
  background: #666;
  color: #fff;
  border-color: #ffdd00;
}

/* ── Right controls ──────────────────────────────────────────────────────── */
#rightControls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.ctrl-btn {
  border-radius: 50%;
  border: 2px solid #555;
  background: #333;
  color: #ccc;
  font-family: 'Press Start 2P', monospace;
  cursor: pointer;
  touch-action: none;
  -webkit-touch-callout: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

#btnPause {
  width: 44px;
  height: 44px;
  font-size: 10px;
}

.fire-btn {
  width: 80px;
  height: 80px;
  font-size: 11px;
  background: #6a1111;
  border-color: #cc3333;
  color: #ff6644;
  box-shadow: 0 0 14px rgba(255, 60, 30, 0.3);
}

.fire-btn:active,
.fire-btn.pressed {
  background: #aa2222;
  color: #fff;
  border-color: #ff6644;
  box-shadow: 0 0 24px rgba(255, 60, 30, 0.6);
}

/* ── Mobile: show touch controls, adjust layout ──────────────────────────── */
@media (pointer: coarse), (hover: none) {
  #touchControls {
    display: flex;
  }

  body {
    justify-content: center;
  }

  #gameCanvas {
    cursor: default;
  }
}
