*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #010208;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}

#scene canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#scene canvas:active {
  cursor: grabbing;
}

.control {
  position: fixed;
  right: max(18px, calc(env(safe-area-inset-right) + 12px));
  bottom: max(18px, calc(env(safe-area-inset-bottom) + 12px));
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(190, 210, 255, 0.18);
  background: rgba(10, 14, 30, 0.38);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: rgba(235, 240, 255, 0.82);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.85);
  transition: opacity 0.8s ease, transform 0.8s ease, border-color 0.3s ease, background 0.3s ease, color 0.3s ease;
}

.control.ready {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.control:hover,
.control:focus-visible {
  color: #fff;
  border-color: rgba(255, 196, 120, 0.55);
  background: rgba(30, 22, 18, 0.5);
  outline: none;
}

.control svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.control .icon-play {
  display: none;
  fill: currentColor;
  stroke-width: 1.5;
  margin-left: 2px;
}

.control[data-mode="play"] .icon-play {
  display: block;
}

.control[data-mode="play"] .icon-reset {
  display: none;
}

.control[data-mode="play"]::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid rgba(255, 190, 110, 0.6);
  animation: pulse 2.4s ease-out infinite;
  pointer-events: none;
}

@keyframes pulse {
  from {
    transform: scale(1);
    opacity: 0.9;
  }
  to {
    transform: scale(1.7);
    opacity: 0;
  }
}

#veil {
  position: fixed;
  inset: 0;
  background: #010208;
  pointer-events: none;
  transition: opacity 2.4s ease;
}

#veil.gone {
  opacity: 0;
}

.fallback {
  display: none;
  position: fixed;
  inset: 0;
  margin: 0;
  place-items: center;
  font: 500 clamp(28px, 8vw, 72px) / 1 Jost, Futura, "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0.3em;
  color: #e8ecff;
  background: radial-gradient(circle at 70% 50%, #2a1a10 0%, #010208 60%);
}

.no-webgl .fallback {
  display: grid;
}

.no-webgl #veil {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .control[data-mode="play"]::after {
    animation: none;
  }
}
