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

body {
  overflow: hidden;
  background-color: #1a1a1a;
  font-family: Arial, sans-serif;
}

/* Splash screen styles */
#splash-screen {
  position: fixed;
  width: 100vw;
  height: 100vh;
  background-color: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  overflow: auto;
}

.splash-content {
  text-align: center;
  max-width: 800px;
  padding: 20px;
  max-height: 95vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.splash-image {
  width: 100%;
  max-width: 600px;
  max-height: 50vh;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 0 30px rgba(255, 0, 0, 0.6);
  margin-bottom: 20px;
}

.game-title {
  font-family: 'Creepster', cursive;
  font-size: 5rem;
  color: #ff3000;
  text-shadow: 5px 5px 0 #000, -2px -2px 0 #000, 3px -2px 0 #000,
    -3px 3px 0 #000, 0 0 15px rgba(255, 0, 0, 0.8);
  transform: rotate(-2deg) skew(-5deg);
  margin-bottom: 30px;
  letter-spacing: 3px;
  animation: wobble 2s ease-in-out infinite;
}

@keyframes wobble {
  0%,
  100% {
    transform: rotate(-2deg) skew(-5deg);
  }
  25% {
    transform: rotate(0deg) skew(-3deg) translateX(-5px);
  }
  50% {
    transform: rotate(1deg) skew(0deg) scale(1.03);
  }
  75% {
    transform: rotate(-1deg) skew(-7deg) translateX(5px);
  }
}

@media (max-height: 700px) {
  .splash-image {
    max-height: 40vh;
  }

  .game-title {
    font-size: 4rem;
    margin-bottom: 20px;
  }

  #play-button {
    padding: 10px 40px;
    font-size: 1.2rem;
    margin-bottom: 15px;
  }
}

#play-button {
  background-color: #ff3000;
  color: white;
  border: none;
  padding: 15px 50px;
  font-size: 1.5rem;
  font-weight: bold;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(255, 0, 0, 0.4);
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

#play-button:hover:not(:disabled) {
  background-color: #ff6000;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(255, 0, 0, 0.6);
}

#play-button:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 3px 10px rgba(255, 0, 0, 0.4);
}

#play-button:disabled {
  background-color: #777;
  cursor: not-allowed;
  box-shadow: none;
}

#connection-status {
  color: #ccc;
  font-size: 1rem;
}

/* Game container styles */
#game-container {
  position: fixed;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  background-color: #87ceeb;
}

#controls {
  position: fixed;
  bottom: 20px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  pointer-events: none;
}

#movement-joystick,
#camera-joystick {
  width: 120px;
  height: 120px;
  pointer-events: auto;
  position: relative;
}

#movement-joystick {
  margin-right: 20px;
}

#camera-joystick {
  margin-left: 20px;
}

#movement-joystick .nipple,
#camera-joystick .nipple {
  opacity: 0.7;
  background-color: rgba(255, 255, 255, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.5);
}

#movement-joystick .front,
#camera-joystick .front {
  background-color: rgba(255, 255, 255, 0.8);
}

#actionButton {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background-color: rgba(255, 0, 0, 0.8);
  border: none;
  color: white;
  font-size: 16px;
  font-weight: bold;
  pointer-events: auto;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  text-transform: uppercase;
  letter-spacing: 1px;
}

#actionButton:active {
  transform: scale(0.95);
  background-color: rgba(255, 0, 0, 0.9);
}

/* HUD container for score, players, and mute button */
#hud-container {
  position: fixed;
  top: 20px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
}

#score,
#players {
  color: white;
  font-size: 24px;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  background-color: rgba(0, 0, 0, 0.5);
  padding: 10px 20px;
  border-radius: 20px;
}

/* Mute button styles */
.mute-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  font-size: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.2s ease;
  padding: 0;
  margin-left: 15px;
}

.mute-button:hover {
  background-color: rgba(0, 0, 0, 0.7);
  transform: scale(1.05);
}

.mute-button:active {
  transform: scale(0.95);
}

/* Responsive adjustments for mute button and HUD */
@media (max-width: 768px) {
  #hud-container {
    top: 10px;
    padding: 0 10px;
  }

  #score,
  #players {
    font-size: 18px;
    padding: 8px 15px;
  }

  .mute-button {
    width: 35px;
    height: 35px;
    font-size: 18px;
    margin-left: 10px;
  }
}

/* Energy meter styles */
#energy-meter-container {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 20px;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

#energy-meter {
  width: 0%;
  height: 100%;
  background-color: #f7941d;
  transition: width 0.1s ease-out, background-color 0.3s;
  position: relative;
}

#energy-meter:after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.4),
    rgba(255, 255, 255, 0)
  );
}

#energy-meter.high-energy {
  box-shadow: 0 0 10px #ff3000;
  animation: pulse 0.6s infinite alternate;
}

@keyframes pulse {
  from {
    opacity: 0.8;
  }
  to {
    opacity: 1;
  }
}

#desktop-instructions {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 20px;
  border-radius: 10px;
  font-size: 18px;
  text-align: center;
  z-index: 1000;
  pointer-events: none;
  transition: opacity 0.5s;
}
