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

html {
  font-size: 16px;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: #000010;
  background-image: radial-gradient(
    ellipse at bottom,
    #000010 0%,
    #0c0c2c 50%,
    #1a1a4a 100%
  );
  font-family: "Orbitron", sans-serif;
  color: #e0e0ff;
  overflow: hidden;
  position: relative;
}

@keyframes move-twink-back {
  from {
    background-position: 0 0;
  }
  to {
    background-position: -10000px 5000px;
  }
}
@keyframes move-twink-middle {
  from {
    background-position: 0 0;
  }
  to {
    background-position: -8000px 4000px;
  }
}
@keyframes move-twink-front {
  from {
    background-position: 0 0;
  }
  to {
    background-position: -6000px 3000px;
  }
}

#stars,
#stars2,
#stars3 {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

#stars {
  background: transparent
    url("https://www.transparenttextures.com/patterns/stardust.png") repeat top
    center;
  animation: move-twink-back 200s linear infinite;
}
#stars2 {
  background: transparent
    url("https://www.transparenttextures.com/patterns/stardust.png") repeat top
    center;
  opacity: 0.7;
  transform: scale(0.8);
  animation: move-twink-middle 150s linear infinite;
}
#stars3 {
  background: transparent
    url("https://www.transparenttextures.com/patterns/stardust.png") repeat top
    center;
  opacity: 0.5;
  transform: scale(0.6);
  animation: move-twink-front 100s linear infinite;
}

#menu-container {
  position: relative;
  z-index: 1;
  width: 90%;
  max-width: 450px;
  padding: 2rem 1.5rem;
  background: rgba(10, 20, 50, 0.6);
  border: 1px solid rgba(0, 191, 255, 0.4);
  border-radius: 15px;
  box-shadow: 0 0 25px rgba(0, 191, 255, 0.3),
    inset 0 0 10px rgba(0, 191, 255, 0.2);
  backdrop-filter: blur(5px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.game-title {
  font-size: clamp(2rem, 8vw, 3.5rem);
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  letter-spacing: 2px;
  text-shadow: 0 0 8px #00e5ff, 0 0 15px #00e5ff, 0 0 25px #00e5ff,
    0 0 40px #ff00ff;
  line-height: 1.1;
  display: flex;
  flex-direction: column;
}

.game-title span {
  display: block;
}

.menu-nav {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
}

.menu-button {
  font-family: "Orbitron", sans-serif;
  font-size: clamp(1rem, 4vw, 1.2rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #c0f0ff;
  background: transparent;
  border: 2px solid rgba(255, 0, 255, 0.6);
  padding: 0.8rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.3),
    inset 0 0 5px rgba(255, 0, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.menu-button .icon {
  font-size: 1.2em;
  line-height: 1;
}

.menu-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255, 0, 255, 0.2) 0%,
    rgba(0, 229, 255, 0.3) 100%
  );
  transition: left 0.4s ease-out;
  z-index: -1;
}

.menu-button:hover::before {
  left: 0;
}

.menu-button:hover {
  color: #ffffff;
  border-color: rgba(0, 229, 255, 0.8);
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.5), 0 0 25px rgba(255, 0, 255, 0.3),
    inset 0 0 8px rgba(0, 229, 255, 0.3);
  transform: scale(1.02);
}

.menu-button:active {
  transform: scale(0.98);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.4),
    inset 0 0 5px rgba(0, 229, 255, 0.2);
}

.footer-info {
  font-size: 0.8rem;
  color: rgba(224, 224, 255, 0.6);
  text-align: center;
  margin-top: 1rem;
}

.footer-info a {
  color: #80c0ff;
  text-decoration: none;
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

.footer-info a:hover {
  color: #a0e0ff;
  text-shadow: 0 0 5px rgba(0, 229, 255, 0.5);
}

#game-container {
  position: relative;
  z-index: 1;
  width: 90%;
  max-width: 400px;
  padding: 25px;
  background: rgba(10, 20, 50, 0.7);
  border: 1px solid rgba(0, 191, 255, 0.5);
  border-radius: 15px;
  box-shadow: 0 0 20px rgba(0, 191, 255, 0.3),
    inset 0 0 8px rgba(0, 191, 255, 0.2);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  font-family: "Orbitron", sans-serif;
  color: #e0e0ff;
}

