/* ==========================================================================
   MERRY CHRISTMAS — 3D 粒子圣诞树
   ========================================================================== */

:root {
  --accent: #9fc6f5;
  --ink: #eef6ff;
  --ink-dim: rgba(206, 226, 248, 0.56);
  --font-display: "Didot", "Bodoni MT", "Bodoni 72", "Playfair Display",
    "Palatino Linotype", Palatino, Georgia, "Songti SC", "STSong", serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #02050c;
  color: var(--ink);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
}

body {
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

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

#scene.is-dragging {
  cursor: grabbing;
}

/* ---------- 画面压暗（增强文字可读性 / 边缘氛围） ---------- */

.veil {
  position: fixed;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 1;
}

.veil--top {
  top: 0;
  height: 34vh;
  background: linear-gradient(
    to bottom,
    rgba(2, 5, 12, 0.86) 0%,
    rgba(2, 5, 12, 0.5) 38%,
    rgba(2, 5, 12, 0) 100%
  );
}

.veil--bottom {
  bottom: 0;
  height: 26vh;
  background: linear-gradient(
    to top,
    rgba(2, 5, 12, 0.9) 0%,
    rgba(2, 5, 12, 0.45) 45%,
    rgba(2, 5, 12, 0) 100%
  );
}

/* ---------- 标题 ---------- */

.hero {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: clamp(26px, 5.2vh, 62px);
  padding-inline: 20px;
  text-align: center;
  pointer-events: none;
  animation: heroIn 1.6s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both;
}

.hero-title {
  display: inline-block;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(21px, 3.5vw, 54px);
  line-height: 1.12;
  text-transform: uppercase;
  letter-spacing: 0.38em;
  margin-right: -0.38em;
  color: #f4f9ff;
  text-shadow:
    0 0 1px rgba(255, 255, 255, 0.9),
    0 0 18px rgba(178, 214, 255, 0.55),
    0 0 48px rgba(104, 160, 226, 0.4),
    0 0 110px rgba(70, 120, 200, 0.28);
}

.hero-sub {
  margin: clamp(10px, 1.6vh, 18px) 0 0;
  font-size: clamp(9.5px, 0.92vw, 12px);
  font-weight: 300;
  letter-spacing: 0.3em;
  margin-right: -0.3em;
  color: rgba(188, 212, 240, 0.52);
  transition: color 0.6s ease;
}

/* ---------- 提示 ---------- */

.hint {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-b) + 88px);
  transform: translateX(-50%);
  z-index: 3;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: rgba(180, 205, 235, 0.4);
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 1s ease;
  animation: fadeIn 1.4s ease 2s both;
}

.hint.is-hidden {
  opacity: 0;
}

/* ---------- 底部控制条 ---------- */

.dock {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-b) + 22px);
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px;
  border-radius: 999px;
  background: rgba(9, 17, 30, 0.42);
  border: 1px solid rgba(150, 190, 240, 0.13);
  box-shadow:
    0 18px 50px -18px rgba(0, 0, 0, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  animation: dockIn 1.2s cubic-bezier(0.16, 1, 0.3, 1) 1s both;
}

.dock-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(196, 216, 240, 0.5);
  cursor: pointer;
  transition:
    color 0.28s ease,
    background 0.28s ease,
    transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.28s ease;
}

.dock-btn svg {
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.dock-btn:hover {
  color: rgba(232, 244, 255, 0.95);
  background: rgba(150, 195, 245, 0.1);
}

.dock-btn:hover svg {
  transform: scale(1.08);
}

.dock-btn:active {
  transform: scale(0.92);
}

.dock-btn:focus-visible {
  outline: 1px solid rgba(160, 200, 250, 0.7);
  outline-offset: 2px;
}

.dock-btn.is-active {
  color: #eaf4ff;
  background: radial-gradient(
    circle at 50% 40%,
    rgba(146, 194, 248, 0.26),
    rgba(120, 170, 230, 0.1) 60%,
    transparent 75%
  );
  box-shadow:
    inset 0 0 0 1px rgba(160, 200, 250, 0.22),
    0 0 22px -4px rgba(130, 180, 240, 0.55);
}

.dock-btn.is-active svg {
  filter: drop-shadow(0 0 6px rgba(150, 200, 255, 0.75));
}

/* 悬浮气泡提示 */
.dock-tip {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translate(-50%, 4px);
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(12, 22, 38, 0.92);
  border: 1px solid rgba(140, 180, 230, 0.16);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(215, 232, 250, 0.9);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.dock-btn:hover .dock-tip,
.dock-btn:focus-visible .dock-tip {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (hover: none) {
  .dock-tip {
    display: none;
  }
}

/* ---------- 许愿输入 ---------- */

.wish {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-b) + 90px);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(340px, calc(100vw - 44px));
  padding: 6px 6px 6px 18px;
  border-radius: 999px;
  background: rgba(10, 19, 33, 0.62);
  border: 1px solid rgba(150, 190, 240, 0.18);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 14px) scale(0.96);
  transition:
    opacity 0.42s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.42s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0.42s;
}

