@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

body {
  font-family: 'Press Start 2P', system-ui;
  background: #000;
  color: #f60;
  overflow: hidden;
  height: 91vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

#game-container {
  position: relative;
  width: 100%;
  max-width: 740px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#gameCanvas {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  background: #111;
  display: block;
  border: 2px solid #c30;
}

/* HUD */
#hud {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 12px;
  color: #fff;
  text-shadow: 1px 1px 1px #f00;
  z-index: 10;
  pointer-events: none;
  line-height: 1.5;
}

#high-score-display {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 12px;
  color: #f00;
  text-shadow: 1px 1px 1px #fff;
  z-index: 15;
  pointer-events: none;
}

/* Screens */
#title-screen,
#start-screen,
#game-over,
#wave-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 20;
}

#title-screen {
  background-image: url('assets/bg.jpg');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: auto 100%;
  background-color: #000;
}

#start-screen {
  background-color: rgba(0, 0, 0, 0.85);
}

.title-content {
  padding: 40px 40px;
  text-align: center;
}

#title-screen h1,
#start-screen h1,
#game-over h1,
#wave-screen h1 {
  letter-spacing: 3px;
  color: #fff;
  text-shadow: 0 4px 14px #c30;
  margin-bottom: 15px;
  font-size: 34px;
  animation: pulse 1.5s infinite alternate;
}

#title-screen .version {
  font-size: 12px;
  margin: 15px 0 30px;
  line-height: 1.6;
  color: #fff;
  text-shadow: 0 2px 2px #000;
}

@keyframes pulse {
  from { transform: scale(1); opacity: 0.7; }
  to { transform: scale(1.08); opacity: 0.9; }
}

#start-screen p,
#game-over p {
  font-size: 14px;
  margin: 10px 0;
}

.controls {
  font-size: 12px;
  opacity: 0.85;
  margin-bottom: 20px;
  line-height: 1.6;
}

button {
  font-family: 'Press Start 2P', system-ui;
  background: #f00;
  color: #fff;
  border: 2px solid #b20;
  padding: 14px 28px;
  font-size: 14px;
  cursor: pointer;
  border-radius: 12px;
}

button:active {
  transform: scale(0.95);
}

.hidden {
  display: none !important;
}

/* Sound button */
#soundBtn {
  position: absolute;
  top: 40px;
  right: 10px;
  font-size: 12px;
  padding: 7px 10px;
  z-index: 15;
  background: rgba(0, 96, 144, 0.4);
  color: #f00;
  border: 1px solid #069;
  border-radius: 8px;
}

/* Mobile Controls */
#mobile-controls {
  width: 100%;
  max-width: 750px;
  display: none;
  justify-content: space-between;
  padding: 16px 20px 22px;
  background: #000;
  gap: 3px;
}

.left-controls,
.right-controls {
  display: flex;
  gap: 2px;
}

.control-btn {
  width: 75px;
  height: 75px;
  font-size: 20px;
  background: rgba(0, 48, 48, 0.5);
  border: 2px solid #366;
  color: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
}

.control-btn.fire {
  font-size: 8px;
  background: rgba(255, 0, 0, 0.75);
  border-color: #c30;
}

.control-btn:active {
  background: rgba(204, 51, 0, 0.75);
  transform: scale(0.92);
}

@media (hover: none) and (pointer: coarse), (max-width: 768px) {
  #mobile-controls {
    display: flex !important;
  }
  .controls {
    display: none;
  }
}

@media (max-width: 480px) {
  #title-screen h1,
  #start-screen h1,
  #game-over h1 {
    font-size: 26px;
  }
  #wave-screen h1 {
    font-size: 30px;
  }
}