/* ============================================================
   咕泠泠 · 雨天森林 — 治愈系绘本场景
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: #0e1f1b;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

#scene {
  position: fixed;
  inset: 0;
  display: block;
  touch-action: none;
}

/* 柔和暗角，聚拢视线 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(115% 100% at 50% 42%, transparent 58%, rgba(4, 10, 8, 0.5) 100%);
}

/* ---------- 灯笼光标（仅精细指针设备） ---------- */
.lantern {
  position: fixed;
  top: 0; left: 0;
  z-index: 60;
  pointer-events: none;
  translate: -50% -58%;
  transform-origin: 50% 8%; /* 以提手为摆心 */
  opacity: 0;
  transition: opacity 0.5s ease;
  filter:
    drop-shadow(0 0 10px rgba(255, 217, 138, 0.8))
    drop-shadow(0 0 34px rgba(255, 190, 90, 0.4));
}
.lantern.is-on { opacity: 1; }
@media (pointer: coarse) { .lantern { display: none; } }
@media (pointer: fine) {
  body, a { cursor: none; }
}

/* ---------- 画作落款 ---------- */
.signature {
  position: fixed;
  left: 30px;
  bottom: 52px;
  z-index: 10;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", "BiauKai", serif;
  font-size: 17px;
  letter-spacing: 0.35em;
  color: rgba(226, 236, 228, 0.5);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
  user-select: none;
  pointer-events: none;
}

/* ---------- 备案页脚 ---------- */
.beian {
  position: fixed;
  left: 0; right: 0; bottom: 14px;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: rgba(206, 222, 212, 0.42);
}
.beian a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 2px;
  transition: color 0.3s ease;
}
.beian a:hover { color: rgba(226, 238, 229, 0.85); }
.beian a:focus-visible {
  outline: 1.5px solid rgba(226, 238, 229, 0.7);
  outline-offset: 2px;
  border-radius: 2px;
}
.beian-sep { opacity: 0.35; }

/* ---------- 音频控制浮窗 ---------- */
.audio-controls {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 5px;
  background: rgba(12, 28, 24, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(158, 186, 166, 0.22);
  border-radius: 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  user-select: none;
  transition: all 0.3s ease;
}

.audio-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(206, 222, 212, 0.45);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
}

.audio-btn:hover {
  color: rgba(230, 242, 235, 0.85);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

.audio-btn.active {
  color: #f2f7f4;
  background: rgba(73, 124, 87, 0.45);
  border-color: rgba(125, 154, 92, 0.5);
  box-shadow: 0 0 14px rgba(125, 154, 92, 0.3);
}

.audio-btn .icon {
  transition: stroke 0.3s ease, transform 0.3s ease;
}

.audio-btn.active .icon {
  stroke: #dbe4aa;
}

.audio-btn:focus-visible {
  outline: 2px solid rgba(201, 207, 154, 0.8);
  outline-offset: 2px;
}

/* ---------- 特色露珠水滴音量调节器 ---------- */
.volume-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 0;
  opacity: 0;
  margin-left: 0;
  overflow: hidden;
  pointer-events: none;
  transition: max-width 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.35s ease,
              margin-left 0.35s ease,
              padding 0.35s ease;
  padding-left: 0;
  padding-right: 0;
}

/* 当音乐开启时平滑展开音量调节器 */
.audio-controls.has-bgm .volume-wrapper,
.audio-btn.active + .volume-wrapper {
  max-width: 180px;
  opacity: 1;
  pointer-events: auto;
  margin-left: 8px;
  padding-right: 4px;
}

/* 静音 / 音量图标按钮 */
.volume-icon-btn {
  background: transparent;
  border: none;
  color: rgba(206, 222, 212, 0.6);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  outline: none;
  transition: color 0.3s ease, transform 0.2s ease, background 0.3s ease;
}

.volume-icon-btn:hover {
  color: #dbe4aa;
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.1);
}

.volume-icon-btn:focus-visible {
  outline: 2px solid rgba(201, 207, 154, 0.8);
}

/* 音量滑动容器 */
.volume-slider-container {
  position: relative;
  width: 95px;
  height: 28px;
  display: flex;
  align-items: center;
  cursor: pointer;
  outline: none;
  padding: 0 4px;
}

/* 水波律动条 */
.volume-waves {
  position: absolute;
  top: 2px;
  left: 6px;
  right: 6px;
  height: 6px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
  opacity: 0.4;
  transition: opacity 0.3s ease;
}

.volume-slider-container:hover .volume-waves,
.volume-slider-container.dragging .volume-waves {
  opacity: 0.85;
}

.wave-bar {
  width: 2px;
  height: 3px;
  background: rgba(219, 228, 170, 0.6);
  border-radius: 1px;
  transform-origin: bottom;
}

/* 音量播放时的音浪微律动 */
.audio-controls.has-bgm .wave-bar:nth-child(1) { animation: wavePulse 1.2s ease-in-out infinite alternate 0.1s; }
.audio-controls.has-bgm .wave-bar:nth-child(2) { animation: wavePulse 1.5s ease-in-out infinite alternate 0.3s; }
.audio-controls.has-bgm .wave-bar:nth-child(3) { animation: wavePulse 1.1s ease-in-out infinite alternate 0.0s; }
.audio-controls.has-bgm .wave-bar:nth-child(4) { animation: wavePulse 1.4s ease-in-out infinite alternate 0.4s; }
.audio-controls.has-bgm .wave-bar:nth-child(5) { animation: wavePulse 1.3s ease-in-out infinite alternate 0.2s; }

@keyframes wavePulse {
  0% { transform: scaleY(0.6); }
  100% { transform: scaleY(1.8); }
}

/* 音量长轨 */
.volume-track {
  position: relative;
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.4);
}

/* 充盈色阶轨 */
.volume-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, #3d6849 0%, #7d9a5c 65%, #c9cf9a 100%);
  border-radius: 4px;
  box-shadow: 0 0 8px rgba(125, 154, 92, 0.5);
  transition: width 0.08s linear;
}

/* 晶莹露珠水滴滑块 */
.volume-handle {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 18px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  z-index: 2;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
              filter 0.2s ease,
              left 0.08s linear;
}

.volume-handle .dew-drop {
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.5))
          drop-shadow(0 0 6px rgba(255, 246, 207, 0.6));
  transition: transform 0.2s ease;
}

.volume-slider-container:hover .volume-handle,
.volume-slider-container:focus-visible .volume-handle {
  transform: translate(-50%, -50%) scale(1.15);
}

.volume-slider-container.dragging .volume-handle {
  cursor: grabbing;
  transform: translate(-50%, -55%) scale(1.28) rotate(-5deg);
  filter: drop-shadow(0 0 12px rgba(255, 246, 207, 0.9));
}

/* 音量数值 Tooltip */
.volume-tooltip {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(12, 28, 24, 0.9);
  color: #f0f7f2;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  border: 1px solid rgba(158, 186, 166, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}

.volume-slider-container:hover .volume-tooltip,
.volume-slider-container.dragging .volume-tooltip,
.volume-slider-container:focus-visible .volume-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 640px) {
  .signature { left: 20px; bottom: 60px; font-size: 15px; }
  .audio-controls {
    top: 14px;
    right: 14px;
    gap: 6px;
    padding: 4px;
  }
  .audio-btn {
    padding: 6px 11px;
    font-size: 12px;
  }
  .volume-slider-container {
    width: 75px;
  }
}

