/* ===== 基础重置 ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
  color: #fff8f0;
  background: #0a0e27;
  user-select: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(
    165deg,
    #0a0e27 0%,
    #1a1035 45%,
    #0d0818 100%
  );
}

/* ===== 月亮方向柔光 ===== */
.sky-glow {
  position: fixed;
  top: -10%;
  left: -10%;
  width: 55vw;
  height: 55vw;
  max-width: 320px;
  max-height: 320px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(245, 230, 184, 0.12) 0%,
    rgba(245, 230, 184, 0.04) 40%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 1;
}

/* ===== Canvas 粒子层 ===== */
#particles-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ===== 月亮 ===== */
.moon {
  position: fixed;
  top: 5vh;
  left: 6vw;
  width: clamp(72px, 20vw, 120px);
  height: auto;
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 0 24px rgba(245, 230, 184, 0.45))
    drop-shadow(0 0 48px rgba(245, 230, 184, 0.2));
}

/* ===== 场景切换 ===== */
body.scene-heart {
  background: #000;
}

body.scene-heart #app {
  background: #000;
}

body.scene-heart .moon,
body.scene-heart .sky-glow,
body.scene-heart .content {
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

body.scene-heart #particles-canvas {
  opacity: 0;
  transition: opacity 0.6s ease;
}

body.scene-star #heart-scene {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.scene-heart #heart-scene {
  opacity: 1;
  visibility: visible;
}

/* ===== 爱心文字 3D 场景 ===== */
.heart-scene {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.heart-scene__perspective {
  perspective: 1000px;
  perspective-origin: 50% 50%;
}

.heart-scene__stage {
  --heart-stage-max: 480px;
  position: relative;
  width: min(82vmin, var(--heart-stage-max));
  height: min(82vmin, var(--heart-stage-max));
  transform-style: preserve-3d;
}

.heart-scene__track {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.heart-word {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  font-weight: 600;
  color: #ff8fb8;
  text-shadow:
    0 0 12px rgba(255, 107, 157, 0.75),
    0 0 24px rgba(255, 107, 157, 0.35);
  will-change: transform, opacity;
  pointer-events: none;
  transform-style: preserve-3d;
}

.heart-word--highlight {
  color: #ffd6e8;
  text-shadow:
    0 0 16px rgba(255, 182, 193, 0.85),
    0 0 32px rgba(255, 255, 255, 0.25);
}

.heart-word--highlight.heart-word--front {
  color: #ffffff;
  text-shadow:
    0 0 20px rgba(255, 255, 255, 0.95),
    0 0 40px rgba(255, 182, 193, 0.5);
}

/* 全屏点击层 — 用于切换场景 */
.scene-tap {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

body.scene-switchable .scene-tap {
  display: block;
}

.scene-hint {
  position: fixed;
  bottom: calc(6vh + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 11;
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  color: rgba(255, 248, 240, 0.5);
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
  pointer-events: none;
  transition: opacity 0.5s ease;
  animation: hintPulse 2.4s ease-in-out infinite;
}

body.scene-heart .scene-hint {
  color: rgba(255, 182, 193, 0.55);
}

.scene-hint.is-hidden {
  opacity: 0;
  animation: none;
}

/* ===== 内容区 ===== */
.content {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12vh 8vw 18vh;
  gap: 1.25rem;
  pointer-events: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.content-block {
  width: 100%;
  max-width: 520px;
  text-align: center;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.content-block.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.content-block[hidden] {
  display: none;
}

.content-block.is-visible[hidden] {
  display: block;
}

.content-name {
  font-size: clamp(1.75rem, 6vw, 2.5rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #fff8f0;
  text-shadow:
    0 0 20px rgba(255, 182, 193, 0.5),
    0 0 40px rgba(255, 255, 255, 0.15);
}

.content-message {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.content-message p {
  font-size: clamp(1rem, 4vw, 1.2rem);
  line-height: 1.85;
  letter-spacing: 0.04em;
  color: rgba(255, 248, 240, 0.92);
  text-shadow: 0 0 16px rgba(255, 255, 255, 0.2);
}

.content-images {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.content-images img {
  width: 100%;
  max-width: 70vw;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.35),
    0 0 24px rgba(255, 182, 193, 0.15);
  object-fit: cover;
}

.content-signature {
  font-size: clamp(1rem, 4vw, 1.15rem);
  letter-spacing: 0.12em;
  color: rgba(255, 248, 240, 0.85);
  text-shadow: 0 0 12px rgba(255, 182, 193, 0.35);
  margin-top: 0.5rem;
}

/* ===== 左右半屏提示 ===== */
.tap-zone {
  position: fixed;
  bottom: calc(8vh + env(safe-area-inset-bottom, 0px));
  z-index: 4;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  color: rgba(255, 248, 240, 0.35);
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.tap-zone--left {
  left: 8vw;
}

.tap-zone--right {
  right: 8vw;
}

body.is-ended .tap-zone {
  opacity: 0;
}

/* ===== 点击提示 ===== */
.tap-hint {
  position: fixed;
  bottom: calc(8vh + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  font-size: 0.9rem;
  letter-spacing: 0.2em;
  color: rgba(255, 248, 240, 0.55);
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
  animation: hintPulse 2.4s ease-in-out infinite;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.tap-hint.is-hidden {
  opacity: 0;
  animation: none;
}

@keyframes hintPulse {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 0.85;
  }
}

/* ===== 终幕爱心 ===== */
.finale {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  z-index: 5;
  font-size: 3rem;
  opacity: 0;
  pointer-events: none;
  text-shadow:
    0 0 30px rgba(255, 107, 157, 0.8),
    0 0 60px rgba(255, 107, 157, 0.4);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.finale.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ===== 安全区适配 ===== */
@supports (padding: env(safe-area-inset-top)) {
  .moon {
    top: calc(5vh + env(safe-area-inset-top, 0px));
  }
}
