/* ── Reset & Full-Viewport ─────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0a0f;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  color: #e0e0e8;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ── Loading Overlay ──────────────────────────────────── */
#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #12121a 0%, #07070c 100%);
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

#loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Spinner ring */
.spinner {
  width: 56px;
  height: 56px;
  border: 3px solid rgba(255, 255, 255, 0.06);
  border-top-color: #7c6aff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin-bottom: 28px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
}

/* ── Error / Placeholder State ────────────────────────── */
#error-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #12121a 0%, #07070c 100%);
  text-align: center;
  padding: 2rem;
}

#error-overlay.visible {
  display: flex;
}

.error-icon {
  width: 72px;
  height: 72px;
  border: 2px solid rgba(124, 106, 255, 0.3);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 24px;
  background: rgba(124, 106, 255, 0.06);
}

.error-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: #ffffff;
}

.error-desc {
  font-size: 0.9rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.4);
  max-width: 420px;
}

.error-desc code {
  background: rgba(124, 106, 255, 0.12);
  color: #a99aff;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.85em;
}

/* ── Subtle vignette on the 3D canvas ─────────────────── */
#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.45) 100%);
}
