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

body {
  font-family: 'Orbitron', 'Courier New', monospace;
  background: #0a0e1a;
  color: #ffffff;
  overflow: hidden;
}

#scene-container {
  display: block;
  width: 100vw;
  height: 100vh;
}

/* ==================== LOADING SCREEN ==================== */

#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0a0e1a 0%, #1a1e2a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.5s ease;
}

.loading-content {
  text-align: center;
}

.cybertruck-logo {
  font-size: 80px;
  margin-bottom: 20px;
  animation: pulse 2s ease-in-out infinite;
}

.loading-text {
  font-size: 18px;
  letter-spacing: 3px;
  color: #00ffff;
  margin-bottom: 30px;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.loading-bar {
  width: 300px;
  height: 4px;
  background: rgba(0, 255, 255, 0.2);
  border-radius: 2px;
  overflow: hidden;
  margin: 0 auto;
}

.loading-progress {
  height: 100%;
  background: linear-gradient(90deg, #00ffff, #ff00ff);
  width: 0;
  animation: loading 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes loading {
  0% { width: 0; }
  100% { width: 100%; }
}

/* ==================== CONTROL PANEL ==================== */

.control-panel {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(10, 14, 26, 0.9);
  border: 1px solid #00ffff;
  border-radius: 8px;
  padding: 20px;
  min-width: 280px;
  box-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
  backdrop-filter: blur(10px);
  z-index: 1000;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.control-panel.hidden {
  transform: translateX(400px);
  opacity: 0;
  pointer-events: none;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #00ffff;
}

.panel-title {
  font-size: 16px;
  font-weight: bold;
  color: #00ffff;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.close-btn {
  background: none;
  border: none;
  color: #00ffff;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.close-btn:hover {
  transform: scale(1.2);
}

.control-group {
  margin-bottom: 20px;
}

.control-group label {
  display: block;
  font-size: 12px;
  color: #00ffff;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.control-group select {
  width: 100%;
  padding: 8px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #00ffff;
  border-radius: 4px;
  color: #ffffff;
  font-family: 'Orbitron', monospace;
  font-size: 14px;
  cursor: pointer;
}

.control-group select:focus {
  outline: none;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.clearance-display,
.width-display {
  margin-top: 8px;
  font-size: 12px;
  color: #aaa;
}

.clearance-display span,
.width-display span {
  color: #00ffff;
  font-weight: bold;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.radio-label:hover {
  background: rgba(0, 255, 255, 0.1);
}

.radio-label input[type="radio"] {
  margin-right: 8px;
  accent-color: #00ffff;
}

.toggle-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toggle-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.toggle-label:hover {
  background: rgba(0, 255, 255, 0.1);
}

.toggle-label input[type="checkbox"] {
  margin-right: 8px;
  accent-color: #00ffff;
}

.action-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #00ffff, #ff00ff);
  border: none;
  border-radius: 4px;
  color: #ffffff;
  font-family: 'Orbitron', monospace;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(0, 255, 255, 0.5);
}

.action-btn:active {
  transform: translateY(0);
}

/* ==================== FLOATING BUTTON ==================== */

.floating-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #00ffff, #ff00ff);
  border: none;
  border-radius: 50%;
  color: #ffffff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 5px 20px rgba(0, 255, 255, 0.5);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  z-index: 999;
}

.floating-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 30px rgba(0, 255, 255, 0.7);
}

/* ==================== DEBUG OVERLAY ==================== */

.debug-overlay {
  position: fixed;
  top: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid #00ff00;
  border-radius: 8px;
  padding: 15px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: #00ff00;
  z-index: 1000;
  transition: opacity 0.3s ease;
}

.debug-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.debug-header {
  font-weight: bold;
  margin-bottom: 10px;
  color: #00ffff;
  border-bottom: 1px solid #00ff00;
  padding-bottom: 5px;
}

.debug-line {
  margin: 5px 0;
}

.fps-good { color: #00ff00; }
.fps-ok { color: #ffff00; }
.fps-bad { color: #ff0000; }

.tolerance-good { color: #00ff00; }
.tolerance-bad { color: #ff0000; }

/* ==================== BERRRY CREDIT ==================== */

.berrry-credit {
  position: fixed;
  bottom: 20px;
  left: 20px;
  font-size: 12px;
  color: #888;
  z-index: 1000;
}

.berrry-credit a {
  color: #00ffff;
  text-decoration: none;
  transition: color 0.2s ease;
}

.berrry-credit a:hover {
  color: #ff00ff;
}

/* ==================== MOBILE RESPONSIVENESS ==================== */

@media (max-width: 768px) {
  .control-panel {
    top: auto;
    bottom: 80px;
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .loading-text {
    font-size: 14px;
  }

  .cybertruck-logo {
    font-size: 60px;
  }

  .floating-btn {
    bottom: 20px;
    right: 20px;
  }

  .berrry-credit {
    font-size: 10px;
  }
}

@media (orientation: portrait) {
  body::before {
    content: '📱 Rotate device for best experience';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #00ffff;
    color: #00ffff;
    font-size: 14px;
    text-align: center;
    z-index: 10001;
    animation: pulse 2s ease-in-out infinite;
  }
}