.story-entrance{position:absolute;inset:0;z-index:20;background:#080e15;overflow:hidden;animation:story-appear .35s ease both}
.story-entrance video{display:block;width:100%;height:100%;object-fit:cover;object-position:center}
.story-actions{position:absolute;left:20px;right:20px;bottom:calc(28px + env(safe-area-inset-bottom));display:flex;flex-direction:column;gap:12px;animation:story-appear .45s ease both}
.story-actions[hidden]{display:none}
.story-choice{width:100%;min-height:60px;padding:16px;border:1px solid #ffffff9c;border-radius:18px;background:#cccccc24;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:#fff;font:600 18px/1.5 'Pretendard Variable',sans-serif;text-shadow:0 1px 6px #0005}
.story-skip{align-self:center;min-height:44px;padding:8px 16px;border:0;background:none;color:#fff;font:500 15px/1.5 'Pretendard Variable',sans-serif;text-shadow:0 1px 6px #0008}
.story-actions button:disabled{pointer-events:none}
@keyframes story-appear{from{opacity:0}to{opacity:1}}
@media(prefers-reduced-motion:reduce){.story-entrance,.story-actions{animation:none}}

.story-ruby{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center;opacity:0;pointer-events:none;transition:opacity .3s ease}.story-ended .story-ruby{opacity:1}.story-actions{z-index:2}@media(prefers-reduced-motion:reduce){.story-ruby{transition:none}}
.story-options{display:flex;flex-direction:column;gap:10px}
.story-dialogue{margin:0 0 12px;text-align:center;white-space:pre-line;word-break:keep-all;font:400 clamp(20px,5.7vw,25px)/1.55 SchoolSafeUniverse,sans-serif;color:#fff;text-shadow:0 2px 8px #000,0 0 24px #0009;animation:story-appear .35s ease both}
.story-talking::after{content:'';position:absolute;inset:35% 0 0;pointer-events:none;background:linear-gradient(transparent,#07101b44 40%,#07101ba8)}
.story-talking .story-choice{font-size:16px;min-height:54px;padding:12px}
@media(max-height:600px){.story-dialogue{font-size:19px;line-height:1.4;margin-bottom:6px}.story-actions{bottom:12px;gap:6px}.story-talking .story-choice{min-height:44px;padding:8px}}
.story-dialogue{position:relative;min-height:160px;padding:34px 22px 20px;margin:0 0 14px;text-align:left;border:1px solid #e6d9ff8c;border-radius:14px;background:linear-gradient(130deg,#251d3bea,#302445d9);box-shadow:inset 0 0 22px #bc92e318,0 8px 28px #0003;backdrop-filter:blur(12px);font-size:21px;line-height:1.55;text-shadow:none}
.story-dialogue::before{content:'별의마녀 루비';position:absolute;left:22px;top:10px;font:500 12px/18px 'Pretendard Variable',sans-serif;color:#e8c5f3;letter-spacing:.03em}
.story-options{transition:opacity .3s ease,transform .3s ease}
.story-options.is-pending{visibility:hidden;opacity:0;transform:translateY(8px);pointer-events:none}
.story-skip[hidden]{display:none}
@media(max-height:600px){.story-dialogue{min-height:135px;font-size:18px;padding:32px 18px 14px;margin-bottom:8px}}
@media(prefers-reduced-motion:reduce){.story-options{transition:none}}
.story-entrance .story-ruby-film{position:absolute;inset:0;opacity:0;pointer-events:none;transition:opacity .3s ease}
.story-ended.ruby-film-ready .story-ruby-film{opacity:1}
@media(prefers-reduced-motion:reduce){.story-entrance .story-ruby-film{transition:none}}

.story-ended.ruby-film-ready .story-ruby-film{opacity:1;visibility:visible;transition:none}
.story-ended.ruby-film-ready .story-ruby{opacity:0}
/* Nine-slice frame: keep corner ornaments anchored rather than stretching the button artwork. */
.story-dialogue{isolation:isolate;min-height:164px;padding:38px 32px;margin:0;border:0;border-radius:0;background:none;backdrop-filter:none;box-shadow:none;color:#fff1df;font:400 21px/1.55 SchoolSafeUniverse,sans-serif;text-shadow:0 1px 3px #100b1d99;overflow:visible}
.story-dialogue::before{content:'';position:absolute;inset:9px 10px;z-index:-2;border-radius:8px;background:#07517b url('assets/blue-night-reference.png') center/125% auto no-repeat;filter:hue-rotate(55deg) saturate(.8);box-shadow:0 8px 24px #100b204d}
.story-dialogue::after{content:'';position:absolute;inset:0;z-index:-1;pointer-events:none;border-style:solid;border-color:transparent;border-width:40px 66px;border-image-source:url('assets/silver-moon-scroll-frame.svg?v=no-moons-2');border-image-slice:65 125;border-image-width:40px 66px;border-image-repeat:stretch}
.story-dialogue[hidden],.story-options.is-pending{display:none}
@media(max-height:600px){.story-dialogue{padding:30px 28px;min-height:140px;font-size:18px}}
/* Reserve the complete dialogue footprint before typing begins. */
.story-dialogue{display:grid}
.story-dialogue-text{grid-area:1/1;white-space:pre-line}
.story-dialogue-text::before{content:attr(data-reserve)}
/* Story captions float directly on the film, with no panel or ornamental frame. */
.story-dialogue{display:grid;min-height:0;padding:0 8px;margin:0 0 18px;border:0;border-radius:0;background:none;box-shadow:none;backdrop-filter:none;overflow:visible;text-align:center;color:#fff;font:400 clamp(22px,5.7vw,25px)/1.55 SchoolSafeUniverse,sans-serif;text-shadow:0 2px 7px #000b,0 0 20px #0006}
.story-dialogue::before,.story-dialogue::after,.story-dialogue-text::before{content:none;display:none}
.story-dialogue-text,.story-dialogue-reserve{grid-area:1/1;white-space:pre-line;word-break:keep-all}
.story-dialogue-reserve{visibility:hidden;pointer-events:none;user-select:none}
.story-dialogue[hidden]{display:none}
@media(max-height:600px){.story-dialogue{min-height:0;padding:0 8px;font-size:20px;margin-bottom:12px}}

/* Caption center: 50% of the scene, independent of bottom choices. */
.story-entrance .story-dialogue{position:absolute;left:20px;right:20px;top:50%;z-index:3;transform:translateY(-50%);height:3.1em;min-height:0;margin:0;padding:0;pointer-events:none;animation:none;font-size:clamp(22px,6vw,28px)}
.story-dialogue-text{white-space:pre;word-break:normal;align-self:center}

/* Reveal whole words, then dissolve the caption without an empty pause. */
.story-dialogue-text{opacity:1;transition:opacity .28s ease;text-shadow:0 2px 3px #000,0 0 8px #000e,0 0 18px #000b}
.story-dialogue-text.is-fading-out{opacity:0}
.story-word{opacity:0;animation:story-word-in .32s ease forwards}
@keyframes story-word-in{from{opacity:0}to{opacity:1}}
@media(prefers-reduced-motion:reduce){.story-word{opacity:1;animation:none}.story-dialogue-text{transition:none}}
