/* ============================================================
   一封寄给你的信 —— 薄樱粉 / 银白
   ============================================================ */

@font-face {
  font-family: 'LetterHand';
  src: url('../fonts/letter-hand.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'LetterScript';
  src: url('../fonts/letter-script.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --pink: #FBB1C5;
  --pink-2: #F8C9D7;
  --pink-3: #FDE3EA;
  --pink-deep: #E4819F;
  --rose: #B85C7A;
  --rose-deep: #9D4663;
  --rose-soft: #D87593;
  --paper: #F2F0EA;
  --paper-hi: #FCFBF7;
  --cream: #FFF8F2;
  --ink: #40303A;
  --ink-soft: #8A6B76;
  --line: rgba(184, 92, 122, .26);

  --font-hand: 'LetterHand', 'Ma Shan Zheng', 'Kaiti SC', 'STKaiti', serif;
  --font-script: 'LetterScript', 'Caveat', 'Segoe Script', cursive;

  --fit: 1;
  --ease-soft: cubic-bezier(.22, .68, .24, 1);
  --ease-page: cubic-bezier(.2, .72, .18, 1);
}

* { box-sizing: border-box; }

html { height: 100%; -webkit-text-size-adjust: 100%; }

html, body { overscroll-behavior: none; }

body {
  margin: 0;
  height: 100%;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #F6DDE5;
  color: var(--ink);
  font-family: var(--font-hand);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- 世界：薄樱粉的暮色 ---------- */

.world { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

.wash {
  position: absolute; inset: 0;
  background:
    /* 信纸背后的暖光 */
    radial-gradient(46% 30% at 50% 34%, rgba(255, 250, 244, .92) 0%, rgba(255, 250, 244, 0) 68%),
    /* 远处虚化的光斑 */
    radial-gradient(26% 18% at 82% 20%, rgba(255, 228, 214, .75) 0%, rgba(255, 228, 214, 0) 70%),
    radial-gradient(22% 15% at 16% 26%, rgba(255, 244, 236, .6) 0%, rgba(255, 244, 236, 0) 72%),
    radial-gradient(30% 22% at 72% 78%, rgba(255, 207, 198, .42) 0%, rgba(255, 207, 198, 0) 72%),
    radial-gradient(36% 26% at 12% 84%, rgba(178, 138, 186, .34) 0%, rgba(178, 138, 186, 0) 72%),
    /* 空气 */
    linear-gradient(176deg, #FBF1F1 0%, #F8DDE4 26%, #F4CCD8 58%, #E9B0C3 84%, #DFA1B8 100%);
}
.wash::after {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 78% at 50% 40%, rgba(0, 0, 0, 0) 42%, rgba(97, 45, 74, .20) 100%),
    linear-gradient(196deg, rgba(108, 86, 132, .10) 0%, rgba(108, 86, 132, 0) 34%);
}

.grain {
  position: absolute; inset: -20%;
  opacity: .42;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainShift 7s steps(6) infinite;
}
@keyframes grainShift {
  0% { transform: translate(0, 0); }
  100% { transform: translate(8px, -6px); }
}

/* 背景手写字：低到只是呼吸 */
.mark {
  position: absolute;
  bottom: -2%;
  left: -12%;
  font-family: var(--font-script);
  font-size: min(44vw, 360px);
  font-weight: 600;
  line-height: .8;
  color: rgba(255, 255, 255, .26);
  transform: rotate(-7deg);
  mix-blend-mode: soft-light;
  letter-spacing: -.02em;
  white-space: nowrap;
}

.motes i {
  position: absolute;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: rgba(255, 253, 250, .95);
  box-shadow: 0 0 7px rgba(255, 250, 245, .85);
  opacity: .5;
  animation: drift 14s ease-in-out infinite alternate;
}
.motes i:nth-child(1) { left: 8%;  top: 22%; animation-duration: 17s; }
.motes i:nth-child(2) { left: 21%; top: 64%; width: 2px; height: 2px; animation-duration: 13s; animation-delay: -4s; }
.motes i:nth-child(3) { left: 34%; top: 12%; animation-duration: 21s; animation-delay: -9s; }
.motes i:nth-child(4) { left: 47%; top: 78%; width: 4px; height: 4px; opacity: .32; animation-duration: 19s; }
.motes i:nth-child(5) { left: 62%; top: 30%; animation-duration: 16s; animation-delay: -6s; }
.motes i:nth-child(6) { left: 77%; top: 58%; width: 2px; height: 2px; animation-duration: 22s; animation-delay: -2s; }
.motes i:nth-child(7) { left: 88%; top: 16%; animation-duration: 18s; }
.motes i:nth-child(8) { left: 92%; top: 72%; animation-duration: 15s; animation-delay: -7s; }
.motes i:nth-child(9) { left: 14%; top: 86%; width: 2px; height: 2px; animation-duration: 20s; }
.motes i:nth-child(10) { left: 55%; top: 6%; width: 2px; height: 2px; animation-duration: 24s; animation-delay: -11s; }
.motes i:nth-child(11) { left: 70%; top: 88%; animation-duration: 17s; animation-delay: -3s; }
.motes i:nth-child(12) { left: 4%; top: 47%; width: 2px; height: 2px; animation-duration: 19s; }
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); opacity: .2; }
  to   { transform: translate3d(14px, -26px, 0) scale(1.25); opacity: .65; }
}

/* ---------- 顶部 ---------- */

.masthead {
  position: relative; z-index: 3;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: calc(16px + env(safe-area-inset-top)) 24px 2px;
  color: #A8556F;
}
.masthead p {
  margin: 0;
  font-size: 11.5px;
  letter-spacing: .5em;
  text-indent: .5em;
  opacity: .86;
}
.masthead .hair {
  width: 26px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(168, 85, 111, .55));
}
.masthead .hair:last-child {
  background: linear-gradient(90deg, rgba(168, 85, 111, .55), transparent);
}

