/* ============================================================
   写给最爱的你 · 生日惊喜网页
   配色：奶油白 / 柔粉 / 玫瑰金
   ============================================================ */

:root {
  --cream: #fff8f5;
  --cream-deep: #fdeef0;
  --pink-50: #fdf2f5;
  --pink-100: #fbe4ea;
  --pink-200: #f6cdd8;
  --pink-300: #efaec0;
  --pink-400: #e58aa6;
  --rose: #d9748f;
  --rose-deep: #c55d7c;
  --gold: #d9a86c;
  --ink: #6b4a55;
  --ink-soft: #9a7c87;
  --paper: #fffdfa;
  --shadow: 0 18px 45px -18px rgba(197, 93, 124, 0.35);
  --shadow-soft: 0 10px 30px -12px rgba(197, 93, 124, 0.25);
  --serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --hand: "Ma Shan Zheng", "Noto Serif SC", cursive;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--serif);
  color: var(--ink);
  line-height: 1.85;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 50% -10%, #ffffff 0%, transparent 60%),
    linear-gradient(180deg, var(--cream) 0%, var(--pink-50) 35%, var(--pink-100) 100%);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---------- 飘落层 ---------- */
.falling-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.falling-item {
  position: absolute;
  top: -6vh;
  opacity: 0;
  animation: fall linear infinite;
  will-change: transform, opacity;
}
.falling-item.heart svg { width: 100%; height: 100%; fill: var(--pink-300); }
.falling-item.star svg { width: 100%; height: 100%; fill: var(--gold); }
.falling-item.dot { border-radius: 50%; background: var(--pink-200); }

@keyframes fall {
  0%   { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
  8%   { opacity: .8; }
  92%  { opacity: .7; }
  100% { transform: translateY(108vh) translateX(var(--drift, 30px)) rotate(360deg); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .falling-item { animation: none; }
  html { scroll-behavior: auto; }
}

/* ---------- 页面容器 ---------- */
.page {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 22px;
}

/* ---------- 首屏 ---------- */
.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 0 40px;
}
.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--rose);
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--pink-200);
  padding: 7px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
}
.hero__dot { width: 5px; height: 5px; border-radius: 50%; background: var(--pink-300); }

.hero__title {
  font-family: var(--hand);
  font-size: clamp(40px, 11vw, 60px);
  font-weight: 400;
  line-height: 1.35;
  margin: 34px 0 20px;
  color: var(--rose-deep);
  text-shadow: 0 4px 20px rgba(217, 116, 143, 0.18);
  animation: riseIn 1.1s cubic-bezier(.2,.8,.2,1) both;
}
.hero__sub {
  font-size: 16px;
  color: var(--ink-soft);
  letter-spacing: 1px;
  animation: riseIn 1.1s .15s cubic-bezier(.2,.8,.2,1) both;
}
.hero__divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 34px 0 26px;
  width: 70%;
  animation: riseIn 1.1s .3s cubic-bezier(.2,.8,.2,1) both;
}
.hero__divider .line { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--pink-300), transparent); }
.heart-icon { width: 22px; height: 22px; fill: var(--rose); animation: heartbeat 2.4s ease-in-out infinite; }

.hero__hint {
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: 2px;
  animation: bob 2.6s ease-in-out infinite;
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.18); }
  30% { transform: scale(1); }
  45% { transform: scale(1.12); }
  60% { transform: scale(1); }
}
@keyframes bob {
  0%, 100% { transform: translateY(0); opacity: .7; }
  50% { transform: translateY(7px); opacity: 1; }
}

