* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #05060a;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #e8ecff;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

/* Sized to the game's own 480x640 aspect ratio so Phaser's FIT scaling has
   nothing to letterbox. That matters because the HUD and overlay are DOM
   elements positioned against #wrap - if the canvas were letterboxed inside
   it, they would drift out of alignment at other screen sizes. */
#wrap {
  position: relative;
  width: min(480px, 100vw, calc(100vh * 480 / 640));
  aspect-ratio: 480 / 640;
}

#game,
#game canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

#game canvas {
  background: radial-gradient(ellipse at 50% 0%, #0a0e1f 0%, #05060a 70%);
  border: 2px solid #2a3560;
  border-radius: 6px;
  box-shadow: 0 0 30px rgba(80, 120, 255, 0.25);
  touch-action: none;   /* stop the page panning while a finger steers the ship */
}

#hud {
  position: absolute;
  top: 2.2%;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 3.5%;
  font-size: clamp(11px, 3.3vmin, 16px);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

/* Active power-ups. Sits under the HUD row, NOT at the bottom: the player
   ship parks bottom-centre, and a label there is unreadable on top of it. */
#power {
  position: absolute;
  top: 7.5%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: clamp(10px, 2.9vmin, 14px);
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #ffd76b;
  text-shadow: 0 0 10px rgba(255, 190, 60, 0.55);
  pointer-events: none;
  min-height: 1em;
}

/* A real button, not just a keyboard shortcut: touch players have no M key. */
#mute {
  position: absolute;
  right: 2.5%;
  bottom: 2.5%;
  width: clamp(26px, 7vmin, 34px);
  height: clamp(26px, 7vmin, 34px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(13px, 3.6vmin, 17px);
  line-height: 1;
  color: #8fa0d8;
  background: rgba(20, 26, 50, 0.6);
  border: 1px solid #2a3560;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
}

#mute:hover {
  color: #cdd8ff;
  border-color: #47588f;
}

#mute.muted {
  color: #5a6485;
  text-decoration: line-through;
}

#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(2, 3, 8, 0.82);
  border-radius: 6px;
  text-align: center;
  padding: 20px;
}

#overlay.hidden {
  display: none;
}

#overlayTitle {
  margin: 0;
  font-size: clamp(22px, 6.6vmin, 32px);
  letter-spacing: 2px;
  color: #7ea2ff;
  text-shadow: 0 0 14px rgba(126, 162, 255, 0.7);
}

#overlayMsg {
  margin: 0;
  max-width: 380px;
  color: #b7c0e6;
  font-size: clamp(11px, 2.9vmin, 14px);
  line-height: 1.5;
}

#startBtn {
  padding: 10px 28px;
  font-size: clamp(13px, 3.3vmin, 16px);
  font-weight: 600;
  color: #05060a;
  background: #7ea2ff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
}

#startBtn:hover {
  background: #a3bcff;
}

#startBtn:active {
  transform: scale(0.97);
}
