/* Both figures share one stage and one floor. The dialogue owns its space. */
.story-screen{--dialogue-h:220px}
.story-cast-stage{position:absolute;z-index:2;inset:175px 3% calc(var(--dialogue-h) + 38px);max-width:1100px;margin-inline:auto;pointer-events:none;min-height:100px}
.story-cast-stage:after{content:'';position:absolute;left:8%;right:8%;bottom:-7px;height:17px;border-radius:50%;background:radial-gradient(ellipse,#030912b3,transparent 70%)}
.story-player-figure,.story-screen .story-cast-stage .companion-portrait-frame{position:absolute;display:flex;align-items:flex-end;justify-content:center;top:0;bottom:0;height:100%;width:46%;min-width:0;max-width:none;margin:0;overflow:visible;mask-image:none;-webkit-mask-image:none}
.story-player-figure{left:1%;right:auto}
.story-screen .story-cast-stage .companion-portrait-frame{left:auto;right:1%}
.story-screen .story-cast-stage .companion-portrait-frame[hidden]{display:none}
.story-screen .story-cast-stage .companion-portrait-frame:after{display:none}
.story-player-art,.story-screen .story-cast-stage .kai-portrait{width:100%;height:100%;max-height:100%;max-width:100%;object-fit:contain;object-position:center bottom;transform-origin:center bottom;filter:drop-shadow(0 6px 10px #060a1844);mask-image:none;-webkit-mask-image:none}
.story-player-art{animation:player-breathe 5.5s ease-in-out infinite;filter:brightness(.94) drop-shadow(0 6px 10px #060a1844)}
.story-player-figure figcaption{position:absolute;bottom:-18px;text-align:center;color:#e9d8df;font:10px var(--mono);text-shadow:0 1px 4px #000}
.story-screen[data-speaker=player] .story-player-art{filter:brightness(1.06) drop-shadow(0 0 15px #c2d9ec33)}
.story-screen .story-dialogue,.story-screen[data-scene=choice] .story-dialogue,.story-screen[data-scene=end] .story-dialogue{z-index:5;left:50%;transform:translateX(-50%);width:min(900px,calc(100% - 48px));bottom:calc(27px + var(--safe-bottom));max-height:48%;padding:20px 25px 15px;background:linear-gradient(130deg,#101b2bf5,#1c2234ed);backdrop-filter:blur(14px)}
.story-screen .story-location{top:120px;left:24px;max-width:260px;pointer-events:none}
.story-screen .story-location h2{font-size:24px;margin:7px 0}
.story-screen .story-location p{display:none}
.story-screen .story-tools{top:96px;right:22px}
.story-objective{position:absolute;z-index:3;top:132px;right:24px;max-width:46%;color:#d7d8dd;font:10px/1.7 var(--mono);text-align:right}
.story-feedback{position:absolute;z-index:9;left:50%;top:173px;transform:translate(-50%,-8px);opacity:0;transition:opacity .2s,transform .2s;margin:0;padding:11px 18px;border:1px solid #caaebc66;border-radius:30px;background:#152235ee;color:#f4d4df;font:12px/1.4 var(--sans,Arial);max-width:90%;text-align:center;pointer-events:none}
.story-feedback.is-visible{opacity:1;transform:translate(-50%,0)}
.story-wallet-button{white-space:nowrap;font-size:10px}
.story-screen[data-scene=game] .story-dialogue{left:3%;transform:none;width:min(650px,65%);max-height:calc(100% - 205px);bottom:28px}
.story-screen[data-scene=game] .story-cast-stage{left:68%;right:1%;top:200px;bottom:45px}
.story-screen[data-scene=game] .story-cast-stage .companion-portrait-frame{display:flex}
.story-screen[data-scene=game] .story-cast-stage .story-player-figure{display:flex}
.premium-reader[data-cast-layout=solo] .premium-player,.premium-reader[data-cast-layout=solo] .premium-portrait{position:absolute;top:85px;bottom:210px;height:calc(100% - 295px);width:44%;object-fit:contain;object-position:center bottom;mask-image:none;-webkit-mask-image:none;transform-origin:center bottom}
.premium-reader[data-cast-layout=solo] .premium-player{left:3%;right:auto}
.premium-reader[data-cast-layout=solo] .premium-portrait{right:3%;left:auto}
.premium-reader[data-cast-layout=solo] .premium-panel{left:50%;right:auto;transform:translateX(-50%);width:calc(100% - 44px);max-width:850px;bottom:20px;max-height:40%;z-index:3}
.premium-reader[data-cast-layout=solo] .premium-shade{pointer-events:none;background:linear-gradient(0deg,#0b142be6,transparent 70%)}
@keyframes player-breathe{0%,100%{transform:scale(1)}50%{transform:scale(1.002,1.004)}}
@media(max-width:700px){
 .story-topbar{gap:8px;padding-inline:12px}.story-brand{font-size:18px}.story-topbar>span{font-size:7px}.story-wallet-button{font-size:8px;padding:8px 6px}.story-topbar #storyExit{font-size:9px;padding:8px}
 .story-screen .story-tools{top:74px;left:12px;right:12px;justify-content:center;gap:4px}.story-screen .story-tools>.story-tool,.story-screen .story-settings summary{padding:8px 7px;font-size:8px;min-height:34px}
 .story-screen .story-location{top:123px;left:15px;max-width:45%}.story-screen .story-location h2{font-size:18px}.story-screen .story-location>span{font-size:8px}
 .story-objective{top:119px;right:15px;font-size:8px;max-width:47%}.story-cast-stage{top:174px;left:0;right:0;bottom:calc(var(--dialogue-h) + 38px)}
 .story-player-figure{left:0;width:49%}.story-screen .story-cast-stage .companion-portrait-frame{right:0;width:49%}
 .story-screen .story-dialogue,.story-screen[data-scene=choice] .story-dialogue,.story-screen[data-scene=end] .story-dialogue{left:50%;width:calc(100% - 22px);bottom:calc(25px + var(--safe-bottom));padding:14px 15px 10px;max-height:47%}.story-dialogue-text{margin:10px 0;font-size:var(--reading-size,16px);line-height:1.55}.story-choice{padding:10px;min-height:48px}.story-choice small{font-size:10px;line-height:1.5}.story-speaker-row{padding-bottom:7px}.story-dialogue-footer{margin-top:10px}.story-feedback{top:164px;font-size:10px;max-width:92%}
 .story-screen[data-scene=game] .story-dialogue{left:11px;transform:none;width:calc(100% - 22px);max-height:calc(100% - 185px);bottom:25px}.story-screen[data-scene=game] .story-cast-stage{display:none}.story-screen[data-scene=game] .story-location{display:block}
 .premium-reader[data-cast-layout=solo] .premium-player,.premium-reader[data-cast-layout=solo] .premium-portrait{top:82px;bottom:270px;height:calc(100% - 352px);width:49%}.premium-reader[data-cast-layout=solo] .premium-player{left:0}.premium-reader[data-cast-layout=solo] .premium-portrait{right:0}.premium-reader[data-cast-layout=solo] .premium-panel{width:calc(100% - 22px);max-height:43%;bottom:12px;padding:16px}.premium-header{padding:16px}.premium-panel h2{font-size:24px}
}
@media(max-height:560px) and (orientation:landscape){
 .story-screen .story-location{display:none}.story-objective{top:105px;left:3%;right:auto;text-align:left;font-size:8px;max-width:35%}.story-screen .story-tools{top:58px}.story-topbar{height:52px}.story-cast-stage{top:110px;left:0;right:57%;bottom:32px}.story-screen .story-dialogue,.story-screen[data-scene=choice] .story-dialogue,.story-screen[data-scene=end] .story-dialogue{left:44%;width:54%;transform:none;max-height:calc(100% - 110px);padding:12px 15px;bottom:20px}.story-screen[data-scene=game] .story-dialogue{left:2%;width:96%;transform:none;max-height:calc(100% - 105px)}.story-screen[data-scene=game] .story-cast-stage{display:none}.story-feedback{top:96px;font-size:10px}.premium-reader[data-cast-layout=solo] .premium-panel{left:45%;width:53%;transform:none;max-height:calc(100% - 85px)}.premium-reader[data-cast-layout=solo] .premium-player,.premium-reader[data-cast-layout=solo] .premium-portrait{top:80px;bottom:10px;height:calc(100% - 90px);width:22%}.premium-reader[data-cast-layout=solo] .premium-player{left:0}.premium-reader[data-cast-layout=solo] .premium-portrait{left:22%;right:auto}
}
@media(prefers-reduced-motion:reduce){.story-player-art{animation:none}.story-feedback{transition:none}}

/* Tool rows may wrap when music controls or larger text are enabled. */
.story-screen{--tools-bottom:136px}.story-screen .story-location{top:calc(var(--tools-bottom) + 12px)}.story-objective{top:calc(var(--tools-bottom) + 9px)}.story-cast-stage{top:calc(var(--tools-bottom) + 65px)}.story-feedback{top:calc(var(--tools-bottom) + 58px)}
@media(max-width:700px){.story-screen{--tools-bottom:112px}.story-cast-stage{top:calc(var(--tools-bottom) + 65px)}.story-screen[data-scene=choice] .story-cast-stage{bottom:calc(var(--dialogue-h) * .65 + 35px)}}
@media(max-height:560px) and (orientation:landscape){.story-cast-stage{top:calc(var(--tools-bottom) + 18px)}.story-objective{top:calc(var(--tools-bottom) + 8px)}}
