:root { color-scheme: light; }
* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
  overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #fee9eb 0%, #f9d9d4 73%, #f2c9c6 100%);
  color: #8f4e52;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}
body.read { overflow-x: hidden; overflow-y: auto; }

#stage { position: fixed; inset: 0; z-index: 10; overflow: hidden; perspective: 1200px; transition: opacity .9s ease, visibility .9s ease; }
#stage.done { opacity: 0; visibility: hidden; pointer-events: none; }
.grain { position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: .18; mix-blend-mode: multiply; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.42'/%3E%3C/svg%3E"); }
.scene { position: absolute; inset: 0; display: grid; place-items: center; }
.plain-button, .cover-button { border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; background: transparent; }

.collage-scene { transition: opacity .9s ease; }
.collage-scene.gone { opacity: 0; pointer-events: none; }
#photos { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.photo { position: absolute; top: 50%; left: 50%; width: clamp(92px, 14vw, 165px); border-radius: 3px; box-shadow: 0 14px 32px rgba(139, 75, 80, .22); transform: translate(-50%, -50%) translate(var(--from-x), var(--from-y)) scale(.35); opacity: 0; transition: transform 1.45s cubic-bezier(.2,.85,.25,1), opacity 1.25s ease; }
.photo.in { transform: translate(-50%, -50%) translate(var(--x), var(--y)) rotate(var(--r)) scale(var(--s)); opacity: 1; }
.collage-scene.settled .photo { opacity: 0; transition: opacity .9s ease; }

.cover-button { position: relative; z-index: 2; opacity: 0; transform: translateY(-5vh) scale(.92); transition: opacity 1.2s ease, transform 1.35s cubic-bezier(.22,1,.36,1); }
.settled .cover-button { opacity: 1; transform: translateY(-6vh) scale(1); }
.cover-card { width: min(56vw, 515px); min-width: 270px; aspect-ratio: 1 / .82; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; overflow: hidden; background: linear-gradient(145deg, rgba(255,250,247,.98), rgba(250,212,216,.98)); border: 1px solid rgba(255,255,255,.75); box-shadow: 0 26px 60px rgba(155, 84, 94, .16), inset 0 0 0 12px rgba(255,255,255,.25); }
.cover-card::before, .cover-card::after { content: ""; position: absolute; border: 1px solid rgba(187,104,114,.2); border-radius: 50%; }
.cover-card::before { width: 86%; height: 135%; top: -58%; left: -41%; }
.cover-card::after { width: 74%; height: 112%; right: -33%; bottom: -52%; }
.cover-kicker, .cover-to { position: relative; z-index: 1; font-size: clamp(8px, 1.2vw, 11px); letter-spacing: .24em; color: #b16c73; }
.cover-love { position: relative; z-index: 1; margin: 6px 0 0; font-family: "DM Serif Display", Georgia, serif; font-size: clamp(62px, 12vw, 132px); font-weight: 400; letter-spacing: -.06em; line-height: .9; color: #ca858d; text-shadow: 0 2px 1px rgba(255,255,255,.75); }
.cover-line { width: 40%; height: 1px; margin: 15px 0 11px; background: rgba(174, 89, 100, .38); }
.cover-bloom { position: absolute; z-index: 1; color: rgba(205, 126, 138, .67); }
.bloom-one { top: 15%; left: 13%; font-size: clamp(20px, 4vw, 37px); }
.bloom-two { right: 12%; bottom: 15%; font-size: clamp(25px, 4.5vw, 45px); }
.bloom-three { left: 24%; bottom: 13%; font-size: clamp(13px, 2vw, 21px); }
.hand-title { position: absolute; z-index: 2; bottom: 13vh; width: 100%; margin: 0; display: flex; justify-content: center; align-items: baseline; gap: .34em; color: #8f4a4a; font-family: "Ma Shan Zheng", "STKaiti", cursive; font-size: clamp(39px, 6.8vw, 73px); font-weight: 400; text-shadow: 0 2px 8px rgba(255,255,255,.6); opacity: 0; transition: opacity .9s ease 1.4s; }
.settled .hand-title { opacity: 1; }
.hint { position: absolute; z-index: 4; bottom: 6vh; left: 0; right: 0; margin: 0; text-align: center; color: #a66e72; font-size: clamp(12px, 2vw, 18px); letter-spacing: .3em; text-shadow: 0 2px 10px rgba(255,255,255,.8); animation: pulse 2.4s ease-in-out infinite; opacity: 0; transition: opacity .8s ease 1.9s; }
.settled .hint, .envelope-scene.show .hint, .open-scene.visible .hint { opacity: .88; }
@keyframes pulse { 50% { transform: translateY(-4px); opacity: 1; } }

.envelope-scene, .open-scene { opacity: 0; pointer-events: none; transition: opacity 1s ease, transform 1s cubic-bezier(.22,1,.36,1); }
.envelope-scene { transform: scale(1.04); }
.envelope-scene.show { opacity: 1; transform: scale(1); pointer-events: auto; }
.envelope-scene.hide { opacity: 0; transform: translateY(-35vh) rotateX(-115deg) scale(.75); pointer-events: none; }
.open-scene { transform: scale(.78) translateY(8vh); }
.open-scene.visible { opacity: 1; transform: scale(1) translateY(0); pointer-events: auto; }
.plain-button { width: min(92vw, 840px); min-height: 62vh; display: grid; place-items: center; position: relative; }
.open-card { position: relative; display: block; width: min(92vw, 840px); max-height: 80vh; }
.envelope { display: block; max-width: 100%; max-height: 75vh; object-fit: contain; filter: drop-shadow(0 24px 55px rgba(150, 86, 92, .16)); }
.envelope.closed { width: min(72vw, 520px); animation: float 4.5s ease-in-out infinite; }
.envelope.open { width: 100%; max-height: 80vh; }
.open-name-patch { position: absolute; z-index: 5; top: 72%; left: 23%; width: 54%; height: 12.8%; display: grid; place-items: center; color: #f0928f; font-family: "STKaiti", "Kaiti SC", serif; font-size: clamp(45px, 7vw, 78px); font-weight: 400; letter-spacing: .13em; line-height: 1; text-shadow: 0 0 5px #fde2e3, 0 0 10px #fde2e3, 0 0 16px #fde2e3; }
.plain-button .hint { bottom: 3vh; transition-delay: .5s; }
@keyframes float { 50% { transform: translateY(-16px) rotate(1deg); } }

.letter-section, .album-section, .fullscreen-section { display: none; position: relative; min-height: 100vh; }
.letter-section.show, .album-section.show, .fullscreen-section.show { display: block; }
.letter-section { z-index: 1; padding: 5vh 0 7vh; background: radial-gradient(circle at 50% 0%, #fee9e8, #f7d9d2); }
.letter-book { position: relative; width: min(82vw, 470px); aspect-ratio: 1170 / 1650; margin: 0 auto; perspective: 2400px; }
.letter-page { position: absolute; inset: 0; transform-origin: left center; transform-style: preserve-3d; backface-visibility: hidden; transition: transform 1.1s cubic-bezier(.645,.045,.355,1); }
.letter-page.flipped { transform: rotateY(-178deg); }
.letter-page img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 6px; box-shadow: 0 22px 50px rgba(150,90,90,.22); }
.letter-text { position: absolute; top: 11%; left: 14%; right: 14%; color: #6a4a39; font-family: "Ma Shan Zheng", "Long Cang", "Kaiti SC", "STKaiti", cursive; text-shadow: 0 1px 0 rgba(255,255,255,.3); }
.letter-text p { margin: 0; font-size: clamp(12px, 3.6vw, 17px); line-height: 1.8; text-indent: 2em; }
.book-nav { display: flex; align-items: center; justify-content: center; gap: 22px; margin-top: 3.2vh; }
.book-nav button { border: 1px solid #d4a8a8; border-radius: 999px; padding: 9px 20px; color: #8f5f65; background: rgba(255,255,255,.4); font: inherit; font-size: 14px; letter-spacing: .14em; cursor: pointer; transition: background .3s, color .3s; }
.book-nav button:hover:not(:disabled) { color: #744040; background: rgba(255,255,255,.65); }
.book-nav button:disabled { cursor: default; opacity: .35; }
.book-nav span { min-width: 52px; color: #9e6b72; font-size: 13px; letter-spacing: .1em; text-align: center; }
.book-tip { margin: 1.6vh 0 0; text-align: center; color: #b07e7e; font-size: 12px; letter-spacing: .12em; opacity: .7; }
.album-section { z-index: 1; padding: 14vh 0 7vh; text-align: center; background: radial-gradient(circle at 50% 0%, #fee9e8, #f7d9d2); }
.eyebrow { margin: 0 0 .6rem; color: #bf7d84; font-size: 11px; letter-spacing: .32em; }
.album-section h2 { margin: 0 0 3vh; color: #9a5b61; font-family: "Ma Shan Zheng", "STKaiti", cursive; font-size: clamp(35px, 7vw, 56px); font-weight: 400; }
.album { position: relative; width: min(86vw, 620px); aspect-ratio: 4 / 3; margin: 0 auto; }
.album::before { content: ""; position: absolute; z-index: -1; inset: -16px -12px; border-radius: 14px; background: linear-gradient(160deg, #fbf3ea, #f1ddcc); box-shadow: 0 28px 64px rgba(150,90,90,.24), inset 0 0 0 1px rgba(212,168,168,.45); }
.album-face { position: absolute; inset: 0; display: grid; place-items: center; padding: 3.5%; overflow: hidden; border: 1px solid rgba(212,168,168,.35); border-radius: 8px; background: #fffaf7; box-shadow: 0 18px 44px rgba(150,90,90,.18); }
.album-face img { width: auto; height: min(47.7vw, 344px); max-width: 100%; max-height: none; object-fit: contain; border-radius: 4px; box-shadow: 0 6px 18px rgba(0,0,0,.08); transition: opacity .32s ease, transform .32s ease; }
.album-face img.changing { opacity: 0; transform: scale(.985); }
.album-nav { display: flex; align-items: center; justify-content: center; gap: 22px; margin-top: 3.5vh; }
.album-nav button, .continue-button { border: 1px solid #d4a8a8; border-radius: 999px; padding: 10px 22px; color: #8f5f65; background: rgba(255,255,255,.5); font: inherit; font-size: 14px; letter-spacing: .14em; cursor: pointer; transition: transform .2s, background .3s; }
.album-nav button:hover:not(:disabled), .continue-button:hover { background: rgba(255,255,255,.78); transform: translateY(-2px); }
.album-nav button:disabled { cursor: default; opacity: .35; }
.album-nav span, .album-tip { color: #9e6b72; font-size: 13px; letter-spacing: .1em; }
.album-tip { margin: 2vh 0 0; opacity: .75; font-size: 12px; }
.continue-button { display: block; margin: 3vh auto 0; font-family: "Ma Shan Zheng", "STKaiti", sans-serif; }

.fullscreen-section { overflow: hidden; background: #f3dcd6; }
.fullscreen-section img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fullscreen-section .on-image { position: absolute; z-index: 1; bottom: 6vh; left: 50%; transform: translateX(-50%); }
.fullscreen-section .on-image:hover { transform: translateX(-50%) translateY(-2px); }
.fullscreen-section.last p { position: absolute; z-index: 1; left: 0; right: 0; bottom: 8vh; margin: 0; text-align: center; color: white; font-family: "Ma Shan Zheng", "STKaiti", cursive; font-size: clamp(29px, 6vw, 50px); text-shadow: 0 2px 20px rgba(0,0,0,.35); }

@media (max-width: 600px) {
  .cover-card { width: min(74vw, 410px); }
  .settled .cover-button { transform: translateY(-7vh) scale(1); }
  .hand-title { bottom: 14vh; font-size: clamp(34px, 9vw, 51px); gap: .23em; }
  .hint { bottom: 6vh; font-size: 12px; }
  .plain-button .hint { bottom: 4vh; }
  .letter-section { padding: 3vh 0 6vh; }
  .letter-book { width: 92vw; aspect-ratio: 1170 / 1780; perspective: 1800px; }
  .letter-text { top: 6.5%; left: 8%; right: 8%; }
  .letter-text p { font-size: clamp(11px, 3.3vw, 15px); line-height: 1.62; }
  .book-nav { gap: 16px; margin-top: 2.4vh; }
  .book-nav button { padding: 8px 16px; font-size: 13px; }
  .book-tip { font-size: 11px; }
  .album-section { padding-top: 10vh; }
  .album { width: 90vw; }
  .fullscreen-section img { object-fit: contain; }
}
