body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: #000;
  font-family: "Courier New", Courier, monospace;
  color: white;
}
#gameCanvas {
  background-color: #000; /* The background is now solid black */
  display: block;
  cursor: crosshair;
}
#ui-container {
  position: absolute;
  top: 20px;
  left: 20px;
  background-color: rgba(20, 20, 20, 0.7);
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid #333;
  font-size: 1.2em;
  text-shadow: 0 0 5px #0f0;
}
#message-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(255, 255, 255, 0.95);
  color: #111;
  padding: 30px;
  border-radius: 15px;
  text-align: center;
  display: none; /* Hidden by default */
  font-size: 1.8em;
  box-shadow: 0 0 40px rgba(100, 255, 255, 0.5);
}
#message-box h2 {
  margin: 0;
  color: #008080;
}
#message-box button {
  margin-top: 20px;
  padding: 10px 25px;
  font-size: 0.8em;
  background-color: #008080;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s;
}
#message-box button:hover {
  background-color: #006666;
}

/* Welcome Popup Styles */
#welcome-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.popup-content {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 2px solid #4caf50;
  border-radius: 20px;
  padding: 30px;
  text-align: center;
  max-width: 450px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 0 50px rgba(76, 175, 80, 0.3);
  animation: glow 2s ease-in-out infinite alternate;
  margin: 0 20px;
}

@keyframes glow {
  from {
    box-shadow: 0 0 50px rgba(76, 175, 80, 0.3);
  }
  to {
    box-shadow: 0 0 70px rgba(76, 175, 80, 0.5);
  }
}

.popup-content h1 {
  color: #4caf50;
  font-size: 2.2em;
  margin-bottom: 25px;
  text-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
  line-height: 1.2;
}

.instructions {
  text-align: left;
  margin: 25px 0;
}

.instructions h3 {
  color: #4caf50;
  font-size: 1.3em;
  margin-bottom: 15px;
}

.instructions ul {
  list-style: none;
  padding: 0;
}

.instructions li {
  margin: 10px 0;
  font-size: 1em;
  color: #e0e0e0;
  line-height: 1.4;
}

.tip {
  background-color: rgba(76, 175, 80, 0.1);
  border: 1px solid #4caf50;
  border-radius: 10px;
  padding: 15px;
  margin-top: 20px;
  font-size: 1em;
  color: #4caf50;
}

#start-game-button {
  background: linear-gradient(45deg, #4caf50, #45a049);
  color: white;
  border: none;
  padding: 12px 25px;
  font-size: 1.1em;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 15px;
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
  min-width: 200px;
}

#start-game-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.5);
  background: linear-gradient(45deg, #45a049, #4caf50);
}

/* Responsive Design for smaller screens */
@media (max-width: 768px) {
  .popup-content {
    padding: 20px;
    max-width: 95%;
    margin: 10px;
  }

  .popup-content h1 {
    font-size: 1.8em;
    margin-bottom: 20px;
  }

  .instructions h3 {
    font-size: 1.1em;
  }

  .instructions li {
    font-size: 0.9em;
    margin: 8px 0;
  }

  .tip {
    padding: 12px;
    font-size: 0.9em;
  }

  #start-game-button {
    padding: 10px 20px;
    font-size: 1em;
    min-width: 180px;
  }
}

@media (max-width: 480px) {
  .popup-content h1 {
    font-size: 1.5em;
  }

  .instructions li {
    font-size: 0.85em;
  }

  #start-game-button {
    min-width: 160px;
  }
}

/* Mobile Joystick Controller Styles */
#joystick-container {
  position: fixed;
  bottom: 30px;
  left: 30px;
  z-index: 1000;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#joystick-container.joystick-hidden {
  opacity: 0;
  transform: scale(0.8);
  pointer-events: none;
}

#joystick-container.joystick-visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: all;
}

#joystick-base {
  position: relative;
  width: 120px;
  height: 120px;
  background: radial-gradient(
    circle,
    rgba(233, 175, 81, 0.2) 0%,
    rgba(233, 175, 81, 0.1) 70%,
    transparent 100%
  );
  border: 3px solid rgba(233, 175, 81, 0.6);
  border-radius: 50%;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 20px rgba(233, 175, 81, 0.3),
    inset 0 0 20px rgba(233, 175, 81, 0.1);
  transition: all 0.2s ease;
  will-change: transform, box-shadow;
}

#joystick-base:active {
  transform: scale(0.95);
  box-shadow: 0 0 30px rgba(233, 175, 81, 0.5),
    inset 0 0 30px rgba(233, 175, 81, 0.2);
}

#joystick-stick {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 50px;
  height: 50px;
  background: radial-gradient(circle, #e9af51 0%, #d19a3f 70%, #b8860b 100%);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(233, 175, 81, 0.4),
    inset 0 2px 5px rgba(255, 255, 255, 0.2);
  transition: transform 0.05s ease-out;
  z-index: 2;
  will-change: transform;
}

#joystick-stick:active {
  transform: translate(-50%, -50%) scale(0.9);
  box-shadow: 0 2px 10px rgba(233, 175, 81, 0.6),
    inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

#joystick-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  z-index: 1;
}

/* Joystick movement animation */
@keyframes joystickGlow {
  0%,
  100% {
    box-shadow: 0 0 20px rgba(233, 175, 81, 0.3),
      inset 0 0 20px rgba(233, 175, 81, 0.1);
  }
  50% {
    box-shadow: 0 0 30px rgba(233, 175, 81, 0.5),
      inset 0 0 30px rgba(233, 175, 81, 0.2);
  }
}

#joystick-base.joystick-active {
  animation: joystickGlow 1s ease-in-out infinite;
}

/* Responsive joystick sizing */
@media (max-width: 768px) {
  #joystick-base {
    width: 100px;
    height: 100px;
  }

  #joystick-stick {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 480px) {
  #joystick-container {
    bottom: 20px;
    left: 20px;
  }

  #joystick-base {
    width: 90px;
    height: 90px;
  }

  #joystick-stick {
    width: 35px;
    height: 35px;
  }
}
