* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: #000; color: #fff; overflow: hidden; font-family: monospace; }
canvas { display: block; width: 100%; height: 100vh; }
#ui-root { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; }
#hud { width: 100%; height: 100%; }
#crosshair { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 24px; color: rgba(255,255,255,0.8); text-shadow: 0 0 2px #000; }
#health-bar { position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%); width: 200px; height: 8px; background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.3); }
#health-fill { height: 100%; width: 100%; background: #0f0; transition: width 0.2s, background-color 0.2s; }
#health-text { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 14px; color: #fff; text-shadow: 0 0 4px #000; }
#info { position: absolute; top: 10px; left: 10px; font-size: 13px; line-height: 1.6; color: #0f0; text-shadow: 0 0 2px #000; }
#click-prompt { position: absolute; top: 50%; left: 50%; transform: translate(-50%, 30px); font-size: 18px; color: rgba(255,255,255,0.7); text-shadow: 0 0 4px #000; z-index: 20; }

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.loading-container {
  text-align: center;
  color: white;
  max-width: 400px;
  width: 90%;
}

.loading-header h1 {
  margin: 0 0 10px 0;
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #00d4ff, #0099ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.loading-label {
  margin: 0;
  font-size: 0.95rem;
  opacity: 0.8;
  color: #a0a0a0;
  min-height: 1.5rem;
}

.loading-bars {
  margin: 28px 0 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.loading-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.loading-bar-name {
  font-size: 0.72rem;
  color: #808080;
  width: 74px;
  text-align: right;
  flex-shrink: 0;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.loading-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  transition: width 0.18s ease-out;
}

.loading-bar-download {
  background: linear-gradient(90deg, #00d4ff, #0099ff);
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.4);
}

.loading-bar-process {
  background: linear-gradient(90deg, #a259ff, #7c3aed);
  box-shadow: 0 0 8px rgba(162, 89, 255, 0.4);
}

.loading-bar-pct {
  font-size: 0.78rem;
  font-weight: 600;
  width: 34px;
  text-align: right;
  flex-shrink: 0;
  color: #c0c0c0;
}

.loading-detail-text {
  font-size: 0.72rem;
  color: #606060;
  margin-top: 10px;
  min-height: 1rem;
  text-align: center;
}

.loading-spinner {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 30px;
  height: 12px;
}

.spinner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00d4ff;
  opacity: 0.4;
  animation: spin-bounce 1.2s infinite ease-in-out;
}

.spinner-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.spinner-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes spin-bounce {
  0%, 80%, 100% {
    opacity: 0.4;
    transform: scale(0.8);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}

.loading-overlay.fade-out {
  animation: fade-out-animation 0.5s ease-out forwards;
}

@keyframes fade-out-animation {
  from {
    opacity: 1;
    visibility: visible;
  }
  to {
    opacity: 0;
    visibility: hidden;
  }
}

@media (max-width: 640px) {
  .loading-header h1 {
    font-size: 1.8rem;
  }

  .loading-label {
    font-size: 0.85rem;
  }

  .loading-detail-text {
    font-size: 0.7rem;
  }
}

#mobile-controls {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 1000;
  touch-action: none;
}

.mobile-joystick {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.3);
  pointer-events: auto;
  touch-action: none;
}

.mobile-joystick-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  touch-action: none;
}

.mobile-joystick-knob.active {
  background: rgba(255, 255, 255, 0.7) !important;
}

.mobile-buttons {
  position: absolute;
  display: grid;
  gap: 8px;
  pointer-events: auto;
}

.mobile-button {
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.mobile-button.active {
  background: rgba(255, 255, 255, 0.5) !important;
  transform: scale(0.95);
}

.mobile-button-shoot {
  background: rgba(255, 100, 100, 0.4);
}

.mobile-button-reload {
  background: rgba(100, 100, 255, 0.4);
}

#ar-button {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: rgba(0, 150, 0, 0.8);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1001;
  touch-action: none;
}

@media (max-width: 480px) {
  .mobile-joystick {
    width: 100px !important;
    height: 100px !important;
  }
  
  .mobile-joystick-knob {
    width: 40px !important;
    height: 40px !important;
  }
  
  .mobile-button {
    width: 44px !important;
    height: 44px !important;
    font-size: 14px !important;
  }
}
