* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; font-family: system-ui, -apple-system, sans-serif; background: #F9F9F8; }

#viewer-container {
  width: 100%;
  height: 100%;
  position: relative;
}

glb-configurator {
  display: block;
  width: 100%;
  height: 100%;
}

#previews {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #003b30;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  z-index: 10;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#previews::-webkit-scrollbar { height: 6px; }
#previews::-webkit-scrollbar-track { background: transparent; }
#previews::-webkit-scrollbar-thumb { background: #4a4a6e; border-radius: 3px; }

.preview-item {
  flex: 0 0 auto;
  cursor: pointer;
  border-radius: 6px;
  border: 3px solid transparent;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}

.preview-item:hover { border-color: #027c64; transform: scale(1.05); }
.preview-item.active { border-color: #00d4a8; }

.preview-item img {
  display: block;
  width: 110px;
  height: 110px;
  object-fit: cover;
}

.preview-placeholder {
  width: 110px;
  height: 110px;
  background: #3a3a5e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #8888aa;
  text-transform: capitalize;
}

#controls-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 20;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  color: #027c64;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  backdrop-filter: blur(10px);
}

#controls-toggle:hover { background: #fff; }

#controls {
  position: fixed;
  top: 0;
  right: -320px;
  width: 300px;
  height: 100%;
  background: #f7f7f7;
  color: #1a1a1a;
  overflow-y: auto;
  z-index: 15;
  padding: 60px 16px 16px;
  transition: right 0.3s ease;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
}

#controls.open { right: 0; }

#controls h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #027c64;
  margin-bottom: 16px;
}

#controls h3 {
  font-size: 12px;
  color: #027c64;
  margin: 16px 0 8px;
}

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #999;
  border-top: 1px solid #e0e0e0;
  padding-top: 12px;
  margin-top: 16px;
  margin-bottom: 8px;
}

.base-toggles {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #1a1a1a;
  cursor: pointer;
}

.toggle-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #027c64;
}

.option-group {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.btn-option {
  flex: 1;
  padding: 8px 12px;
  border-radius: 6px;
  border: 2px solid #027c64;
  background: transparent;
  color: #027c64;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.btn-option.active {
  background: #027c64;
  color: #fff;
}

.btn-option:hover:not(.active) {
  background: #e8f5f2;
}

#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #F9F9F8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.5s ease;
}

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

#loading-text {
  font-size: 18px;
  color: #555;
  margin-bottom: 16px;
}

#progress-bar-container {
  width: 200px;
  height: 3px;
  background: #e0e0e0;
  border-radius: 2px;
  overflow: hidden;
}

#progress-bar {
  height: 100%;
  background: #027c64;
  width: 0%;
  transition: width 0.3s;
  border-radius: 2px;
}

.dev-details {
  margin-top: 16px;
  border-top: 1px solid #e0e0e0;
  padding-top: 12px;
}

.dev-details summary {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #999;
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
}

.dev-details summary:hover { color: #666; }

#status {
  margin-top: 8px;
  padding: 8px;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  font-family: monospace;
  font-size: 10px;
  max-height: 150px;
  overflow-y: auto;
  color: #888;
}

#camera-info {
  margin-top: 8px;
  padding: 8px;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  font-family: monospace;
  font-size: 11px;
  color: #555;
  line-height: 1.6;
}

@media (max-width: 600px) {
  #controls { width: 260px; right: -280px; }
  .preview-item img, .preview-placeholder { width: 80px; height: 80px; }
}