/* ---------- 舞台 ---------- */

.stage {
  position: relative; z-index: 2;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 2px 0 calc(102px + env(safe-area-inset-bottom));
  overflow: hidden;
}
.fit {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

/* 长信时上下边缘柔化，信纸像是从光里浮出来 */
body.long.scrolled .fit {
  --fade-top: 48px;
  --fade-bot: 22px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, transparent var(--fade-top), #000 calc(var(--fade-top) + 26px), #000 calc(100% - var(--fade-bot)), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, transparent var(--fade-top), #000 calc(var(--fade-top) + 26px), #000 calc(100% - var(--fade-bot)), transparent 100%);
}

.scene {
  position: relative;
  width: min(90vw, 408px);
  height: 100%;
}

/* 信纸 + 垫纸一起位移（JS 控制滚动） */
.stack {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

.deck {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.sheet {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  opacity: 0;
  transition: opacity .9s ease .5s;
}
.sheet-a {
  transform: rotate(-2deg) translate(-6px, 10px);
  background: linear-gradient(168deg, #F8AFC6, #E58AA5);
  box-shadow: 0 20px 36px -24px rgba(140, 45, 75, .55);
}
.sheet-b {
  transform: rotate(1.4deg) translate(7px, 6px);
  background: linear-gradient(168deg, #FFF9EC, #F2E5D4);
  box-shadow: 0 18px 32px -24px rgba(140, 45, 75, .45);
}

/* ---------- 信纸 ---------- */

.letter {
  position: relative;
  z-index: 3;
  width: 100%;
  padding: clamp(30px, 8.4vw, 40px) clamp(24px, 7vw, 34px) clamp(26px, 6.4vw, 32px);
  border-radius: 4px;
  background:
    radial-gradient(120% 46% at 30% -8%, rgba(255, 255, 255, .92) 0%, rgba(255, 255, 255, 0) 62%),
    radial-gradient(90% 40% at 92% 4%, rgba(255, 236, 240, .6) 0%, rgba(255, 236, 240, 0) 70%),
    linear-gradient(170deg, var(--paper-hi) 0%, var(--paper) 46%, #EEE9DF 100%);
  box-shadow:
    0 34px 60px -32px rgba(124, 40, 68, .55),
    0 6px 14px -10px rgba(124, 40, 68, .3),
    0 1px 0 rgba(255, 255, 255, .8) inset,
    0 0 0 1px rgba(186, 150, 158, .2);
  opacity: 0;
  transition: opacity .38s ease .52s, box-shadow .8s ease;
  will-change: opacity;
}
.letter::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: .42;
  mix-blend-mode: multiply;
  background-image:
    linear-gradient(92deg, rgba(255, 255, 255, .55) 0%, rgba(255, 255, 255, 0) 12%, rgba(255, 255, 255, 0) 88%, rgba(150, 120, 110, .05) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23p)' opacity='.2'/%3E%3C/svg%3E");
}
.letter::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(120% 54% at 50% 0%, rgba(255, 255, 255, .55), transparent 58%),
    linear-gradient(90deg, rgba(150, 100, 110, .10), transparent 7%, transparent 93%, rgba(150, 100, 110, .10));
  mix-blend-mode: soft-light;
}

.letter-inner { position: relative; z-index: 2; }

.ribbon {
  position: absolute;
  left: -10px;
  top: 62px;
  width: 22px;
  height: 122px;
  z-index: 1;
  transform: rotate(-4deg) translateY(-10px);
  background: linear-gradient(90deg, #DE7E97, #F9A8C0 34%, #F08FAB 70%, #D9748F);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 10px), 0 100%);
  box-shadow: 0 8px 14px -8px rgba(120, 35, 65, .5);
  opacity: 0;
  transition: opacity .5s ease .9s, transform .9s var(--ease-soft) .9s;
}
.ribbon::after {
  content: '';
  position: absolute; inset: 5px 6px 13px;
  border-left: 1px dashed rgba(255, 255, 255, .5);
  border-right: 1px dashed rgba(255, 255, 255, .3);
}

/* 宝丽来 */
.polaroid {
  position: absolute;
  top: -26px;
  right: -14px;
  width: 34%;
  max-width: 138px;
  margin: 0;
  padding: 7px 7px 0;
  z-index: 4;
  background: #FFFDF8;
  border-radius: 2px;
  box-shadow: 0 14px 22px -14px rgba(110, 45, 65, .55), 0 1px 0 rgba(255, 255, 255, .9) inset;
  transform: rotate(9deg) scale(.94);
  opacity: 0;
  transition: opacity .7s ease 1.05s, transform 1s var(--ease-soft) 1.05s;
}
.polaroid::after {
  content: '';
  position: absolute; inset: 4px 4px 30px;
  border-radius: 1px;
  box-shadow: inset 0 0 0 1px rgba(160, 120, 120, .18);
  pointer-events: none;
}
.tape {
  position: absolute;
  left: 50%;
  top: -13px;
  width: 74%;
  height: 22px;
  transform: translateX(-50%) rotate(-3deg);
  background:
    repeating-linear-gradient(105deg, rgba(255, 255, 255, .5) 0 6px, rgba(248, 190, 205, .45) 6px 12px),
    rgba(250, 214, 224, .72);
  border-left: 1px solid rgba(255, 255, 255, .55);
  border-right: 1px solid rgba(255, 255, 255, .55);
  clip-path: polygon(2% 0, 98% 0, 100% 36%, 97% 100%, 3% 100%, 0 62%);
  box-shadow: 0 2px 4px -2px rgba(120, 50, 70, .28);
  z-index: 5;
  opacity: .9;
}
.photo {
  display: block;
  width: 100%;
  aspect-ratio: 1 / .92;
  background-image: url(../img/polaroid.jpg);
  background-size: cover;
  background-position: 50% 54%;
  filter: saturate(.95) contrast(1.03) brightness(1.01);
}
.polaroid figcaption {
  font-family: var(--font-script);
  font-size: 10.5px;
  letter-spacing: .06em;
  color: #9C7E86;
  text-align: center;
  padding: 5px 0 7px;
}

/* 雏菊 */
.daisies {
  position: absolute;
  left: -16px;
  bottom: -22px;
  width: 37%;
  max-width: 150px;
  z-index: 4;
  opacity: 0;
  transform: rotate(-12deg) translateY(10px);
  transition: opacity .8s ease 1.2s, transform 1s var(--ease-soft) 1.2s;
  filter: drop-shadow(0 4px 6px rgba(120, 70, 70, .16));
}

/* ---------- 信的内容 ---------- */

.salutation {
  margin: 0 0 2px;
  font-family: var(--font-script);
  font-weight: 600;
  font-size: clamp(32px, 9.4vw, 43px);
  line-height: 1;
  letter-spacing: .02em;
  color: #B85C7A;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .7);
}
.salutation .colon { opacity: .78; margin-left: 1px; }

.swash {
  display: block;
  width: min(200px, 62%);
  height: 13px;
  margin: 2px 0 clamp(15px, 4.2vw, 22px) 3px;
  color: var(--rose);
  opacity: .45;
}
.swash path { stroke-dasharray: 260; stroke-dashoffset: 260; transition: stroke-dashoffset 1.2s ease 1.05s; }

.ink {
  line-break: strict;
  font-family: var(--font-hand);
  font-size: clamp(15.5px, 4.5vw, 17.5px);
  line-height: 1.92;
  letter-spacing: .012em;
  color: var(--ink);
}
.ink p { margin: 0 0 .62em; text-wrap: pretty; }
.ink p:last-child { margin-bottom: 0; }

.c {
  position: relative;
  top: var(--c-dy, 0);
  opacity: 0;
  color: #9A6B7C;
  transition: opacity .24s ease, color 1.6s ease;
  text-shadow: 0 0 .5px rgba(64, 48, 58, .28);
}
.c.on { opacity: 1; color: var(--c-ink, var(--ink)); }

.signature {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin: 16px 2px 0 0;
  font-size: 13.5px;
  letter-spacing: .12em;
  color: var(--rose);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .8s ease, transform .8s ease;
}
.signature svg { width: 13px; height: 13px; color: var(--rose-soft); opacity: .85; }
.signature.show { opacity: .95; transform: none; }

.letter-hint {
  position: absolute;
  left: 0; right: 0;
  bottom: 6%;
  margin: 0;
  text-align: center;
  font-size: 12.5px;
  letter-spacing: .16em;
  color: rgba(174, 86, 116, .6);
  opacity: 0;
  transition: opacity .6s ease;
  pointer-events: none;
}
body.is-open .letter-hint { opacity: 1; transition-delay: 1.1s; }
body.started .letter-hint { opacity: 0 !important; transition-delay: 0s; }

.pen {
  position: absolute;
  left: 0; top: 0;
  width: 7px; height: 7px;
  margin: 0;
  border-radius: 50%;
  background: radial-gradient(circle, #F291AF, rgba(242, 145, 175, 0));
  box-shadow: 0 0 9px 2px rgba(242, 145, 175, .7);
  opacity: 0;
  z-index: 5;
  pointer-events: none;
  transition: opacity .25s ease, transform .08s linear;
}
.pen.live { opacity: .95; }

/* ---------- 信封 ---------- */

.envelope {
  position: absolute;
  inset: 0;
  margin: auto;
  width: min(80vw, 340px);
  aspect-ratio: 1.54 / 1;
  height: auto;
  z-index: 10;
  perspective: 900px;
  transform: rotate(-1.6deg);
  filter: drop-shadow(0 30px 34px rgba(133, 42, 72, .36));
  transition: opacity .42s ease .74s, transform .9s var(--ease-soft) .56s;
}

.env-back {
  position: absolute; inset: 0;
  border-radius: 9px;
  background:
    linear-gradient(152deg, #FDDCE6 0%, #F9B8CC 44%, #EE93AE 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .85),
    inset 0 0 0 1px rgba(200, 110, 140, .16);
  overflow: hidden;
}
.env-back::after {
  content: '';
  position: absolute; inset: 8px;
  border-radius: 5px;
  border: 1px dashed rgba(255, 255, 255, .5);
}

.env-front {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 100%;
  border-radius: 0 0 9px 9px;
  background:
    linear-gradient(180deg, rgba(255, 236, 242, .9) 0%, #F9B7CB 26%, #F2A0B8 62%, #E68BA5 100%);
  clip-path: polygon(0 0, 50% 56%, 100% 0, 100% 100%, 0 100%);
  box-shadow: inset 0 10px 18px -14px rgba(150, 50, 80, .5);
}
.env-front::before,
.env-front::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 56%;
  opacity: .5;
  pointer-events: none;
}
.env-front::before {
  left: 0;
  background: linear-gradient(115deg, rgba(255, 255, 255, .4) 0%, rgba(255, 255, 255, 0) 52%);
  clip-path: polygon(0 4%, 96% 100%, 0 100%);
}
.env-front::after {
  right: 0;
  background: linear-gradient(245deg, rgba(255, 255, 255, .32) 0%, rgba(255, 255, 255, 0) 54%);
  clip-path: polygon(4% 100%, 100% 6%, 100% 100%);
}

.env-fold {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
}

.env-flap {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 56%;
  transform-origin: 50% 0;
  transform: rotateX(0deg);
  transform-style: preserve-3d;
  filter: drop-shadow(0 5px 7px rgba(150, 45, 78, .32));
  transition: transform .78s cubic-bezier(.45, .05, .25, 1);
  z-index: 3;
}
.flap-face {
  position: absolute; inset: 0;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: linear-gradient(178deg, #FFE1E9 0%, #FBC4D4 46%, #F1A2BB 100%);
  box-shadow: inset 0 -12px 20px -14px rgba(150, 50, 80, .42);
  backface-visibility: hidden;
}
.flap-face::after {
  content: '';
  position: absolute; inset: 0;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background:
    linear-gradient(96deg, rgba(255, 255, 255, .45), transparent 16%, transparent 84%, rgba(200, 100, 130, .12)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23f)' opacity='.13'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.seal {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 66px; height: 66px;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  color: #FFF2F5;
  background:
    radial-gradient(72% 72% at 32% 26%, #F7A9BF 0%, #E9819E 42%, #C76184 100%);
  border-radius: 47% 53% 51% 49% / 53% 46% 54% 47%;
  box-shadow:
    0 9px 18px -7px rgba(110, 30, 58, .62),
    inset 0 2px 7px rgba(255, 255, 255, .42),
    inset 0 -7px 12px rgba(120, 35, 62, .38);
  transition: opacity .38s ease, transform .6s ease;
}
.seal::before {
  content: '';
  position: absolute; inset: 3px;
  border-radius: inherit;
  background: radial-gradient(60% 60% at 30% 20%, rgba(255, 255, 255, .3), rgba(255, 255, 255, 0) 60%);
}
.seal svg { width: 23px; height: 23px; opacity: .95; filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .4)); }
.seal-ring {
  position: absolute;
  inset: 8px;
  border-radius: inherit;
  border: 1px solid rgba(255, 235, 240, .5);
  box-shadow: inset 0 0 7px rgba(255, 255, 255, .22);
}
.seal-ring::after {
  content: '';
  position: absolute; inset: -10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .45);
  opacity: 0;
  animation: sealPulse 3.4s ease-out infinite;
}
@keyframes sealPulse {
  0% { transform: scale(.86); opacity: 0; }
  35% { opacity: .5; }
  100% { transform: scale(1.35); opacity: 0; }
}

.env-address {
  position: absolute;
  left: 0; right: 0;
  bottom: 9%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 2;
}
.env-address .to {
  font-family: var(--font-script);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .26em;
  text-indent: .26em;
  color: rgba(255, 250, 247, .96);
  text-shadow: 0 1px 2px rgba(150, 55, 85, .32);
}
.env-address .rule {
  width: 88px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 250, 247, .78), transparent);
}
.env-address .rule.short { width: 50px; opacity: .66; }

.env-tap {
  position: absolute;
  inset: -9%;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
  z-index: 4;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.env-tap:focus-visible { outline: 2px dashed rgba(255, 255, 255, .85); outline-offset: 4px; }

/* 信封打开后 */
body.is-open .env-flap { transform: rotateX(-172deg); }
body.is-open .seal { opacity: 0; transform: translate(-50%, -66%) scale(.84) rotate(-14deg); }
body.is-open .envelope {
  opacity: 0;
  transform: rotate(-1.6deg) translateY(30px) scale(.94);
  pointer-events: none;
}
body.is-open .letter {
  opacity: 1;
}
body.is-open .sheet { opacity: 1; }
body.is-open .ribbon { opacity: 1; transform: rotate(-4deg) translateY(0); }
body.is-open .polaroid { opacity: 1; transform: rotate(8deg) scale(1); }
body.is-open .daisies { opacity: 1; transform: rotate(-8deg) translateY(0); }
body.is-open .swash path { stroke-dashoffset: 0; }

/* 信封关闭时，信纸不占据视觉焦点 */
body:not(.is-open) .letter { pointer-events: none; }

/* ---------- 提示 ---------- */

.stage-hint {
  position: absolute;
  left: 0; right: 0;
  bottom: 7.5%;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  font-size: 12.5px;
  letter-spacing: .18em;
  color: rgba(150, 62, 92, .82);
  opacity: 0;
  transform: translateY(6px);
  animation: hintIn .9s var(--ease-soft) .55s forwards;
  transition: opacity .45s ease;
}
.stage-hint .dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--rose-soft);
  box-shadow: 0 0 0 0 rgba(216, 117, 147, .5);
  animation: beacon 2.4s ease-out infinite;
}
@keyframes beacon {
  0% { box-shadow: 0 0 0 0 rgba(216, 117, 147, .45); }
  70% { box-shadow: 0 0 0 10px rgba(216, 117, 147, 0); }
  100% { box-shadow: 0 0 0 0 rgba(216, 117, 147, 0); }
}
@keyframes hintIn { to { opacity: 1; transform: none; } }
body.is-open .stage-hint { opacity: 0; animation: none; }

/* ---------- 播放器 ---------- */

.dock {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px 9px 9px;
  border-radius: 26px;
  background: linear-gradient(160deg, rgba(255, 249, 246, .72), rgba(253, 235, 238, .58));
  border: 1px solid rgba(255, 255, 255, .62);
  box-shadow:
    0 18px 30px -20px rgba(122, 46, 76, .6),
    0 2px 6px -4px rgba(122, 46, 76, .3),
    0 1px 0 rgba(255, 255, 255, .9) inset;
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  backdrop-filter: blur(14px) saturate(1.1);
}

.play {
  flex: none;
  position: relative;
  width: 50px; height: 50px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #FFF8F4;
  background:
    radial-gradient(80% 80% at 34% 22%, #F8ABC2 0%, #EA83A0 52%, #D36C8A 100%);
  box-shadow:
    0 10px 20px -10px rgba(160, 55, 95, .8),
    0 2px 0 rgba(255, 255, 255, .45) inset,
    0 0 0 3px rgba(255, 255, 255, .38);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .25s var(--ease-soft), box-shadow .3s ease;
}
.play:active { transform: scale(.94); }
.play:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.play .ico { width: 21px; height: 21px; fill: currentColor; position: absolute; transition: opacity .22s ease, transform .3s var(--ease-soft); }
.play .ico-play { margin-left: 2px; }
.play .ico-pause, .play .ico-replay { opacity: 0; transform: scale(.7); }
body.playing .play .ico-play { opacity: 0; transform: scale(.7); }
body.playing .play .ico-pause { opacity: 1; transform: none; }
body.ended .play .ico-play, body.ended .play .ico-pause { opacity: 0; }
body.ended .play .ico-replay { opacity: 1; transform: none; }

.track {
  position: relative;
  flex: 1;
  height: 32px;
  min-width: 0;
  cursor: pointer;
  touch-action: none;
  outline: none;
}
.track:focus-visible::after {
  content: '';
  position: absolute; inset: 1px -3px;
  border: 1px dashed rgba(184, 92, 122, .5);
  border-radius: 9px;
}
.rail-svg {
  position: absolute;
  left: 0; top: 0;
  width: 100%; height: 32px;
  overflow: visible;
}
.rail { fill: none; stroke: rgba(178, 100, 125, .26); stroke-width: 5.5; stroke-linecap: round; }
.rail-fill {
  fill: none;
  stroke: #D87593;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
}
.knob {
  position: absolute;
  top: 50%;
  left: 0;
  width: 19px; height: 19px;
  margin: 0;
  transform: translate(-50%, -50%);
  color: #D87593;
  display: grid;
  place-items: center;
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(150, 55, 85, .35));
}
.knob svg { width: 15px; height: 15px; }

.time {
  flex: none;
  min-width: 64px;
  text-align: right;
  font-family: var(--font-script);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: .03em;
  color: rgba(110, 60, 78, .82);
  font-variant-numeric: tabular-nums;
}
.time .sep { opacity: .45; margin: 0 2px; }
#cur { color: var(--rose); }

/* ---------- 减少动态 ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .letter { transform: none; }
}

/* ---------- 小屏微调 ---------- */

@media (max-height: 720px) {
  .masthead { padding-top: calc(10px + env(safe-area-inset-top)); }
  .letter { padding-top: 24px; padding-bottom: 22px; }
  .ink { line-height: 1.84; }
  .letter-inner { padding-top: 12px; }
  .polaroid { top: -20px; width: 29%; }
  .polaroid figcaption { font-size: 9.5px; padding-top: 4px; }
  .stage { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .dock { bottom: calc(8px + env(safe-area-inset-bottom)); }
}
@media (max-height: 640px) {
  .salutation { font-size: 28px; }
  .ink { font-size: 14.5px; line-height: 1.8; }
  .stage-hint { bottom: 4%; }
}
@media (min-width: 720px) {
  .scene { width: 410px; }
  .stage { padding-bottom: 118px; }
}
@media (min-width: 900px) {
  .scene { width: 430px; }
  .dock {
    left: 50%;
    right: auto;
    width: 560px;
    margin-left: -280px;
  }
  .masthead p { font-size: 12px; }
}