/* ---------- 通用小节 ---------- */
.section-label {
  text-align: center;
  font-family: var(--hand);
  font-size: 24px;
  color: var(--rose-deep);
  letter-spacing: 2px;
  margin-bottom: 28px;
}
.letter-section, .audio-section {
  padding: 56px 0 10px;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ---------- 信封 ---------- */
.envelope {
  position: relative;
  width: 100%;
  max-width: 360px;
  height: 240px;
  margin: 0 auto;
  border: none;
  background: transparent;
  cursor: pointer;
  display: block;
  transition: transform .4s ease;
  -webkit-tap-highlight-color: transparent;
}
.envelope:active { transform: scale(.98); }
.envelope__back {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--pink-200), var(--pink-100));
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.envelope__letter {
  position: absolute;
  left: 8%;
  top: 14%;
  width: 84%;
  height: 72%;
  background: var(--paper);
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(197,93,124,.15);
  transition: transform .6s cubic-bezier(.3,.9,.3,1);
  z-index: 2;
}
.envelope__letter::before {
  content: "";
  position: absolute;
  left: 12%; right: 12%; top: 26%;
  height: 2px;
  background: var(--pink-100);
  box-shadow: 0 14px 0 var(--pink-100), 0 28px 0 var(--pink-100);
}
.envelope__front {
  position: absolute; inset: 0;
  background: linear-gradient(160deg, #fff, var(--pink-50));
  border-radius: 12px;
  z-index: 3;
  clip-path: polygon(0 34%, 50% 100%, 100% 34%, 100% 100%, 0 100%);
  box-shadow: inset 0 0 0 1px var(--pink-200);
}
.envelope__flap {
  position: absolute; inset: 0;
  background: linear-gradient(160deg, var(--pink-100), var(--pink-200));
  border-radius: 12px 12px 0 0;
  clip-path: polygon(0 0, 100% 0, 50% 62%);
  z-index: 4;
  transform-origin: top;
  transition: transform .55s ease, z-index 0s .28s;
  box-shadow: inset 0 0 0 1px var(--pink-200);
}
.envelope__seal {
  position: absolute;
  left: 50%; top: 46%;
  transform: translate(-50%, -50%);
  width: 46px; height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--pink-300), var(--rose-deep));
  display: flex; align-items: center; justify-content: center;
  z-index: 5;
  box-shadow: 0 6px 16px rgba(197,93,124,.4);
  transition: transform .5s ease, opacity .4s;
}
.envelope__seal svg { width: 22px; height: 22px; fill: #fff; }
.envelope__cta {
  position: absolute;
  left: 0; right: 0; bottom: -42px;
  text-align: center;
  font-size: 14px;
  color: var(--rose);
  letter-spacing: 2px;
  z-index: 6;
}

/* 打开态 */
.envelope.open .envelope__flap { transform: rotateX(180deg); z-index: 1; }
.envelope.open .envelope__letter { transform: translateY(-78px); }
.envelope.open .envelope__seal { transform: translate(-50%, -50%) scale(.6); opacity: 0; }

/* ---------- 信纸 ---------- */
.letter-paper {
  margin: 24px auto 0;
  max-width: 460px;
  animation: paperIn .7s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes paperIn {
  from { opacity: 0; transform: translateY(30px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.letter-paper__inner {
  background: var(--paper);
  border-radius: 14px;
  padding: 38px 28px 30px;
  box-shadow: var(--shadow);
  border: 1px solid var(--pink-100);
  background-image:
    linear-gradient(var(--paper), var(--paper)),
    repeating-linear-gradient(transparent, transparent 31px, var(--pink-100) 32px);
  position: relative;
}
.letter-paper__inner::before,
.letter-paper__inner::after {
  content: "";
  position: absolute;
  width: 26px; height: 26px;
  border: 1.5px solid var(--pink-200);
}
.letter-paper__inner::before { top: 12px; left: 12px; border-right: none; border-bottom: none; }
.letter-paper__inner::after { bottom: 12px; right: 12px; border-left: none; border-top: none; }

.letter-paper__title {
  font-family: var(--hand);
  font-size: 30px;
  font-weight: 400;
  text-align: center;
  color: var(--rose-deep);
  margin-bottom: 8px;
}
.letter-subtitle {
  text-align: center;
  font-family: var(--hand);
  font-size: 19px;
  color: var(--rose);
  letter-spacing: 3px;
  margin-bottom: 26px;
}
.letter-paper__body { font-size: 16.5px; color: var(--ink); }
.letter-paper__body p { margin-bottom: 15px; text-indent: 2em; line-height: 1.95; }
.letter-paper__body p.salute { text-indent: 0; color: var(--rose-deep); font-weight: 600; }
.letter-paper__sign {
  text-align: right;
  text-indent: 0;
  margin-top: 26px;
  margin-bottom: 0;
  color: var(--rose);
  font-family: var(--hand);
  font-size: 22px;
}
.placeholder-tip {
  font-size: 13px;
  color: var(--gold);
  background: #fdf6ec;
  border: 1px dashed var(--gold);
  border-radius: 8px;
  padding: 10px 14px;
  text-align: center;
  margin-bottom: 20px !important;
}
.letter-paper__close {
  display: block;
  margin: 26px auto 0;
  border: 1px solid var(--pink-300);
  background: var(--pink-50);
  color: var(--rose-deep);
  font-family: var(--serif);
  font-size: 14px;
  padding: 9px 26px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .3s;
  -webkit-tap-highlight-color: transparent;
}
.letter-paper__close:active { background: var(--pink-100); }

/* ---------- 播放器 ---------- */
.player {
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--pink-200);
  border-radius: 22px;
  padding: 26px 22px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 20px;
}
.player__btn {
  position: relative;
  flex-shrink: 0;
  width: 72px; height: 72px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: radial-gradient(circle at 32% 28%, var(--pink-300), var(--rose-deep));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px rgba(197,93,124,.45);
  -webkit-tap-highlight-color: transparent;
}
.player__btn svg { width: 28px; height: 28px; fill: #fff; position: relative; z-index: 2; }
.player__btn .icon-pause { display: none; }
.player__btn.playing .icon-play { display: none; }
.player__btn.playing .icon-pause { display: block; }
.player__rings span {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--pink-300);
  opacity: 0;
}
.player__btn.playing .player__rings span { animation: ripple 2.4s ease-out infinite; }
.player__btn.playing .player__rings span:nth-child(2) { animation-delay: 1.2s; }
@keyframes ripple {
  0% { transform: scale(.9); opacity: .7; }
  100% { transform: scale(1.45); opacity: 0; }
}
.player__meta { flex: 1; min-width: 0; }
.player__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--rose-deep);
  margin-bottom: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player__progress {
  position: relative;
  height: 22px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}
.player__progress::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 5px;
  border-radius: 999px;
  background: var(--pink-100);
}
.player__buffer {
  position: absolute;
  left: 0;
  height: 5px;
  width: 0;
  border-radius: 999px;
  background: var(--pink-200);
}
.player__fill {
  position: absolute;
  left: 0;
  height: 5px;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pink-300), var(--rose-deep));
}
.player__thumb {
  position: absolute;
  left: 0;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--rose-deep);
  transform: translateX(-50%);
  box-shadow: 0 2px 6px rgba(197,93,124,.4);
  transition: transform .15s;
}
.player__progress:active .player__thumb { transform: translateX(-50%) scale(1.25); }
.player__time {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.audio-hint {
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 20px;
  letter-spacing: 1px;
}

/* ---------- 页脚 ---------- */
.footer {
  text-align: center;
  padding: 70px 0 50px;
  color: var(--ink-soft);
}
.footer__heart svg { width: 26px; height: 26px; fill: var(--rose); animation: heartbeat 2.4s ease-in-out infinite; }
.footer p { font-size: 15px; margin-top: 14px; color: var(--rose); letter-spacing: 1px; }
.footer__small { font-size: 12px; color: var(--ink-soft); letter-spacing: 1px; }

/* ---------- 小屏适配 ---------- */
@media (max-width: 360px) {
  .player { gap: 14px; padding: 22px 18px; }
  .player__btn { width: 62px; height: 62px; }
  .player__btn svg { width: 24px; }
  .envelope { height: 210px; }
}
