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

body {
  overflow: hidden;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #1a1a2e;
}

#canvas-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Welcome Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 20, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: linear-gradient(145deg, #2d2d44, #1a1a2e);
  padding: 3rem 4rem;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5),
              0 0 100px rgba(100, 100, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  max-width: 90%;
  width: 400px;
}

.modal-content h1 {
  color: #fff;
  font-size: 2rem;
  margin-bottom: 0.5rem;
  font-weight: 300;
  letter-spacing: 2px;
}

.modal-content p {
  color: #888;
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.modal-content input {
  width: 100%;
  padding: 1rem 1.5rem;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 1rem;
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
}

.modal-content input:focus {
  outline: none;
  border-color: rgba(100, 150, 255, 0.5);
  background: rgba(255, 255, 255, 0.08);
}

.modal-content input::placeholder {
  color: #666;
}

.modal-content button {
  width: 100%;
  padding: 1rem 2rem;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  letter-spacing: 1px;
}

.modal-content button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.modal-content button:active {
  transform: translateY(0);
}

.controls-hint {
  margin-top: 1.5rem !important;
  margin-bottom: 0 !important;
  font-size: 0.8rem !important;
  color: #555 !important;
}

/* Controls Overlay */
.controls-overlay {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  padding: 0.8rem 1.5rem;
  border-radius: 30px;
  z-index: 100;
  transition: opacity 0.5s ease;
}

.controls-overlay p {
  color: #fff;
  font-size: 0.9rem;
  opacity: 0.8;
}

/* Player HUD */
.player-hud {
  position: fixed;
  top: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.5);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  z-index: 100;
  color: #fff;
  font-size: 0.9rem;
}

/* Mobile Joystick */
.joystick-container {
  position: fixed;
  bottom: 30px;
  left: 30px;
  z-index: 100;
  touch-action: none;
}

.joystick-base {
  width: 120px;
  height: 120px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.joystick-stick {
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  transition: transform 0.1s ease-out;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 20, 0.98);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
  transition: opacity 0.5s ease;
}

.loading-content {
  text-align: center;
  max-width: 320px;
  width: 90%;
}

.loading-content h2 {
  color: #fff;
  font-size: 1.5rem;
  font-weight: 300;
  letter-spacing: 2px;
  margin-bottom: 1.5rem;
}

/* Animated picture frames */
.loading-frames {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 2rem;
  height: 80px;
}

.loading-frame {
  background: linear-gradient(145deg, #2d2d44, #1a1a2e);
  border: 3px solid #3a3a4a;
  border-radius: 4px;
  position: relative;
  animation: frameFloat 1.5s ease-in-out infinite;
}

.loading-frame::after {
  content: '';
  position: absolute;
  inset: 4px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  opacity: 0;
  animation: frameFill 1.5s ease-in-out infinite;
}

.frame-1 {
  width: 40px;
  height: 50px;
  animation-delay: 0s;
}
.frame-1::after { animation-delay: 0s; }

.frame-2 {
  width: 55px;
  height: 70px;
  animation-delay: 0.2s;
}
.frame-2::after { animation-delay: 0.2s; }

.frame-3 {
  width: 45px;
  height: 55px;
  animation-delay: 0.4s;
}
.frame-3::after { animation-delay: 0.4s; }

@keyframes frameFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes frameFill {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.loading-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.loading-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.loading-content p {
  color: #888;
  font-size: 0.9rem;
  letter-spacing: 1px;
}

/* Music Toggle Button */
.music-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  cursor: pointer;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.3s ease;
  padding: 0;
}

.music-toggle:hover {
  background: rgba(0, 0, 0, 0.7);
  border-color: rgba(255, 255, 255, 0.3);
}

.music-icon {
  width: 22px;
  height: 22px;
  color: #fff;
  opacity: 0.85;
}

.music-toggle:hover .music-icon {
  opacity: 1;
}

/* Utility classes */
.hidden {
  display: none !important;
}

.fade-out {
  opacity: 0;
  pointer-events: none;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .modal-content {
    padding: 2rem;
  }

  .modal-content h1 {
    font-size: 1.5rem;
  }

  .joystick-base {
    width: 100px;
    height: 100px;
  }

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