* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #05060c;
  overflow: hidden;
  font-family: 'Courier New', Courier, monospace;
  touch-action: none;
}

#game-wrap {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

canvas#game {
  background: #05060c;
  image-rendering: pixelated;
  max-width: 100vw;
  max-height: 100vh;
  width: auto;
  height: 100vh;
  aspect-ratio: 480 / 640;
  border-left: 1px solid #1a2036;
  border-right: 1px solid #1a2036;
}

#hud {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: min(480px, 100vw);
  display: flex;
  justify-content: space-between;
  padding: 0 14px;
  color: #6cf7ff;
  font-size: 14px;
  letter-spacing: 1px;
  text-shadow: 0 0 6px rgba(108, 247, 255, 0.6);
  pointer-events: none;
}

#overlay {
  position: absolute;
  inset: 0;
  background: rgba(2, 3, 8, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #e8f6ff;
  z-index: 10;
}

#overlay.hidden {
  display: none;
}

#overlay-inner h1 {
  font-size: 32px;
  color: #ff5cc7;
  text-shadow: 0 0 12px rgba(255, 92, 199, 0.7);
  margin: 0 0 10px;
  letter-spacing: 3px;
}

#overlay-inner p {
  margin: 6px 0;
  font-size: 13px;
  color: #9fb3d9;
}

#overlay-inner .hint {
  font-size: 12px;
  color: #6cf7ff;
}

#start-btn {
  margin-top: 20px;
  padding: 12px 32px;
  font-family: inherit;
  font-size: 16px;
  letter-spacing: 2px;
  background: #ff5cc7;
  color: #05060c;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(255, 92, 199, 0.6);
}

#start-btn:active {
  transform: scale(0.97);
}

#touch-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  padding: 18px;
  z-index: 5;
  pointer-events: none;
}

.touch-btn {
  pointer-events: auto;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(108, 247, 255, 0.12);
  border: 2px solid rgba(108, 247, 255, 0.5);
  color: #6cf7ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: bold;
}

.touch-btn:active {
  background: rgba(108, 247, 255, 0.3);
}

#touch-fire {
  width: 84px;
  height: 84px;
  font-size: 14px;
  background: rgba(255, 92, 199, 0.15);
  border-color: rgba(255, 92, 199, 0.6);
  color: #ff5cc7;
}

/* Tilt steering active: hide the left/right pad, center the fire button. */
#touch-controls.tilt-active #touch-left,
#touch-controls.tilt-active #touch-right {
  display: none;
}

#touch-controls.tilt-active #touch-fire {
  margin: 0 auto;
}

#touch-recenter {
  display: none;
  position: absolute;
  top: 46px;
  right: 14px;
  width: 44px;
  height: 44px;
  font-size: 18px;
  z-index: 6;
}

#touch-recenter.visible {
  display: flex;
}

.touch-hint { display: none; }

/* Show touch controls / hints on coarse-pointer (touch) devices */
@media (pointer: coarse) {
  #touch-controls {
    display: flex;
  }
  .desktop-hint { display: none; }
  .touch-hint { display: block; }
}
