:root {
  color-scheme: dark;
  --night: #08110f;
  --forest: #09231b;
  --chalk: #f1eee4;
  --muted: #a6aaa0;
  --leaf: #96b59b;
  --rose: #e78479;
  --line: rgba(241, 238, 228, .18);
  font-family: 'Noto Serif SC', 'Songti SC', serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--night); }
body { margin: 0; color: var(--chalk); background: var(--night); min-width: 0; overflow-x: hidden; }
button, input { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.screen { min-height: 100svh; min-height: 100dvh; position: relative; overflow: hidden; }
.gate { display: grid; place-items: center; padding: 32px 24px max(40px, env(safe-area-inset-bottom)); isolation: isolate; background: linear-gradient(180deg, rgba(4, 11, 9, .38), rgba(4, 12, 9, .8)), url('assets/backgrounds/gate-roses.jpg') center 48% / cover no-repeat, #07100e; transition: opacity .6s ease; }
.gate.gate-leaving { opacity: 0; }
.gate::before, .letter-board::before { content: ''; position: absolute; inset: 0; opacity: .13; pointer-events: none; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E"); mix-blend-mode: screen; }
.gate-stars { position: absolute; inset: 0; background: radial-gradient(1px 1px at 17% 25%, #d8e5ce 50%, transparent 80%), radial-gradient(2px 2px at 80% 17%, #bdcdb5 45%, transparent 80%), radial-gradient(1px 1px at 74% 71%, #e6d9bf 50%, transparent 80%), radial-gradient(1px 1px at 28% 78%, #d8e5ce 50%, transparent 80%); opacity: .42; filter: drop-shadow(0 0 7px #e0e9d0); animation: breathe 6s ease-in-out infinite alternate; }
.gate-content { z-index: 1; width: min(100%, 420px); text-align: center; transform: translateY(-2vh); }
.eyebrow, .letter-kicker { text-transform: uppercase; font-family: Arial, sans-serif; font-size: 10px; color: var(--leaf); }
.eyebrow { margin-bottom: 27px; }
.gate h1 { font-size: 30px; line-height: 1.7; font-weight: 400; margin: 0 0 31px; }
.gate-copy { color: #bdc2b9; font-size: 13px; margin: 0 0 14px; }
#password-form { display: flex; width: min(100%, 310px); margin: 0 auto; border-bottom: 1px solid rgba(226, 232, 218, .48); align-items: center; }
#password { flex: 1; width: 0; border: 0; outline: 0; background: transparent; padding: 13px 12px; text-align: center; color: var(--chalk); font-family: Arial, sans-serif; font-size: 20px; }
#password::placeholder { color: rgba(241, 238, 228, .43); }
.enter-button { width: 44px; height: 44px; border: 0; background: transparent; color: var(--chalk); font-size: 25px; cursor: pointer; transition: color .2s, transform .2s; }
.enter-button:hover { color: var(--rose); transform: translate(2px, -2px); }
.error-message { min-height: 20px; color: #f0a198; font-size: 12px; margin: 10px 0 0; }
.gate-footnote { margin-top: 48px; color: #79847b; font-size: 11px; }

.starlight { background: linear-gradient(180deg, rgba(3, 11, 9, .48), rgba(3, 11, 9, .72)), url('assets/backgrounds/stars-rose.jpg') center 52% / cover no-repeat, #06100e; display: grid; place-items: center; isolation: isolate; }
.star-field { position: absolute; inset: 0; z-index: -1; }
.star { position: absolute; width: var(--size); height: var(--size); left: var(--x); top: var(--y); clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 94%, 50% 72%, 21% 94%, 32% 57%, 2% 35%, 39% 35%); background: linear-gradient(145deg, #fffef0 5%, #f8dca5 48%, #dfad72); filter: drop-shadow(0 0 6px rgba(255, 246, 205, .96)) drop-shadow(0 0 15px rgba(255, 197, 133, .62)); opacity: .72; animation: drift var(--duration) ease-in-out infinite alternate; transition: left 2.3s cubic-bezier(.2,.72,.22,1), top 2.3s cubic-bezier(.2,.72,.22,1), opacity 1.3s, transform 2s; }
.star::after { content: ''; position: absolute; inset: -100%; border-radius: 50%; background: radial-gradient(circle, rgba(255, 234, 180, .72), rgba(255, 218, 152, .18) 30%, transparent 68%); animation: star-aura calc(var(--duration) * .72) ease-in-out infinite alternate; }
.starlight.gathering .star { left: 50%; top: 50%; opacity: 1; transform: scale(2.3); animation-play-state: paused; }
.starlight.gathering::after { content: ''; position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; border-radius: 50%; background: white; box-shadow: 0 0 30px 16px rgba(221, 245, 215, .8), 0 0 110px 54px rgba(142, 194, 158, .42); animation: bloom 1.3s ease-out forwards; }
.star-hint { position: absolute; top: calc(50% + 68px); color: #bac8ba; font-size: 12px; opacity: .82; transition: opacity .8s; }
.starlight.gathering .star-hint { opacity: 0; }
.heart-tree { position: absolute; z-index: 0; left: 50%; bottom: 9%; width: min(84vw, 330px); height: min(58svh, 500px); transform: translate(-50%, 24px) scaleY(.28); transform-origin: 50% 100%; opacity: 0; filter: drop-shadow(0 0 22px rgba(208, 224, 177, .16)); transition: opacity 1.1s ease, transform 2.8s cubic-bezier(.22,1,.36,1); }
.starlight.gathering .heart-tree, .starlight.revealed .heart-tree { opacity: .92; transform: translate(-50%, 0) scaleY(1); }
.heart-tree-ground { position: absolute; left: 5%; right: 5%; bottom: 5%; height: 2px; background: linear-gradient(90deg, transparent, rgba(210, 218, 185, .48), transparent); }
.heart-tree-trunk { position: absolute; z-index: 2; left: 50%; bottom: 5%; width: clamp(21px, 7.5%, 30px); height: 46%; border-radius: 48% 52% 2px 2px / 6% 8% 0 0; clip-path: polygon(39% 0, 61% 1%, 67% 14%, 62% 27%, 74% 42%, 66% 59%, 74% 76%, 100% 100%, 70% 96%, 58% 100%, 43% 95%, 30% 100%, 0 100%, 25% 78%, 31% 57%, 24% 38%, 36% 24%); background: linear-gradient(90deg, #1d3028 0%, #705943 18%, #b59a77 36%, #766049 52%, #403c30 72%, #263b2e 100%); filter: drop-shadow(0 3px 4px rgba(0,0,0,.35)); transform: translateX(-50%); transform-origin: 50% 100%; }
.heart-tree-trunk { position: absolute; z-index: 2; left: 50%; bottom: 5%; width: clamp(25px, 8.5%, 36px); height: 47%; border-radius: 48% 52% 2px 2px / 6% 8% 0 0; clip-path: polygon(39% 0, 61% 1%, 67% 14%, 62% 27%, 74% 42%, 66% 59%, 74% 76%, 100% 100%, 70% 96%, 58% 100%, 43% 95%, 30% 100%, 0 100%, 25% 78%, 31% 57%, 24% 38%, 36% 24%); background: linear-gradient(90deg, #182a21 0%, #4d3b2c 16%, #927352 31%, #bd9b70 42%, #846348 54%, #55412f 73%, #203529 100%); filter: drop-shadow(0 3px 4px rgba(0,0,0,.42)); transform: translateX(-50%); transform-origin: 50% 100%; }
.heart-tree-trunk::before { content: ''; position: absolute; left: -48%; right: -48%; bottom: -2%; height: 24%; background: linear-gradient(180deg, #766049, #493d30 72%, #202e25); clip-path: polygon(42% 0, 58% 0, 64% 30%, 100% 74%, 87% 82%, 65% 66%, 74% 100%, 55% 83%, 48% 61%, 38% 100%, 31% 76%, 34% 58%, 4% 91%, 0 75%, 30% 35%); }
.heart-tree-trunk::after { content: ''; position: absolute; inset: 5% 29% 9%; opacity: .36; background: repeating-linear-gradient(96deg, transparent 0 4px, rgba(29, 31, 24, .74) 4px 5px, transparent 5px 9px), linear-gradient(90deg, transparent, rgba(245, 212, 157, .44), transparent); clip-path: polygon(38% 0, 75% 8%, 64% 31%, 77% 47%, 58% 66%, 72% 84%, 42% 100%, 31% 77%, 44% 54%, 29% 32%); }
.heart-tree-trunk::after { content: ''; position: absolute; inset: 5% 29% 9%; opacity: .36; background: repeating-linear-gradient(96deg, transparent 0 4px, rgba(29, 31, 24, .74) 4px 5px, transparent 5px 9px), linear-gradient(90deg, transparent, rgba(245, 212, 157, .44), transparent); clip-path: polygon(38% 0, 75% 8%, 64% 31%, 77% 47%, 58% 66%, 72% 84%, 42% 100%, 31% 77%, 44% 54%, 29% 32%); }
.heart-tree-root { position: absolute; z-index: 1; left: 50%; bottom: 3.4%; width: 45%; height: 12%; transform: translateX(-50%); background: radial-gradient(ellipse at 50% 30%, rgba(171, 133, 91, .76), rgba(74, 57, 42, .95) 52%, transparent 74%); clip-path: polygon(44% 0, 57% 0, 66% 22%, 100% 72%, 94% 89%, 63% 57%, 72% 100%, 52% 72%, 47% 45%, 36% 100%, 31% 68%, 3% 93%, 0 74%, 33% 27%); filter: drop-shadow(0 3px 4px rgba(0,0,0,.4)); }
.heart-tree-root::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(12deg, transparent 0 8px, rgba(26, 29, 22, .48) 8px 9px, transparent 9px 15px); opacity: .7; }
.heart-tree-branch { position: absolute; z-index: 2; left: 50%; bottom: 37%; width: clamp(9px, 3vw, 14px); height: 29%; clip-path: polygon(38% 100%, 61% 100%, 66% 64%, 100% 0, 66% 7%, 44% 44%, 34% 17%, 0 0, 28% 62%); background: linear-gradient(90deg, #27372d, #76654d 30%, #a98c6e 52%, #675640 71%, #314333); transform-origin: 50% 100%; opacity: .94; filter: drop-shadow(0 1px 3px rgba(0,0,0,.4)); }
.branch-one { transform: translateX(-50%) rotate(-38deg); height: 34%; }
.branch-two { transform: translateX(-50%) rotate(36deg); height: 32%; }
.branch-three { transform: translateX(-50%) rotate(-15deg); height: 36%; }
.branch-four { transform: translateX(-50%) rotate(15deg); height: 37%; }
.branch-five { transform: translateX(-50%) rotate(-57deg); height: 23%; bottom: 48%; }
.branch-six { transform: translateX(-50%) rotate(55deg); height: 24%; bottom: 48%; }
.branch-seven { transform: translateX(-50%) rotate(2deg); height: 24%; bottom: 51%; width: 2px; }
.heart-tree-canopy { position: absolute; z-index: 3; inset: -1% -2% 16%; isolation: isolate; animation: canopy-breathe 7s ease-in-out infinite alternate; animation-play-state: paused; }
.heart-tree-canopy::before { content: ''; position: absolute; z-index: 0; inset: 1% 0 0; border-radius: 48% 52% 45% 55% / 38% 38% 62% 62%; background: radial-gradient(ellipse at 16% 31%, rgba(71, 112, 73, .96) 0 12%, rgba(41, 80, 54, .82) 37%, transparent 68%), radial-gradient(ellipse at 35% 19%, rgba(106, 153, 91, .74) 0 14%, rgba(46, 88, 59, .82) 43%, transparent 72%), radial-gradient(ellipse at 66% 20%, rgba(99, 148, 87, .76) 0 14%, rgba(44, 84, 57, .84) 43%, transparent 72%), radial-gradient(ellipse at 85% 34%, rgba(74, 119, 75, .94) 0 12%, rgba(42, 81, 55, .84) 40%, transparent 69%), radial-gradient(ellipse at 23% 58%, rgba(47, 91, 59, .9) 0 18%, rgba(32, 66, 46, .86) 55%, transparent 80%), radial-gradient(ellipse at 52% 48%, rgba(57, 103, 65, .94) 0 31%, rgba(34, 71, 48, .86) 58%, transparent 78%), radial-gradient(ellipse at 78% 60%, rgba(48, 93, 58, .92) 0 19%, rgba(31, 65, 44, .86) 53%, transparent 80%), radial-gradient(ellipse at 48% 83%, rgba(45, 86, 56, .9) 0 23%, rgba(30, 62, 42, .82) 57%, transparent 80%); background-color: #294a33; clip-path: polygon(50% 100%, 43% 95%, 36% 89%, 29% 83%, 21% 76%, 14% 68%, 8% 59%, 4% 49%, 2% 40%, 3% 32%, 6% 25%, 10% 19%, 16% 14%, 22% 10%, 29% 8%, 36% 9%, 42% 12%, 47% 17%, 50% 22%, 53% 17%, 58% 12%, 64% 9%, 71% 8%, 78% 10%, 84% 14%, 90% 19%, 94% 25%, 97% 32%, 98% 40%, 96% 49%, 92% 59%, 86% 68%, 79% 76%, 71% 83%, 64% 89%, 57% 95%); filter: saturate(1.12) drop-shadow(0 0 12px rgba(117, 156, 95, .22)); opacity: .98; pointer-events: none; }
.heart-tree-canopy::after { content: ''; position: absolute; z-index: 0; inset: 4% 1% -1%; border-radius: 48% 52% 45% 55% / 38% 38% 62% 62%; background: radial-gradient(ellipse at 24% 25%, rgba(173, 204, 130, .2), transparent 30%), radial-gradient(ellipse at 72% 27%, rgba(164, 197, 124, .2), transparent 32%), radial-gradient(ellipse at 42% 57%, rgba(118, 164, 97, .15), transparent 34%), radial-gradient(ellipse at 72% 72%, rgba(105, 153, 90, .14), transparent 30%); filter: blur(2px); opacity: .88; pointer-events: none; }
.starlight.gathering .heart-tree-canopy, .starlight.revealed .heart-tree-canopy { animation-play-state: running; }
.tree-particle { position: absolute; z-index: 1; left: var(--x); top: var(--y); width: var(--size); height: var(--height, var(--size)); display: block; color: #e58c87; opacity: 0; transform: translate(-50%, -50%) rotate(var(--r)) scale(.2); transition: opacity .75s ease var(--delay), transform .85s cubic-bezier(.22,1,.36,1) var(--delay); pointer-events: none; }
.tree-particle::before { position: absolute; inset: 0; display: grid; place-items: center; }
.tree-heart::before { content: '♥'; font: calc(var(--size) * 1.45)/1 Arial, sans-serif; text-shadow: 0 0 10px rgba(228, 112, 120, .32); }
.tree-star { z-index: 2; color: #fff5cf; filter: drop-shadow(0 0 5px rgba(255, 248, 205, .98)) drop-shadow(0 0 12px rgba(255, 218, 147, .86)) drop-shadow(0 0 24px rgba(251, 186, 119, .55)); }
.tree-star::before { content: ''; inset: 0; background: linear-gradient(145deg, #fffef2 8%, #ffe6a4 52%, #f0b66e); clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 94%, 50% 72%, 21% 94%, 32% 57%, 2% 35%, 39% 35%); animation: star-sparkle var(--twinkle-duration, 2.8s) ease-in-out var(--twinkle-delay, 0s) infinite alternate; animation-play-state: paused; transform-origin: center; }
.tree-star::after { content: ''; position: absolute; inset: -105%; z-index: -1; border-radius: 50%; background: radial-gradient(circle, rgba(255, 247, 202, .98), rgba(255, 200, 132, .44) 28%, rgba(255, 180, 110, .12) 49%, transparent 72%); animation: star-aura var(--twinkle-duration, 2.8s) ease-in-out var(--twinkle-delay, 0s) infinite alternate; animation-play-state: paused; }
.tree-blossom { color: #f2c6b1; text-shadow: 0 0 9px rgba(242, 198, 177, .5); }
.tree-blossom.blossom-tone-1 { color: #f1aeb0; text-shadow: 0 0 9px rgba(241, 174, 176, .46); }
.tree-blossom.blossom-tone-2 { color: #f4d2a5; text-shadow: 0 0 9px rgba(244, 210, 165, .48); }
.tree-blossom::before { content: '✿'; font: calc(var(--size) * 1.35)/1 Georgia, serif; animation: blossom-twinkle var(--twinkle-duration, 3.6s) ease-in-out var(--twinkle-delay, 0s) infinite alternate; animation-play-state: paused; transform-origin: center; }
.tree-blossom.blossom-tone-1::before { content: '❀'; }
.tree-blossom.blossom-tone-2::before { content: '✾'; }
.tree-blossom::after { content: ''; position: absolute; left: 50%; top: 50%; width: 23%; aspect-ratio: 1; border-radius: 50%; background: #f5d39d; box-shadow: 0 0 5px rgba(245, 211, 157, .5); transform: translate(-50%, -50%); }
.tree-leaf { color: #a8c48f; }
.tree-leaf.leaf-tone-1 { color: #bdd39a; }
.tree-leaf.leaf-tone-2 { color: #8fb77f; }
.tree-leaf.leaf-tone-3 { color: #739d74; }
.tree-leaf { height: var(--height, calc(var(--size) * .82)); }
.tree-leaf::before { content: ''; inset: 0; background: linear-gradient(135deg, #d5e2a8, currentColor 45%, #526f4b); clip-path: polygon(0 50%, 18% 22%, 48% 5%, 78% 18%, 100% 50%, 80% 80%, 48% 96%, 18% 72%); filter: drop-shadow(0 1px 2px rgba(4, 12, 7, .26)); }
.tree-leaf::after { content: ''; position: absolute; left: 10%; top: 50%; width: 80%; height: 1px; background: rgba(238, 243, 201, .48); transform: rotate(-8deg); transform-origin: left center; }
.starlight.gathering .tree-particle, .starlight.revealed .tree-particle { opacity: .94; transform: translate(-50%, -50%) rotate(var(--r)) scale(1); }
.starlight.gathering .tree-blossom::before, .starlight.revealed .tree-blossom::before { animation-play-state: running; }
.starlight.gathering .tree-star::before, .starlight.revealed .tree-star::before,
.starlight.gathering .tree-star::after, .starlight.revealed .tree-star::after { animation-play-state: running; }
.star-title { position: relative; font-size: 38px; font-weight: 400; margin: 0; opacity: 0; filter: blur(12px); text-shadow: 0 0 30px rgba(220, 243, 211, .4); transition: opacity 1.8s ease, transform 1.8s ease, filter 1.8s ease; transform: translateY(10px) scale(1.04); }
.starlight.revealed .star-title { opacity: 1; filter: blur(0); transform: translateY(0) scale(1); }
.skip-intro { position: absolute; bottom: max(28px, env(safe-area-inset-bottom)); right: 24px; border: 0; background: transparent; color: #b2c2b4; font-size: 12px; padding: 12px; cursor: pointer; }

.story { position: relative; isolation: isolate; min-height: 100vh; background: var(--night); }
.story::before { content: ''; position: fixed; z-index: -1; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(5, 12, 10, .83), rgba(5, 12, 10, .72) 45%, rgba(5, 12, 10, .88)), url('assets/backgrounds/story-train.jpg') center 52% / cover no-repeat; }
.story-bar { position: fixed; z-index: 5; inset: 0 0 auto; height: calc(58px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 20px 0; display: flex; align-items: center; justify-content: space-between; background: rgba(8, 17, 15, .8); backdrop-filter: blur(16px); }
.wordmark { text-decoration: none; color: #e6e8dd; font: 10px Arial, sans-serif; }
.wordmark span { color: var(--rose); padding-left: 4px; }
.bar-actions { display: flex; align-items: center; gap: 17px; }
.icon-button { display: grid; place-items: center; width: 38px; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,255,255,.035); cursor: pointer; }
.icon-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.motion-off { display: none; }
.motion-button[aria-pressed='true'] { color: var(--rose); }
.motion-button[aria-pressed='true'] .motion-off { display: inline; }
.motion-button:disabled { opacity: .6; }
.volume-off { display: none; }
.music-button.muted .volume-on { display: none; }
.music-button.muted .volume-off { display: block; }
.progress-track { position: fixed; z-index: 5; top: calc(58px + env(safe-area-inset-top)); left: 0; right: 0; height: 1px; background: rgba(255,255,255,.08); }
.progress-track span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--leaf), var(--rose)); transition: width .45s ease; }
.chapters { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
.chapter { position: relative; min-height: 100svh; padding: calc(88px + env(safe-area-inset-top)) 22px calc(42px + env(safe-area-inset-bottom)); scroll-margin-top: 58px; display: flex; flex-direction: column; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .48s ease; }
.chapter:not(.is-active) { transition: none; visibility: hidden; }
.chapter.is-active { opacity: 1; visibility: visible; pointer-events: auto; }
.letter-scene { min-height: 94svh; justify-content: center; padding-top: 74px; }
.letter-board { width: min(100%, 950px); min-height: min(78svh, 680px); margin: auto; position: relative; display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; overflow: hidden; isolation: isolate; background: linear-gradient(180deg, rgba(5, 16, 11, .48), rgba(5, 16, 11, .78)), url('assets/backgrounds/letter-pages.jpg') center 52% / cover no-repeat, #09281e; border: 1px solid rgba(219, 233, 215, .12); box-shadow: inset 0 0 100px rgba(0,0,0,.34), 0 24px 80px rgba(0,0,0,.28); }
.letter-board::after { content: ''; z-index: -1; position: absolute; inset: 12px; border: 1px solid rgba(221, 230, 208, .1); }
.letter-kicker { color: #c5d3bd; opacity: .7; margin: 0 0 21px; }
.letter-board h1 { margin: 0; max-width: 100%; padding: 0 14px; font-family: 'STKaiti', 'KaiTi', 'Kaiti SC', cursive; font-size: 38px; font-weight: 400; line-height: 1.35; text-shadow: 0 0 1px rgba(255,255,255,.6), 0 0 22px rgba(211, 235, 204, .1); }
.letter-english { margin: 10px 0 23px; color: #d6dacb; font-family: 'STKaiti', 'KaiTi', cursive; font-size: 28px; font-style: italic; transform: rotate(-3deg); }
.letter-english span { color: #ed6665; font-family: sans-serif; font-style: normal; font-size: .83em; display: inline-block; transform: rotate(10deg); }
.chalk-line { width: min(60%, 270px); height: 1px; background: linear-gradient(90deg, transparent, rgba(232, 231, 211, .56), transparent); margin: 0 0 22px; }
.letter-dedication { color: #e3e4d7; font-size: 14px; line-height: 1.9; margin: 0; }
.chalk-dust { position: absolute; color: rgba(222, 233, 214, .33); }
.dust-one { left: 15%; top: 17%; font-size: 21px; }.dust-two { right: 14%; bottom: 19%; font-size: 28px; }
.begin-story { position: absolute; bottom: 32px; border: 0; background: transparent; color: #aebdae; font-size: 12px; cursor: pointer; animation: nudge 1.8s ease-in-out infinite; }
.begin-story span { padding-left: 9px; color: var(--rose); }

.memory-scene {
  height: 100svh;
  min-height: 100svh;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  padding: calc(78px + env(safe-area-inset-top)) clamp(18px, 4vw, 58px) max(155px, calc(145px + env(safe-area-inset-bottom)));
  display: grid;
  gap: clamp(12px, 2.2vw, 28px);
  align-items: stretch;
  isolation: isolate;
  contain: layout paint;
}
.scene-copy {
  position: relative;
  z-index: 3;
  width: 100%;
  min-width: 0;
  max-width: 520px;
  align-self: center;
  justify-self: center;
  padding: clamp(14px, 2vw, 24px);
  border: 1px solid rgba(233, 219, 194, .17);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(8, 17, 15, .97), rgba(19, 31, 25, .94));
  box-shadow: 0 18px 50px rgba(0, 0, 0, .24), inset 0 1px rgba(255, 255, 255, .035);
  backdrop-filter: blur(12px);
}
.scene-heading { margin: 0 auto 7px; width: 100%; }
.scene-heading h2 { margin: 0; font-size: clamp(23px, 2.6vw, 34px); font-weight: 400; line-height: 1.42; }
.narration { width: 100%; margin: 0; color: #c8cabe; font-size: clamp(13px, 1.25vw, 15px); font-weight: 300; line-height: 1.78; }

/* The gallery wrapper disappears from layout so the copy and every photo in a
   chapter can share one cinematic grid. All source images remain uncropped. */
.gallery { display: contents; }
.gallery figure {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}
.photo-mount,
.gallery figure > .photo-button {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
}
.photo-button {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
  cursor: zoom-in;
  max-width: 100%;
  max-height: 100%;
  justify-self: center;
  align-self: center;
}
.photo-button img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  padding: 0;
  border: 1px solid rgba(236, 220, 192, .26);
  border-radius: 3px;
  background: transparent;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .28);
  object-fit: contain;
}
.motion-gallery { touch-action: pan-y pinch-zoom; }
.gallery-ready .photo-mount { opacity: 0; transform: translate3d(0, 24px, 0) rotate(var(--photo-tilt)) scale(.96); }
.is-active .gallery-ready .photo-mount { animation: photo-arrive 1.05s cubic-bezier(.22,1,.36,1) var(--photo-delay) both; }
.motion-gallery .photo-button img { animation: photo-float 6s ease-in-out infinite alternate both; animation-play-state: paused; }
.motion-gallery figure:nth-child(even) .photo-button img { animation-direction: alternate-reverse; }
.is-active .gallery-ready .photo-button img { animation-play-state: running; }
.photos-paused .photo-mount { opacity: 1; transform: none; }
.photos-paused .photo-mount,
.photos-paused .motion-gallery .photo-button img { animation-play-state: paused !important; transform: none !important; }
.is-active .gallery-ready.motion-settled .photo-mount,
body.reduce-motion .is-active .gallery-ready .photo-mount { opacity: 1; transform: none; animation: none; }
.photo-button:focus-visible { outline: 2px solid var(--rose); outline-offset: 4px; }

.memory-feature { grid-template-columns: minmax(0, 1fr) minmax(235px, .78fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.memory-feature .scene-copy { grid-column: 2; grid-row: 1; text-align: center; }
.memory-feature .gallery figure:nth-child(1) { grid-column: 1; grid-row: 1; }
.memory-feature .gallery figure:nth-child(2) { grid-column: 3; grid-row: 1; }

.memory-pair-a { grid-template-columns: minmax(0, .92fr) minmax(260px, 1.08fr); grid-template-rows: minmax(0, 1fr) auto; }
.memory-pair-a .gallery figure:nth-child(1) { grid-column: 1; grid-row: 1 / 3; }
.memory-pair-a .gallery figure:nth-child(2) { grid-column: 2; grid-row: 1; }
.memory-pair-a .scene-copy { grid-column: 2; grid-row: 2; }

.memory-single { grid-template-columns: minmax(0, 1.12fr) minmax(260px, .88fr); grid-template-rows: minmax(0, 1fr); }
.memory-single .gallery figure { grid-column: 1; grid-row: 1; }
.memory-single .scene-copy { grid-column: 2; grid-row: 1; }

.memory-pair-b { grid-template-columns: minmax(250px, .84fr) minmax(0, 1.16fr); grid-template-rows: auto minmax(0, 1fr); }
.memory-pair-b .scene-copy { grid-column: 1; grid-row: 1; }
.memory-pair-b .gallery figure:nth-child(1) { grid-column: 1; grid-row: 2; }
.memory-pair-b .gallery figure:nth-child(2) { grid-column: 2; grid-row: 1 / 3; }

.memory-trio { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr) auto minmax(0, .55fr); }
.memory-trio .gallery figure:nth-child(1) { grid-column: 1; grid-row: 1; }
.memory-trio .gallery figure:nth-child(2) { grid-column: 2; grid-row: 1; }
.memory-trio .scene-copy { grid-column: 1 / 3; grid-row: 2; max-width: 720px; text-align: center; }
.memory-trio .gallery figure:nth-child(3) { grid-column: 1 / 3; grid-row: 3; }

.letter-board h1 { perspective: 900px; }
.fold-letter { display: inline-block; transform-origin: 50% 0; }
.typed-visual { white-space: pre-wrap; }
.ending-line { display: block; }
.ending-scene { padding-bottom: 100px; }
.memory-film { width: min(100%, 500px); margin: 0; }
.film-divider { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0 0 18px; color: #c7b69d; font: 9px Arial, sans-serif; letter-spacing: .18em; }
.film-divider::before, .film-divider::after { content: ''; width: 35px; height: 1px; background: linear-gradient(90deg, transparent, #a59176); }
.film-divider::after { transform: rotate(180deg); }
.film-frame { position: relative; margin-inline: auto; padding: 6px; border: 1px solid rgba(223,201,170,.3); border-radius: 5px; background: #080e0c; box-shadow: 0 18px 60px rgba(0,0,0,.4), 0 0 40px rgba(231,132,121,.05); overflow: hidden; }
.film-frame video { display: block; width: 100%; max-height: 52svh; aspect-ratio: var(--video-aspect, 16 / 9); object-fit: contain; background: #080e0c; border-radius: 2px; }
.video-play-fallback { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); min-height: 48px; padding: 0 18px; border: 1px solid rgba(244, 218, 194, .55); border-radius: 999px; color: #f5e8d5; background: rgba(11, 18, 15, .82); box-shadow: 0 10px 30px rgba(0,0,0,.35); font-size: 12px; cursor: pointer; }
.film-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.film-caption { text-align: left; color: #b7bbaa; font-size: 11px; }
.video-sound { min-height: 44px; padding: 0 13px; color: #e2cbb4; border: 1px solid rgba(223,201,170,.3); border-radius: 24px; background: rgba(12,20,16,.6); font-size: 11px; cursor: pointer; }
.video-status { color: #d9c7b2; font-size: 11px; line-height: 1.8; }

.ending-scene.film-focus { position: fixed; z-index: 10; inset: 0; width: 100%; height: 100svh; height: 100dvh; min-height: 0; padding: 0; display: grid; place-items: center; overflow: hidden; background: #030706; }
.ending-scene.film-focus .ending-copy,
.ending-scene.film-focus > h2,
.ending-scene.film-focus > .restart-button { display: none; }
.ending-scene.film-focus .memory-film { position: relative; width: 100%; max-width: none; height: 100%; display: grid; place-items: center; }
.ending-scene.film-focus .film-divider,
.ending-scene.film-focus .film-actions { display: none; }
.ending-scene.film-focus .film-frame { width: min(100vw, calc(100dvh * var(--video-ratio, .46))); height: min(100dvh, calc(100vw / var(--video-ratio, .46))); aspect-ratio: var(--video-aspect, 592 / 1280); padding: 0; border-color: rgba(223,201,170,.12); border-radius: 0; box-shadow: 0 20px 80px rgba(0,0,0,.58); }
.ending-scene.film-focus .film-frame video { width: 100%; height: 100%; max-height: none; border-radius: 0; }
.ending-scene.film-focus .video-status { position: fixed; z-index: 2; left: 16px; right: 16px; bottom: max(18px, env(safe-area-inset-bottom)); text-align: center; }
.video-stage.video-ended .ending-scene.film-focus > .restart-button { display: block; position: fixed; z-index: 12; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); margin: 0; white-space: nowrap; background: rgba(5, 12, 10, .78); backdrop-filter: blur(12px); }
.video-stage .story-bar,
.video-stage .progress-track,
.video-stage .player-controls { opacity: 0; pointer-events: none; }
.video-stage { overflow: hidden; }
.video-stage .story-bar,
.video-stage .progress-track,
.video-stage .player-controls,
.video-stage #music-toggle { visibility: hidden; }

.ending-scene { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); grid-template-rows: auto auto; column-gap: clamp(12px, 3vw, 34px); row-gap: 18px; align-content: center; align-items: center; text-align: left; background: linear-gradient(180deg, rgba(5, 12, 10, .42), rgba(5, 12, 10, .79)), url('assets/backgrounds/ending-hearts.jpg') center 45% / cover no-repeat; }
.ending-copy { grid-column: 1; grid-row: 1; width: 100%; }
.ending-scene .memory-film { grid-column: 2; grid-row: 1; width: 100%; }
.ending-scene .restart-button { grid-column: 1 / -1; grid-row: 2; justify-self: center; margin-top: 0; }
.ending-mark { color: #e47f78; font-size: 29px; margin-bottom: 20px; animation: heartbeat 2s ease-in-out infinite; }
.ending-scene h2 { margin: 8px 0 28px; font-size: 27px; font-weight: 400; line-height: 1.9; }
.video-placeholder { width: min(100%, 500px); aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; border: 1px solid rgba(222,230,214,.2); background: linear-gradient(145deg, rgba(30,49,39,.9), rgba(12,23,18,.96)); color: #d8ded3; }
.film-icon { width: 42px; height: 42px; border: 1px solid rgba(226,234,216,.58); border-radius: 50%; display: grid; place-items: center; }
.film-icon span { width: 0; height: 0; border-top: 7px solid transparent; border-bottom: 7px solid transparent; border-left: 10px solid #dfe7d9; margin-left: 3px; }
.video-placeholder p { margin: 5px 0 0; font-size: 13px; }.video-placeholder > span { color: #849287; font: 9px Arial, sans-serif; }
.restart-button { margin-top: 28px; border: 1px solid rgba(222,230,214,.3); background: transparent; padding: 10px 20px; color: #c5cec1; font-size: 12px; cursor: pointer; }.restart-button span { color: var(--rose); padding-left: 8px; }

.player-controls { position: fixed; z-index: 6; bottom: max(13px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; gap: 9px; padding: 7px; border: 1px solid rgba(228,232,220,.12); background: rgba(13, 21, 18, .86); backdrop-filter: blur(20px); border-radius: 40px; }
.control-button { width: 42px; aspect-ratio: 1; border: 0; border-radius: 50%; background: transparent; color: #d7ddd3; font-family: Arial, sans-serif; font-size: 20px; cursor: pointer; }.control-button:hover { background: rgba(255,255,255,.1); }.play-control { width: 48px; border: 1px solid rgba(212, 228, 208, .25); color: #c8d9c7; font-size: 15px; }.play-symbol { display: none; font-size: 13px; }.player-controls.paused .play-symbol { display: inline; }.player-controls.paused .pause-symbol { display: none; }

.lightbox { width: 100%; height: 100%; max-width: none; max-height: none; padding: max(60px, env(safe-area-inset-top)) 54px max(45px, env(safe-area-inset-bottom)); border: 0; background: rgba(3, 7, 6, .96); color: white; place-items: center; }
.lightbox[open] { display: grid; }
.lightbox::backdrop { background: rgba(0,0,0,.94); }.lightbox img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox button { position: absolute; display: grid; place-items: center; border: 0; background: transparent; color: #e5e8e0; cursor: pointer; }.lightbox-close { top: max(15px, env(safe-area-inset-top)); right: 18px; width: 42px; height: 42px; font: 32px Arial, sans-serif; }.lightbox-prev, .lightbox-next { top: 50%; transform: translateY(-50%); font: 45px Arial, sans-serif; width: 42px; height: 64px; }.lightbox-prev { left: 4px; }.lightbox-next { right: 4px; }

@keyframes breathe { to { opacity: .7; transform: scale(1.04); } }
@keyframes drift { to { transform: translate(14px, -20px); opacity: .85; } }
@keyframes bloom { 0% { transform: translate(-50%,-50%) scale(.3); opacity: .9; } 100% { transform: translate(-50%,-50%) scale(28); opacity: 0; } }
@keyframes nudge { 0%,100% { transform: translateY(0); } 50% { transform: translateY(5px); } }
@keyframes heartbeat { 0%,100% { transform: scale(1); } 14% { transform: scale(1.16); } 28% { transform: scale(1); } 42% { transform: scale(1.1); } }
@keyframes photo-arrive { from { opacity: 0; transform: translate3d(0,32px,0) rotate(var(--photo-tilt)) scale(.94); } to { opacity: 1; transform: translate3d(0,0,0) rotate(0deg) scale(1); } }
@keyframes photo-float { from { transform: translate3d(0,5px,0) rotate(-.7deg); } to { transform: translate3d(0,-5px,0) rotate(.7deg); } }
@keyframes photo-push { from { transform: scale(1); } to { transform: scale(1.025); } }
@keyframes canopy-breathe { from { transform: translateY(1px) scale(1); } to { transform: translateY(-2px) scale(1.015); } }
@keyframes blossom-twinkle { from { opacity: .78; transform: scale(.9) rotate(-4deg); } to { opacity: 1; transform: scale(1.08) rotate(4deg); } }
@keyframes star-sparkle { 0% { opacity: .5; transform: scale(.58) rotate(-15deg); } 45% { opacity: 1; transform: scale(1.42) rotate(0); } 100% { opacity: .74; transform: scale(.88) rotate(16deg); } }
@keyframes star-aura { from { opacity: .32; transform: scale(.62); } to { opacity: 1; transform: scale(1.34); } }

@media (min-width: 760px) {
  .gate-content { transform: translateY(-3vh); }
  .gate h1 { font-size: 42px; }
  .star-title { font-size: 58px; }
  .story-bar { padding-inline: 36px; }
  .chapter { padding-inline: 8vw; }
  .letter-board { min-height: min(78vh, 720px); }
  .letter-board h1 { font-size: 76px; }
  .letter-english { font-size: 42px; }
  .scene-heading h2 { font-size: 34px; }
  .ending-scene h2 { font-size: 38px; }
  .player-controls { bottom: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .motion-gallery figure { transform: none; opacity: 1; }
  .motion-gallery .photo-mount, .motion-gallery .photo-button, .motion-gallery .photo-button img { animation: none; }
  .star-title { filter: none; }
  .heart-tree { opacity: .88; transform: translate(-50%, 0) scaleY(1); }
  .tree-particle { opacity: .94; transform: translate(-50%, -50%) rotate(var(--r)) scale(1); transition: none; }
  .heart-tree-canopy { animation: none; }
}
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { scroll-behavior: auto !important; animation: none !important; transition-duration: .01ms !important; }
body.reduce-motion .motion-gallery figure { transform: none; opacity: 1; }
body.reduce-motion .star-title { filter: none; }
body.reduce-motion .heart-tree { opacity: .92; transform: translate(-50%, 0) scaleY(1); }
body.reduce-motion .tree-particle { opacity: .94; transform: translate(-50%, -50%) rotate(var(--r)) scale(1); transition: none; }
body.reduce-motion .heart-tree-canopy { animation: none; }

/* Mobile collage: one module appears as a complete composition. The first
   module is always image one | narration | image two. */
@media (max-width: 759px) {
  .memory-scene {
    padding: calc(65px + env(safe-area-inset-top)) 10px calc(150px + env(safe-area-inset-bottom));
    display: grid;
    gap: 8px;
    align-items: stretch;
    justify-content: stretch;
  }

  .memory-scene .scene-copy {
    width: 100%;
    min-width: 0;
    max-width: none;
    padding: 11px 10px;
    margin: 0;
    border-radius: 13px;
  }

  .scene-heading { margin: 0 auto 4px; }
  .scene-heading h2 { font-size: clamp(17px, 5vw, 21px); line-height: 1.25; }
  .narration { font-size: clamp(10px, 3vw, 12.5px); line-height: 1.5; }
  .photo-button img { padding: 0; border-radius: 3px; box-shadow: 0 9px 22px rgba(0,0,0,.3); }

  .memory-feature {
    grid-template-columns: minmax(0, 1fr) minmax(124px, .92fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }
  .memory-feature .scene-copy { grid-column: 2; grid-row: 1; text-align: center; }
  .memory-feature .gallery figure:nth-child(1) { grid-column: 1; grid-row: 1; }
  .memory-feature .gallery figure:nth-child(2) { grid-column: 3; grid-row: 1; }

  .memory-pair-a {
    grid-template-columns: minmax(0, .88fr) minmax(0, 1.12fr);
    grid-template-rows: minmax(0, 1fr) auto;
  }
  .memory-pair-a .gallery figure:nth-child(1) { grid-column: 1; grid-row: 1 / 3; }
  .memory-pair-a .gallery figure:nth-child(2) { grid-column: 2; grid-row: 1; }
  .memory-pair-a .scene-copy { grid-column: 2; grid-row: 2; }

  .memory-single {
    grid-template-columns: minmax(0, 1.18fr) minmax(118px, .82fr);
    grid-template-rows: minmax(0, 1fr);
  }
  .memory-single .gallery figure { grid-column: 1; grid-row: 1; }
  .memory-single .scene-copy { grid-column: 2; grid-row: 1; }

  .memory-pair-b {
    grid-template-columns: minmax(110px, .82fr) minmax(0, 1.18fr);
    grid-template-rows: auto minmax(0, 1fr);
  }
  .memory-pair-b .scene-copy { grid-column: 1; grid-row: 1; }
  .memory-pair-b .gallery figure:nth-child(1) { grid-column: 1; grid-row: 2; }
  .memory-pair-b .gallery figure:nth-child(2) { grid-column: 2; grid-row: 1 / 3; }

  .memory-trio {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr) auto minmax(0, .55fr);
  }
  .memory-trio .gallery figure:nth-child(1) { grid-column: 1; grid-row: 1; }
  .memory-trio .gallery figure:nth-child(2) { grid-column: 2; grid-row: 1; }
  .memory-trio .scene-copy { grid-column: 1 / 3; grid-row: 2; }
  .memory-trio .gallery figure:nth-child(3) { grid-column: 1 / 3; grid-row: 3; }

  .ending-scene {
    padding-inline: 12px;
    column-gap: 10px;
    row-gap: 10px;
  }
  .ending-scene h2 { margin: 5px 0 0; font-size: clamp(16px, 5vw, 24px); line-height: 1.65; }
  .ending-mark { margin-bottom: 8px; font-size: 24px; }
  .ending-scene .memory-film { align-self: center; }
  .ending-scene .film-divider { gap: 5px; margin-bottom: 8px; font-size: 7px; letter-spacing: .12em; }
  .ending-scene .film-divider::before, .ending-scene .film-divider::after { width: 13px; }
  .ending-scene .film-frame { padding: 3px; }
  .ending-scene .film-actions { flex-direction: column; align-items: stretch; gap: 5px; margin-top: 6px; }
  .ending-scene .film-caption { font-size: 9px; line-height: 1.35; }
  .ending-scene .video-sound { min-height: 34px; padding: 0 5px; font-size: 9px; }
  .ending-scene .restart-button { font-size: 10px; padding: 8px 15px; }
}

@media (max-width: 759px) and (max-height: 640px) {
  .memory-scene {
    padding-top: calc(62px + env(safe-area-inset-top));
    padding-bottom: calc(146px + env(safe-area-inset-bottom));
  }

  .scene-heading h2 { font-size: 16px; line-height: 1.2; }
  .narration { font-size: 10.5px; line-height: 1.42; }
  .memory-scene .scene-copy { padding: 8px 7px; }
}

/* r3 2026-10-23: full-screen film mode uses one grid cell, so the video is centred
   and complete on phones (it was pushed into the right column and cropped). */
.ending-scene.film-focus { grid-template-columns: 100%; grid-template-rows: 100%; }
.ending-scene.film-focus .memory-film { grid-column: 1; grid-row: 1; }
@supports not (height: 100dvh) {
  .ending-scene.film-focus { height: 100vh; }
  .ending-scene.film-focus .film-frame { width: min(100vw, calc(100vh * var(--video-ratio, .46))); height: min(100vh, calc(100vw / var(--video-ratio, .46))); }
}

/* r4 2026-10-23: in full-screen film mode keep the sound button and notice at the top,
   clear of the browser's own play button and control bar. */
.ending-scene.film-focus .video-play-fallback { top: calc(env(safe-area-inset-top) + 22px); transform: translateX(-50%); z-index: 3; white-space: nowrap; }
.ending-scene.film-focus .video-status { top: calc(env(safe-area-inset-top) + 82px); bottom: auto; text-shadow: 0 1px 6px rgba(0,0,0,.9); }
