@font-face{font-family:MaruBuri;src:url('./assets/fonts/MaruBuri-Regular.otf') format('opentype');font-display:swap}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%;background:#080607;color:#f1e8df}
.opening{position:relative;isolation:isolate;margin:auto;width:100%;max-width:540px;height:100vh;height:100dvh;overflow:hidden;background:#080607}
video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center}
.shade{position:absolute;inset:0;pointer-events:none;background:linear-gradient(180deg,#0002,transparent 20%,transparent 62%,#08060740 80%,#080607b3)}
.preview-label{position:absolute;top:calc(env(safe-area-inset-top) + 20px);left:24px;margin:0;font:11px/1.5 sans-serif;letter-spacing:.06em;color:#c6ae9c}
.preview-label span{color:#a0938a}
h1{position:absolute;left:16px;right:16px;bottom:calc(env(safe-area-inset-bottom) + 23%);margin:0;text-align:center;font:400 clamp(19px,5.1vw,27px)/1.85 MaruBuri,serif;letter-spacing:-.035em;text-shadow:0 2px 14px #000}
h1 span{display:inline-block;min-height:1.85em;white-space:pre;text-align:left}
.opening[data-scene="5"] #opening-copy,.opening[data-scene="6"] #opening-copy{width:100%;text-align:center}
h1 span .letter{visibility:hidden}
h1 span .letter.visible{visibility:visible}
footer{position:absolute;left:20px;right:20px;bottom:calc(env(safe-area-inset-bottom) + 24px);text-align:center}
#status{margin:0 0 12px;font:12px/1.5 sans-serif;color:#c6b9ad}
button{min-height:44px;padding:10px 20px;border:1px solid #b59a6959;border-radius:30px;background:#140e12b3;color:#dfcdb5;font:12px/1.5 sans-serif;cursor:pointer}
button:focus-visible{outline:2px solid #dfcdb5;outline-offset:5px}
@media(prefers-reduced-motion:reduce){h1 span{transition:none;transform:none}}
#film-memory,#film-two,#film-four{opacity:0;transition:opacity 850ms ease;pointer-events:none}
#film-memory{transition-duration:300ms}
.opening[data-scene="3"] #film-memory,.opening[data-scene="6"] #film-memory,.opening[data-scene="7"] #film-memory{opacity:1}
.opening[data-scene="6"] #film-two,.opening[data-scene="7"] #film-two{opacity:1}
.opening[data-scene="3"] .shade{background:linear-gradient(180deg,#0001,transparent 35%,#08060738 55%,#080607b8 82%,#080607db)}
.vignette{position:absolute;inset:0;pointer-events:none;opacity:0;background:radial-gradient(ellipse at 50% 33%,transparent 23%,#08060724 58%,#08060780 100%);transition:opacity 850ms ease}
.opening[data-scene="7"] #film-four{opacity:1}
.opening[data-scene="7"] .vignette{opacity:1}
.opening[data-scene="7"] h1{top:58%;bottom:auto;font-size:clamp(23px,6vw,31px);line-height:1.55}
.opening[data-scene="7"] h1 span{min-height:1.6em}
#relationship-panel{position:absolute;top:73%;bottom:calc(env(safe-area-inset-bottom) + 65px);left:24px;right:24px;overflow:auto;scrollbar-width:thin}
[hidden]{display:none!important}
.relationship-options{display:grid;gap:10px}
.relationship-options button{width:100%;min-height:54px;padding:12px 10px;border:1px solid #e4c9b64f;border-radius:8px;background:#3b2224bb;backdrop-filter:blur(10px);color:#f8eade;font:14px/1.55 Arial,'Malgun Gothic',sans-serif;word-break:keep-all;transition:background .2s,border-color .2s}
.relationship-options button:hover,.relationship-options button[aria-pressed="true"]{border-color:#dfbd8e;background:#7a4542dc;color:#fff0d9}
@media(prefers-reduced-motion:reduce){.relationship-options button{transition:none}}
#selection-status,.preview-note{margin:8px 0;text-align:center;font:11px/1.5 sans-serif;color:#d0c1b4}
.preview-note{color:#a99c92}
@media(prefers-reduced-motion:reduce){#film-four{transition:none}}
@media(prefers-reduced-motion:reduce){#film-memory,#film-two,.vignette{transition:none}}



.opening[data-view=loading]>video,.opening[data-view=loading]>.shade,.opening[data-view=loading]>.vignette,.opening[data-view=loading]>.preview-label,.opening[data-view=loading]>h1,.opening[data-view=loading]>footer{visibility:hidden}
#loading-panel{position:absolute;inset:0;z-index:10;display:flex;flex-direction:column;align-items:center;overflow-y:auto;padding:calc(env(safe-area-inset-top) + 34px) 24px calc(env(safe-area-inset-bottom) + 24px);background:#140e14 url('./assets/opening/loading-background.png') center / cover no-repeat;text-align:center}
.loading-brand{margin:0;color:#b79d83;font:12px/1.5 MaruBuri,serif;letter-spacing:.16em}
.loading-center{width:100%;margin:auto;padding:44px 0}
.loading-tablets{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:22px;width:min(100%,340px);margin:0 auto 38px}
.fate-tablet{position:relative;isolation:isolate;overflow:hidden;min-height:280px;display:flex;flex-direction:column;align-items:center;padding:25px 14px 21px;border:1px solid #ac875c70;border-radius:3px;background:linear-gradient(150deg,#38202bcc,#20121ef2 60%,#291725e6);box-shadow:0 15px 38px #0005,inset 0 0 26px #100a1233;animation:tablet-enter 1s .15s both}
.fate-tablet:nth-child(2){animation-delay:.7s}
.fate-tablet:before{content:'';position:absolute;inset:6px;border:1px solid #b59a6924;pointer-events:none;z-index:-1}
.fate-tablet:after{content:'';position:absolute;inset:-10%;z-index:-1;pointer-events:none;background:linear-gradient(115deg,transparent 10%,#e3bc7930 45%,#ffe1a540 50%,transparent 80%);opacity:0;animation:tablet-light 7s ease-in-out infinite}
.fate-tablet:nth-child(2):after{animation-delay:3.5s}
.tablet-caption{font:10px/1.7 MaruBuri,serif;color:#c8aa86;letter-spacing:.06em}
.tablet-mark{margin:19px 0 13px;color:#c4a273;font-size:19px}
.tablet-name{display:block;width:100%;margin:auto 0;padding:14px 0 24px;font:400 clamp(20px,5.5vw,28px)/1.6 MaruBuri,serif;color:#f4e5d3;overflow-wrap:anywhere;word-break:normal;text-shadow:0 2px 12px #0005}
.tablet-foot{font:9px/1.6 MaruBuri,serif;color:#a48a7c;letter-spacing:.06em}
@keyframes tablet-enter{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}
@keyframes tablet-light{0%,45%,100%{opacity:0;transform:translateX(-20%)}15%,25%{opacity:1}40%{opacity:0;transform:translateX(20%)}}
#loading-title{margin:0;font:400 clamp(21px,5.4vw,27px)/1.65 MaruBuri,serif;letter-spacing:-.025em;outline:none}
.loading-subtitle{margin:15px 0 0;font:12px/1.8 sans-serif;color:#ab979e}
.loading-controls{flex-shrink:0;width:100%;color:#9b8992;font:10px/1.7 sans-serif}
.loading-controls p{margin:0 0 12px}
.loading-controls button{margin:4px;font-size:11px;background:transparent;color:#c9b5a4}
 .motion-paused .fate-tablet:after{animation-play-state:paused}
@media(max-height:650px){.loading-center{padding:20px 0}.fate-tablet{min-height:220px;padding-top:18px}.loading-tablets{margin-bottom:24px}.tablet-mark{margin:10px 0 5px}}
@media(prefers-reduced-motion:reduce){.fate-tablet,.fate-tablet:after{animation:none}#loading-motion{display:none}}


/* Book film loading: captions roll below the book, as in the compatibility intro. */
#loading-panel{background:#140e14;isolation:isolate}
#loading-video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:-2}
.loading-video-shade{position:absolute;inset:0;z-index:-1;background:linear-gradient(180deg,#140c1010 30%,#140c1033 55%,#140c10c9 79%,#140c10ef)}
.loading-brand,.loading-controls{position:relative}
#loading-panel .loading-center{margin-top:auto;margin-bottom:0;padding:36px 0 26px}
#loading-title.loading-rolling{display:grid;overflow:hidden;min-height:3.3em;font-size:clamp(20px,5.2vw,25px);text-shadow:0 2px 12px #0009}
.loading-line{display:block;grid-area:1/1;align-self:center;overflow-wrap:anywhere;word-break:keep-all}
.loading-line.is-entering{animation:book-line-in .5s ease both}
.loading-line.is-leaving{animation:book-line-out .5s ease both}
@keyframes book-line-in{from{opacity:0;transform:translateY(100%)}to{opacity:1;transform:translateY(0)}}
@keyframes book-line-out{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-100%)}}
.motion-paused .loading-line{animation-play-state:paused}
@media(prefers-reduced-motion:reduce){.loading-line.is-entering,.loading-line.is-leaving{animation:none}}


/* The seated guidance continues into the question without a visual cut. */
.opening[data-scene="6"] h1{bottom:22%;font-size:clamp(21px,5.4vw,29px);line-height:1.7}
.opening[data-scene="7"] h1{top:48%;font-size:clamp(21px,5.4vw,28px)}
#relationship-panel{top:62%}

/* Four films followed by the question on the seated film's last frame. */
#film-standing{opacity:0;transition:opacity 500ms ease;pointer-events:none}
.opening[data-scene="5"] #film-memory{opacity:1}
.opening[data-scene="5"] #film-standing,.opening[data-scene="6"] #film-standing,.opening[data-scene="7"] #film-standing{opacity:1}
@media(prefers-reduced-motion:reduce){#film-standing{transition:none}}

.story-fields{display:grid;gap:8px;text-align:left}
.story-fields label{font:14px/1.5 MaruBuri,serif;color:#f1e8df}
.story-fields label:not(:first-child){margin-top:8px}
.story-fields select{width:100%;min-height:46px;padding:10px 12px;border:1px solid #b59a6970;border-radius:8px;background:#1b1219;color:#f1e8df;font:14px/1.5 sans-serif;color-scheme:dark}
.story-fields select:focus-visible{outline:2px solid #dfcdb5;outline-offset:2px}
#enter-person{width:100%;margin-top:4px}
#enter-person:disabled{opacity:.45;cursor:default}

/* One question at a time over the still consultation scene. */
.opening[data-scene="7"]>h1{top:39%;font-size:clamp(20px,5vw,26px)}
#relationship-panel{top:52%;padding:18px 16px 22px;background:linear-gradient(#170c0d55,#170c0dd9);border-radius:12px}
.story-navigation{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px;font:12px/1.5 sans-serif;color:#c9b5a4}
#story-back{min-height:36px;padding:4px 10px;background:transparent;border:0}
#story-back:disabled{visibility:hidden}
#story-question{margin:0 0 22px;font:600 clamp(21px,5.7vw,27px)/1.65 MaruBuri,serif;text-align:center;letter-spacing:-.04em;color:#fff8ef;text-shadow:0 2px 10px #0007;word-break:keep-all;outline:none}
#story-step{opacity:1;transition:opacity .2s ease}
.story-changing #story-step{opacity:.35}
@media(prefers-reduced-motion:reduce){#story-step{transition:none}}

/* Invitation stays in scene four; the following screen contains only the questionnaire. */
.opening[data-scene="7"]>h1{display:none}
.opening[data-scene="7"] #relationship-panel{top:48%;animation:question-screen-in .5s ease both}
@keyframes question-screen-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
@media(prefers-reduced-motion:reduce){.opening[data-scene="7"] #relationship-panel{animation:none}}

/* Anchor the questionnaire to the lower edge; long option lists scroll inside. */
.opening[data-scene="7"] #relationship-panel{top:auto;bottom:calc(env(safe-area-inset-bottom) + 76px);max-height:65%;left:16px;right:16px;overflow-y:auto;overscroll-behavior:contain}
@media(max-height:700px){#story-question{font-size:21px;margin-bottom:18px}.relationship-options{gap:8px}.relationship-options button{min-height:46px;padding:9px 10px}#relationship-panel{padding-top:12px}}

#film-door{opacity:0;transition:opacity .5s ease;pointer-events:none}
.opening[data-scene="4"] #film-memory,.opening[data-scene="4"] #film-door,.opening[data-scene="5"] #film-door,.opening[data-scene="6"] #film-door,.opening[data-scene="7"] #film-door{opacity:1}
#enter-room{position:absolute;z-index:3;bottom:calc(env(safe-area-inset-bottom) + 100px);left:22px;right:22px;width:calc(100% - 44px);min-height:68px;padding:20px 24px;border:0;border-radius:14px;font:600 20px/1.4 MaruBuri,serif;letter-spacing:.02em;background:#743b38;color:#fff7ed;box-shadow:none;text-shadow:none;transition:filter .2s ease}
#enter-room:hover{filter:brightness(1.1)}
#enter-room:active{filter:brightness(.95)}
@media(prefers-reduced-motion:reduce){#enter-room{transition:none}}
.opening[data-scene="4"]>h1{display:none}
@media(prefers-reduced-motion:reduce){#film-door{transition:none}}

.opening[data-scene="4"]>h1{display:block;opacity:1;transition:opacity .7s ease}
.opening[data-scene="4"].door-copy-faded>h1{opacity:0}
@media(prefers-reduced-motion:reduce){.opening[data-scene="4"]>h1{transition:none}}

/* New opening leads into the trimmed phone scene. */
.opening>#film{opacity:0;transition:opacity .35s ease}
.opening[data-scene="2"]>#film,.opening[data-scene="3"]>#film,.opening[data-scene="4"]>#film,.opening[data-scene="5"]>#film,.opening[data-scene="6"]>#film,.opening[data-scene="7"]>#film{opacity:1}
.opening[data-scene="1"]>h1{display:block}
@media(prefers-reduced-motion:reduce){.opening>#film{transition:none}}
