/* Master presentation uses the existing shared stage, panels and novel event. */
#masterHUD{position:fixed;inset:84px 0 0;z-index:160;pointer-events:none;color:#f0f3f9;--master-rail:240px}
#masterHUD[hidden],#masterHUD [hidden]{display:none!important}
#masterHUD #masterHeading{display:block;padding:0;background:none;border:0;height:auto}
#masterHeading{position:absolute;top:12px;left:144px;right:264px;min-width:0;pointer-events:none;text-shadow:0 2px 8px #000}
#masterHeading span{font-size:10px;letter-spacing:.12em;color:#b8d2dc}
#masterTitle{margin:3px 0;font-size:20px;line-height:1.3;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#masterGMControls{position:absolute;top:70px;left:24px;width:min(590px,calc(100% - 296px));max-height:calc(100% - 300px);overflow:auto;pointer-events:auto;border:1px solid #71839080;border-radius:7px;background:#14202dec;margin:0}
#masterGMControls>summary{padding:10px 12px;margin:0;font-size:13px;cursor:pointer}#masterProgress{float:right;color:#b8d2dc;font-size:12px}
.masterGMBody{padding:0 12px 12px}.masterGMBody p{font-size:12px;margin:8px 0}.masterActionRow{display:flex;gap:6px;flex-wrap:wrap}.masterActionRow button,#masterGMControls .masterSceneTransition button{font-size:12px;padding:7px 10px}
#masterNextPreview{margin:10px 0;font-size:12px}#masterNextPreview>summary{font-size:12px}#masterNextText{max-height:100px;overflow:auto;border-left:2px solid #8fb5c5;padding-left:10px;overflow-wrap:anywhere}
.masterSceneTransition{display:flex;align-items:end;gap:8px;margin-top:10px}.masterSceneTransition label{flex:1;min-width:0;margin:0;font-size:11px}.masterSceneTransition select{font-size:12px;padding:6px;margin:4px 0 0}.masterSceneTransition button{flex:none}
#masterParty{position:absolute;top:12px;right:16px;bottom:16px;width:224px;display:flex;flex-direction:column;background:#121d2bea;border:1px solid #71839080;border-radius:7px;pointer-events:auto;overflow:hidden;box-shadow:0 4px 20px #0004}
.masterPartyHeading{display:flex;align-items:center;justify-content:space-between;gap:6px;padding:9px 10px;border-bottom:1px solid #71839050;flex:none}.masterPartyHeading strong{font-size:13px}.masterPartyHeading button{font-size:10px;padding:4px 6px}
#masterPartyBody{overflow:auto;min-height:0;overscroll-behavior:contain}#masterPartySettings{margin:8px 10px;font-size:11px}#masterPartySettings summary{font-size:11px;margin-bottom:6px}#masterPartySettings p{font-size:11px}#masterPartyAuto{font-size:10px;padding:5px 6px}#masterPartyChoices{max-height:180px;overflow:auto}#masterPartyChoices label{font-size:11px;margin:8px 0;overflow-wrap:anywhere}
#masterPartyCards{display:flex;flex-direction:column;padding:0 8px 8px;gap:8px}.masterPC{display:grid;grid-template-columns:58px minmax(0,1fr);gap:8px;padding:8px;border:1px solid #71839050;border-radius:5px;background:#25344399}.masterPC.myMasterPC{border-color:#9ad2df}
.masterPCPortrait{width:58px;height:86px;display:flex;align-items:center;justify-content:center;overflow:hidden;border-radius:4px;background:#0b142380}.masterPCPortrait img{width:100%;height:100%;object-fit:contain}.masterPCPortrait>span{font-size:32px;color:#b0c4d7}
.masterPCInfo{min-width:0;display:flex;flex-direction:column;gap:5px}.masterPCName{font-size:13px;overflow-wrap:anywhere;line-height:1.35}.masterPCOwner{font-size:10px;color:#afc6d0;overflow-wrap:anywhere}.masterPCStats{display:grid;grid-template-columns:1fr;gap:3px;font-size:10px}.masterPCStats>span{display:flex;justify-content:space-between;gap:4px}.masterPCStats b{font-size:12px;font-variant-numeric:tabular-nums;color:#fff}.masterPCOperate{align-self:end;font-size:10px;padding:3px 8px}.masterPCStats [data-pc-stat=hp]{color:#a7d6ad}.masterPCStats [data-pc-stat=mp]{color:#b6d9ed}.masterPCStats [data-pc-stat=san]{color:#d4c2ed}#masterPartyEmpty{padding:0 12px;font-size:12px}
body[data-stage-presentation=true][data-master-party=collapsed] #masterParty{bottom:auto;width:142px}body[data-stage-presentation=true][data-master-party=collapsed] #masterHeading{right:180px}
body[data-stage-presentation=true] #stageBackground img,body[data-stage-presentation=true] #stageBackground video{opacity:1}
body[data-stage-presentation=true] #stageNarrative{position:absolute;left:24px;right:264px;bottom:24px;max-width:none;margin:0;padding:20px 24px;max-height:32%;overflow:auto;background:#101c2bea;border:1px solid #86bdd9;border-radius:8px}
body[data-stage-presentation=true] #stageNarrative>.badge,body[data-stage-presentation=true] #stageNarrative>h2{display:none}body[data-stage-presentation=true] #stageNarrative p{font-size:18px;line-height:1.8;margin:0}
body[data-stage-presentation=true][data-stage-description=bottom]:has(#novelOverlay:not([hidden])) #stageNarrative{display:none}
body[data-stage-presentation=true] #novelOverlay{z-index:150;left:0;right:248px;padding:16px 24px}body[data-stage-presentation=true] .novelBox{width:100%;max-width:980px}body[data-stage-presentation=true] .novelPortrait{width:clamp(110px,24%,260px)}body[data-stage-presentation=true] .novelPortrait img{height:min(40vh,350px)}body[data-stage-presentation=true] #novelLeft{left:24px}body[data-stage-presentation=true] #novelRight{right:24px}
body[data-stage-presentation=true][data-master-party=collapsed] #stageNarrative{right:24px}body[data-stage-presentation=true][data-master-party=collapsed] #novelOverlay{right:0}
@media(max-width:900px){#masterGMControls{width:calc(100% - 280px)}.masterSceneTransition{align-items:stretch;flex-direction:column}#masterHeading{left:140px}#masterTitle{font-size:17px}}
@media(max-width:600px){
 #masterHeading{top:12px;left:132px;right:12px}#masterHeading span{font-size:9px}#masterTitle{font-size:16px}
 #masterParty,body[data-stage-presentation=true][data-master-party=collapsed] #masterParty{top:62px;left:12px;right:12px;bottom:auto;width:auto;max-height:184px}.masterPartyHeading{padding:6px 9px}.masterPartyHeading button{font-size:11px}#masterPartyBody{display:flex;flex-direction:column}#masterPartySettings{margin:5px 9px}#masterPartySettings[open]{max-height:230px;overflow:auto}#masterParty:has(#masterPartySettings[open]){max-height:55%}
 #masterPartyCards{flex-direction:row;overflow-x:auto;gap:7px;padding:0 7px 6px;flex-shrink:0}.masterPC{flex:0 0 205px;grid-template-columns:48px minmax(0,1fr);padding:6px}.masterPCPortrait{width:48px;height:66px}.masterPCInfo{gap:3px}.masterPCName{font-size:12px}.masterPCStats{grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}.masterPCStats>span{display:flex;flex-direction:column;gap:0}.masterPCStats b{font-size:11px}.masterPCOperate{padding:2px 6px}
 #masterGMControls{top:258px;left:12px;right:12px;width:auto;max-height:calc(100% - 480px);min-height:38px}body[data-stage-presentation=true][data-master-party=collapsed] #masterGMControls{top:108px}body[data-stage-presentation=true][data-master-party=collapsed] #masterHeading{right:12px}.masterGMBody{padding:0 9px 9px}
 body[data-stage-presentation=true] #stageNarrative{left:8px;right:8px;bottom:8px;padding:14px;max-height:30%}body[data-stage-presentation=true] #stageNarrative p{font-size:15px}body[data-stage-presentation=true] #novelOverlay,body[data-stage-presentation=true][data-master-party=collapsed] #novelOverlay{right:0;padding:8px}body[data-stage-presentation=true] .novelBox{padding:12px;min-height:150px}body[data-stage-presentation=true] .novelPortrait{width:34vw}body[data-stage-presentation=true] .novelPortrait img{height:min(25vh,190px)}body[data-stage-presentation=true] #novelLeft{left:12px}body[data-stage-presentation=true] #novelRight{right:12px}
}
@media(max-width:600px) and (max-height:700px){#masterParty,body[data-stage-presentation=true][data-master-party=collapsed] #masterParty{top:54px;max-height:154px}#masterGMControls{top:218px;max-height:150px}body[data-stage-presentation=true] .novelPortrait img{height:100px}body[data-stage-presentation=true] .novelBox p{max-height:18vh;min-height:40px}}

/* The GM controls are now owned by the common floating window, not the master HUD. */
#progressPanel #masterGMControls{position:static;inset:auto;top:auto;left:auto;right:auto;bottom:auto;width:100%;max-height:none;min-height:0;overflow:visible;pointer-events:auto;margin:0;border:0;background:none;border-radius:0}
#progressPanel #masterGMControls>summary{padding:4px 0 10px;font-size:12px}
#progressPanel .masterGMBody{padding:0}
#progressPanel .masterSceneTransition{flex-direction:column;align-items:stretch}
#progressPanel .masterActionRow button{font-size:12px;padding:7px 9px}

/* Both legacy stage kinds use one PC rail and narration layout. */
body[data-stage-pcs=false] #masterHeading{right:16px}
body[data-stage-presentation=true][data-stage-pcs=false] #novelOverlay{right:0}
body[data-stage-presentation=true][data-stage-pcs=false] #stageNarrative{right:24px}
body[data-stage-presentation=true][data-stage-description=hidden] #stageNarrative{display:none}
body[data-stage-presentation=true][data-stage-description=summary] #stageNarrative{display:block;position:static;inset:auto;max-width:none;max-height:none;background:none;border:0;border-radius:0;margin:0;padding:0 12px 12px;overflow:visible}
body[data-stage-presentation=true][data-stage-description=summary] #stageNarrative p{font-size:14px;line-height:1.7}
@media(max-width:600px){body[data-stage-presentation=true][data-stage-pcs=false] #stageNarrative{right:8px}}

/* Exploration retains the spatial board beneath a compact shared HUD. */
body[data-scene-kind=exploration] #masterHeading{right:370px}
body[data-scene-kind=exploration] #masterParty{left:16px;right:auto;top:var(--exploration-party-top,110px);bottom:88px;width:224px}
body[data-scene-kind=exploration][data-master-party=collapsed] #masterParty{bottom:auto;width:150px}
body[data-scene-kind=exploration] .masterPC{grid-template-columns:40px minmax(0,1fr);padding:6px;gap:6px}
body[data-scene-kind=exploration] .masterPCPortrait{width:40px;height:60px}
body[data-scene-kind=exploration] .masterPCStats{grid-template-columns:repeat(3,minmax(0,1fr));gap:4px}
body[data-scene-kind=exploration] .masterPCStats>span{flex-direction:column;gap:0}
body[data-scene-kind=exploration] .masterPCStats b{font-size:11px}
body[data-scene-kind=exploration] #stageNarrative{position:static;inset:auto;max-width:none;max-height:none;margin:0;padding:0 12px 12px;border:0;background:none;overflow:visible}
body[data-scene-kind=exploration] #stageNarrative>.badge,body[data-scene-kind=exploration] #stageNarrative>h2{display:none}
body[data-scene-kind=exploration] #stageNarrative p{font-size:14px;line-height:1.7;margin:0;max-height:24vh;overflow:auto;overflow-wrap:anywhere}
body[data-scene-kind=exploration] #novelOverlay{left:256px;right:0}
body[data-scene-kind=exploration][data-master-party=collapsed] #novelOverlay{left:182px}
body[data-scene-kind=exploration][data-stage-pcs=false] #novelOverlay{left:0}
@media(max-width:900px){body[data-scene-kind=exploration] #masterHeading{right:16px}}
@media(max-width:600px){
 body[data-scene-kind=exploration] #masterHeading{left:132px;right:12px}
 body[data-scene-kind=exploration] #masterParty,body[data-scene-kind=exploration][data-master-party=collapsed] #masterParty{top:62px;left:12px;right:12px;bottom:auto;width:auto;max-height:168px}
 body[data-scene-kind=exploration] .masterPC{flex:0 0 205px}
 body[data-scene-kind=exploration] #conversationHUD{left:12px;right:12px}
 body[data-scene-kind=exploration] #novelOverlay,body[data-scene-kind=exploration][data-master-party=collapsed] #novelOverlay,body[data-scene-kind=exploration][data-stage-pcs=false] #novelOverlay{left:0;right:0;padding:8px}
}

/* Reserve a separate row for placement controls and the scene heading. */
body[data-stage-presentation=true] #masterHeading{top:calc(12px + var(--stage-placement-height,0px))}
@media(max-width:600px){body[data-stage-presentation=true] #masterParty,body[data-stage-presentation=true][data-master-party=collapsed] #masterParty{top:calc(80px + var(--stage-placement-height,0px))}}
