/* ========== 3D 星空回忆馆样式 ========== */
:root {
  --rose: #e0899c;
  --sage: #a3b394;
  --rose-deep: #c96f86;
  --gold: #d8bd96;
  --ink: #f5e8ea;
  --serif: "Noto Serif SC", "Songti SC", serif;
  --hand: "Ma Shan Zheng", "Noto Serif SC", cursive;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body { font-family: var(--serif); background: #0d0812; color: var(--ink); }

#scene { position: fixed; inset: 0; display: block; }

/* ========== 门帘（G1 重设计：星封信笺语言，与开场 intro-card 同源） ========== */
.gate {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1.5px 1.5px at 8% 18%, rgba(245,237,228,.4) 50%, transparent 51%),
    radial-gradient(1px 1px at 86% 12%, rgba(245,237,228,.35) 50%, transparent 51%),
    radial-gradient(1px 1px at 16% 78%, rgba(216,189,150,.35) 50%, transparent 51%),
    radial-gradient(2px 2px at 92% 70%, rgba(224,137,156,.3) 50%, transparent 51%),
    radial-gradient(1px 1px at 64% 88%, rgba(245,237,228,.3) 50%, transparent 51%),
    radial-gradient(ellipse at center, #17132a 0%, #0b0817 100%);
  transition: opacity 1.4s ease, visibility 1.4s;
}
.gate.open { opacity: 0; visibility: hidden; pointer-events: none; }
/* 信笺卡片：深蓝夜纸 + 细金双线框 + 星点 + 呼吸（对齐 intro-card） */
.gate-inner {
  text-align: center; position: relative;
  padding: clamp(38px, 6vw, 60px) clamp(44px, 8vw, 92px);
  background:
    radial-gradient(1px 1px at 12% 22%, rgba(245,237,228,.5) 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 14%, rgba(245,237,228,.35) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 30% 78%, rgba(216,189,150,.5) 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 62%, rgba(245,237,228,.3) 50%, transparent 51%),
    radial-gradient(2px 2px at 58% 30%, rgba(224,137,156,.45) 50%, transparent 51%),
    linear-gradient(168deg, rgba(26,22,42,.92) 0%, rgba(16,13,28,.95) 100%);
  border: 1px solid rgba(216,189,150,.55);
  box-shadow:
    0 0 0 6px rgba(13,10,20,.55),
    0 0 0 7px rgba(216,189,150,.28),
    0 24px 80px rgba(0,0,0,.55),
    inset 0 0 60px rgba(216,189,150,.05);
  animation: gateCardIn 1.2s cubic-bezier(.22,.9,.3,1) both, introCardBreath 5s ease-in-out 1.4s infinite;
}
@keyframes gateCardIn {
  from { opacity: 0; transform: translateY(22px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
/* 金线自上而下描画（同 intro-card） */
.gate-inner::before {
  content: ""; position: absolute; left: 10px; right: 10px; top: 10px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(216,189,150,.9), transparent);
  transform-origin: left; animation: introRule 1.2s ease .3s both;
}
.gate-inner::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: 10px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(216,189,150,.9), transparent);
  transform-origin: right; animation: introRule 1.2s ease .5s both;
}
.gate-ring {
  position: absolute; left: 50%; top: 50%;
  width: 240px; height: 240px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(216,189,150,.38);
  border-radius: 50%;
  animation: ringPulse 2.4s ease-in-out infinite;
  pointer-events: none;
}
.gate-ring::after {
  content: ""; position: absolute; inset: -22px;
  border: 1px solid rgba(224,137,156,.28);
  border-radius: 50%;
  animation: ringPulse 2.4s ease-in-out .6s infinite;
}
@keyframes ringPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: .8; }
  50% { transform: translate(-50%, -50%) scale(1.08); opacity: .3; }
}
.gate-sub { color: rgba(216,189,150,.75); letter-spacing: .4em; font-size: 14px; margin-bottom: 14px; }
.gate-title {
  color: #f7ede6; font-family: var(--hand);
  font-size: clamp(34px, 7vw, 56px); letter-spacing: .25em;
  margin-bottom: 36px; font-weight: 400;
  text-shadow: 0 0 30px rgba(224,137,156,.35);
}
.gate-btn {
  width: 84px; height: 84px; border-radius: 50%;
  border: 1px solid rgba(216,189,150,.6); cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #f0dcc0, var(--gold) 55%, #b3935f);
  color: #4a2f3a; font-size: 34px;
  box-shadow: 0 0 40px rgba(216,189,150,.5);
  animation: heartbeat 1.6s ease-in-out infinite;
  transition: transform .2s;
}
.gate-btn:hover { transform: scale(1.1); }
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.12); }
  28% { transform: scale(1); }
  42% { transform: scale(1.12); }
  70% { transform: scale(1); }
}

