/* Chapter stage: portraits share the real stage illustration and camera. */
.story-intro{position:relative;isolation:isolate;overflow:hidden;min-height:100%;padding:24px 7% 30px;background:#060d19;display:flex;justify-content:end}
.story-intro:before{content:'';position:absolute;inset:-5%;z-index:-3;background-image:linear-gradient(#06101a10,#06101a38),var(--story-art,none);background-size:cover;background-position:50% 50%;transform:scale(1.04);transition:transform 3.8s ease,background-position 4s ease}
.story-intro[data-camera="1"]:before{transform:scale(1.10) translateX(-1%);background-position:45% 45%}
.story-intro[data-camera="2"]:before{transform:scale(1.08) translateX(1%);background-position:55% 50%}
.story-intro:after{content:'';position:absolute;inset:0;z-index:-1;background:linear-gradient(0deg,#06101b 0%,#06101bb8 18%,transparent 60%),linear-gradient(90deg,#06101b55,transparent 60%);pointer-events:none}
.story-chapter{position:absolute;top:28px;left:7%;right:7%;font-size:14px;letter-spacing:3px;text-shadow:0 2px 8px #000;padding-bottom:18px;z-index:3}
.story-cast{position:absolute;inset:65px 0 10%;z-index:-2;pointer-events:none}
.story-actor{position:absolute;bottom:0;width:min(56%,660px);height:100%;opacity:.28;filter:saturate(.5) brightness(.65);transform:translateY(12px) scale(.95);transition:opacity .55s,filter .55s,transform .65s;mask-image:linear-gradient(#000 77%,transparent 99%)}
.story-actor[data-side="0"]{left:-2%}.story-actor[data-side="1"]{right:-2%;transform:translateY(12px) scale(.95)}
.story-actor.speaking{opacity:1;filter:none;transform:translateY(0) scale(1)}
.story-actor img{height:100%;width:100%;object-fit:contain;object-position:bottom}
.story-box{position:relative;z-index:2;background:linear-gradient(100deg,#071322ed,#0713229c);border:1px solid #bca7737a;border-top:2px solid #d9bc7d;padding:22px 30px 17px;box-shadow:0 15px 70px #0008;min-height:215px}
.story-box h3{font-size:25px;margin:0}.story-box p{font-size:clamp(17px,1.7vw,24px);line-height:1.85;min-height:76px;margin:12px 0 15px;max-width:100%}.story-controls{gap:18px}.story-controls button{min-height:42px}.story-controls button:last-child{background:#b7995530;border-color:#bca773}
#banter>img.banter-face{width:94px;height:88px;object-fit:cover;object-position:center top;mask-image:linear-gradient(#000 70%,transparent);filter:none;flex-shrink:0}
.narrative-line.with-portrait{display:grid;grid-template-columns:85px 1fr;gap:14px;align-items:center}.narrative-line.with-portrait img{width:85px;height:90px;object-fit:cover;object-position:center 15%;mask-image:linear-gradient(#000 75%,transparent)}
.cloud-panel{font-family:inherit;line-height:1.8}.cloud-panel .primary,.cloud-panel .secondary{min-height:44px}.cloud-note{font-size:13px;color:#b9cbd5;line-height:1.95;margin:18px 0}.cloud-key-label{display:grid;gap:8px;margin:18px 0;font-size:14px;color:#f3d89d}.cloud-key-label input,.cloud-key-label textarea{width:100%;font:14px/1.6 ui-monospace,monospace;color:#e5f5fb;background:#061522;border:1px solid #7a94a9;padding:13px;resize:vertical;box-sizing:border-box}.cloud-key-label input:focus,.cloud-key-label textarea:focus{outline:2px solid #cda66b;outline-offset:2px}.cloud-tools{display:flex;flex-wrap:wrap;gap:10px}.cloud-divider{height:1px;background:#c3a56855;margin:25px 0}.cloud-state{padding:9px 14px;border-left:3px solid #84dccc;background:#7ce9d715;color:#c4fff0}.cloud-summary{display:flex;gap:12px;flex-wrap:wrap;align-items:center;margin:16px 0;color:#c6d6df;font-size:14px}.cloud-summary b{color:#efce99}.cloud-summary small{margin-left:auto}.cloud-versions{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin:16px 0}.cloud-versions article{border:1px solid #b99a6d80;padding:16px;display:flex;flex-direction:column;gap:9px;background:#091a2d}.cloud-versions button{margin-top:6px}.cloud-versions small{color:#a5bdce}.cloud-conflict>h3{color:#f1cb8b;margin-top:18px}.cloud-conflict>p{font-size:13px}.top-actions #cloud-account{font-size:12px;white-space:nowrap;padding:8px;border:1px solid #b6a17166;min-width:62px}#save-indicator[data-cloud="conflict"]{color:#ffd49c}
@media(max-width:700px){.story-intro{padding:20px 4% 22px}.story-chapter{left:5%;right:5%;top:17px;font-size:12px}.story-cast{inset:65px -10% 18%}.story-actor{width:78%}.story-actor[data-side="0"]{left:-6%}.story-actor[data-side="1"]{right:-6%}.story-actor:not(.speaking){opacity:.08}.story-box{padding:15px 18px;min-height:240px}.story-box h3{font-size:22px}.story-box p{font-size:18px;line-height:1.8;min-height:100px}.story-controls{gap:8px}.story-controls button{font-size:12px;padding:10px}.cloud-versions{grid-template-columns:1fr}.cloud-summary small{margin-left:0}.top-actions #cloud-account{font-size:11px;padding:6px;min-width:50px}.cloud-tools button{flex:1 1 42%}}
@media(max-height:500px) and (orientation:landscape){.story-chapter{top:10px;padding-bottom:8px}.story-intro{padding-bottom:12px}.story-cast{inset:35px 0 7%}.story-box{padding:11px 22px;min-height:152px}.story-box h3{font-size:21px}.story-box p{font-size:16px;min-height:50px;margin:7px 0}.story-controls button{min-height:34px;padding:7px 12px}.story-actor{width:45%}}
@media(prefers-reduced-motion:reduce){.story-intro:before,.story-actor{transition:none!important;transform:none!important}}
#app.battle.touch-mode #hud .key-row{display:none}
#app.battle #hud .key-row button{flex-shrink:0;min-width:88px}
#app.battle #hud .key-row button span{white-space:nowrap}

.story-actor.communication{width:260px;height:360px;left:calc(50% - 130px);right:auto;bottom:28%;filter:drop-shadow(0 0 28px #7bdfff55);opacity:.8;mask-image:none}.story-actor.communication img{object-fit:contain}.story-actor.communication:not(.speaking){opacity:0}

.battle-supply-grid{display:flex;flex-wrap:wrap;gap:10px;margin:14px 0 24px}.battle-supply-grid button{min-height:44px;flex:1 1 140px;font-size:14px}
.story-controls{flex-wrap:wrap}
#story-voice{font-size:11px;letter-spacing:.5px;color:#a7d5dc;white-space:nowrap}
#story-voice:empty{display:none}
@media(max-width:520px){#story-voice{order:4;width:100%;text-align:right}}
/* Preserve a 44px finger target in the compact portrait control grid. */
@media(max-width:540px) and (orientation:portrait){
 #app .touch-actions{grid-template-columns:repeat(3,44px) 54px;grid-template-rows:repeat(2,44px);width:201px}
 #app .touch-actions button{width:44px;height:44px}
 #app .touch-actions .fire{width:54px;height:93px}
}
