/* ============================================
   七夕纪念网页 — 温馨手绘风设计系统
   ============================================ */

/* ---- CSS Reset ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; overscroll-behavior: none; }
body {
  font-family: 'Noto Serif SC', serif;
  background: #FFF8F0;
  color: #5C4033;
  overflow: hidden;
  position: relative;
  height: 100vh;
  height: 100svh;
  overscroll-behavior: none;
  touch-action: none;
}
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ---- 设计 Token ---- */
:root {
  --cream: #FFF8F0;
  --warm-white: #FFFDF9;
  --peach: #FFD4B8;
  --coral: #FF8B7B;
  --coral-light: #FFB5A0;
  --honey: #FFC857;
  --warm-brown: #8B6F5C;
  --dark-brown: #5C4033;
  --soft-amber: #E8A87C;
  --shadow-warm: rgba(139, 111, 92, 0.15);
  --shadow-deep: rgba(92, 64, 51, 0.3);
  --font-handwriting: 'Ma Shan Zheng', cursive;
  --font-body: 'Noto Serif SC', serif;
  --ease-soft: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================
   加载屏
   ============================================ */
#loader {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: linear-gradient(180deg, var(--peach) 0%, var(--cream) 50%, var(--warm-white) 100%);
  transition: opacity 0.8s ease, visibility 0.8s ease;
}
#loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.loader-heart {
  width: 50px; height: 50px;
  background: var(--coral);
  transform: rotate(-45deg);
  border-radius: 0 0 50% 50% / 0 0 60% 60%;
  position: relative;
  animation: heartBeat 1.2s ease-in-out infinite;
  box-shadow: 0 4px 15px rgba(255, 139, 123, 0.4);
}
.loader-heart::before, .loader-heart::after {
  content: ''; position: absolute;
  width: 50px; height: 50px; background: var(--coral);
  border-radius: 50%;
}
.loader-heart::before { top: -25px; left: 0; }
.loader-heart::after { left: 25px; top: 0; }

@keyframes heartBeat {
  0%, 100% { transform: rotate(-45deg) scale(1); }
  50% { transform: rotate(-45deg) scale(1.15); }
}

.loader-text {
  margin-top: 30px;
  font-size: 14px; color: var(--warm-brown);
  letter-spacing: 2px; opacity: 0.8;
  animation: textPulse 1.5s ease-in-out infinite;
}
@keyframes textPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.9; }
}

/* ============================================
   音乐控制
   ============================================ */
#music-toggle {
  position: fixed; top: calc(env(safe-area-inset-top, 0px) + 16px); right: 16px;
  z-index: 1000;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(255, 248, 240, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 12px var(--shadow-warm);
  color: var(--coral);
  transition: all 0.3s var(--ease-soft);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
#music-toggle:active { transform: scale(0.9); }
#music-toggle svg { width: 22px; height: 22px; }
#music-toggle .icon-music-off { display: none; }
#music-toggle.music-on .icon-music-on { display: block; animation: musicSpin 4s linear infinite; }
#music-toggle.music-on .icon-music-off { display: none; }
#music-toggle.music-off .icon-music-on { display: none; }
#music-toggle.music-off .icon-music-off { display: block; }

@keyframes musicSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ============================================
   漂浮装饰元素层
   ============================================ */
#float-layer {
  position: fixed; inset: 0; z-index: 500;
  pointer-events: none; overflow: hidden;
}
.float-heart {
  position: absolute;
  color: var(--coral); opacity: 0;
  font-size: 16px;
  animation: floatHeartUp 6s ease-out forwards;
}
@keyframes floatHeartUp {
  0% { opacity: 0; transform: translateY(0) scale(0.5); }
  20% { opacity: 0.6; }
  100% { opacity: 0; transform: translateY(-100vh) scale(1.2) rotate(20deg); }
}

.float-petal {
  position: absolute;
  width: 12px; height: 12px;
  background: var(--peach);
  border-radius: 0 100% 0 100%;
  opacity: 0;
  animation: floatPetalDown 8s linear forwards;
}
@keyframes floatPetalDown {
  0% { opacity: 0; transform: translateY(-20px) rotate(0deg); }
  10% { opacity: 0.5; }
  100% { opacity: 0; transform: translateY(100vh) translateX(50px) rotate(360deg); }
}