.game-screen-title {
  font-size: clamp(1.8rem, 6vw, 2.5rem);
  font-weight: 600;
  color: #ffffff;
  text-align: center;
  letter-spacing: 1px;
  text-shadow: 0 0 6px #00e5ff, 0 0 12px #00e5ff;
  margin-bottom: 10px;
}

#score {
  font-size: clamp(1.1rem, 4vw, 1.3rem);
  font-weight: 600;
  color: #c0f0ff;
  background-color: rgba(0, 229, 255, 0.1);
  padding: 6px 15px;
  border-radius: 20px;
  border: 1px solid rgba(0, 229, 255, 0.3);
}

#gameCanvas {
  background-color: #050a18;
  display: block;
  border-radius: 8px;
  border: 1px solid rgba(0, 191, 255, 0.3);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.4);
  max-width: 100%;
  height: auto;
}

#gameOverScreen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(5, 10, 24, 0.95);
  color: #e0e0ff;
  padding: 20px;
  border-radius: 15px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  z-index: 10;
  gap: 15px;
  text-align: center;
}

#gameOverScreen h2 {
  font-size: clamp(2rem, 7vw, 2.8rem);
  margin-bottom: 10px;
  color: #ff4d4d;
  font-weight: 700;
  text-shadow: 0 0 8px #ff4d4d;
}

#gameOverScreen p {
  font-size: clamp(1.2rem, 4.5vw, 1.5rem);
  margin-bottom: 20px;
}

#finalScore {
  font-weight: 700;
  color: #ffd700;
}

#gameOverScreen .game-button {
  font-family: "Orbitron", sans-serif;
  font-size: clamp(0.9rem, 3.5vw, 1.1rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #1a1a2e;
  background: linear-gradient(145deg, #00e5ff, #00a2ff);
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 229, 255, 0.3);
  min-width: 150px;
}
#gameOverScreen .game-button:hover {
  background: linear-gradient(145deg, #33ffff, #33b5ff);
  box-shadow: 0 6px 15px rgba(0, 229, 255, 0.5);
  transform: translateY(-2px);
}
#gameOverScreen .game-button:active {
  transform: translateY(0px) scale(0.98);
  box-shadow: 0 2px 5px rgba(0, 229, 255, 0.4);
}

#gameOverScreen #mainMenuButton {
  background: linear-gradient(145deg, #ff8a65, #ff5722);
  box-shadow: 0 4px 10px rgba(255, 87, 34, 0.3);
}
#gameOverScreen #mainMenuButton:hover {
  background: linear-gradient(145deg, #ffab91, #ff7043);
  box-shadow: 0 6px 15px rgba(255, 87, 34, 0.5);
}
#gameOverScreen #mainMenuButton:active {
  box-shadow: 0 2px 5px rgba(255, 87, 34, 0.4);
}

.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 20, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(3px);
}

.popup-content {
  background: rgba(15, 30, 60, 0.95);
  padding: 30px 40px;
  border-radius: 12px;
  border: 1px solid rgba(0, 191, 255, 0.5);
  box-shadow: 0 0 30px rgba(0, 191, 255, 0.4);
  color: #e0e0ff;
  position: relative;
  width: 85%;
  max-width: 450px;
  text-align: center;
  font-family: "Orbitron", sans-serif;
}

.popup-content h2 {
  font-size: clamp(1.6rem, 5vw, 2rem);
  color: #00e5ff;
  margin-bottom: 20px;
  text-shadow: 0 0 8px #00e5ff;
}

.popup-content p {
  font-size: clamp(0.9rem, 3.5vw, 1.1rem);
  line-height: 1.6;
  margin-bottom: 15px;
  color: #c0d0ff;
}

.popup-close {
  position: absolute;
  top: 10px;
  right: 15px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: color 0.3s ease;
}

.popup-close:hover {
  color: #ff4d4d;
}
