:root {
  --pink-50: #fff5f8;
  --pink-100: #ffe4ee;
  --pink-200: #ffc9dc;
  --pink-300: #f7a8c4;
  --pink-400: #ee85ad;
  --pink-500: #d96493;
  --ink: #7a4a5e;
  --ink-soft: #a2748a;
  --cream: #fffaf6;
  --shadow: 0 18px 50px rgba(150, 80, 110, 0.18);
  --radius: 22px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: var(--ink);
  background: #dceaf5;
  user-select: none;
}
button { font-family: inherit; cursor: pointer; }

#scene-root { position: fixed; inset: 0; }
#scene-root canvas { display: block; }

/* 顶部提示 */
.hint {
  position: fixed; top: 22px; left: 50%; transform: translateX(-50%);
  text-align: center; z-index: 10; pointer-events: none;
  padding: 12px 26px; border-radius: 18px;
  background: rgba(255, 250, 252, 0.82);
  border: 1px solid rgba(247, 168, 196, 0.55);
  box-shadow: 0 8px 26px rgba(150, 80, 110, 0.12);
  backdrop-filter: blur(10px);
}
.hint-title {
  font-family: 'ZCOOL KuaiLe', 'Noto Sans SC', cursive;
  font-size: 21px; color: var(--pink-500); letter-spacing: 1px;
}
.hint-sub { font-size: 12px; color: var(--ink-soft); margin-top: 3px; }