.float-sparkle {
  position: absolute;
  width: 6px; height: 6px;
  background: var(--honey);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--honey);
  opacity: 0;
  animation: sparkleTwinkle 3s ease-in-out infinite;
}
@keyframes sparkleTwinkle {
  0%, 100% { opacity: 0; transform: scale(0.5); }
  50% { opacity: 0.8; transform: scale(1.2); }
}

/* ============================================
   场景进度指示器
   ============================================ */
#progress-dots {
  position: fixed;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  pointer-events: none;
}
.progress-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(92, 64, 51, 0.25);
  transition: all 0.4s ease;
}
.progress-dot.active {
  background: var(--coral);
  box-shadow: 0 0 6px rgba(255, 139, 123, 0.6);
  transform: scale(1.4);
}
.progress-dot.completed {
  background: var(--honey);
}

/* ============================================
   继续按钮
   ============================================ */
.next-scene-btn {
  position: absolute;
  bottom: 8%;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 36px;
  background: linear-gradient(135deg, var(--coral), var(--coral-light));
  color: #FFF8F0;
  border-radius: 30px;
  font-family: 'Noto Serif SC', serif;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 3px;
  box-shadow: 0 4px 20px rgba(255, 139, 123, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease 0.3s, transform 0.6s ease 0.3s;
  cursor: pointer;
  z-index: 20;
  border: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.next-scene-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.next-scene-btn:active {
  transform: translateX(-50%) scale(0.95);
}
.next-scene-arrow {
  display: inline-flex;
  animation: nextArrowBounce 1.5s ease-in-out infinite;
}
@keyframes nextArrowBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

/* 开场开始按钮 */
.start-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 16px 48px;
  background: linear-gradient(135deg, var(--coral), var(--coral-light));
  color: #FFF8F0;
  border-radius: 30px;
  font-family: 'Noto Serif SC', serif;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 4px;
  box-shadow: 0 4px 20px rgba(255, 139, 123, 0.4);
  cursor: pointer;
  border: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  margin-top: 32px;
  transition: transform 0.2s ease;
  pointer-events: auto;
}
.start-btn:active { transform: scale(0.95); }

/* ============================================
   场景通用样式 — 锁定式全屏导航
   ============================================ */
.scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100svh;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  touch-action: none;
  transition: opacity 0.8s var(--ease-soft), visibility 0s linear 0.8s;
  z-index: 1;
}
.scene.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.8s var(--ease-soft), visibility 0s linear 0s;
  z-index: 2;
}

.scene-bg-wrapper {
  position: absolute; inset: 0;
  z-index: 0;
}
.scene-bg {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
  transform: scale(1.05);
  transition: transform 8s ease-out;
}
.scene.active .scene-bg { transform: scale(1.12); }

.scene-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(92, 64, 51, 0.25) 100%);
  pointer-events: none;
}
.scene-vignette-deep {
  background: radial-gradient(ellipse at center, transparent 30%, rgba(50, 35, 28, 0.45) 100%);
}

.scene-content {
  position: relative; z-index: 10;
  width: 100%; max-width: 420px;
  padding: 0 24px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end;
  min-height: 100svh;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 80px);
  pointer-events: none;
}

/* ---- 场景文字说明 ---- */
.scene-caption {
  font-family: var(--font-handwriting);
  font-size: 24px;
  color: var(--warm-white);
  text-shadow: 0 2px 12px rgba(92, 64, 51, 0.5), 0 0 30px rgba(92, 64, 51, 0.3);
  letter-spacing: 4px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 1.2s var(--ease-soft), transform 1.2s var(--ease-soft);
  text-align: center;
  line-height: 1.8;
  padding: 8px 20px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.15));
  border-radius: 20px;
}
.scene.active .scene-caption {
  opacity: 1; transform: translateY(0);
}
.scene-caption-light {
  color: var(--warm-white);
  text-shadow: 0 2px 16px rgba(0,0,0,0.6);
}

/* ============================================
   开场场景
   ============================================ */
.opening-content {
  justify-content: center;
  padding-bottom: 0;
  text-align: center;
}

