/* 3D Lab — scene & UI */

#scene-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#three-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Push scene below header */
header + #scene-container {
  top: 0;
}

/* Loading overlay */
#loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10;
  transition: opacity 0.4s ease;
}

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

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

.loader-content p {
  color: var(--text-muted);
  font-size: 16px;
  margin-top: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Drag-over visual feedback */
#scene-container.drag-over #loading-overlay {
  opacity: 1;
  pointer-events: auto;
  background: rgba(93, 214, 255, 0.12);
}

#scene-container.drag-over #loading-text {
  color: var(--accent);
}

/* Controls panel */
#controls-panel {
  position: absolute;
  top: 80px;
  right: 16px;
  width: 240px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  z-index: 20;
  font-size: 14px;
  color: var(--text);
}

#controls-panel h3 {
  font-size: 16px;
  margin: 0 0 4px;
  font-weight: 600;
}

#controls-panel .hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

#controls-panel hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 12px 0;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}

.toggle-row label {
  font-size: 13px;
  color: var(--text-muted);
}

.toggle-row input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Pirate animation grid */
#pirate-anims > label {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

.anim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.anim-btn {
  padding: 7px 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.anim-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.anim-btn.active {
  background: rgba(170, 85, 255, 0.2);
  border-color: rgba(170, 85, 255, 0.5);
  color: #aa55ff;
  font-weight: 600;
}

/* If odd number of buttons, last one spans full width */
.anim-grid .anim-btn:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

/* Animation controls */
#animation-controls {
  margin-top: 8px;
}

#animation-controls label {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

#anim-select {
  width: 100%;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

#anim-select option {
  background: #1a1a1a;
}

.anim-buttons {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.anim-buttons button {
  flex: 1;
  padding: 5px 0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.anim-buttons button:hover {
  background: rgba(255, 255, 255, 0.15);
}

#model-name {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
  margin: 0;
}

/* Stats panel position */
#stats-panel {
  position: absolute;
  top: 80px;
  left: 16px;
  z-index: 20;
}

#stats-panel canvas {
  border-radius: 8px !important;
}

/* Responsive */
@media (max-width: 768px) {
  #controls-panel {
    top: auto;
    bottom: 16px;
    right: 16px;
    left: 16px;
    width: auto;
  }
}
