/* Static illustrated stages. No looping animation or gameplay-size assumptions. */
#story-scene{position:fixed;inset:0;margin:0;width:100%;max-width:none;height:100%;height:100dvh;max-height:none;padding:0;border:0;color:#f7f5ef;background:#0c1b2b;overflow:auto;overscroll-behavior:contain;font-family:GameText,system-ui,sans-serif}
#story-scene::backdrop{background:#07121e}
#story-scene[open]{display:grid;grid-template-rows:auto minmax(120px,1fr) auto auto;isolation:isolate;padding:max(18px,env(safe-area-inset-top)) max(20px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(20px,env(safe-area-inset-left));box-sizing:border-box}
#story-scene-background{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:-2}
#story-scene::after{content:'';position:absolute;inset:0;z-index:-1;background:linear-gradient(#071522b3,transparent 34%,#07152255 60%,#071522 100%);pointer-events:none}
.story-scene-heading{display:flex;justify-content:space-between;align-items:start;gap:12px;max-width:760px;width:100%;margin:0 auto}
.story-scene-heading small{display:block;color:#ffdc9b;font-size:11px;font-weight:800;letter-spacing:.16em;margin:8px 0}
#story-scene-title{font-size:clamp(23px,5.9vw,36px);line-height:1.12;margin:0;max-width:520px;text-shadow:0 2px 10px #071522}
#story-scene-skip{flex-shrink:0;min-width:64px;min-height:44px;padding:10px 14px;border:1px solid #a4bcc766;border-radius:30px;background:#0b1c2de8;color:#fff;font:700 14px GameText,system-ui,sans-serif}
.story-scene-stage{min-height:0;display:flex;align-items:end;max-width:760px;width:100%;margin:8px auto 0;overflow:hidden;pointer-events:none}
#story-scene-portrait{display:block;width:min(88%,440px);height:100%;max-height:50dvh;object-fit:contain;object-position:center bottom;filter:drop-shadow(0 8px 10px #08182988)}
#story-scene[data-side=right] #story-scene-portrait{margin-left:auto}
.story-scene-dialogue{width:100%;max-width:760px;margin:0 auto;background:#0a192af5;border:1px solid #92b4c266;border-top:3px solid var(--speaker-color,#ffd18d);border-radius:18px;box-shadow:0 12px 32px #0005;overflow:hidden}
#story-scene-advance{display:block;text-align:left;width:100%;min-height:164px;padding:19px 22px 16px;border:0;border-radius:0;background:transparent;color:#f7f5ef;touch-action:manipulation;cursor:pointer;white-space:normal;font-family:inherit}
#story-scene-advance:hover{background:#ffffff05}
#story-scene-advance:focus-visible,#story-scene-skip:focus-visible{outline:3px solid #fff2b0;outline-offset:-5px}
#story-scene-speaker{display:block;margin-bottom:9px;color:var(--speaker-color,#ffd18d);font-size:14px;font-weight:900;letter-spacing:.08em;text-transform:uppercase}
#story-scene-copy{display:block;font-size:clamp(19px,4.8vw,24px);font-weight:500;line-height:1.48}
.story-scene-prompt{display:flex;justify-content:space-between;gap:12px;margin-top:18px;font-size:12px;color:#b9cdd8;font-weight:700}
#story-scene-progress{display:block;width:100%;height:3px;appearance:none;border:0;background:#203447;color:#ffcf8a}
#story-scene-progress::-webkit-progress-bar{background:#203447}#story-scene-progress::-webkit-progress-value{background:#ffcf8a}
#story-scene-location{width:100%;max-width:760px;margin:12px auto 0;color:#c3d4da;font-size:10px;letter-spacing:.12em;line-height:1.4;text-align:center}
@media(min-width:700px) and (min-height:650px){#story-scene[open]{padding-top:max(30px,env(safe-area-inset-top))}.story-scene-stage{margin-top:18px}#story-scene-portrait{width:60%;max-height:52dvh}}
@media(max-height:600px){#story-scene[open]{grid-template-rows:auto minmax(80px,1fr) auto auto;padding-top:max(8px,env(safe-area-inset-top));padding-bottom:max(8px,env(safe-area-inset-bottom))}#story-scene-title{font-size:20px}.story-scene-heading small{margin:2px 0}#story-scene-portrait{max-height:35dvh}#story-scene-advance{min-height:112px;padding:12px 16px}#story-scene-copy{font-size:18px;line-height:1.35}.story-scene-prompt{margin-top:8px}#story-scene-location{margin-top:7px}}
@media(prefers-reduced-motion:reduce){#story-scene *,#story-scene::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
#story-scene{border-radius:0}
#story-scene .story-scene-heading{height:auto;min-height:60px}
#story-scene .story-scene-heading>div{display:block}

/* Action panels and current speaker remain independent presentation layers. */
#story-scene[data-illustrated=true] #story-scene-background{position:static;grid-row:2;grid-column:1;z-index:0;object-fit:contain;min-height:0;max-height:100%;align-self:center}
#story-scene[data-illustrated=true] .story-scene-stage{display:flex;grid-row:3;grid-column:1;z-index:2;align-self:start;width:104px;height:130px;min-height:0;margin:16px 0 0 8px;justify-self:start;background:transparent;border-radius:0;overflow:visible}
#story-scene[data-illustrated=true] #story-scene-portrait{width:100%;height:100%;max-height:none;object-fit:contain;object-position:center bottom;margin:0;filter:none}
#story-scene[data-illustrated=true]::after{display:none}
#story-scene[data-illustrated=true] .story-scene-heading{grid-row:1}
#story-scene[data-illustrated=true] .story-scene-dialogue{grid-row:3;grid-column:1}
#story-scene[data-illustrated=true] #story-scene-location{grid-row:4}
#story-scene[data-illustrated=true] #story-scene-advance{min-height:180px;padding:14px 18px 14px 126px}
#story-scene[data-illustrated=true] #story-scene-copy{font-size:clamp(18px,4.5vw,22px);line-height:1.35}

@media(max-width:370px){#story-scene[data-illustrated=true] .story-scene-stage{width:78px;height:108px;margin-left:6px}#story-scene[data-illustrated=true] #story-scene-advance{padding-left:96px}#story-scene[data-illustrated=true] #story-scene-copy{font-size:18px}}
@media(max-height:500px) and (min-width:600px){#story-scene[data-illustrated=true][open]{grid-template-columns:1fr 1fr;grid-template-rows:auto 1fr auto;gap:8px}#story-scene[data-illustrated=true] .story-scene-heading{grid-column:1/-1}#story-scene[data-illustrated=true] #story-scene-background{grid-column:1;grid-row:2}#story-scene[data-illustrated=true] .story-scene-dialogue,#story-scene[data-illustrated=true] .story-scene-stage{grid-row:2;grid-column:2}#story-scene[data-illustrated=true] #story-scene-location{grid-row:3;grid-column:1/-1}}

/* Contain the complete approved cutout, including ears/antlers and torso.
   Only the bottom edge dissolves into the scene; never translate anatomy
   below a clipping frame. Offset only the measured empty bottom padding. */
#story-scene .story-scene-stage{position:relative;background:transparent;border:0;border-radius:0;opacity:1;overflow:visible}
#story-scene #story-scene-portrait{opacity:1;filter:none;transform:none;box-sizing:border-box;padding:8px;mask-image:linear-gradient(to bottom,#000 0%,#000 calc(94% - var(--portrait-bottom,0%)),transparent calc(100% - var(--portrait-bottom,0%)));-webkit-mask-image:linear-gradient(to bottom,#000 0%,#000 calc(94% - var(--portrait-bottom,0%)),transparent calc(100% - var(--portrait-bottom,0%)))}
#story-scene:not([data-illustrated=true]) .story-scene-stage{align-self:stretch;margin-bottom:0}
#story-scene:not([data-illustrated=true]) #story-scene-portrait{position:absolute;bottom:0;left:0;right:0;width:auto;height:auto;max-width:100%;max-height:min(44dvh,100%);object-fit:contain;object-position:center bottom;margin:0 auto;transform:translateY(var(--portrait-bottom,0%))}
.story-scene-dialogue{position:relative;z-index:3}
/* Current speakers paint above the dialogue surface, with no thumbnail box.
   The action illustration occupies its own row and is never a portrait source. */
#story-scene[data-illustrated=true] .story-scene-stage{z-index:4;width:116px;height:156px;margin:12px 0 0 6px}
#story-scene[data-illustrated=true] #story-scene-portrait{width:auto;height:auto;max-width:100%;max-height:100%;padding:4px;object-position:center bottom;margin:0 auto}
#story-scene[data-illustrated=true] #story-scene-advance{padding-left:132px}
@media(max-width:370px){#story-scene[data-illustrated=true] .story-scene-stage{width:90px;height:130px;margin-left:4px}#story-scene[data-illustrated=true] #story-scene-advance{padding-left:102px}}
@media(max-height:600px){#story-scene:not([data-illustrated=true]) #story-scene-portrait{max-height:min(35dvh,100%)}}

/* Scene 1 beat 8 alone uses the approved full-body Patch cutout. Keep both feet opaque and above dialogue. */
#story-scene[data-scene="1"][data-full-body="true"] #story-scene-portrait{mask-image:none;-webkit-mask-image:none;transform:none;bottom:4px;max-height:min(44dvh,calc(100% - 4px))}