.opening-silhouette {
  width: 120px; height: 80px;
  margin-bottom: 30px;
  background: radial-gradient(ellipse at 35% 60%, var(--dark-brown) 12px, transparent 13px),
              radial-gradient(ellipse at 65% 55%, var(--dark-brown) 10px, transparent 11px),
              radial-gradient(ellipse at 50% 80%, var(--dark-brown) 8px, transparent 9px);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1.5s ease 0.5s, transform 1.5s ease 0.5s;
}
.scene-opening.active .opening-silhouette { opacity: 0.5; transform: translateY(0); }

.title-main {
  font-family: var(--font-handwriting);
  font-size: 48px;
  color: var(--dark-brown);
  text-shadow: 0 2px 20px rgba(255, 200, 87, 0.4);
  letter-spacing: 8px;
  opacity: 0;
  transform: translateY(30px) scale(0.9);
  transition: opacity 1.5s var(--ease-bounce) 0.8s, transform 1.5s var(--ease-bounce) 0.8s;
  line-height: 1.2;
}
.scene-opening.active .title-main { opacity: 1; transform: translateY(0) scale(1); }

.title-sub {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 300;
  color: var(--warm-brown);
  letter-spacing: 6px;
  margin-top: 16px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 1.2s ease 1.5s, transform 1.2s ease 1.5s;
}
.scene-opening.active .title-sub { opacity: 0.85; transform: translateY(0); }

.scroll-hint {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 40px);
  left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column;
  align-items: center; gap: 8px;
  opacity: 0;
  transition: opacity 1s ease 2.5s;
}
.scene-opening.active .scroll-hint { opacity: 0.7; }

.scroll-text {
  font-size: 12px;
  color: var(--warm-brown);
  letter-spacing: 3px;
}
.scroll-arrow {
  color: var(--coral);
  animation: scrollBounce 2s ease-in-out infinite;
}
@keyframes scrollBounce {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(8px); opacity: 1; }
}

/* ============================================
   场景动画装饰
   ============================================ */

/* 闪烁爆发（场景1） */
.sparkle-burst {
  position: absolute;
  top: 40%; left: 50%;
  width: 1px; height: 1px;
}
.sparkle-burst::before, .sparkle-burst::after {
  content: ''; position: absolute;
  width: 200px; height: 200px;
  top: -100px; left: -100px;
  background: radial-gradient(circle, rgba(255,200,87,0.3) 0%, transparent 50%);
  opacity: 0;
}
.scene.active .sparkle-burst::before {
  animation: burstGlow 2s ease-out 1.5s;
}
.scene.active .sparkle-burst::after {
  animation: burstGlow 2s ease-out 2s;
}
@keyframes burstGlow {
  0% { opacity: 0; transform: scale(0.3); }
  50% { opacity: 1; transform: scale(1.2); }
  100% { opacity: 0; transform: scale(1.5); }
}

/* 爱心飘浮（场景2） */
.heart-float-anim {
  position: absolute;
  top: 30%; left: 50%;
  transform: translateX(-50%);
  width: 200px; height: 200px;
  pointer-events: none;
}
.heart-float-anim::before {
  content: '♥ ♥ ♥ ♥ ♥';
  position: absolute;
  top: 0; left: 0; width: 100%;
  text-align: center;
  color: var(--coral);
  font-size: 14px;
  letter-spacing: 20px;
  opacity: 0;
}
.scene.active .heart-float-anim::before {
  animation: heartFloatScene 3s ease-out 1.5s;
}
@keyframes heartFloatScene {
  0% { opacity: 0; transform: translateY(40px) scale(0.5); }
  30% { opacity: 0.7; }
  100% { opacity: 0; transform: translateY(-80px) scale(1.2); }
}

/* 猫爪印（场景3） */
.paw-print-anim {
  position: absolute;
  bottom: 25%; left: 0; right: 0;
  height: 60px;
  display: flex;
  justify-content: center;
  gap: 20px;
  opacity: 0;
}
.paw-print-anim::before,
.paw-print-anim::after {
  content: '🐾';
  font-size: 20px;
  opacity: 0;
}
.scene.active .paw-print-anim::before {
  animation: pawWalk 3s ease-in-out 1.5s forwards;
}
.scene.active .paw-print-anim::after {
  animation: pawWalk 3s ease-in-out 2s forwards;
}
@keyframes pawWalk {
  0% { opacity: 0; transform: translateX(-30px) scale(0.5); }
  50% { opacity: 0.6; transform: translateX(0) scale(1); }
  100% { opacity: 0; transform: translateX(30px) scale(0.5); }
}