/* 底部控制条 */
.dock {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 10; display: flex; gap: 12px; padding: 8px;
  border-radius: 999px; background: rgba(255, 250, 252, 0.78);
  border: 1px solid rgba(247, 168, 196, 0.5);
  box-shadow: var(--shadow); backdrop-filter: blur(10px);
}
.pill {
  border: 1.5px solid var(--pink-200);
  background: #fff; color: var(--ink);
  padding: 10px 22px; border-radius: 999px; font-size: 13px; font-weight: 500;
  transition: transform .18s, background .2s, color .2s, box-shadow .2s;
  white-space: nowrap;
}
.pill:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(217, 100, 147, 0.2); }
.pill.active { background: var(--pink-400); color: #fff; border-color: var(--pink-400); }
.pill.ghost { background: var(--pink-50); }

.enter-btn {
  position: fixed; z-index: 10; right: 32px; bottom: 32px;
  padding: 12px 22px; border: none; border-radius: 999px;
  background: var(--pink-400); color: #fff; font-size: 14px;
  box-shadow: var(--shadow); transition: transform .2s;
}
.enter-btn:hover { transform: translateY(-3px); }

/* 背景音乐按钮（右上角唱片） */
.music-btn {
  position: fixed; top: 20px; right: 20px; z-index: 35;
  width: 50px; height: 50px; padding: 0;
  border: 1.5px solid rgba(247, 168, 196, 0.7);
  border-radius: 50%; background: rgba(255, 250, 252, 0.9);
  box-shadow: 0 8px 22px rgba(150, 80, 110, 0.18);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s;
}
.music-btn:hover { transform: scale(1.08); }
.music-disc {
  width: 34px; height: 34px; border-radius: 50%;
  background: repeating-radial-gradient(circle, #f7a8c4 0 2px, #fff5f8 2px 4px);
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 3px #fff, 0 2px 6px rgba(217, 100, 147, 0.25);
}
.music-note { font-size: 16px; color: var(--pink-500); line-height: 1; }
.music-btn.playing .music-disc { animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.music-waves { position: absolute; bottom: -3px; right: -3px; display: flex; gap: 2px; align-items: flex-end; height: 14px; }
.music-waves i { width: 3px; height: 5px; border-radius: 2px; background: var(--pink-400); }
.music-btn.playing .music-waves i { animation: wave .9s ease-in-out infinite alternate; }
.music-btn.playing .music-waves i:nth-child(2) { animation-delay: .25s; }
.music-btn.playing .music-waves i:nth-child(3) { animation-delay: .5s; }
@keyframes wave { from { height: 4px; } to { height: 13px; } }

.music-hint {
  position: fixed; top: 26px; right: 78px; z-index: 35;
  padding: 7px 14px; border-radius: 999px; font-size: 12px; white-space: nowrap;
  color: var(--ink); background: rgba(255, 250, 252, 0.92);
  border: 1px solid rgba(247, 168, 196, 0.6);
  box-shadow: 0 6px 18px rgba(150, 80, 110, 0.14);
  animation: floaty 1.6s ease-in-out infinite alternate;
}
@keyframes floaty { from { transform: translateY(0); } to { transform: translateY(-5px); } }

/* 详情层 */
.detail {
  position: fixed; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 78px 22px 96px;
  background: radial-gradient(circle at 50% 30%, #fff7fa 0%, #fde7f0 60%, #f7d3e2 100%);
}
.detail::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(217,100,147,.12) 1px, transparent 1px);
  background-size: 22px 22px; opacity: .5;
}
.detail.dark-mode { background: radial-gradient(circle at 50% 30%, #4a3a52 0%, #33283f 65%, #241d33 100%); }
.detail.dark-mode .detail-head h2 { color: #ffd9e8; }
.detail.dark-mode .detail-head p { color: #d9b8c9; }
.detail-head { position: relative; text-align: center; margin-bottom: 18px; }
.detail-head h2 {
  font-family: 'ZCOOL KuaiLe', cursive; font-size: 27px;
  color: var(--pink-500); margin: 0; letter-spacing: 2px;
}
.detail-head p { margin: 6px 0 0; font-size: 13px; color: var(--ink-soft); }
.stage { position: relative; display: flex; align-items: center; justify-content: center; flex: 1; min-height: 0; width: 100%; }
.detail-actions {
  position: relative; display: flex; gap: 12px; flex-wrap: wrap;
  justify-content: center; margin-top: 16px;
}

/* ---- 蛋糕 ---- */
.cake-stage { min-height: 340px; }
.cake-glow {
  position: absolute; width: 340px; height: 340px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,214,140,.45), transparent 70%);
  transition: opacity .4s; opacity: 1;
}
.cake-glow.off { opacity: 0; }
#cake-canvas { position: relative; z-index: 2; display: block; width: min(560px, 88vw); height: 340px; cursor: pointer; }
.cake-tip { position: absolute; bottom: 4px; z-index: 3; font-size: 12px; color: var(--ink-soft); pointer-events: none; }
.cake { position: relative; width: 260px; height: 270px; }
.cake-plate {
  position: absolute; bottom: 8px; left: 5px; width: 250px; height: 30px;
  background: linear-gradient(#fff, #f4dbe6); border-radius: 50%;
  box-shadow: 0 16px 24px rgba(150,80,110,.22);
}
.cake-layer { position: absolute; left: 50%; transform: translateX(-50%); border-radius: 14px 14px 18px 18px; overflow: visible; }
.layer-bottom {
  bottom: 28px; width: 210px; height: 96px;
  background: linear-gradient(90deg, #ffd9e7, #fff0f6 45%, #ffd9e7);
  border: 2px solid #f6b9d0;
}
.layer-top {
  bottom: 116px; width: 150px; height: 72px; left: 50%;
  background: linear-gradient(90deg, #ffe3ee, #fff8fb 45%, #ffe3ee);
  border: 2px solid #f6b9d0;
}
.drip { position: absolute; left: 0; right: 0; top: -10px; height: 22px; background: #fff7fb; border-radius: 50% 50% 40% 40%; box-shadow: 0 6px 0 -3px #ffd0e2; }
.cherry { position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #e8607f; box-shadow: inset -3px -3px 0 rgba(0,0,0,.08), 0 2px 4px rgba(150,80,110,.25); }
.cherry::after { content:''; position:absolute; width:3px; height:9px; background:#7ab07a; top:-7px; left:6px; transform:rotate(20deg); border-radius:2px; }
.cherry-l { left: 58px; bottom: 196px; }
.cherry-r { right: 58px; bottom: 196px; }
.candles { position: absolute; left: 50%; transform: translateX(-50%); bottom: 188px; display: flex; gap: 26px; }
.candle { position: relative; width: 14px; height: 46px; cursor: pointer; }
.candle-body { position: absolute; bottom: 0; width: 14px; height: 34px; border-radius: 4px; }
.stripe-pink { background: repeating-linear-gradient(45deg, #f7a8c4 0 6px, #fff 6px 12px); }
.stripe-cream { background: repeating-linear-gradient(45deg, #ffd98a 0 6px, #fff 6px 12px); }
.wick { position: absolute; bottom: 33px; left: 6px; width: 2px; height: 6px; background: #6b4a3a; }
.flame {
  position: absolute; bottom: 37px; left: 1px; width: 12px; height: 20px;
  background: radial-gradient(ellipse at 50% 70%, #fff3a8, #ff9f43 60%, #ff6b6b);
  border-radius: 50% 50% 50% 50% / 70% 70% 30% 30%;
  transform-origin: 50% 100%;
  animation: flicker .45s infinite alternate ease-in-out;
  opacity: 1; transition: opacity .25s, transform .25s;
}
.flame.off { opacity: 0; transform: scale(0) translateY(8px); animation: none; }
@keyframes flicker { from { transform: rotate(-6deg) scaleY(.94); } to { transform: rotate(6deg) scaleY(1.08); } }

/* ---- 日历 ---- */
.calendar-card {
  width: min(440px, 92vw); background: var(--cream);
  border: 2px solid var(--pink-200); border-radius: 18px;
  padding: 14px; box-shadow: var(--shadow);
}
.calendar-ring { display: flex; justify-content: center; gap: 90px; margin-bottom: 8px; }
.calendar-ring i { width: 16px; height: 16px; border: 4px solid #d9a2b8; border-radius: 50%; display: block; }
.calendar-page { border: 1.5px dashed var(--pink-200); border-radius: 12px; overflow: hidden; background: #fffdfd; }
.calendar-top { background: var(--pink-100); color: var(--pink-500); font-size: 12px; letter-spacing: 2px; padding: 8px 14px; text-align: center; }
.calendar-body { padding: 30px 24px 36px; }
.calendar-title { font-family: 'ZCOOL KuaiLe', cursive; font-size: 40px; font-weight: 700; color: var(--pink-500); text-align: center; letter-spacing: 4px; }
.calendar-text { margin-top: 18px; font-size: 17px; color: var(--ink); text-align: left; text-indent: 2em; line-height: 1.9; }
.calendar-date { margin-top: 22px; text-align: right; font-size: 12px; color: var(--ink-soft); }

/* ---- 信封 / 信纸 ---- */
.envelope { position: relative; width: min(380px, 88vw); aspect-ratio: 1.5; cursor: pointer; filter: drop-shadow(0 20px 26px rgba(150,80,110,.25)); }
.env-back { position: absolute; inset: 0; background: #ffd9e7; border: 2px solid #f3b6ce; border-radius: 12px; }
.env-letter-peek { position: absolute; left: 14%; right: 14%; top: 12%; height: 60%; background: #fffdf8; border-radius: 6px; border: 1px solid #f0d7e1; display:flex; align-items:center; justify-content:center; font-family:'ZCOOL KuaiLe',cursive; color:var(--pink-400); font-size:18px; transition: transform .5s; }
.envelope.open .env-letter-peek { transform: translateY(-70px); }
.env-front { position: absolute; inset: 0; background: linear-gradient(160deg, #ffe6f0, #ffcedf); border: 2px solid #f3b6ce; border-radius: 12px; clip-path: polygon(0 100%, 0 42%, 50% 72%, 100% 42%, 100% 100%); }
.env-flap { position: absolute; inset: 0; background: #ffd9e7; border: 2px solid #f3b6ce; border-radius: 12px; clip-path: polygon(0 0, 100% 0, 50% 62%); transform-origin: top; transition: transform .6s; }
.envelope.open .env-flap { transform: rotateX(180deg); }
.env-seal { position: absolute; left: 50%; top: 56%; transform: translate(-50%, -50%); width: 44px; height: 44px; border-radius: 50%; background: var(--pink-400); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; box-shadow: 0 4px 10px rgba(150,80,110,.3); transition: opacity .3s; }
.envelope.open .env-seal { opacity: 0; }

.letter-paper {
  width: min(520px, 92vw); min-height: 340px;
  background: #fffdf6; border: 1px solid #f0dcc6; border-radius: 10px;
  padding: 44px 38px; box-shadow: var(--shadow);
  background-image: repeating-linear-gradient(transparent 0 33px, #f6e8d8 33px 34px);
  background-position: 0 44px;
}
.letter-line { font-size: 17px; line-height: 2.05; color: var(--ink); }
.letter-line.indent { text-indent: 2em; margin-top: 12px; }
.letter-sign { text-align: right; margin-top: 30px; font-family: 'ZCOOL KuaiLe', cursive; color: var(--pink-400); font-size: 15px; }

/* ---- 地图 ---- */
.map-stage { min-height: 0; }
.map-card {
  width: min(760px, 96vw); background: #fff8f1; border: 2px solid #f4c9d8;
  border-radius: 20px; padding: 8px; box-shadow: var(--shadow);
}
#china-map { width: 100%; height: auto; display: block; }
.cn-land { fill: #ffe1ec; stroke: #ee9fbd; stroke-width: 3; stroke-linejoin: round; }
.cn-island { fill: #ffe1ec; stroke: #ee9fbd; stroke-width: 2.5; }
.cn-line { fill: none; stroke: #f3bad0; stroke-width: 1.5; stroke-dasharray: 5 7; opacity: .8; }
.city { cursor: pointer; }
.city-halo { fill: rgba(238, 133, 173, .18); animation: halo 2s infinite ease-in-out; transform-origin: center; }
@keyframes halo { 0%,100% { transform: scale(1); opacity:.7; } 50% { transform: scale(1.25); opacity:.25; } }
.city-heart { fill: #ec6d9a; stroke: #fff; stroke-width: 2; transition: transform .2s; transform-origin: center; }
.city:hover .city-heart { transform: scale(1.25); }
.city-label {
  font-family: 'ZCOOL KuaiLe', cursive; font-size: 17px; font-weight: 700;
  fill: #a25275; text-anchor: middle;
  paint-order: stroke; stroke: #fff; stroke-width: 5px; stroke-linejoin: round;
}

/* ---- 照片 ---- */
.photo-stage { min-height: 0; }
.photo-img {
  max-width: min(460px, 92vw); max-height: 100%;
  width: auto; height: auto; object-fit: contain;
  border: 8px solid #fff; border-radius: 8px;
  box-shadow: 0 22px 50px rgba(120,60,90,.3);
  transform: rotate(-1.5deg);
}

/* 转场遮罩 */
.fade { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 50; }

.hidden { display: none !important; }

@media (max-width: 640px) {
  .hint { top: 12px; padding: 8px 16px; }
  .hint-title { font-size: 17px; }
  .hint-sub { font-size: 10px; }
  .detail { padding: 66px 14px 84px; }
  .detail-head h2 { font-size: 22px; }
  .dock { bottom: 16px; gap: 6px; padding: 6px; }
  .pill { padding: 8px 14px; font-size: 12px; }
  .enter-btn { right: 16px; bottom: 76px; }
  .calendar-title { font-size: 30px; }
  .calendar-text { font-size: 15px; }
  .letter-paper { padding: 30px 22px; }
  .letter-line { font-size: 15px; }
}