/* ========== HUD ========== */
.hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  padding: 14px 70px 14px 20px;
  pointer-events: none;
  opacity: 0; transition: opacity 1.5s ease .8s;
}
.hud.on { opacity: 1; }
.hud-counter {
  font-size: 13px; letter-spacing: .2em; color: rgba(245,232,234,.75);
  background: rgba(20, 10, 18, .35); backdrop-filter: blur(8px);
  padding: 8px 18px; border-radius: 999px;
  border: 1px solid rgba(224,137,156,.25);
  font-variant-numeric: tabular-nums;
}
.hud-counter b { color: var(--rose); font-weight: 600; }
@keyframes dayPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(224,137,156,0); }
  50%      { transform: scale(1.06); box-shadow: 0 0 18px rgba(224,137,156,.45); }
}
.hud-counter.pulse { animation: dayPulse 1s ease-in-out 3; } /* M-10 跨 0 点 1Hz×3 次 */
.music-toggle {
  position: fixed; top: 12px; right: 14px; z-index: 45;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid rgba(224,137,156,.4);
  background: rgba(20, 10, 18, .45); backdrop-filter: blur(6px);
  color: var(--rose); font-size: 19px; cursor: pointer;
  pointer-events: auto;
}
.music-toggle.playing { animation: spin 4s linear infinite; }
.music-toggle.muted { opacity: .4; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== 开场封面（2026-10-21 P2 重设计：星封信笺） ========== */
.intro {
  position: fixed; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  text-align: center; pointer-events: none;
  opacity: 0; transition: opacity 1.2s ease;
}
.intro.on { opacity: 1; }
.intro.off { opacity: 0; }
/* 信笺卡片：深蓝夜纸 + 细金双线框 + 微光呼吸 */
.intro-card {
  position: relative;
  padding: clamp(34px, 6vw, 64px) clamp(40px, 8vw, 96px);
  background:
    radial-gradient(1px 1px at 12% 22%, rgba(245,237,228,.5) 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 14%, rgba(245,237,228,.35) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 30% 78%, rgba(216,189,150,.5) 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 62%, rgba(245,237,228,.3) 50%, transparent 51%),
    radial-gradient(2px 2px at 58% 30%, rgba(224,137,156,.45) 50%, transparent 51%),
    linear-gradient(168deg, rgba(26,22,42,.88) 0%, rgba(16,13,28,.92) 100%);
  border: 1px solid rgba(216,189,150,.55);
  box-shadow:
    0 0 0 6px rgba(13,10,20,.55),
    0 0 0 7px rgba(216,189,150,.28),
    0 24px 80px rgba(0,0,0,.55),
    inset 0 0 60px rgba(216,189,150,.05);
  animation: introCardIn 1.4s cubic-bezier(.22,.9,.3,1) both, introCardBreath 5s ease-in-out 1.6s infinite;
}
@keyframes introCardIn {
  from { opacity: 0; transform: translateY(22px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes introCardBreath {
  0%,100% { box-shadow: 0 0 0 6px rgba(13,10,20,.55), 0 0 0 7px rgba(216,189,150,.28), 0 24px 80px rgba(0,0,0,.55), inset 0 0 60px rgba(216,189,150,.05); }
  50%     { box-shadow: 0 0 0 6px rgba(13,10,20,.55), 0 0 0 7px rgba(216,189,150,.44), 0 24px 90px rgba(0,0,0,.6), inset 0 0 80px rgba(216,189,150,.1); }
}
/* 金线自上而下描画 */
.intro-card::before {
  content: ""; position: absolute; left: 10px; right: 10px; top: 10px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(216,189,150,.9), transparent);
  transform-origin: left; animation: introRule 1.2s ease .3s both;
}
.intro-card::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: 10px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(216,189,150,.9), transparent);
  transform-origin: right; animation: introRule 1.2s ease .5s both;
}
@keyframes introRule { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.intro-sub { color: var(--gold); letter-spacing: .5em; font-size: 13px; margin-bottom: 20px; opacity: 0; animation: introFadeUp .9s ease .7s both; }
.intro-title {
  font-family: var(--hand); font-weight: 400;
  font-size: clamp(44px, 9vw, 88px); color: #f7ede6;
  text-shadow: 0 0 34px rgba(224,137,156,.4);
  opacity: 0; animation: introFadeUp 1s ease 1s both;
}
.intro-title .amp { color: var(--rose); margin: 0 .22em; font-size: .55em; vertical-align: middle; opacity: .9; }
.intro-anniv {
  margin-top: 18px; font-size: clamp(15px, 2.6vw, 21px); letter-spacing: .45em;
  color: var(--rose); opacity: 0; animation: introFadeUp 1s ease 1.35s both;
}
.intro-divider {
  margin: 22px auto 0; width: 120px; height: 12px; position: relative;
  opacity: 0; animation: introFadeUp 1s ease 1.55s both;
}
.intro-divider::before, .intro-divider::after {
  content: ""; position: absolute; top: 6px; width: 44px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(216,189,150,.8));
}
.intro-divider::before { left: 0; }
.intro-divider::after { right: 0; transform: scaleX(-1); }
.intro-divider i {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%) rotate(45deg);
  width: 7px; height: 7px; border: 1px solid rgba(216,189,150,.9); display: block;
}
@keyframes introFadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.intro-hint {
  margin-top: 44px; font-size: 13px; letter-spacing: .3em;
  color: rgba(245,232,234,.6);
  opacity: 0; animation: introFadeUp 1s ease 2s both, floatY 2.2s ease-in-out 2.6s infinite;
}
@keyframes floatY { 0%,100% { transform: translateY(0); } 50% { transform: translateY(8px); } }

