/* Asteroid Shooter — game-specific overrides */

html, body {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
  height: 100dvh;
}

#game-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #000;
  touch-action: none;
  position: relative;
}

/* JS sets --controls-h to reserve space for touch controls */
#game-container.has-controls {
  height: calc(100vh - var(--controls-h, 0px));
  height: calc(100dvh - var(--controls-h, 0px));
}

canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
}

/* ─────────────────────────────────────────────
   Touch Controls Container
   ───────────────────────────────────────────── */

#touch-controls {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 160px;
  padding: 0 20px;
  padding-bottom: max(env(safe-area-inset-bottom), 16px);
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  pointer-events: none;
}

.touch-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* ─────────────────────────────────────────────
   Virtual Joystick
   ───────────────────────────────────────────── */

#joystick-base {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 2px solid rgba(0, 255, 204, 0.4);
  background: rgba(0, 255, 204, 0.05);
  position: relative;
  pointer-events: auto;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

#joystick-thumb {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #00ffcc;
  background: rgba(0, 255, 204, 0.25);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: none;
}

/* ─────────────────────────────────────────────
   Fire Button
   ───────────────────────────────────────────── */

.touch-btn {
  pointer-events: auto;
  border-radius: 50%;
  border: 2px solid #00ffcc;
  background: rgba(0, 255, 204, 0.1);
  color: #00ffcc;
  font-family: monospace;
  font-size: 20px;
  line-height: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
  cursor: pointer;
  touch-action: none;
}

.touch-btn:active {
  background: rgba(0, 255, 204, 0.35);
  border-color: #66ffd9;
  color: #ffffff;
}

.touch-btn-fire {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 2px;
  border-width: 3px;
  background: rgba(0, 255, 204, 0.12);
}

.touch-btn-fire:active {
  background: rgba(0, 255, 204, 0.4);
  border-color: #66ffd9;
  color: #ffffff;
}

/* ─────────────────────────────────────────────
   Fullscreen Button
   ───────────────────────────────────────────── */

#btn-fullscreen {
  display: none;
  position: fixed;
  top: max(env(safe-area-inset-top), 8px);
  right: max(env(safe-area-inset-right), 8px);
  width: 40px;
  height: 40px;
  font-size: 18px;
  z-index: 1001;
  opacity: 0.5;
}

#btn-fullscreen:active {
  opacity: 1;
  background: rgba(0, 255, 204, 0.35);
}

/* ─────────────────────────────────────────────
   Fullscreen state — hide the button chrome
   ───────────────────────────────────────────── */

:fullscreen #game-container,
:-webkit-full-screen #game-container {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}

:fullscreen #game-container.has-controls,
:-webkit-full-screen #game-container.has-controls {
  height: calc(100vh - var(--controls-h, 0px));
  height: calc(100dvh - var(--controls-h, 0px));
}