/* 花瓣飘落（场景4） */
.petal-drift-anim {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.petal-drift-anim::before,
.petal-drift-anim::after {
  content: '';
  position: absolute;
  width: 10px; height: 10px;
  background: var(--peach);
  border-radius: 0 100% 0 100%;
  opacity: 0;
}
.petal-drift-anim::before { top: 20%; left: 30%; }
.petal-drift-anim::after { top: 30%; right: 25%; }
.scene.active .petal-drift-anim::before {
  animation: petalFall 4s ease-in 1.5s;
}
.scene.active .petal-drift-anim::after {
  animation: petalFall 4s ease-in 2.2s;
}
@keyframes petalFall {
  0% { opacity: 0; transform: translateY(0) rotate(0deg); }
  20% { opacity: 0.6; }
  100% { opacity: 0; transform: translateY(300px) rotate(180deg) translateX(40px); }
}

/* 暖光脉冲（场景5） */
.warm-glow-anim {
  position: absolute;
  top: 35%; left: 50%;
  width: 200px; height: 200px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,200,87,0.15) 0%, transparent 70%);
  opacity: 0;
  pointer-events: none;
}
.scene.active .warm-glow-anim {
  animation: warmPulse 4s ease-in-out 1.5s infinite;
}
@keyframes warmPulse {
  0%, 100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
}

/* 雨滴（场景6） */
.rain-streak-anim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 60%, rgba(100, 80, 70, 0.08) 100%);
  opacity: 0;
}
.scene.active .rain-streak-anim {
  animation: rainOverlay 4s ease-in 1.5s forwards;
}
@keyframes rainOverlay {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

/* ============================================
   结尾互动告白
   ============================================ */
.ending-content {
  justify-content: center;
  padding-bottom: 0;
  text-align: center;
}

.ending-pretext,
.ending-pretext-2 {
  font-family: var(--font-handwriting);
  color: var(--warm-white);
  text-shadow: 0 2px 16px rgba(92, 64, 51, 0.5);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 1.5s var(--ease-soft), transform 1.5s var(--ease-soft);
}
.ending-pretext {
  font-size: 32px;
  letter-spacing: 10px;
}
.ending-pretext-2 {
  font-size: 18px;
  letter-spacing: 4px;
  margin-top: 12px;
  color: var(--peach);
}
.scene.active .ending-pretext { opacity: 1; transform: translateY(0); }
.scene.active .ending-pretext-2 { opacity: 0.9; transform: translateY(0); }

.confession-area {
  margin-top: 40px;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 1.5s var(--ease-soft), transform 1.5s var(--ease-soft);
  pointer-events: auto;
}
.scene.active .confession-area { opacity: 1; transform: translateY(0); }

.confession-question {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 300;
  color: var(--warm-white);
  text-shadow: 0 2px 12px rgba(92, 64, 51, 0.6);
  line-height: 2;
  letter-spacing: 3px;
  margin-bottom: 36px;
}

.confession-btn {
  position: relative;
  padding: 14px 48px;
  font-family: var(--font-handwriting);
  font-size: 22px;
  letter-spacing: 8px;
  color: var(--warm-white);
  background: linear-gradient(135deg, var(--coral), var(--coral-light));
  border-radius: 50px;
  box-shadow: 0 6px 20px rgba(255, 139, 123, 0.4),
              inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: all 0.3s var(--ease-bounce);
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
}
.confession-btn::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255,255,255,0.3), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}
.confession-btn:hover { transform: scale(1.05); box-shadow: 0 8px 28px rgba(255, 139, 123, 0.5); }
.confession-btn:hover::before { transform: translateX(100%); }
.confession-btn:active { transform: scale(0.95); }

