/* ---------------------------
   Global reset + mobile safety
---------------------------- */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  background: #000;
  overflow: hidden;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  touch-action: manipulation;  /* prevents double-tap zoom */
}

/* ---------------------------
   Game container
---------------------------- */
#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
  background: #000;
}

/* ---------------------------
   Canvas responsiveness
   Internal resolution is still set in JS.
---------------------------- */
canvas {
  display: block;
  width: 100vw;            /* full phone width */
  max-width: 480px;        /* avoids huge desktop scaling */
  height: auto;
  aspect-ratio: 2 / 3;     /* matches 400x600 ratio */
  border-radius: 10px;
  background: #000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  touch-action: none;      /* critical: stops browser gestures on canvas */
}

/* ---------------------------
   Overlay (ready / game over)
---------------------------- */
#overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  background: rgba(0, 0, 0, 0.35);
  padding: 24px;
  pointer-events: none;  /* critical: overlay never blocks taps */
}

#overlay.hidden {
  display: none;
}

#overlay-title {
  margin: 0 0 8px 0;
  font-size: clamp(26px, 6vw, 40px);
  font-weight: 900;
  letter-spacing: 0.5px;
  color: #ffffff;
  text-shadow:
    0 2px 6px rgba(0,0,0,0.9);
}

#overlay-text {
  margin: 0;
  font-size: clamp(14px, 3.5vw, 18px);
  font-weight: 600;
  color: #eaeaea;
  text-shadow:
    0 2px 5px rgba(0,0,0,0.9);
}

/* ---------------------------
   Bloody game-over styling
   JS adds class "bloody" to #overlay
---------------------------- */
#overlay.bloody {
  background: rgba(0, 0, 0, 0.6);
}

#overlay.bloody #overlay-title {
  color: #b00000;
  text-shadow:
    0 2px 0 #320000,
    0 6px 12px rgba(0,0,0,0.95),
    0 0 10px rgba(255, 0, 0, 0.35);
  transform: translateY(-6px);
  animation: bloody-pulse 1.2s infinite ease-in-out;
}

#overlay.bloody #overlay-text {
  color: #ffd7d7;
}

/* subtle “blood pulse” */
@keyframes bloody-pulse {
  0%   { transform: translateY(-6px) scale(1); }
  50%  { transform: translateY(-6px) scale(1.03); }
  100% { transform: translateY(-6px) scale(1); }
}

/* ---------------------------
   Desktop tweaks (optional)
---------------------------- */
@media (min-width: 900px) {
  canvas {
    max-width: 520px;
  }
}
