body {
  font-family: "Orbitron", sans-serif;
  background-color: #0c0a1a;
  color: #00f6ff;
  overflow: hidden;
}
canvas {
  background: radial-gradient(circle, #1a1a3a, #0c0a1a);
  display: block;
}
#ui-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  pointer-events: none;
  overflow-y: auto; /* Allow scrolling on mobile */
}
.ui-panel {
  pointer-events: all;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  border-radius: 1.5rem;
  box-shadow: 0 0 30px rgba(128, 0, 128, 0.5);
  max-height: 90vh; /* Limit height on mobile */
  overflow-y: auto; /* Allow scrolling within panels */
  margin: 1rem; /* Add margin for mobile */
  touch-action: pan-y; /* Allow vertical scrolling */
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}
#startButton,
#restartButton {
  pointer-events: all;
  transition: all 0.3s ease;
  touch-action: manipulation; /* Optimize for touch */
  -webkit-tap-highlight-color: transparent; /* Remove default tap highlight */
  user-select: none; /* Prevent text selection */
}
#startButton:hover,
#restartButton:hover {
  transform: scale(1.05);
  box-shadow: 0 0 25px #ff00ff, 0 0 10px #00f6ff inset;
}
#startButton:active,
#restartButton:active {
  transform: scale(0.98);
  box-shadow: 0 0 15px #ff00ff, 0 0 5px #00f6ff inset;
}
.text-glow {
  text-shadow: 0 0 5px #00f6ff, 0 0 10px #00f6ff, 0 0 15px #ff00ff;
}
.hidden {
  display: none !important;
}

/* Mobile Controller Styles */
.mobile-controller {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 120px;
  height: 120px;
  z-index: 1000;
  display: none; /* Hidden by default, shown on mobile */
}

.controller-outer {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(233, 175, 81, 0.3),
    rgba(233, 175, 81, 0.1)
  );
  border: 2px solid rgba(233, 175, 81, 0.6);
  position: relative;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 20px rgba(233, 175, 81, 0.4),
    inset 0 0 20px rgba(233, 175, 81, 0.1);
}

.controller-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(233, 175, 81, 0.8),
    rgba(233, 175, 81, 0.4)
  );
  border: 2px solid rgba(233, 175, 81, 0.9);
  transform: translate(-50%, -50%);
  cursor: grab;
  transition: all 0.1s ease;
  box-shadow: 0 0 15px rgba(233, 175, 81, 0.6),
    inset 0 0 10px rgba(255, 255, 255, 0.2);
}

.controller-inner:active {
  cursor: grabbing;
  transform: translate(-50%, -50%) scale(0.95);
  box-shadow: 0 0 25px rgba(233, 175, 81, 0.8),
    inset 0 0 15px rgba(255, 255, 255, 0.3);
}

.controller-inner.active {
  box-shadow: 0 0 30px rgba(233, 175, 81, 0.9),
    inset 0 0 20px rgba(255, 255, 255, 0.4);
  animation: controllerPulse 0.5s ease-in-out infinite alternate;
}

@keyframes controllerPulse {
  0% {
    box-shadow: 0 0 30px rgba(233, 175, 81, 0.9),
      inset 0 0 20px rgba(255, 255, 255, 0.4);
  }
  100% {
    box-shadow: 0 0 40px rgba(233, 175, 81, 1),
      inset 0 0 25px rgba(255, 255, 255, 0.6);
  }
}

.controller-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
}

/* Fire Button */
.fire-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 0, 255, 0.6),
    rgba(255, 0, 255, 0.3)
  );
  border: 2px solid rgba(255, 0, 255, 0.8);
  display: none; /* Hidden by default, shown on mobile */
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 20px rgba(255, 0, 255, 0.4),
    inset 0 0 15px rgba(255, 255, 255, 0.1);
  transition: all 0.1s ease;
}

.fire-button:active {
  transform: scale(0.95);
  box-shadow: 0 0 25px rgba(255, 0, 255, 0.6),
    inset 0 0 20px rgba(255, 255, 255, 0.2);
}

.fire-button::before {
  content: "🔥";
  font-size: 24px;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.8));
}

/* Mobile Detection */
@media (max-width: 768px) {
  .mobile-controller,
  .fire-button {
    display: block;
  }

  .ui-panel {
    padding: 1.5rem;
    font-size: 0.9rem;
  }

  .ui-panel h1 {
    font-size: 2.5rem !important;
  }

  .ui-panel p {
    font-size: 0.85rem !important;
  }

  .ui-panel button {
    font-size: 1.5rem !important;
    padding: 0.75rem 1.5rem !important;
  }
}
