:root { color-scheme: light; }
@font-face {
  font-family: "CreamyRound";
  src: url("assets/fonts/ZCOOLKuaiLe-Regular.ttf") format("truetype");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
  overflow: hidden;
  background: radial-gradient(circle at 50% 20%, #fff8ea 0%, #eef0db 70%, #dde3c8 100%);
  color: #8f4e52;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}
body.read { overflow-x: hidden; overflow-y: auto; }

#stage { position: relative; z-index: 10; width: 100%; min-height: 100vh; min-height: 100svh; overflow: hidden; perspective: 1200px; }
.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(-2vh) scale(.92); transition: opacity 1.2s ease, transform 1.35s cubic-bezier(.22,1,.36,1); }
.settled .cover-button { opacity: 1; transform: translateY(-3vh) scale(1); }
.poster-card { position: relative; display: block; width: min(74vw, 57vh, 540px); min-width: 270px; aspect-ratio: 3 / 4; overflow: hidden; border: 1px solid rgba(255,255,255,.85); border-radius: 4px; background: #fbebe4; box-shadow: 0 30px 70px rgba(130, 65, 67, .26), 0 0 0 10px rgba(255,255,255,.18); animation: posterFloat 5.8s ease-in-out infinite; }
.poster-card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.poster-card::after { content: ""; position: absolute; z-index: 2; inset: -40% -85%; pointer-events: none; background: linear-gradient(105deg, transparent 39%, rgba(255,255,255,.32) 49%, transparent 59%); transform: translateX(-48%) rotate(7deg); animation: posterGlimmer 6.5s ease-in-out infinite 2.3s; }
@keyframes posterFloat { 50% { transform: translateY(-9px) rotate(.25deg); } }
@keyframes posterGlimmer { 0%, 30% { transform: translateX(-48%) rotate(7deg); opacity: 0; } 45% { opacity: 1; } 70%, 100% { transform: translateX(48%) rotate(7deg); opacity: 0; } }
.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, .fullscreen-section { display: block; position: relative; min-height: 100vh; }
.album-section { display: none; }
.letter-section { z-index: 1; padding: 5vh 0 7vh; background: radial-gradient(circle at 50% 0%, #fbf8e8, #e8ead3 76%, #dde2c9); }
.letter-book { position: relative; width: min(86vw, 500px); aspect-ratio: 1056 / 1492; 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: 12px; box-shadow: 0 22px 55px rgba(100,110,78,.2); }
.letter-text { position: absolute; top: 19.2%; left: 17%; right: 17%; bottom: 15.5%; overflow: hidden; color: #5f6854; font-family: "CreamyRound", "Yuanti SC", "STYuanti-SC-Regular", "YouYuan", sans-serif; text-shadow: 0 1px 0 rgba(255,255,255,.7); }
.letter-text p { margin: 0 0 .65em; font-size: clamp(13px, 3.5vw, 17px); line-height: 1.74; letter-spacing: .035em; text-indent: 2em; }
.letter-text .letter-greeting { margin-bottom: .75em; color: #778465; font-size: clamp(14px, 3.7vw, 18px); text-indent: 0; }
.book-nav { display: flex; align-items: center; justify-content: center; gap: 22px; margin-top: 3.2vh; }
.book-nav button { border: 1px solid #aeb99a; border-radius: 999px; padding: 9px 20px; color: #667257; background: rgba(255,255,255,.5); font-family: "CreamyRound", "Yuanti SC", sans-serif; font-size: 14px; letter-spacing: .14em; cursor: pointer; transition: background .3s, color .3s; }
.book-nav button:hover:not(:disabled) { color: #4f5945; background: rgba(255,255,255,.75); }
.book-nav button:disabled { cursor: default; opacity: .35; }
.book-nav span { min-width: 52px; color: #748064; font-family: "CreamyRound", "Yuanti SC", sans-serif; font-size: 13px; letter-spacing: .1em; text-align: center; }
.book-tip { margin: 1.6vh 0 0; text-align: center; color: #879174; font-family: "CreamyRound", "Yuanti SC", sans-serif; font-size: 12px; letter-spacing: .12em; opacity: .76; }
.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; border-color: #aeb99a; color: #667257; font-family: "CreamyRound", "Yuanti SC", 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) {
  .poster-card { width: min(88vw, 61vh); min-width: 0; }
  .settled .cover-button { transform: translateY(-2vh) scale(1); }
  .hint { bottom: 3vh; font-size: 12px; }
  .plain-button .hint { bottom: 4vh; }
  .letter-section { padding: 3vh 0 6vh; }
  .letter-book { width: 94vw; aspect-ratio: 1056 / 1492; perspective: 1800px; }
  .letter-text { top: 18.8%; left: 15.5%; right: 15.5%; bottom: 14.5%; }
  .letter-text p { font-size: clamp(11.5px, 3.35vw, 14px); line-height: 1.7; letter-spacing: .02em; }
  .letter-text .letter-greeting { font-size: clamp(12.5px, 3.55vw, 15px); }
  .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; }
}