/* ========== 站点字幕 ========== */
.caption {
  position: fixed; left: 50%; bottom: 9vh; z-index: 30;
  transform: translateX(-50%) translateY(20px);
  max-width: min(560px, 86vw); text-align: center;
  background: rgba(18, 9, 16, .55); backdrop-filter: blur(10px);
  border: 1px solid rgba(224,137,156,.22);
  border-radius: 16px; padding: 20px 30px;
  opacity: 0; pointer-events: none;
  transition: opacity .7s ease, transform .7s ease;
}
.caption.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.cap-date { color: var(--gold); font-size: 12px; letter-spacing: .3em; }
.cap-title { font-family: var(--hand); font-weight: 400; font-size: clamp(22px, 4vw, 32px); color: #fdf3f0; margin: 6px 0 8px; }
.cap-text { font-size: 14px; line-height: 1.9; color: rgba(245,232,234,.85); }

/* ========== 情书 ========== */
.letter-overlay {
  position: fixed; inset: 0; z-index: 35;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 5, 10, .55); backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden; transition: opacity 1s ease, visibility 1s;
  padding: 20px;
}
.letter-overlay.on { opacity: 1; visibility: visible; }
.letter-paper {
  width: min(620px, 92vw); max-height: 84vh; overflow-y: auto;
  background: linear-gradient(160deg, #fffdf6, #fdf0ea);
  color: #4a3138;
  border-radius: 8px; padding: clamp(26px, 5vw, 52px);
  box-shadow: 0 30px 90px rgba(0,0,0,.5);
  text-align: center;
}
.letter-body {
  font-size: clamp(15px, 2.4vw, 17px); line-height: 2.2;
  white-space: pre-wrap; text-align: left; min-height: 180px;
}
.caret {
  display: inline-block; width: 2px; height: 1.1em;
  background: var(--rose-deep); vertical-align: -0.15em;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.letter-sign {
  margin-top: 24px; text-align: right;
  font-family: var(--hand); font-size: 23px; color: var(--rose-deep);
  opacity: 0; transition: opacity 1.2s;
}
.letter-sign.show { opacity: 1; }
.surprise-btn {
  margin-top: 34px; padding: 15px 48px;
  font-family: var(--serif); font-size: 16px; letter-spacing: .35em;
  color: #fff; background: linear-gradient(135deg, var(--rose), var(--rose-deep));
  border: none; border-radius: 999px; cursor: pointer;
  box-shadow: 0 12px 34px rgba(201,111,134,.4);
  opacity: 0; transition: opacity 1s, transform .25s;
}
.surprise-btn.show { opacity: 1; }
.surprise-btn:hover { transform: translateY(-3px) scale(1.03); }

/* ========== 烟花大字 ========== */
.finale-text {
  position: fixed; inset: 0; z-index: 36;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--hand);
  font-size: clamp(40px, 9vw, 90px); color: #fff2f4;
  text-shadow: 0 0 60px rgba(224,137,156,.9), 0 0 20px rgba(255,255,255,.6);
  letter-spacing: .2em; text-align: center;
  opacity: 0; transform: scale(.85); pointer-events: none;
  transition: opacity 1.6s ease, transform 1.6s ease;
}
.finale-text.show { opacity: 1; transform: scale(1); }

/* ========== 灯箱 ========== */
.lightbox {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(8, 4, 8, .92);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: opacity .35s;
  cursor: zoom-out; padding: 30px;
}
.lightbox.on { opacity: 1; visibility: visible; }
.lightbox img { max-width: 92vw; max-height: 80vh; border-radius: 8px; box-shadow: 0 20px 80px rgba(0,0,0,.6); }
.lightbox p { color: rgba(255,255,255,.8); margin-top: 18px; font-size: 15px; letter-spacing: .15em; }

/* ========== 手机端微调 ========== */
@media (max-width: 640px) {
  .caption { bottom: 6vh; padding: 16px 20px; }
  .hud-counter { font-size: 11px; padding: 6px 14px; }
}

/* ========== 密码门（G1：金线夜纸语言） ========== */
.pwd-wrap { margin-bottom: 28px; }
.pwd-wrap input {
  width: 220px; padding: 12px 18px;
  font-family: var(--serif); font-size: 18px; letter-spacing: .5em; text-align: center;
  color: #f7ede6; background: rgba(216,189,150,.07);
  border: 1px solid rgba(216,189,150,.45); border-radius: 999px;
  outline: none; transition: border-color .3s, box-shadow .3s;
}
.pwd-wrap input::placeholder { color: rgba(216,189,150,.4); }
.pwd-wrap input:focus { border-color: var(--gold); box-shadow: 0 0 24px rgba(216,189,150,.28); }
.pwd-hint { margin-top: 10px; font-size: 12px; letter-spacing: .2em; color: rgba(216,189,150,.5); }
.pwd-wrap.shake { animation: shake .45s ease; }
.pwd-wrap.shake input { border-color: #ff5a5a; }
/* C1 输错提示文案（docs/05-I4 撒娇式，禁系统腔） */
.pwd-wrong {
  margin-top: 10px; font-size: 13px; letter-spacing: .25em;
  color: rgba(242, 178, 190, .95);
  opacity: 0; transition: opacity .4s ease;
  pointer-events: none;
}
.pwd-wrong.on { opacity: 1; }
/* C1 输对后心形 1.2s 心跳加速（覆盖常驻 1.6s heartbeat，docs/05-I3） */
.gate.beating .gate-btn {
  animation: heartbeatFast .34s ease-in-out infinite;
  box-shadow: 0 0 64px rgba(216,189,150,.95);
  cursor: default;
}
.gate.beating .gate-ring { animation-duration: .8s; }
@keyframes heartbeatFast {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.22); }
  45% { transform: scale(1.04); }
  65% { transform: scale(1.3); }
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(9px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(4px); }
}

