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

html {
  overscroll-behavior: none;
}

body {
  background: #1a0b2e;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-x: hidden;
  touch-action: manipulation;
}

#game-container {
  text-align: center;
}

#title {
  font-size: 36px;
  margin-bottom: 16px;
  color: #ff4fa3;
  text-shadow: 3px 3px 0 #000, -1px -1px 0 #ffce4f;
  letter-spacing: 3px;
  font-weight: 900;
}

canvas {
  display: block;
  margin: 0 auto;
  width: min(100%, 640px);
  height: auto;
  border: 4px solid #ff4fa3;
  background: #2d1b4e;
  image-rendering: pixelated;
  box-shadow: 0 0 20px rgba(255, 79, 163, 0.4);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#hud {
  margin-top: 16px;
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  font-size: 24px;
}

.hud-label {
  font-size: 16px;
  color: #aaa;
  margin-right: 8px;
}

.hud-spacer { margin-left: 24px; }

#lives {
  font-size: 22px;
  letter-spacing: 4px;
  min-width: 90px;
  display: inline-block;
  text-align: left;
}

#powerup-timer {
  margin-left: 16px;
  padding: 4px 10px;
  background: #ffce4f;
  color: #000;
  border-radius: 12px;
  font-weight: bold;
  font-size: 14px;
  box-shadow: 0 0 12px #ffce4f;
}

#powerup-timer.hidden { display: none; }

.slot {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #2d1b4e;
  border: 2px solid #5a3a8a;
  border-radius: 6px;
  opacity: 0.35;
  filter: grayscale(1);
  transition: opacity 0.2s, filter 0.2s, box-shadow 0.2s;
}

.slot.filled {
  opacity: 1;
  filter: none;
  border-color: #ffce4f;
  box-shadow: 0 0 12px #ffce4f;
}

#hint {
  margin-top: 16px;
  font-size: 13px;
  color: #aaa;
}

#overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

#overlay.hidden { display: none; }

#overlay-content {
  background: #2d1b4e;
  border: 4px solid #ff4fa3;
  border-radius: 12px;
  padding: 36px 56px;
  text-align: center;
  box-shadow: 0 0 40px rgba(255, 79, 163, 0.6);
}

#overlay-title {
  font-size: 40px;
  margin-bottom: 12px;
  color: #ffce4f;
}

#overlay-text {
  font-size: 22px;
  margin-bottom: 28px;
  color: #fff;
}

#replay {
  padding: 14px 28px;
  font-size: 18px;
  background: #ff4fa3;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  letter-spacing: 1px;
}

#replay:hover {
  background: #ff7ab8;
}

@media (max-width: 700px) {
  body {
    align-items: flex-start;
    padding: 14px;
  }

  #game-container {
    width: 100%;
  }

  #title {
    font-size: 28px;
    line-height: 1.05;
    margin-bottom: 12px;
  }

  #hud {
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    font-size: 20px;
  }

  .hud-label {
    font-size: 14px;
    margin-right: 2px;
  }

  .hud-spacer {
    margin-left: 0;
  }

  #lives {
    min-width: 76px;
    font-size: 19px;
  }

  .slot {
    width: 38px;
    height: 38px;
  }

  #hint {
    max-width: 640px;
    margin: 12px auto 0;
    line-height: 1.35;
  }

  #overlay-content {
    width: min(92vw, 440px);
    padding: 28px 22px;
  }

  #overlay-title {
    font-size: 30px;
  }

  #overlay-text {
    font-size: 18px;
  }
}