.wish.is-open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0) scale(1);
}

.wish-input {
  flex: 1;
  min-width: 0;
  height: 38px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13px;
  letter-spacing: 0.06em;
  outline: none;
}

.wish-input::placeholder {
  color: rgba(170, 198, 228, 0.42);
}

.wish-send {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  background: rgba(150, 195, 245, 0.14);
  color: #dcecff;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease;
}

.wish-send:hover {
  background: rgba(160, 205, 255, 0.26);
  transform: translateY(-1px);
}

.wish-send:active {
  transform: scale(0.94);
}

/* ---------- 轻提示 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-b) + 148px);
  z-index: 8;
  transform: translate(-50%, 10px) scale(0.96);
  padding: 11px 22px;
  border-radius: 999px;
  background: rgba(9, 17, 30, 0.78);
  border: 1px solid rgba(160, 200, 250, 0.16);
  font-size: 12.5px;
  letter-spacing: 0.1em;
  color: rgba(226, 240, 255, 0.94);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition:
    opacity 0.4s ease,
    transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* ---------- 载入 ---------- */

.loader {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: #02050c;
  transition: opacity 1.1s ease, visibility 1.1s;
}

.loader.is-done {
  opacity: 0;
  visibility: hidden;
}

.loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.loader-ring {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(140, 180, 230, 0.16);
  border-top-color: rgba(190, 220, 255, 0.85);
  animation: spin 1.1s linear infinite;
}

.loader-text {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.42em;
  margin-right: -0.42em;
  color: rgba(190, 215, 245, 0.5);
}

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 30;
  padding: 30px;
  text-align: center;
  color: rgba(210, 228, 248, 0.8);
  font-size: 14px;
  letter-spacing: 0.08em;
}

/* ---------- 动画 ---------- */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes heroIn {
  from {
    opacity: 0;
    transform: translateY(-14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes dockIn {
  from {
    opacity: 0;
    transform: translate(-50%, 22px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* ---------- 响应式 ---------- */

@media (max-width: 760px) {
  .hero {
    padding-top: max(26px, calc(env(safe-area-inset-top, 0px) + 22px));
  }

  .hero-title {
    font-size: clamp(17px, 6.4vw, 30px);
    letter-spacing: 0.26em;
    margin-right: -0.26em;
  }

  .hero-sub {
    font-size: 9.5px;
    letter-spacing: 0.2em;
    margin-right: -0.2em;
    margin-top: 9px;
  }

  .hint {
    bottom: calc(var(--safe-b) + 78px);
    font-size: 10px;
    letter-spacing: 0.12em;
  }

  .dock {
    gap: 2px;
    padding: 5px;
    bottom: calc(var(--safe-b) + 16px);
  }

  .dock-btn {
    width: 44px;
    height: 44px;
  }

  .wish {
    bottom: calc(var(--safe-b) + 80px);
    padding-left: 15px;
  }
}

@media (max-height: 520px) {
  .hero-title {
    font-size: clamp(15px, 3vw, 22px);
  }

  .hero-sub {
    display: none;
  }

  .hint {
    display: none;
  }

  .hero {
    padding-top: 14px;
  }
}

/* 低动态偏好 */
@media (prefers-reduced-motion: reduce) {
  .hero,
  .dock,
  .hint {
    animation: none;
  }

  .loader-ring {
    animation-duration: 2.6s;
  }
}