.btn-heart {
  display: inline-block;
  margin-left: 8px;
  font-size: 18px;
  animation: btnHeartBeat 1.5s ease-in-out infinite;
}
@keyframes btnHeartBeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* 点击后的回应 */
.confession-response {
  display: none;
  opacity: 0;
  transition: opacity 1.5s ease;
}
.confession-response.show {
  display: block;
  opacity: 1;
}
.response-text {
  font-family: var(--font-handwriting);
  font-size: 24px;
  color: var(--warm-white);
  text-shadow: 0 2px 16px rgba(255, 139, 123, 0.5);
  line-height: 2;
  letter-spacing: 4px;
}

/* 点击后隐藏告白区 */
.confession-area.hidden {
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.6s ease;
  pointer-events: none;
}

/* ============================================
   庆祝动画层
   ============================================ */
#celebration-layer {
  position: fixed; inset: 0;
  z-index: 800;
  pointer-events: none;
  display: none;
}
#celebration-layer.active { display: block; }
#celebration-canvas {
  width: 100%; height: 100%;
}

/* ============================================
   暗色场景微调
   ============================================ */
.scene-dark .scene-content {
  padding-top: 0;
}

/* ============================================
   移动端适配
   ============================================ */
@media (max-width: 380px) {
  .title-main { font-size: 40px; letter-spacing: 6px; }
  .scene-caption { font-size: 20px; letter-spacing: 3px; }
  .confession-question { font-size: 16px; }
  .ending-pretext { font-size: 28px; }
}

@media (min-width: 768px) {
  .scene-content { max-width: 480px; }
  .title-main { font-size: 56px; }
  .scene-caption { font-size: 28px; }
}

/* ============================================
   减少动画偏好
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.3s !important;
  }
  .scene-bg { transform: none !important; }
}

/* ============================================
   互动系统样式
   ============================================ */

/* 互动层基础 — z-index 高于 scene-content 确保触屏可及 */
.interaction-layer {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  touch-action: none;
  transition: opacity 0.6s ease;
}
.interaction-layer.completed {
  opacity: 0;
  pointer-events: none;
}
/* 互动元素接收触摸 */
.interaction-layer .door-overlay,
.interaction-layer .card-overlay,
.interaction-layer .phone-overlay,
.interaction-layer .hands-overlay,
.interaction-layer .cat-pet-overlay,
.interaction-layer .surf-overlay,
.interaction-layer .embrace-overlay,
.interaction-layer .light-overlay,
.interaction-layer .crack-overlay,
.interaction-layer .reunite-overlay,
.interaction-layer .key-overlay {
  pointer-events: auto;
  touch-action: none;
}
/* 点击类互动 */
.interaction-layer .game-card,
.interaction-layer .ring-light-off {
  touch-action: manipulation;
}