/* ========== 自由模式提示 ========== */
.free-hint {
  position: fixed; left: 50%; bottom: 26px; z-index: 40;
  transform: translateX(-50%);
  font-size: 12px; letter-spacing: .25em; color: rgba(245,232,234,.8);
  background: rgba(20, 10, 18, .5); backdrop-filter: blur(8px);
  border: 1px solid rgba(224,137,156,.25);
  padding: 10px 22px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity 1s ease;
}
.free-hint.on { opacity: 1; }

.gate-loading {
  margin-top: 14px; font-size: 12px; letter-spacing: .3em;
  color: rgba(216,189,150,.45);
  animation: gate-loading-breath 1.6s ease-in-out infinite;
  transition: opacity .5s;
}
.gate-loading.off { opacity: 0; animation: none; }
@keyframes gate-loading-breath { 0%,100% { opacity: .25; } 50% { opacity: .6; } }

/* ========== 互动提示（靠近照片） ========== */
.interact-hint {
  position: fixed; left: 50%; bottom: 84px; z-index: 40;
  transform: translateX(-50%);
  font-size: 12px; letter-spacing: .2em; color: rgba(255,240,220,.92);
  background: rgba(20, 10, 18, .55); backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 200, 130, .3);
  padding: 8px 18px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity .4s ease;
  white-space: nowrap;
}
.interact-hint.on { opacity: 1; }

