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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #0b0f11;
  color: #f2f6f7;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

.stage {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
}

.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  user-select: none;
  -webkit-user-drag: none;
  opacity: 1;
  transform: scale(1.02);
  transition: opacity 0.62s ease;
  will-change: opacity;
}

.scene.is-fading { opacity: 0; }

.grade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(130% 110% at 50% 45%, rgba(0, 0, 0, 0) 50%, rgba(4, 8, 10, 0.34) 100%),
    linear-gradient(to bottom, rgba(6, 12, 15, 0.1), rgba(6, 12, 15, 0) 34%, rgba(6, 12, 15, 0.16));
}

.fog-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: none;
  touch-action: none;
}

.glow {
  position: absolute;
  inset: -4%;
  width: 108%;
  height: 108%;
  object-fit: cover;
  pointer-events: none;
  opacity: 0.24;
  mix-blend-mode: screen;
  filter: blur(24px) saturate(1.45) brightness(1.05);
  transform: translateZ(0);
  transition: opacity 0.62s ease;
}

.glass {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow:
    inset 0 0 140px rgba(3, 7, 9, 0.55),
    inset 0 0 32px rgba(214, 236, 240, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 58px;
  height: 58px;
  margin: -29px 0 0 -29px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 0 18px rgba(180, 220, 230, 0.12);
  opacity: 0;
  pointer-events: none;
  z-index: 5;
  transition: opacity 0.3s ease;
  will-change: transform;
}

.cursor.is-on { opacity: 1; }

.hint {
  position: absolute;
  left: 50%;
  bottom: 128px;
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.16em;
  color: rgba(240, 247, 249, 0.86);
  background: rgba(10, 16, 19, 0.32);
  border: 0.5px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
  z-index: 4;
  animation: hintFloat 3.6s ease-in-out infinite;
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.hint.is-gone,
.hint.is-idle {
  opacity: 0;
  transform: translate(-50%, 8px);
}

@keyframes hintFloat {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -5px); }
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 186px;
  transform: translate(-50%, 8px);
  margin: 0;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  white-space: nowrap;
  color: rgba(240, 247, 249, 0.9);
  background: rgba(10, 16, 19, 0.5);
  border: 0.5px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  z-index: 7;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.ui {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 16px calc(22px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 6;
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.ui.is-idle {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.scenes {
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(9, 15, 18, 0.42);
  border: 0.5px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
}

.scene-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(232, 242, 245, 0.6);
  font-size: 13px;
  font-family: inherit;
  letter-spacing: 0.06em;
  padding: 7px 15px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.25s ease, background 0.25s ease;
}

.scene-btn:hover { color: rgba(240, 248, 250, 0.92); }

.scene-btn.is-active {
  color: #0c1417;
  background: rgba(236, 245, 247, 0.92);
}

.tools {
  display: flex;
  gap: 8px;
}

.tool {
  appearance: none;
  width: 38px;
  height: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 0.5px solid rgba(255, 255, 255, 0.14);
  background: rgba(9, 15, 18, 0.42);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.tool:hover { background: rgba(20, 30, 34, 0.6); border-color: rgba(255, 255, 255, 0.26); }

.tool svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: rgba(232, 242, 245, 0.82);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#sound svg path:first-child { fill: rgba(232, 242, 245, 0.82); stroke: none; }

#sound .wave { opacity: 0.35; transition: opacity 0.3s ease; }

#sound.is-on .wave { opacity: 1; }

#sound.is-on { border-color: rgba(180, 224, 232, 0.5); }

@media (max-width: 520px) {
  .scene-btn { padding: 7px 11px; font-size: 12px; }
  .hint { bottom: 118px; font-size: 12px; }
  .cursor { display: none; }
  .fog-layer { cursor: default; }
}

@media (prefers-reduced-motion: reduce) {
  .hint { animation: none; }
  .scene { transition: none; }
}