/* 互动提示文字 — 不拦截触摸事件 */
.interaction-prompt {
  position: absolute;
  bottom: 12%;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Noto Serif SC', serif;
  font-size: 16px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(92, 64, 51, 0.4);
  padding: 8px 20px;
  border-radius: 20px;
  white-space: nowrap;
  animation: promptPulse 2s ease-in-out infinite;
  z-index: 10;
  pointer-events: none;
  touch-action: none;
}
@keyframes promptPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* 场景文字锁定状态 */
.scene-caption.locked {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.scene-caption.locked.unlocked {
  opacity: 1;
  transform: translateY(0);
}

/* 全局互动提示 */
#interaction-hint {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(92, 64, 51, 0.7);
  color: #FFF8F0;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 15px;
  z-index: 100;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
#interaction-hint.hint-hidden { opacity: 0; }
#interaction-hint.hint-visible { opacity: 1; }

/* ============================================
   场景1: 推开门
   ============================================ */
.door-overlay {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.door-panel {
  position: absolute;
  width: 60%;
  max-width: 200px;
  height: 70%;
  background: linear-gradient(135deg, #6B5B4A, #8B7D6E);
  border-radius: 12px 12px 0 0;
  transform-origin: left center;
  transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 20px rgba(0,0,0,0.3);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 20px;
}
.door-handle {
  width: 12px;
  height: 12px;
  background: var(--honey);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255, 200, 87, 0.6);
}
.door-light {
  position: absolute;
  width: 50%;
  max-width: 160px;
  height: 60%;
  background: radial-gradient(ellipse at center, rgba(255, 220, 150, 0.8), transparent 70%);
  opacity: 0;
  transition: opacity 1s ease 0.3s;
  z-index: 1;
}
.door-overlay.opening .door-panel {
  transform: perspective(400px) rotateY(-75deg);
}
.door-overlay.opening .door-light {
  opacity: 1;
}

/* ============================================
   场景2: 翻开角色卡
   ============================================ */
.card-overlay {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 600px;
}
.game-card {
  width: 120px;
  height: 170px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}
.game-card.flipped { transform: rotateY(180deg); }
.card-back, .card-front {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
}
.card-back {
  background: linear-gradient(135deg, #C97B5F, #E8A87C);
  color: #FFF8F0;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.card-front {
  background: linear-gradient(135deg, #FFF8F0, #FFD4B8);
  transform: rotateY(180deg);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.card-heart {
  font-size: 60px;
  color: var(--coral);
  animation: heartBeat 1s ease-in-out infinite;
}
@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ============================================
   场景3: 长按回复
   ============================================ */
.phone-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.phone-screen {
  width: 240px;
  background: rgba(255, 248, 240, 0.95);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.chat-bubble-incoming {
  background: #F0E8E0;
  color: var(--dark-brown);
  padding: 10px 16px;
  border-radius: 16px 16px 16px 4px;
  font-size: 15px;
  margin-bottom: 12px;
  align-self: flex-start;
}
.chat-input-area {
  background: #FFF;
  border: 2px solid var(--peach);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}
.chat-input-area.pressing {
  border-color: var(--coral);
}
.chat-input-area.sent .chat-input-placeholder {
  display: none;
}
.chat-input-area.sent::after {
  content: "没有，但我想有你 ♥";
  display: block;
  color: var(--coral);
  font-size: 14px;
}
.chat-input-placeholder {
  font-size: 14px;
  color: var(--warm-brown);
  opacity: 0.6;
}
.chat-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: #F0E8E0;
}
.chat-progress-fill {
  width: 0%;
  height: 100%;
  background: var(--coral);
  transition: width 0.1s linear;
}

/* ============================================
   场景4: 牵起手
   ============================================ */
.hands-overlay {
  position: relative;
  width: 280px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.hand-left, .hand-right {
  font-size: 40px;
  cursor: grab;
  user-select: none;
  transition: transform 0.3s ease;
  z-index: 2;
}
.hand-left { transform: translateX(0); }
.hand-right { transform: translateX(0); }
.hands-connection {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--coral), transparent);
  opacity: 0;
  transition: all 0.6s ease;
}
.hands-connection.connected {
  width: 80px;
  opacity: 1;
}

/* ============================================
   场景5: 抚摸小猫
   ============================================ */
.cat-pet-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.cat-pet-area {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255, 200, 87, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  touch-action: none;
  position: relative;
  overflow: hidden;
}
.cat-sleeping {
  font-size: 60px;
  transition: transform 0.3s ease;
}
.cat-pet-area.petted .cat-sleeping {
  transform: scale(1.1) rotate(-5deg);
}
.pet-stroke-feedback {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}
.pet-stroke-feedback.active {
  opacity: 1;
  animation: strokeGlow 0.6s ease;
}
@keyframes strokeGlow {
  0% { box-shadow: inset 0 0 0 rgba(255, 200, 87, 0); }
  50% { box-shadow: inset 0 0 30px rgba(255, 200, 87, 0.4); }
  100% { box-shadow: inset 0 0 0 rgba(255, 200, 87, 0); }
}
.pet-count {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(92, 64, 51, 0.4);
  padding: 4px 16px;
  border-radius: 12px;
}

/* ============================================
   场景6: 双人避浪
   ============================================ */
.surf-overlay {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.surf-board {
  font-size: 50px;
  position: absolute;
  z-index: 3;
  transition: transform 0.2s ease;
}
.surf-board.tilt-left { transform: translateX(-40px) rotate(-15deg); }
.surf-board.tilt-right { transform: translateX(40px) rotate(15deg); }
.surf-board.balanced { transform: translateX(0) rotate(0); }
.wave-1, .wave-2 {
  position: absolute;
  width: 60px;
  height: 80px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  z-index: 1;
}
.wave-1 { left: 15%; animation: waveApproach 3s ease-in infinite; }
.wave-2 { right: 15%; animation: waveApproach 3s ease-in 1.5s infinite; }
@keyframes waveApproach {
  0% { transform: scale(0.5); opacity: 0.8; }
  100% { transform: scale(1.5); opacity: 0; }
}
.surf-success-count {
  position: absolute;
  bottom: -30px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(92, 64, 51, 0.4);
  padding: 4px 16px;
  border-radius: 12px;
}

/* ============================================
   场景7: 给她拥抱
   ============================================ */
.embrace-overlay {
  position: relative;
  width: 280px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.embrace-figure {
  font-size: 40px;
  cursor: grab;
  user-select: none;
  z-index: 2;
  transition: transform 0.5s ease;
}
.embrace-target {
  font-size: 30px;
  color: var(--coral);
  z-index: 1;
}
.embrace-figure.hugging {
  transform: translateX(100px) scale(1.2);
}

/* ============================================
   场景8: 点亮环形灯
   ============================================ */
.light-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.ring-light-off {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 4px solid rgba(139, 111, 92, 0.3);
  background: rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.4s ease;
}
.ring-light-off.lit {
  border-color: var(--honey);
  background: rgba(255, 220, 87, 0.3);
  box-shadow: 0 0 40px rgba(255, 200, 87, 0.6), inset 0 0 30px rgba(255, 220, 87, 0.3);
}
.ring-light-switch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--warm-brown);
  transition: all 0.3s ease;
}
.ring-light-off.lit .ring-light-switch {
  background: var(--honey);
  box-shadow: 0 0 10px var(--honey);
}
.light-tap-count {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(92, 64, 51, 0.4);
  padding: 4px 16px;
  border-radius: 12px;
}

/* ============================================
   场景9: 修补裂痕
   ============================================ */
.crack-overlay {
  position: relative;
  width: 300px;
  height: 400px;
  touch-action: none;
}
.crack-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#crack-path {
  transition: stroke-width 0.3s ease, opacity 0.3s ease, stroke 0.5s ease;
}
#crack-path.mended {
  stroke: var(--coral-light);
  stroke-width: 1;
  opacity: 0.3;
}
.crack-mend-feedback {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent, transparent);
  transition: background 0.5s ease;
}
.crack-mend-feedback.glowing {
  background: radial-gradient(circle at center, rgba(255, 180, 160, 0.15), transparent 70%);
}

/* ============================================
   场景10: 重新牵手
   ============================================ */
.reunite-overlay {
  position: relative;
  width: 280px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.reunite-left, .reunite-right {
  font-size: 40px;
  cursor: grab;
  user-select: none;
  z-index: 2;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.reunite-left.turned { transform: translateX(60px) rotate(10deg); }
.reunite-right.turned { transform: translateX(-60px) rotate(-10deg); }

/* ============================================
   场景11: 转动钥匙开门
   ============================================ */
.key-overlay {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.key-hole {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid rgba(139, 111, 92, 0.3);
  background: rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  transition: all 0.4s ease;
  position: relative;
}
.key-icon { font-size: 32px; }
.key-hole.opening { transform: rotate(180deg); }
.key-hole.open {
  border-color: var(--honey);
  background: rgba(255, 220, 87, 0.2);
  box-shadow: 0 0 30px rgba(255, 200, 87, 0.5);
}
.key-rotate-hint {
  font-size: 24px;
  color: rgba(255, 255, 255, 0.6);
  animation: rotateHint 2s linear infinite;
}
@keyframes rotateHint {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ============================================
   互动完成效果
   ============================================ */
.interaction-layer.completed .interaction-prompt {
  opacity: 0;
}
.scene-caption.unlocked {
  animation: captionReveal 1s ease forwards;
}
@keyframes captionReveal {
  0% { opacity: 0; transform: translateY(30px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* 场景互动锁定时的渐变遮罩 */
.scene[data-interaction] .scene-content {
  z-index: 6;
  min-height: auto;
  max-height: 25vh;
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 60px);
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 420px;
  padding-bottom: 0;
  overflow: visible;
}
.scene[data-interaction] .interaction-layer:not(.completed) ~ .scene-content .scene-caption {
  opacity: 0;
}
