* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background-color: #071b3d;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.game-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 2;
}

.game-container {
  width: 90vw;
  max-width: 800px;
  height: 80vh;
  max-height: 700px;
  background: radial-gradient(circle at top, #0f2a5b 0%, #071b3d 65%);
  background-size: cover;
  background-position: center;
  position: relative;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.player,
.invader,
.projectile,
.invader-projectile {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
}

p {
  color: white;
  font-size: 1.1rem;
  text-align: center;
  margin: 8px 0;
}

.projectile,
.invader-projectile {
  width: 8px;
  height: 13px;
  background-color: red;
  border-radius: 3px;
  box-shadow: 0 0 10px rgba(255, 76, 76, 0.8);
}
.invader-projectile {
  background-color: yellow;
  box-shadow: 0 0 10px rgba(255, 240, 120, 0.8);
}

.score-container {
  color: #e5e5e5;
  font-size: 0.95rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(80px, 1fr));
  gap: 10px;
  padding: 12px 16px;
  background: rgba(9, 32, 72, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.hud-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  backdrop-filter: blur(6px);
}

.popup {
  opacity: 0.95;
  background-color: #0e2b5c;
  border-radius: 10px;
  text-align: center;
  width: 60%;
  max-width: 500px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.popup h2 {
  color: #ff6b6b;
  font-size: 2.5rem;
  margin-bottom: 20px;
}

.popup p {
  color: white;
  font-size: 1.5rem;
  margin-bottom: 20px;
}

.popup button {
  background: linear-gradient(135deg, #ff6b6b, #6b66ff);
  width: 200px;
  color: white;
  border: none;
  padding: 14px 18px;
  font-size: 1.1rem;
  border-radius: 10px;
  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
}

.popup button:hover {
  transform: scale(1.1);
}

.start-screen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: linear-gradient(
    180deg,
    rgba(7, 27, 61, 0.9),
    rgba(7, 27, 61, 0.6)
  );
  backdrop-filter: blur(2px);
  flex-direction: column;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}
.start-screen h1 {
  color: #ff79c6;
  font-size: 3rem;
  margin-bottom: 20px;
  text-shadow: 0 0 10px rgba(255, 0, 0, 0.7);
}
#startButton:hover {
  transform: scale(1.1);
}
#startButton {
  background: linear-gradient(135deg, #6b66ff, #43d9ad);
  color: white;
  border: none;
  padding: 16px 36px;
  font-size: 1.6rem;
  border-radius: 12px;
  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.25);
}

.star {
  position: absolute;
  width: 1vw;
  height: 1vh;
  background-color: white;
  border-radius: 50%;
  animation: moveStar 18s linear infinite;
  z-index: 1000;
}

@keyframes moveStar {
  0% {
    transform: translateY(-10vh);
  }
  100% {
    transform: translateY(-50vh);
  }
}
.stars {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
@media (max-width: 768px) {
  .game-container {
    width: 95vw;
    height: 70vh;
  }
  .popup {
    width: 90vw;
    height: 50vh;
  }
  .popup h2,
  .popup p {
    font-size: 6vw;
  }
  .popup button {
    width: 40vw;
    font-size: 4vw;
  }
  .start-screen h1 {
    font-size: 6vw;
  }
  #startButton {
    padding: 15px;
    font-size: 4vw;
  }
  .score-container {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    font-size: 0.85rem;
  }
}

@media (max-width: 400px) {
  .game-container {
    width: 95vw;
    height: 60vh;
  }
  .projectile,
  .invader-projectile {
    width: 2.5vw;
    height: 2.5vh;
  }
  .popup {
    width: 95vw;
    height: 50vh;
  }
  .popup h2,
  .popup p {
    font-size: 5vw;
  }
  .popup button {
    width: 50vw;
    font-size: 3vw;
  }
  .start-screen h1 {
    font-size: 5vw;
  }
  #startButton {
    padding: 10px;
    font-size: 3vw;
  }
  .score-container {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
    font-size: 0.8rem;
  }
}
