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

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #000;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
}

#game-canvas {
  position: absolute;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: crosshair;
  touch-action: none;
}

/* ── Splash Screen ─────────────────────────────────────── */

#splash-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #050510;
  z-index: 100;
  gap: 18px;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0)
           env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}

#splash-subtitle {
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: clamp(10px, 3vw, 13px);
  color: #446688;
  letter-spacing: 0.25em;
  text-transform: lowercase;
}

#splash-title {
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: clamp(22px, 7.5vw, 44px);
  color: #e0c060;
  letter-spacing: 0.15em;
  text-align: center;
  text-shadow: 0 0 20px #c0a030, 0 0 50px #804000;
  animation: titlePulse 2.4s ease-in-out infinite;
}

@keyframes titlePulse {
  0%, 100% { opacity: 1; text-shadow: 0 0 20px #c0a030, 0 0 50px #804000; }
  50%       { opacity: 0.75; text-shadow: 0 0 10px #a08020; }
}

#splash-progress-wrap {
  width: min(260px, 68%);
  height: 6px;
  background: #0e0e22;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid #222244;
}

#progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #335599, #5599cc);
  border-radius: 3px;
  transition: width 0.15s ease;
}

#splash-tap {
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: clamp(11px, 3.5vw, 14px);
  color: #5577aa;
  letter-spacing: 0.15em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}

#splash-tap.visible {
  opacity: 1;
  pointer-events: auto;
  animation: tapBlink 1.6s ease-in-out infinite;
}

@keyframes tapBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.25; }
}

/* ── Scene fade overlay ────────────────────────────────── */

#scene-overlay {
  position: absolute;
  inset: 0;
  background: #000;
  pointer-events: none;
  opacity: 0;
  z-index: 50;
  transition: opacity 0.35s ease;
}

#scene-overlay.fade-in  { opacity: 1; }
#scene-overlay.fade-out { opacity: 0; }
