:root {
  color-scheme: dark;
  --bg-top: #0b1830;
  --bg-bottom: #040814;
  --glass-edge: rgba(214, 238, 255, 0.24);
  --glass-glow: rgba(186, 226, 255, 0.12);
  --permission-bg: rgba(255, 255, 255, 0.12);
  --permission-border: rgba(255, 255, 255, 0.2);
  --permission-text: #eef8ff;
}

html,
body,
.app-root {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 15%, rgba(113, 167, 255, 0.18), transparent 35%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

body {
  font-family: Inter, system-ui, sans-serif;
  touch-action: none;
}

.scene-shell {
  position: relative;
  width: 100%;
  height: 100%;
  isolation: isolate;
}

.scene-canvas,
.scene-atmosphere,
.scene-glass,
.scene-grain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.scene-canvas {
  display: block;
}

.scene-atmosphere {
  pointer-events: none;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.08), transparent 25%),
    radial-gradient(circle at 70% 70%, rgba(78, 146, 255, 0.12), transparent 28%);
  filter: blur(10px);
}

.scene-grain {
  pointer-events: none;
  opacity: 0.08;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.18) 0 1px, transparent 1px),
    radial-gradient(circle at 80% 30%, rgba(255,255,255,0.16) 0 1px, transparent 1px),
    radial-gradient(circle at 40% 75%, rgba(255,255,255,0.14) 0 1px, transparent 1px);
  background-size: 120px 120px, 160px 160px, 140px 140px;
  mix-blend-mode: screen;
}

.scene-glass {
  pointer-events: none;
}

.glass-highlight {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 22%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.02));
  opacity: 0.45;
  filter: blur(14px);
}

.glass-highlight--left {
  left: -6%;
  transform: rotate(-8deg);
}

.glass-highlight--right {
  right: -6%;
  transform: rotate(8deg);
}

.glass-vignette {
  position: absolute;
  inset: 0;
  box-shadow:
    inset 0 0 0 1px var(--glass-edge),
    inset 0 0 80px var(--glass-glow),
    inset 0 -80px 120px rgba(4, 13, 29, 0.7);
}

.motion-permission {
  position: absolute;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  min-width: 140px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--permission-border);
  background: var(--permission-bg);
  color: var(--permission-text);
  letter-spacing: 0.02em;
  backdrop-filter: blur(16px);
}

.motion-permission.hidden {
  display: none;
}

@supports (padding: max(0px)) {
  .scene-shell {
    padding:
      env(safe-area-inset-top)
      env(safe-area-inset-right)
      env(safe-area-inset-bottom)
      env(safe-area-inset-left);
  }
}

.scene-shell::before,
.scene-shell::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scene-shell::before {
  background: linear-gradient(180deg, rgba(255,255,255,0.08), transparent 28%);
  mix-blend-mode: screen;
}

.scene-shell::after {
  box-shadow:
    inset 0 0 120px rgba(131, 188, 255, 0.08),
    inset 0 -120px 160px rgba(0, 12, 30, 0.4);
}

.motion-permission:not(.hidden) {
  animation: permissionPulse 1.8s ease-in-out infinite;
}

@keyframes permissionPulse {
  0%,
  100% {
    transform: translateX(-50%) scale(1);
  }
  50% {
    transform: translateX(-50%) scale(1.04);
  }
}
