:root { color-scheme: dark; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b0a26;
}

body {
  font: 11px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #dcd8ff;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline: none;
  cursor: grab;
}
#scene:active { cursor: grabbing; }

#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 52%, rgba(0, 0, 0, 0) 52%, rgba(5, 3, 22, 0.5) 100%);
}

#hint {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(12, 10, 36, 0.5);
  color: rgba(220, 216, 255, 0.85);
  letter-spacing: 0.03em;
  white-space: nowrap;
  pointer-events: none;
  animation: hint 7s ease forwards;
}
@keyframes hint {
  0%, 70% { opacity: 1; }
  100% { opacity: 0; visibility: hidden; }
}

/* controls: small, low-contrast, out of the way */
#ui {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(12, 10, 36, 0.55);
  border: 1px solid rgba(160, 140, 255, 0.18);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.ctl {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.ctl span {
  width: 30px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(220, 216, 255, 0.82);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 116px;
  height: 16px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
input[type="range"]:focus { outline: none; }
input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(255, 79, 208, 0.95), rgba(53, 242, 255, 0.95));
}
input[type="range"]::-moz-range-track {
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(255, 79, 208, 0.95), rgba(53, 242, 255, 0.95));
}
#rain::-webkit-slider-runnable-track { background: linear-gradient(90deg, rgba(110, 120, 170, 0.55), rgba(110, 205, 255, 0.95)); }
#rain::-moz-range-track { background: linear-gradient(90deg, rgba(110, 120, 170, 0.55), rgba(110, 205, 255, 0.95)); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4.5px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 7px rgba(255, 120, 220, 0.9);
}
input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 7px rgba(255, 120, 220, 0.9);
}
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35); }
#rain::-webkit-slider-thumb { box-shadow: 0 0 7px rgba(110, 205, 255, 0.9); }
#rain::-moz-range-thumb { box-shadow: 0 0 7px rgba(110, 205, 255, 0.9); }

#fallback, .noscript {
  position: fixed;
  inset: 0;
  margin: auto;
  height: max-content;
  max-width: 28em;
  padding: 0 1.5em;
  text-align: center;
  font-size: 14px;
  color: #dcd8ff;
}

@media (max-width: 560px), (max-height: 420px) {
  #ui {
    left: 50%;
    transform: translateX(-50%);
    flex-direction: row;
    gap: 14px;
    padding: 6px 10px;
  }
  input[type="range"] { width: 92px; }
  .ctl span { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  #hint { animation: none; opacity: 0; }
}