/* ========== 场景切换黑场 ========== */
.fade {
  position: fixed; inset: 0; z-index: 60;
  background: #000; opacity: 0; pointer-events: none;
  transition: opacity .35s ease;
}
.fade.on { opacity: 1; }


/* ========== M-04 目的地抵达卡（docs/05 I2.4 · docs/06 V5） ========== */
.arrive-card {
  position: fixed; top: 15vh; left: 50%; z-index: 55;
  transform: translateX(-50%) translateY(14px) scale(.96);
  text-align: center; padding: 22px 48px 20px;
  background: rgba(18, 9, 16, .62); backdrop-filter: blur(12px);
  border: 1px solid rgba(232, 192, 125, .35); border-radius: 18px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, .5), 0 0 60px rgba(232, 192, 125, .12);
  opacity: 0; pointer-events: none;
  transition: opacity .45s cubic-bezier(.25, .1, .25, 1),
              transform .45s cubic-bezier(.25, .1, .25, 1);
}
.arrive-card.on {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
  animation: arriveGlow 2.4s ease-out both;
}
.arrive-card.off {
  opacity: 0;
  transform: translateX(-50%) translateY(-10px) scale(.98);
  transition: opacity .3s cubic-bezier(.55, .06, .68, .19),
              transform .3s cubic-bezier(.55, .06, .68, .19);
}
@keyframes arriveGlow {
  0%   { box-shadow: 0 12px 48px rgba(0,0,0,.5), 0 0 24px rgba(216,189,150,.08); }
  25%  { box-shadow: 0 12px 48px rgba(0,0,0,.5), 0 0 70px rgba(216,189,150,.28); }
  100% { box-shadow: 0 12px 48px rgba(0,0,0,.5), 0 0 60px rgba(216,189,150,.12); }
}
.arrive-label {
  color: var(--gold); font-size: 12px; letter-spacing: .6em; text-indent: .6em;
  margin-bottom: 8px;
}
.arrive-name {
  font-family: var(--hand); font-weight: 400;
  font-size: clamp(30px, 5vw, 44px); letter-spacing: .18em;
  color: #fdf3f0;
}
.arrive-rule {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 12px; font-size: 12px; color: rgba(232, 192, 125, .85);
}
.arrive-rule span { display: block; width: 56px; height: 1px; }
.arrive-rule span:first-child {
  background: linear-gradient(90deg, transparent, rgba(232, 192, 125, .6));
}
.arrive-rule span:last-child {
  background: linear-gradient(90deg, rgba(232, 192, 125, .6), transparent);
}

@media (max-width: 640px) {
  .arrive-card { padding: 16px 30px 14px; top: 12vh; }
  .arrive-rule span { width: 36px; }
}
