/* Conversation portraits use measured atlas bounds, with a stable shared stage. */
.phone-only{display:none}.map-area{display:contents}.sheet{position:relative}
.native-battle-hud{display:none}
/* Temporary cutscene review chrome; normal title and scene styles stay intact. */
.review-controls{flex:none}.review-controls>summary{display:none}
.review-shell{height:100dvh;display:flex;flex-direction:column;min-width:0}
.review-toolbar{display:flex;align-items:center;gap:6px;flex:none;padding:4px max(8px,env(safe-area-inset-right)) 4px max(8px,env(safe-area-inset-left));padding-top:max(4px,env(safe-area-inset-top));background:#15262b;border-bottom:1px solid #bca57645;font:13px/1.2 system-ui}
.review-toolbar strong{color:var(--gold);margin-right:auto}.review-toolbar button,.review-exit{min-width:44px;min-height:44px;padding:8px;display:inline-flex;align-items:center;justify-content:center;border-radius:8px;touch-action:manipulation}.review-exit{color:var(--gold)}
.review-stage{flex:1;min-height:0;overflow:auto}body[data-review="cutscenes"] .review-stage>.scene{height:100%;min-height:0}.review-stage>.asset-loading{height:100%;min-height:0}body[data-review="cutscenes"] .review-stage>.story-ending{min-height:0;height:100%}body[data-review="cutscenes"] .review-stage>.story-ending>.credits{height:100%}.review-stage .story-ending .credits{padding-top:16px}
.review-menu h1{font-size:clamp(30px,5vw,48px)}.review-menu header{margin-bottom:24px}.review-menu header p{max-width:650px}.review-directory{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,340px),1fr));gap:16px}.review-directory h2{font-size:22px}.review-entry{margin-top:14px}.review-entry> a{font-weight:400}.review-entry ul{padding-left:20px;margin:4px 0}.review-scene-link{display:block;min-height:44px;padding:10px 4px;color:#e5d4b1;line-height:1.4}.review-scene-link:focus-visible,.review-exit:focus-visible{outline:2px solid var(--gold);outline-offset:2px}
@media(max-height:540px) and (orientation:landscape){.review-controls{position:fixed;left:max(12px,env(safe-area-inset-left));bottom:max(8px,env(safe-area-inset-bottom));z-index:10}.review-controls>summary{display:flex;align-items:center;justify-content:center;min-width:72px;min-height:44px;padding:8px 12px;cursor:pointer;border:1px solid #bca57688;border-radius:10px;background:#15262bf5;color:var(--gold);font:13px system-ui;list-style:none}.review-controls>summary::-webkit-details-marker{display:none}.review-controls .review-toolbar{position:absolute;left:0;bottom:52px;width:min(520px,calc(100vw - 24px));border:1px solid #bca57688;border-radius:10px;background:#15262bf5}}
@media(max-width:600px){.review-wide{display:none}.review-toolbar{gap:4px}.review-menu .page-inner{padding:18px 14px}.review-directory .panel{padding:16px}}
/* Keep footer controls above the full-height title content. */
.title-footer{z-index:2}
.sheet-close{position:absolute;right:12px;top:12px;width:44px;height:44px;padding:0;border:0;border-radius:50%;font:28px/1 system-ui;background:#ffffff0b;z-index:2}.sheet h2{padding-right:35px}.sheet-handle{display:none}
.scene{height:100dvh;min-height:0;display:grid;align-items:stretch;grid-template-rows:96px minmax(0,1fr);padding:calc(env(safe-area-inset-top) + 24px) 6vw 35px;gap:16px}
.scene-header{position:relative;inset:auto;gap:16px;align-self:start;z-index:2}.scene-header h2{font-size:clamp(28px,3.5vw,44px);line-height:1.1;margin:8px 0 0}.scene-header #skip{flex:none;min-width:44px;min-height:44px}
.scene-stage{position:relative;z-index:1;min-height:0;height:100%;width:min(600px,52vw);display:flex;align-items:stretch;justify-content:center;gap:12px}
.scene-actor{position:relative;flex:1;min-width:0;height:100%;margin:0;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;filter:drop-shadow(0 8px 24px #0008)}
.scene-portrait.generated-portrait{position:static;display:block;flex:1;width:100%;height:0;min-height:0;max-width:none;mask-image:linear-gradient(90deg,transparent,#000 8%,#000 92%,transparent);transition:filter .2s,opacity .2s}
.scene-actor.listening .scene-portrait{filter:brightness(.65) saturate(.65);opacity:.8}.scene-actor figcaption{flex:none;text-align:center;font:400 13px/1.3 system-ui;color:#d1d4c9;margin-top:8px;height:27px}.scene-actor.speaking figcaption{color:var(--gold)}
.dialogue-box{position:absolute;right:6vw;bottom:7vh;width:min(650px,48vw);margin:0;padding:26px 30px;border-radius:20px;backdrop-filter:blur(20px);max-height:60dvh;display:flex;flex-direction:column}
.dialogue-heading{display:flex;align-items:baseline;justify-content:space-between;gap:12px;flex:none}.dialogue-heading h3{margin:0;font-size:28px;line-height:1.2}.dialogue-heading>span{font:12px system-ui;color:var(--muted);white-space:nowrap}
.dialogue-box p{min-height:0;margin:18px 0;overflow:auto;overscroll-behavior:contain}.dialogue-box>.row{flex:none}.dialogue-box button{min-height:44px}.narration .dialogue-box{right:50%;transform:translateX(50%)}
.field-log{font-size:14px;color:var(--muted)}.field-log p{margin:8px 0}

/* Fixed dialogue space keeps line wrapping from rescaling the character stage. */
@media (max-width:760px), (max-width:1100px) and (max-height:540px){
 :root{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;font-size:16px}
 body[data-screen="battle"],body[data-screen="scene"]{height:100dvh;overflow:hidden;overscroll-behavior:none}
 button,select{border-radius:12px;min-height:44px;font-size:15px;-webkit-tap-highlight-color:transparent}button{touch-action:manipulation}.primary{background:#d7b980;border-color:#d7b980}.phone-only{display:block}.desktop-only{display:none}
 .topbar{height:calc(52px + env(safe-area-inset-top));min-height:0;padding:env(safe-area-inset-top) 16px 0;gap:8px;flex-wrap:nowrap}.topbar>div{min-width:0}.brand{font-size:17px;letter-spacing:1.2px;white-space:nowrap}.chapter-tag{font-size:12px;letter-spacing:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:70vw}.topbar nav button{min-width:44px;font-size:15px;padding:8px}
 .game-shell{height:100dvh;min-height:0;overflow:hidden;padding-bottom:0}.game-shell>.topbar{height:calc(44px + env(safe-area-inset-top));background:#142126f5}.game-shell .topbar .brand{display:none}.game-shell .topbar .chapter-tag{font-size:15px;font-weight:400;color:var(--paper);max-width:100%}.game-shell .topbar [data-do="grid"],.game-shell .topbar [data-do="help"]{display:none}
 /* Reserve one header row for controls and truncate the chapter in the remainder. */
 .game-shell .topbar>div{flex:1}.game-shell .topbar nav{flex:none;flex-wrap:nowrap}
 .battle-layout{display:flex;flex:1;min-height:0;overflow:hidden}.battle-layout>.sidebar{display:none}.board-column{flex:1;min-height:0;overflow:hidden;background:#101c20}
 .mobile-party{display:flex;flex:none;gap:5px;padding:4px 10px 6px;flex-wrap:nowrap;overflow-x:auto;background:#142126;scrollbar-width:none}.mobile-party button{display:flex;align-items:center;gap:6px;min-width:84px;flex:1;padding:5px;background:#ffffff04;border-color:transparent;text-align:left}.mobile-party button.selected{background:#7dc6b019;border-color:#8bd4be66}.mobile-party strong{display:block;font-size:12px;font-weight:400;white-space:nowrap}.mobile-party small{display:block;font-size:12px;color:var(--muted);margin-top:2px;font-variant-numeric:tabular-nums}
 .mobile-avatar{position:relative;display:block;flex:none;width:27px;height:35px;overflow:hidden;border-radius:8px;background:#8bad9520}.mobile-avatar .portrait-art{width:100%;height:100%;position:static}
 .board-meta{padding:2px 14px 6px;min-height:36px;flex:none;flex-wrap:nowrap;gap:10px;letter-spacing:0;font-size:11px;background:#142126}.board-meta .phase-label{font-size:12px;text-transform:none}.tip-trigger{margin-left:auto;padding:0 10px;min-height:28px;height:28px;font-size:12px;color:#a7d9c9;background:#30453f;border:0}.tactical-tip{display:none}
 .map-area{display:flex;position:relative;flex:1;min-height:0;overflow:hidden;background:#071318}#board-viewport{flex:1;min-height:0;height:auto;margin:0;border:0;scrollbar-width:none}#board-viewport::-webkit-scrollbar{display:none}#board-viewport canvas{border:0}
 .range-legend{position:absolute;z-index:2;left:10px;right:10px;top:8px;margin:0;padding:0;gap:5px 12px;font-size:11px;pointer-events:none}.range-legend>span:first-child:not(.range-move){display:none}.range-legend #terrain-readout{display:none}.range-legend #terrain-readout.has-tile{display:block;flex-basis:auto;max-width:100%;padding:6px 9px;border-radius:10px;background:#14242aeb;font-size:11px;min-height:0}
 .map-controls{position:absolute;z-index:3;top:10px;right:10px;left:auto;bottom:auto;padding:4px;gap:2px;border:1px solid #a9c6bc25;border-radius:16px;background:#14242aeb;backdrop-filter:blur(20px);flex-wrap:nowrap}.map-controls button{min-width:44px;min-height:44px;padding:8px;border:0;background:transparent;font-size:14px}.map-controls #map-zoom,.map-controls small{display:none}.map-controls #zoom-in,.map-controls #zoom-out{font-size:23px;padding:0}.board-bottom{display:none}
 .battle-dock{display:block;flex:none;padding:10px 12px max(10px,env(safe-area-inset-bottom));background:#18282df5;border-top:1px solid #a9c6bc30;box-shadow:0 -8px 24px #0003}.selected-summary{display:flex;align-items:center;gap:10px;margin-bottom:8px}.selected-unit{display:flex;align-items:center;gap:9px;flex:1;min-width:0;text-align:left;border:0;padding:0;background:none;min-height:48px}.selected-unit .mobile-avatar{width:35px;height:43px}.selected-unit>span:last-child{min-width:0;flex:1}.selected-unit strong{display:block;font-size:15px;font-weight:400;white-space:nowrap}.selected-unit strong small{font-size:12px;font-weight:400;margin-left:5px;color:#acc4bb}.selected-unit>span>span{display:block;margin-top:4px;font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.unit-actions{padding:10px 16px;font-size:15px;flex:none}
 .dock-toolbar{display:flex;align-items:center;gap:7px}.dock-toolbar button{min-width:48px;min-height:44px;font-size:14px;padding:9px 12px}.dock-toolbar [data-do="end"]{margin-left:auto;flex:1;max-width:170px}.dock-toolbar [data-battle-panel="orders"]{flex:1}
 .sheet-backdrop{display:flex;align-items:flex-end;justify-content:center;padding:calc(env(safe-area-inset-top) + 12px) 0 0;background:#020b1180;backdrop-filter:blur(5px)}.sheet,.sheet.wide{width:100%;max-height:calc(100dvh - env(safe-area-inset-top) - 12px);padding:32px 20px calc(20px + env(safe-area-inset-bottom));border:1px solid #bcd1c02b;border-bottom:0;border-radius:26px 26px 0 0;background:#1a2a30;overscroll-behavior:contain;animation:sheet-rise .18s ease-out}.sheet-handle{display:block;position:absolute;width:100%;height:24px;left:0;top:0;touch-action:none}.sheet-handle:after{content:"";display:block;width:36px;height:5px;margin:10px auto;border-radius:5px;background:#b7c7bf55}.sheet h2{font-family:-apple-system,BlinkMacSystemFont,sans-serif;font-size:26px;font-weight:400;line-height:1.2;margin:12px 0 18px}.sheet h3{font-size:24px}.sheet .eyebrow{font-size:11px;letter-spacing:1.5px}.sheet p{font-size:16px;line-height:1.5}.sheet .row{gap:8px}.sheet .row button{flex:1}.sheet .stack button{font-size:15px}
 .unit-sheet .unit-heading,.unit-sheet .mobile-objectives{display:none}.unit-sheet .stat-grid small{font-size:11px;letter-spacing:0}.unit-sheet .xp,.unit-sheet .terrain-status{font-size:14px}.unit-sheet .actions button{font-size:15px;border-radius:12px;min-height:48px}.unit-sheet .target-list button{min-height:52px;font-size:15px}.unit-sheet .target-list button span{font-size:13px;color:var(--muted)}
 .forecast-grid{margin:16px 0;gap:10px}.forecast-unit{padding:14px;border-radius:12px}.forecast-unit .xp{font-size:13px;line-height:1.4}.forecast-unit p{font-size:14px;margin:12px 0}.forecast-unit .hit-rate{font-size:22px}#toast{bottom:calc(env(safe-area-inset-bottom) + 15px);border-radius:16px;font-size:14px}
 .scene{padding:calc(env(safe-area-inset-top) + 14px) 16px max(12px,env(safe-area-inset-bottom));grid-template-rows:auto minmax(0,1fr) clamp(240px,30dvh,280px);gap:12px}.scene-header{align-items:start;gap:8px}.scene-header h2{font-size:27px;margin:6px 0 0;line-height:1.1}.scene-header .eyebrow{font-size:10px;letter-spacing:1.5px}.scene-header #skip{padding:4px 8px;color:#c3cec7}.scene-stage{width:100%;min-height:0;gap:8px;overflow:hidden}.scene-actor{max-width:56%;min-height:0}.scene-actor figcaption{font-size:12px;height:20px;margin-top:5px;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.scene-portrait.generated-portrait{height:0;filter:none;mask-image:linear-gradient(90deg,transparent,#000 5%,#000 95%,transparent)}
 .dialogue-box,.narration .dialogue-box{position:relative;inset:auto;transform:none;width:100%;height:100%;min-height:0;max-height:100%;padding:20px;margin:0;border-radius:22px;background:#182930ed;border:1px solid #aecdc035;box-shadow:0 8px 35px #0005}.dialogue-heading h3{font:400 17px/1.3 -apple-system,BlinkMacSystemFont,sans-serif;color:#dfc18b}.dialogue-heading>span{font-size:12px}.dialogue-box p{font-family:-apple-system,BlinkMacSystemFont,sans-serif;font-size:18px;line-height:1.5;margin:15px 0 18px;min-height:0;flex:1}.dialogue-box #next-line{min-width:145px;font-size:16px}.dialogue-box #previous-line{font-size:14px;color:var(--muted);padding-left:0}
 .title-screen{height:100dvh;min-height:0}.title-content{padding:calc(env(safe-area-inset-top) + 30px) 8vw calc(env(safe-area-inset-bottom) + 80px)}.title-content h1{font-size:clamp(54px,18vw,76px);margin:25px 0}.title-actions{margin-top:12px;width:min(280px,100%)}.title-actions button{border-radius:14px;font-size:15px}.title-footer{bottom:calc(env(safe-area-inset-bottom) + 12px);left:8vw;right:8vw}.title-footer>span{font-size:10px;letter-spacing:0}.page .panel,.hero-card{border-radius:18px}.page-inner{padding-bottom:calc(env(safe-area-inset-bottom) + 24px)}.card-body select{font-size:14px}.card-body .eyebrow{font-size:11px;letter-spacing:1.2px}.page .xp{font-size:13px}
}
@media (max-width:390px){.mobile-party button{min-width:78px;gap:4px}.mobile-avatar{width:23px}.selected-unit strong small{display:block;margin:3px 0 0}.unit-actions{padding:10px 13px}.dock-toolbar button{padding:9px 10px}.scene-header h2{font-size:24px}}
@media (max-width:1100px) and (max-height:540px){
 .board-column{display:grid;grid-template-columns:minmax(0,1fr) 200px;grid-template-rows:28px minmax(0,1fr)}.board-meta{grid-column:1;grid-row:1}.map-area{grid-column:1;grid-row:2}.mobile-party{position:absolute;z-index:4;right:0;top:0;width:200px;flex-wrap:wrap;gap:4px;padding:6px;background:#18282d;height:102px;overflow:hidden}.mobile-party button{flex:1;min-width:84px;height:44px}.battle-dock{grid-column:2;grid-row:1/3;padding:106px 10px max(8px,env(safe-area-inset-bottom));min-height:0;overflow:auto;border-left:1px solid #aac8b330;border-top:0}.selected-summary{display:grid;grid-template-columns:1fr;gap:6px}.selected-unit .mobile-avatar{display:none}.selected-unit{min-height:40px}.selected-unit strong small{display:inline;margin-left:6px}.unit-actions{width:100%;min-height:44px}.dock-toolbar{display:grid;grid-template-columns:1fr 1fr;gap:5px}.dock-toolbar [data-do="end"]{grid-column:1/-1;margin:0;max-width:none}
 .scene{grid-template-columns:1fr 1fr;grid-template-rows:50px minmax(0,1fr);gap:8px 20px;padding-top:calc(env(safe-area-inset-top) + 8px)}.scene-header{grid-column:1/-1}.scene-header h2{font-size:22px;margin:3px 0}.scene-stage{grid-column:1;grid-row:2}.dialogue-box,.narration .dialogue-box{grid-column:2;grid-row:2;align-self:end;height:auto;max-height:100%}.dialogue-box p{font-size:16px;margin:12px 0}.dialogue-box{padding:16px}.dialogue-heading h3{font-size:16px}
 .title-content h1{font-size:48px;margin:14px 0}.title-content{max-width:650px;padding:20px 6vw 35px}.title-content>.eyebrow,.title-footer>span{display:none}.title-content p{display:none}.title-actions{display:flex;width:100%;gap:8px;margin-top:8px}.title-actions button{font-size:13px;padding:10px 12px}.title-footer{bottom:6px;left:auto;right:15px}
}
@keyframes sheet-rise{from{transform:translateY(35px);opacity:.7}to{transform:none;opacity:1}}

@media (max-width:760px){.page .topbar .brand{display:none}.page .chapter-tag{font-size:15px;color:var(--paper);max-width:50vw}.page-inner>.row.between{display:block}.page-inner>.row.between>button{width:100%;margin-top:8px}.page-inner h2{font-size:30px}.camp-grid{grid-template-columns:1fr}.card-portrait{height:180px}}

/* Visual playtest fixes: phone combat, unobscured range keys and held rewards. */
@media (max-width:760px), (max-width:1100px) and (max-height:540px){
 .range-legend{top:72px}.range-legend:has(.range-move){padding:7px 9px;border-radius:10px;background:#14242aeb;backdrop-filter:blur(12px)}
 .duel-stage.duel-compact{height:100dvh;display:block;padding:0}
 .duel-compact .duel-field{overflow:hidden}.duel-compact canvas{width:100%;height:100%;min-height:0;aspect-ratio:auto;object-fit:fill;border-radius:0}
 .duel-compact .duel-hud{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px}
 .duel-unit{min-width:0;padding:10px 12px;background:#192a2d;border-radius:14px;border-top:2px solid var(--teal)}.duel-unit.enemy{border-color:var(--red)}
 .duel-unit>strong{display:block;font-size:17px;line-height:1.2}.duel-unit>span{display:block;color:#b8c9bf;font-size:12px;line-height:1.35;margin:5px 0;min-height:32px;overflow-wrap:anywhere}.duel-unit>b{font-size:17px;font-variant-numeric:tabular-nums}.duel-unit .hp{height:6px;margin-top:7px}.duel-unit.enemy .hp>i{background:var(--red)}
 .duel-compact .duel-footer{display:flex;justify-content:flex-end;align-items:center;gap:10px}.duel-compact .duel-footer>button{position:static;min-height:44px;flex:none;border-radius:12px}
 .exp-stage{padding:max(15px,env(safe-area-inset-top)) max(15px,env(safe-area-inset-right)) max(15px,env(safe-area-inset-bottom)) max(15px,env(safe-area-inset-left))}.exp-card{max-height:100%;border-radius:18px}.exp-skip{min-height:44px}
 .promotion-stage{padding:0;display:block;overflow:hidden}.promotion-cinema{height:100dvh;min-height:0;width:100%;border:0;display:grid;grid-template-rows:auto minmax(0,1fr) auto}
 .promotion-header{padding:calc(env(safe-area-inset-top) + 15px) max(20px,env(safe-area-inset-right)) 15px max(20px,env(safe-area-inset-left))}.promotion-header .eyebrow{font-size:9px;letter-spacing:2px}.promotion-chapter{font-size:12px}
 .promotion-composition{display:block;min-height:0;overflow:auto;overscroll-behavior:contain}.promotion-visual{min-height:240px;height:34dvh}.promotion-visual canvas{height:calc(100% - 54px);top:0}.promotion-caption{bottom:8px;gap:5px}.promotion-ground{bottom:calc(12% + 47px)}.promotion-details{padding:22px 24px}.promotion-details h1{font-size:43px}.promotion-quote{font-size:15px;margin-bottom:15px}
 .promotion-footer{position:relative;bottom:auto;padding:12px max(20px,env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 12px) max(20px,env(safe-area-inset-left));gap:12px;background:#0c191cf5}.promotion-footer>span{font-size:11px;max-width:130px}.promotion-footer button{font-size:14px;min-width:0;min-height:44px}
}
@media (max-width:1100px) and (max-height:540px){
 .duel-unit{padding:8px 12px}.duel-unit>span{min-height:0;margin:3px 0}.duel-unit>strong,.duel-unit>b{font-size:15px}.duel-unit .hp{margin-top:4px}
 .exp-has-growth{width:min(820px,100%);display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:0 22px;padding:16px 20px 12px}.exp-has-growth .exp-topline{grid-column:1/-1}.exp-has-growth .exp-identity{grid-column:1;grid-row:2;margin:12px 0;gap:12px}.exp-has-growth .exp-portrait{width:56px;height:70px}.exp-has-growth .exp-name h2{font-size:30px}.exp-has-growth .exp-name>span{font-size:12px}.exp-has-growth .exp-level{padding-left:12px;min-width:45px}.exp-has-growth .exp-level strong{font-size:34px}
 .exp-has-growth .exp-meter-heading{grid-column:1;grid-row:3}.exp-has-growth .exp-meter{grid-column:1;grid-row:4}.exp-has-growth .exp-award{grid-column:1;grid-row:5}.exp-has-growth .exp-growth{grid-column:2;grid-row:2/6;margin:12px 0 0;padding:0;border:0}.exp-has-growth .exp-growth-heading{margin-bottom:8px}.exp-has-growth .exp-growth-heading>strong{font-size:25px}.exp-has-growth .exp-growth-subtitle{font-size:11px}.exp-has-growth .exp-stats{gap:5px 8px}.exp-has-growth .exp-stat{padding:5px;font-size:12px;gap:5px;grid-template-columns:1fr auto 20px}.exp-has-growth .exp-stat b{font-size:12px}.exp-has-growth .exp-stat i{margin:0 3px}.exp-has-growth .exp-cap{grid-column:2;grid-row:6;margin:7px 0 0;font-size:12px;padding-top:7px}.exp-has-growth .exp-skip{grid-column:1;grid-row:6;margin:8px auto 0}
 .promotion-composition{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);overflow:hidden}.promotion-visual{height:100%;min-height:0}.promotion-details{height:100%;padding:18px 24px 18px 10px;overflow:auto}.promotion-details h1{font-size:36px;margin:10px 0}.promotion-quote{font-size:14px}.promotion-stats{gap:2px 12px}.promotion-unlocks{margin-top:14px;padding:12px}.promotion-unlocks>strong{font-size:21px;margin-bottom:10px}.promotion-header{padding-top:8px;padding-bottom:8px}.promotion-footer{padding-top:8px;padding-bottom:max(8px,env(safe-area-inset-bottom))}
}

/* Narration has no actors, so its text can use the available stage. */
@media (max-width:760px), (max-width:1100px) and (max-height:540px){
 .scene.narration{grid-template-rows:auto minmax(0,1fr)}.narration .scene-stage{display:none}.narration .dialogue-box{grid-row:2;height:auto;max-height:100%;align-self:end}.narration .dialogue-box p{flex:0 1 auto}
}
@media (max-width:1100px) and (max-height:540px){.scene.narration{grid-template-rows:50px minmax(0,1fr)}.narration .dialogue-box{grid-column:1/-1}}

@media (max-width:760px){
 .preparation-page .prep-page-inner{padding:20px 15px 24px}.prep-mission{gap:8px;margin-bottom:18px}.prep-mission .eyebrow{font-size:11px;letter-spacing:1.4px}.prep-mission h2{font-size:30px;line-height:1.15}.prep-mission p{font-size:15px;line-height:1.4;margin-bottom:9px}.prep-readiness{font-size:13px}.prep-coins{font-size:12px;padding:5px 8px}.prep-layout{grid-template-columns:1fr;gap:14px}.prep-roster h3{font-size:21px}.prep-roster>.row{margin-bottom:9px}.prep-roster-list{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}.prep-roster-list:has(>button:only-child){grid-template-columns:1fr}.prep-roster-unit{min-height:66px;padding:9px;gap:8px}.prep-roster-unit strong{font-size:15px}.prep-roster-unit small{font-size:11px;line-height:1.3}.prep-roster-status{font-size:11px}.prep-avatar{width:27px;height:40px}.prep-detail{padding:16px;border-radius:16px}.prep-profile{grid-template-columns:80px minmax(0,1fr);gap:12px}.prep-figure{height:185px}.prep-profile-info .eyebrow{font-size:10px;letter-spacing:1px}.prep-profile-info h3{font-size:30px;margin:4px 0}.prep-class{font-size:14px}.prep-profile .stat-grid{gap:4px;margin:10px 0 8px}.prep-profile .stat-grid>div{padding:5px 0}.prep-profile .stat-grid b{font-size:18px}.prep-profile .stat-grid small{font-size:10px;letter-spacing:0}.prep-xp{font-size:12px}.prep-equipment{margin-top:16px;padding-top:12px}.prep-equipment legend{font-size:15px}.prep-equipment>p{font-size:12px}.prep-weapons{grid-template-columns:1fr;gap:12px}.prep-weapon label{font-size:13px}.prep-weapon select{font-size:14px;padding:10px;min-height:44px}.prep-weapon p{font-size:12px}.prep-promotion{margin-top:16px}.prep-options>summary{padding:12px;gap:8px}.prep-options>summary>small{font-size:11px;max-width:55%}.prep-options>summary>span{font-size:14px}.prep-services{grid-template-columns:1fr;gap:10px;margin-top:14px}.prep-option-body{padding:2px 14px 16px}.prep-rest-note{font-size:12px}.prep-start{gap:10px;padding:10px 15px calc(10px + env(safe-area-inset-bottom))}.prep-start>div{flex:1;min-width:0}.prep-start strong{font-size:12px;line-height:1.35}.prep-start small{display:none}.prep-start>button{min-width:145px;min-height:48px;font-size:15px;padding:10px 14px}
}
@media (max-width:360px){.prep-profile{grid-template-columns:66px minmax(0,1fr);gap:9px}.prep-figure{height:175px}.prep-roster-unit small{font-size:10px}.prep-avatar{width:23px}.prep-start>button{min-width:135px}.prep-coins{padding:4px 6px}.prep-mission h2{font-size:28px}}

@media (max-width:760px), (max-width:1100px) and (max-height:540px){
 .battle-dock .context-actions{grid-template-columns:minmax(0,1fr) minmax(0,1.6fr) minmax(0,.8fr);gap:6px;margin:8px 0 0}.battle-dock .context-actions>[data-action="attack"]{grid-column:auto}.battle-dock .context-actions button{min-height:44px;font-size:13px;padding:8px 6px}.battle-dock .action-availability{font-size:11px;margin:5px 0 7px}.battle-dock .selected-summary:has(>.selected-unit:only-child){display:block}.battle-dock .selected-unit{width:100%;min-height:42px;padding:0}.battle-dock .selected-unit strong small{display:inline;margin-left:6px}.battle-dock .dock-toolbar button{font-size:12px;padding:8px;min-height:40px}.battle-dock .dock-toolbar [data-do="end"]{background:#35473d;color:#f1e4c7;border-color:#b1c4af55}.map-area{display:flex;flex-direction:column;background:#112126}.map-controls{position:static;flex:none;display:flex;flex-wrap:nowrap;justify-content:center;align-items:center;gap:5px;padding:6px 8px;min-height:56px;background:#15272bec;border-bottom:1px solid #a7b8a735;width:100%;border-radius:0;box-shadow:none}.map-controls button,.map-controls #zoom-exit{min-height:44px;min-width:40px;padding:8px;font-size:12px}.map-controls small,#map-zoom{display:none}.map-area .board-wrap{min-height:0;flex:1}.map-area .range-legend{top:62px;left:8px;right:auto;pointer-events:none;font-size:10px;padding:5px 8px;background:#14242aeb;border-radius:8px;max-width:calc(100% - 16px)}.range-legend #terrain-readout{display:none}
}
@media (max-width:1100px) and (max-height:540px){.battle-dock .context-actions{grid-template-columns:1fr 1fr}.battle-dock .context-actions>[data-action="equipment"]{grid-column:1/-1;grid-row:2}.battle-dock .dock-toolbar [data-action="undo"]{grid-column:1/-1}.map-area .range-legend{font-size:9px}.map-controls{min-height:50px;padding:3px}}

@media (max-width:760px), (max-width:1100px) and (max-height:540px){.battle-dock .dock-toolbar button{min-height:44px}.map-controls button:focus-visible{outline-offset:-3px}}

/* Short screens keep the main choices visible and use only the roster space needed. */
@media (max-width:1100px) and (max-height:540px){
 .mobile-party{height:56px}.board-column:has(.mobile-party>button:nth-child(3)) .mobile-party{height:102px}.battle-dock{padding-top:62px}.board-column:has(.mobile-party>button:nth-child(3)) .battle-dock{padding-top:106px}.battle-dock .context-actions{margin-top:4px}.battle-dock .action-availability{font-size:10px;line-height:1.2;margin:3px 0}.battle-dock .dock-toolbar [data-action="undo"],.battle-dock .dock-toolbar [data-do="end"]{grid-column:auto}.battle-dock .dock-toolbar [data-do="end"]{font-size:11px}.battle-dock .dock-toolbar:not(:has([data-action="undo"])) [data-do="end"]{grid-column:1/-1}
}

/* The opening is a small side-on tableau with complete, player-held poses. */
.scene.visual-opening{grid-template-rows:80px minmax(0,1fr) auto;gap:16px;background:#15252a;padding-bottom:max(24px,env(safe-area-inset-bottom))}
.visual-opening:before{background:radial-gradient(ellipse at 50% 35%,#73614350,transparent 75%)}
.visual-opening .scene-header{grid-column:1/-1}
.opening-controls{display:flex;align-items:center;gap:4px;flex:none}
.opening-controls button{min-width:48px;min-height:44px;padding:8px}
.opening-tableau{position:relative;z-index:1;min-height:0;display:flex;align-items:center;justify-content:center;overflow:hidden}
.opening-stage{display:block;width:100%;height:100%;max-width:1100px;max-height:100%;filter:drop-shadow(0 12px 25px #0006);pointer-events:none}
.opening-role text{fill:#e9e4d5;font:400 28px/1 system-ui;paint-order:stroke;stroke:#102329;stroke-width:3px}
.opening-role.speaking text{fill:#f2ca83}
.visual-opening .dialogue-box{position:relative;inset:auto;transform:none;grid-column:1/-1;align-self:end;width:min(880px,100%);max-height:none;min-height:0;margin:0 auto;padding:22px 28px}
.visual-opening .dialogue-heading h3{font-size:24px}
.visual-opening .dialogue-box p{font-size:24px;line-height:1.4;margin:12px 0 18px;min-height:68px}
.visual-opening .dialogue-box .row{gap:8px}
.visual-opening .dialogue-box button{touch-action:manipulation}
.opening-motion.exit{animation:opening-exit .4s ease-out both}
.opening-motion.intervene{animation:opening-intervene .25s ease-out both}
@keyframes opening-exit{from{translate:140px 0}to{translate:0 0}}
@keyframes opening-intervene{from{translate:-160px 0}to{translate:0 0}}
.opening-stage[data-reduced-motion="true"] .opening-motion{animation:none}
@media(max-width:760px){
 .scene.visual-opening{grid-template-columns:minmax(0,1fr);grid-template-rows:68px minmax(0,1fr) 220px;padding:calc(env(safe-area-inset-top) + 12px) 12px max(12px,env(safe-area-inset-bottom));gap:10px}
 .visual-opening .scene-header h2{font-size:25px;margin-top:6px}
 .visual-opening .scene-header .eyebrow{font-size:9px;letter-spacing:1px}
 .visual-opening .scene-header{gap:6px;align-items:center}
 .opening-controls{gap:0}
 .opening-controls button{font-size:13px;padding:6px;min-width:44px}
 .visual-opening .dialogue-box{height:100%;max-height:100%;padding:18px 16px}
 .visual-opening .dialogue-heading h3{font:400 17px/1.3 system-ui}
 .visual-opening .dialogue-box p{font:18px/1.5 system-ui;flex:1;min-height:0;margin:12px 0}
 .visual-opening .dialogue-box #next-line{min-width:132px}
 .visual-opening .dialogue-box #previous-line{padding:8px;min-width:80px}
}
@media(max-width:1100px) and (max-height:540px){
 .scene.visual-opening{grid-template-columns:minmax(0,1.2fr) minmax(0,1fr);grid-template-rows:50px minmax(0,1fr);padding:calc(env(safe-area-inset-top) + 8px) max(12px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));gap:8px 12px}
 .visual-opening .scene-header h2{font-size:22px;margin-top:3px}
 .opening-tableau{grid-column:1;grid-row:2}
 .visual-opening .dialogue-box{grid-column:2;grid-row:2;height:100%;padding:14px 12px;max-height:100%}
 .visual-opening .dialogue-heading{gap:6px;align-items:center}
 .visual-opening .dialogue-heading h3{font:400 15px/1.3 system-ui}
 .visual-opening .dialogue-heading>span{font-size:10px}
 .visual-opening .dialogue-box p{font:16px/1.4 system-ui;flex:1;min-height:0;margin:10px 0}
 .visual-opening .dialogue-box #next-line{min-width:0;padding:8px;font-size:14px;flex:1}
 .visual-opening .dialogue-box #previous-line{min-width:68px;font-size:13px;padding:8px}
}
@media(prefers-reduced-motion:reduce){.opening-motion{animation:none}}
.opening-motion.strike{animation:opening-strike .22s ease-out both}
@keyframes opening-strike{from{translate:24px -8px}to{translate:0 0}}
.opening-stage[data-reduced-motion="true"] .opening-motion{animation:none}
@media(prefers-reduced-motion:reduce){.opening-motion{animation:none}}

/* Story staging reuses the conversation space and existing cast portraits. */
.character-story .scene-header{grid-row:1;min-height:0}.story-location{display:block;color:var(--muted);font:13px/1.3 system-ui;margin-top:5px}
.story-stage{display:flex;flex-direction:column;gap:6px;padding-bottom:100px}.story-cast{display:flex;flex-wrap:wrap;justify-content:center;gap:3px 9px;flex:none;font:12px/1.3 system-ui;color:#b5c4bc}.story-cast [aria-current]{color:var(--gold)}
.story-actors{display:flex;flex:1;min-height:0;gap:12px;justify-content:center}.story-actors .scene-actor{max-width:60%;min-height:0}.story-nameplate{align-self:center;margin:auto 0;padding:20px 12px;border:1px solid #c6a26c66;background:#15272c;display:grid;text-align:center;gap:8px;font:18px/1.3 system-ui}.story-nameplate small{font-size:12px;color:var(--muted)}
.story-props{position:absolute;bottom:0;left:50%;transform:translateX(-50%);width:150px;height:100px;overflow:visible}.story-actor.depart{transform:translateX(18%);opacity:.55}.story-actor.block{transform:translateX(-8%)}.story-actor.refuse .scene-portrait{filter:brightness(1.1)}.story-actor.bound figcaption{color:#e8a28a}.story-actor.separated{border-right:3px solid #bba17d66}
.story-ending .credits{max-width:850px;padding:6vh 24px}.story-ending h1{font-size:clamp(36px,6vw,65px);margin:18px 0}.story-ending .story-stage{height:36vh;width:100%;margin:auto}.story-ending .credits p{margin:18px 0}.story-ending .row{flex-wrap:wrap}
@media (max-width:760px), (max-width:1100px) and (max-height:540px){
 .character-story .scene-header h2{font-size:22px}.character-story .scene-header .opening-controls{gap:0}.character-story .scene-header .opening-controls button{font-size:12px;padding:4px 8px;min-width:44px}.story-location{font-size:11px}.story-cast{font-size:11px}.story-stage{padding-bottom:68px}.story-props{height:65px;width:100px}.story-nameplate{font-size:16px;padding:14px 8px}.character-story .dialogue-box p{font-size:17px;line-height:1.45}.story-ending .credits{padding:18px 16px}.story-ending .story-stage{height:34vh}
}
@media (max-width:360px){.character-story .scene-header h2{font-size:20px}.character-story .dialogue-box{padding:16px}.character-story .dialogue-box #next-line{min-width:0;font-size:14px}.character-story .dialogue-box p{font-size:16px}}

.character-story{background-image:var(--story-backdrop);background-position:center;background-size:cover}.story-ending{background-image:linear-gradient(#101e2199,#101e21e6),var(--story-backdrop);background-position:center;background-size:cover}

/* Map-first browser HUD. Its fixed footprint is independent of battle state.
   The overview places world tiles beside this gutter; opening sheets never refits. */
@media (min-width:761px) and (min-height:541px), (min-width:1101px) {
 body[data-screen="battle"]{height:100dvh;overflow:hidden}
 body[data-screen="battle"] .game-shell{height:100dvh;min-height:0;overflow:hidden;padding-bottom:env(safe-area-inset-bottom)}
 .game-shell>.topbar{height:calc(54px + env(safe-area-inset-top));min-height:54px;padding:env(safe-area-inset-top) 16px 0;gap:12px;flex-wrap:nowrap}
 .game-shell .brand{font-size:17px;letter-spacing:2px}.game-shell .chapter-tag{font-size:10px;letter-spacing:.7px}.game-shell .topbar nav{gap:4px;flex-wrap:nowrap}.game-shell .topbar nav button{min-height:40px;padding:8px 10px;font-size:12px}
 .game-shell .battle-layout{display:block;position:relative;flex:1;min-height:0;overflow:hidden}
 .game-shell .battle-layout>.sidebar,.game-shell .board-bottom{display:none}
 .game-shell .board-column{display:block;position:relative;height:100%;min-height:0;overflow:hidden}
 /* Reuse the title painting behind the opaque map and HUD. Background layers
    stay outside the scrolling world, add no layout footprint, and need no blur. */
 .game-shell .map-area{display:block;position:absolute;inset:0;min-height:0;background-color:#0b191e;background-image:radial-gradient(ellipse at 65% 45%,#07111600 25%,#071116a6 100%),linear-gradient(#0a171db8,#0a171dd1),url('./public/assets/title.webp');background-position:center;background-size:cover;background-repeat:no-repeat}
 .game-shell #board-viewport{position:absolute;inset:0;width:100%;height:100%;min-height:0;margin:0;border:0;scrollbar-width:none;padding:0}
 .game-shell #board-viewport::-webkit-scrollbar{display:none}
 .game-shell #board-viewport canvas{border:0;outline:1px solid #cfb78355}
 .game-shell .board-meta,.game-shell .mobile-party,.game-shell .map-controls,.game-shell .range-legend,.game-shell .battle-dock{position:absolute;left:12px;right:auto;z-index:4;width:280px;box-sizing:border-box;background:#15262bef;border:1px solid #bca57645;border-radius:8px;box-shadow:0 6px 20px #0003}
 .game-shell .board-meta{top:10px;height:38px;min-height:38px;padding:4px 8px;gap:6px;font-size:10px;letter-spacing:0;flex-wrap:nowrap}.game-shell .board-meta .phase-label{font-size:11px}.game-shell .tip-trigger{display:block;margin-left:auto;min-height:28px;padding:4px 7px;font-size:11px}
 .game-shell .map-area .map-controls{top:56px;bottom:auto;display:flex;flex-wrap:wrap;justify-content:center;gap:4px;padding:6px;min-height:0}
 .game-shell .map-controls button,.game-shell .map-controls #zoom-exit{min-height:36px;min-width:36px;font-size:12px;padding:6px 8px}.game-shell .map-controls #map-zoom{display:block;min-width:40px}.game-shell .map-controls small{display:block;flex-basis:100%;text-align:center;font-size:10px;margin:0}
 .game-shell .mobile-party{display:flex;top:164px;height:auto;max-height:120px;overflow:auto;flex-wrap:wrap;gap:4px;padding:6px}
 .game-shell .mobile-party button{display:flex;align-items:center;gap:7px;flex:1 1 45%;min-width:0;min-height:44px;padding:4px 7px;text-align:left;font-size:12px}.game-shell .mobile-party strong,.game-shell .mobile-party small{display:block}.game-shell .mobile-party small{font-size:10px;color:var(--muted)}.game-shell .mobile-avatar{position:relative;display:block;flex:none;width:26px;height:32px;overflow:hidden}.game-shell .mobile-avatar .portrait-art{position:static;width:100%;height:100%}
 .game-shell .map-area .range-legend{top:294px;padding:8px 10px;margin:0;font-size:11px;line-height:1.5;gap:4px 10px;pointer-events:none;max-height:94px;overflow:hidden}.game-shell .range-legend #terrain-readout{display:block;font-size:11px;min-height:32px}
 .game-shell .battle-dock{display:block;bottom:12px;top:auto;max-height:calc(100% - 404px);overflow:auto;padding:10px;min-height:0}
 .game-shell .selected-summary{display:flex;align-items:center;gap:6px;margin-bottom:6px}.game-shell .selected-unit{display:flex;align-items:center;gap:8px;flex:1;min-width:0;width:100%;border:0;background:none;padding:0;min-height:44px;text-align:left}.game-shell .selected-unit>span:last-child{min-width:0}.game-shell .selected-unit strong{display:block;font-size:14px}.game-shell .selected-unit strong small{display:inline;font-size:11px;color:#d4ccaf}.game-shell .selected-unit>span>span{display:block;font-size:11px;color:var(--muted);line-height:1.4}.game-shell .selected-unit .mobile-avatar{width:32px;height:40px}
 .game-shell .unit-actions{padding:6px;font-size:11px;min-height:44px}.game-shell .battle-dock .context-actions{display:grid;grid-template-columns:1fr 1fr;gap:5px;margin:5px 0}.game-shell .battle-dock .context-actions>[data-action="attack"]{grid-column:1/-1}.game-shell .battle-dock .context-actions button{min-height:40px;font-size:12px;padding:7px}.game-shell .battle-dock .action-availability{font-size:11px;line-height:1.35;margin:5px 0 8px}.game-shell .dock-toolbar{display:flex;gap:5px;flex-wrap:wrap}.game-shell .dock-toolbar button{min-height:40px;font-size:12px;padding:7px 9px}.game-shell .dock-toolbar [data-do="end"]{margin-left:auto;flex:1;max-width:none}.game-shell .dock-toolbar [data-action="undo"]{flex-basis:100%}
 .game-shell.commands-hidden .mobile-party,.game-shell.commands-hidden .range-legend,.game-shell.commands-hidden .battle-dock{display:none}
 .battle-detail-sheet .unit-heading{margin:0 0 12px;height:100px}.battle-detail-sheet .unit-name h3{font-size:25px}
}
/* A shallow laptop keeps essential commands in a single scrollable gutter. */
@media (min-width:761px) and (min-height:541px) and (max-height:850px), (min-width:1101px) and (max-height:850px){
 .game-shell .mobile-party{top:164px;max-height:100px}.game-shell .map-area .range-legend{top:272px;max-height:70px}.game-shell .battle-dock{max-height:calc(100% - 354px)}
}
@media (min-width:1101px) and (max-height:650px){
 .game-shell .brand{display:none}.game-shell .topbar{height:44px;min-height:44px}.game-shell .map-controls small,.game-shell .range-legend{display:none!important}.game-shell .mobile-party{top:142px;max-height:56px}.game-shell .battle-dock{max-height:calc(100% - 212px);bottom:8px;padding:7px}.game-shell .selected-unit .mobile-avatar{display:none}.game-shell .battle-dock .context-actions{grid-template-columns:1fr 1.4fr .7fr}.game-shell .battle-dock .context-actions>[data-action="attack"]{grid-column:auto}.game-shell .battle-dock .action-availability{margin:3px 0}.game-shell .dock-toolbar [data-action="undo"]{flex-basis:auto}
}
@media (min-width:761px) and (min-height:541px), (min-width:1101px){.game-shell .selected-unit:after{content:'Details ›';margin-left:auto;flex:none;font-size:11px;color:var(--gold)}}
@media (min-width:761px) and (min-height:541px), (min-width:1101px){.game-shell #board-viewport canvas:focus-visible{outline:3px solid #f5d894;outline-offset:-3px}}
/* Dialogue is a painted tableau with every present actor on a shared ground. */
.cutscene-cast-description{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.pay-bench>svg{filter:drop-shadow(0 3px 3px #0006)}
.story-stage{width:min(100%,1000px);padding:0;justify-content:center;gap:6px}
.story-tableau{display:block;width:100%;height:100%;min-height:0;flex:1;overflow:hidden}
.story-tableau .story-actor{transform:none;opacity:1}
.story-tableau .story-actor.listening image{filter:brightness(.88)}
.story-tableau text{font:20px system-ui;fill:#fff4dc;paint-order:stroke;stroke:#152329;stroke-width:4px;stroke-linejoin:round}
.story-tableau .speaking text{fill:#ffe0a1}
.character-story{background-color:#15252a;background-image:radial-gradient(ellipse at 50% 35%,#73614350,transparent 75%)}
.story-art-status{min-height:0;flex:none;font:12px/1.3 system-ui;color:var(--paper)}
.story-art-status:empty{display:none}
.story-ending .story-stage{height:36vh;width:100%;max-width:900px}
@media(max-width:760px){.story-stage{padding:0}.story-cast{font-size:11px;line-height:1.3}.story-tableau text{font-size:23px}}
@media(min-width:761px) and (min-height:541px){
 .character-story{grid-template-rows:96px minmax(0,1fr) auto;gap:12px}
 .character-story .story-stage{margin:auto;height:100%;width:min(100%,1000px)}
 .character-story .dialogue-box{position:relative;inset:auto;width:min(100%,1000px);margin:auto;max-height:32dvh;padding:20px 28px;grid-row:3}
 .character-story .dialogue-box p{margin:12px 0;font-size:23px}
}

/* One backdrop per cutscene, with a transparent, uniformly scaled cast.
   The SVG's second copy of the painting must not create an inset scene. */
body[data-screen="scene"]{height:100dvh;overflow:hidden;overscroll-behavior:none}
.scene:is(.character-story,.visual-opening){
 width:100%;height:100dvh;min-height:0;grid-template-columns:minmax(0,1fr);grid-template-rows:76px minmax(0,1fr) 132px;
 padding:max(16px,env(safe-area-inset-top)) max(24px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(24px,env(safe-area-inset-left));gap:8px;
 background-position:center;background-size:cover;background-repeat:no-repeat;isolation:isolate;
}
.scene.character-story{background-image:var(--story-backdrop)}
.scene.visual-opening{background-image:var(--story-backdrop)}
.scene:is(.character-story,.visual-opening):before{background:linear-gradient(#09181ddd,transparent 25%,transparent 75%,#09181ddd)}
.scene:is(.character-story,.visual-opening) .story-tableau>image,.visual-opening .opening-gate>image,.story-ending .story-tableau>image{display:none}
.scene:is(.character-story,.visual-opening) .scene-header{grid-column:1;grid-row:1;min-width:0;align-items:center;align-self:stretch;gap:16px}
.scene:is(.character-story,.visual-opening) .scene-header>div:first-child{min-width:0}
.scene:is(.character-story,.visual-opening) .scene-header h2{font-size:clamp(26px,2.6vw,38px);line-height:1.05;margin:4px 0}
.scene:is(.character-story,.visual-opening) .story-location{font-size:12px;margin:0;line-height:1.3}
.scene:is(.character-story,.visual-opening) :is(.story-stage,.opening-tableau){grid-column:1;grid-row:2;align-self:stretch;width:100%;max-width:none;height:100%;min-height:0;padding:0;margin:0;gap:4px;overflow:hidden}
.scene:is(.character-story,.visual-opening) :is(.story-tableau,.opening-stage){width:100%;height:100%;max-width:none;max-height:none;min-height:0;flex:1;filter:none}
.scene:is(.character-story,.visual-opening) .story-cast{font-size:12px;line-height:1.3;gap:3px 12px}
.scene:is(.character-story,.visual-opening) .dialogue-box{
 position:relative;inset:auto;transform:none;grid-column:1;grid-row:3;align-self:stretch;width:100%;height:100%;max-height:none;min-height:0;margin:0;
 display:grid;grid-template-columns:minmax(150px,.26fr) minmax(0,1fr) auto;align-items:center;gap:24px;padding:18px 24px;border-radius:16px;
 background:linear-gradient(110deg,#142326f5,#172a2ef5);
}
.scene:is(.character-story,.visual-opening) .dialogue-heading{min-width:0;display:flex;flex-direction:column;align-items:flex-start;gap:6px}
.scene:is(.character-story,.visual-opening) .dialogue-heading h3{font:400 clamp(18px,1.65vw,25px)/1.15 'Cormorant Garamond',Georgia,serif;overflow-wrap:anywhere}
.scene:is(.character-story,.visual-opening) .dialogue-heading>span{font-size:12px}
.scene:is(.character-story,.visual-opening) .dialogue-box p{font:clamp(20px,1.6vw,26px)/1.35 'Cormorant Garamond',Georgia,serif;min-height:0;margin:0;overflow:visible;flex:none}
.scene:is(.character-story,.visual-opening) .dialogue-box>.row{display:flex;flex-wrap:nowrap;gap:10px;justify-content:flex-end}
.scene:is(.character-story,.visual-opening) .dialogue-box button{font-size:15px;min-height:44px;min-width:0;padding:10px 16px;white-space:nowrap}
.story-ending{height:100dvh;min-height:0;overflow:hidden;background-image:linear-gradient(#101e2170,transparent 30%,transparent 70%,#101e21e6),var(--story-backdrop)}
.story-ending .credits{height:100%;width:100%;max-width:none;display:grid;grid-template-rows:auto auto minmax(0,1fr) auto auto;gap:8px;padding:max(20px,env(safe-area-inset-top)) max(24px,env(safe-area-inset-right)) max(20px,env(safe-area-inset-bottom)) max(24px,env(safe-area-inset-left))}
.story-ending .credits h1{font-size:clamp(34px,4vw,52px);line-height:1.1;margin:0}
.story-ending .credits .story-stage{grid-row:3;width:100%;max-width:none;height:100%;min-height:0;margin:0;padding:0}
.story-ending .credits p{font-size:22px;line-height:1.3;margin:0}
.story-ending .credits>.row{gap:10px;flex-wrap:wrap}
.story-ending .credits button{min-height:44px}
@media(max-width:1100px){
 .scene:is(.character-story,.visual-opening) .dialogue-box{grid-template-columns:minmax(115px,.24fr) minmax(0,1fr) auto;gap:16px;padding:16px 20px}
 .scene:is(.character-story,.visual-opening) .dialogue-box>.row{flex-direction:column;gap:0}
 .scene:is(.character-story,.visual-opening) .dialogue-box p{font-size:20px}
}
@media(max-width:760px){
 .scene:is(.character-story,.visual-opening){grid-template-rows:100px minmax(0,1fr) 202px;padding:max(10px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));gap:6px}
 .scene:is(.character-story,.visual-opening) .scene-header{gap:8px;align-items:center}
 .scene:is(.character-story,.visual-opening) .scene-header h2{font-size:24px}
 .scene:is(.character-story,.visual-opening) .scene-header .eyebrow{font-size:9px;letter-spacing:1px}
 .scene:is(.character-story,.visual-opening) .story-location{font-size:11px}
 .scene:is(.character-story,.visual-opening) .dialogue-box{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) 44px;align-items:stretch;gap:8px;padding:16px;border-radius:16px}
 .scene:is(.character-story,.visual-opening) .dialogue-heading{flex-direction:row;align-items:baseline;justify-content:space-between;gap:8px}
 .scene:is(.character-story,.visual-opening) .dialogue-heading h3{font:400 17px/1.2 system-ui}
 .scene:is(.character-story,.visual-opening) .dialogue-box p{align-self:center;font:17px/1.4 system-ui}
 .scene:is(.character-story,.visual-opening) .dialogue-box>.row{flex-direction:row;justify-content:space-between;gap:8px}
 .scene:is(.character-story,.visual-opening) .dialogue-box button{font-size:14px;padding:8px 10px}
 .scene:is(.character-story,.visual-opening) .story-cast{font-size:11px;gap:3px 9px}
 .story-ending .credits{padding:max(12px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));gap:8px}
 .story-ending .credits h1{font-size:36px}.story-ending .credits p{font-size:18px}
 .story-ending .credits>.row{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}.story-ending .credits button{min-width:0;font-size:13px;padding:8px}
}
@media(max-width:360px){
 .scene:is(.character-story,.visual-opening) .scene-header h2{font-size:22px}
 .scene:is(.character-story,.visual-opening) .dialogue-box p{font-size:16px}
 .scene:is(.character-story,.visual-opening) .dialogue-box{padding:12px;gap:6px}
}
@media(max-height:540px) and (orientation:landscape){
 .scene:is(.character-story,.visual-opening){grid-template-columns:minmax(0,1fr) minmax(250px,35%);grid-template-rows:64px minmax(0,1fr);padding:max(8px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));gap:6px 12px}
 .scene:is(.character-story,.visual-opening) .scene-header{grid-column:1/-1;grid-row:1;gap:12px}
 .scene:is(.character-story,.visual-opening) .scene-header h2{font-size:24px}
 .scene:is(.character-story,.visual-opening) .scene-header .eyebrow{font-size:9px;letter-spacing:1px}
 .scene:is(.character-story,.visual-opening) .story-location{font-size:11px}
 .scene:is(.character-story,.visual-opening) .dialogue-box{grid-column:2;grid-row:2;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) 44px;gap:8px;padding:14px}
 .scene:is(.character-story,.visual-opening) .dialogue-heading{flex-direction:row;align-items:baseline;justify-content:space-between;gap:8px}
 .scene:is(.character-story,.visual-opening) .dialogue-heading h3{font:400 16px/1.2 system-ui}
 .scene:is(.character-story,.visual-opening) .dialogue-box p{align-self:center;font:16px/1.4 system-ui}
 .scene:is(.character-story,.visual-opening) .dialogue-box>.row{flex-direction:row;justify-content:space-between;gap:6px}
 .scene:is(.character-story,.visual-opening) .dialogue-box button{font-size:13px;padding:8px;white-space:normal}
 .story-ending .credits{grid-template-columns:minmax(0,1fr) minmax(240px,35%);grid-template-rows:auto minmax(0,1fr) auto auto;gap:8px 16px}
 .story-ending .credits>.eyebrow{grid-column:1/-1}.story-ending .credits h1{grid-column:2;grid-row:2;align-self:center;font-size:34px}
 .story-ending .credits .story-stage{grid-column:1;grid-row:2/5}.story-ending .credits p{grid-column:2;grid-row:3;font-size:18px}
 .story-ending .credits>.row{grid-column:2;grid-row:4;display:grid;grid-template-columns:1fr;gap:4px}.story-ending .credits button{font-size:13px;padding:8px;min-width:0}
}
/* Static preparation figures need room for promoted shields at the same body scale. */
@media(min-width:701px){.preparation-page .prep-profile{grid-template-columns:140px minmax(0,1fr)}}
@media(min-width:1200px){.preparation-page .prep-profile{grid-template-columns:125px minmax(0,1fr)}}
@media(max-width:700px){.preparation-page .prep-profile{grid-template-columns:124px minmax(0,1fr)}}
@media(max-width:360px){.preparation-page .prep-profile{grid-template-columns:114px minmax(0,1fr)}}

/* Comic dialogue floats beside the speaking cast; only small controls use the foot. */
.scene.speech-scene,.story-ending.speech-scene .credits{position:relative;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto;width:100%;height:100dvh;max-width:none;min-height:0;padding:max(14px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));gap:8px;overflow:hidden}
.speech-scene .scene-header{grid-column:1;grid-row:1;min-height:64px;z-index:5;position:relative;inset:auto}
.speech-scene .scene-header h1{font-size:clamp(26px,3vw,40px);line-height:1.1;margin:4px 0}
.scene.speech-scene :is(.story-stage,.opening-tableau),.story-ending.speech-scene .credits .story-stage{grid-column:1;grid-row:2;align-self:stretch;justify-self:start;height:100%;max-width:none;margin:0;padding:0;min-height:0}
:is(.scene,.story-ending).speech-scene .speech-bubble{position:absolute;inset:auto;grid-area:auto;transform:none;z-index:4;display:block;width:430px;height:auto;max-height:none;min-height:0;margin:0;padding:16px 20px;border:2px solid var(--speech-border,#614b35);border-radius:24px;background:var(--speech-fill,#fff5dd);color:#302b24;box-shadow:0 5px 16px #0003;pointer-events:none}
:is(.scene,.story-ending).speech-scene .speech-bubble .dialogue-heading{display:flex;flex-direction:row;justify-content:space-between;align-items:baseline;gap:12px;margin:0 0 8px}
:is(.scene,.story-ending).speech-scene .speech-bubble .dialogue-heading h3{font:400 12px/1.25 system-ui;letter-spacing:.04em;color:#77552f;overflow-wrap:normal}
:is(.scene,.story-ending).speech-scene .speech-bubble .dialogue-heading>span{font:11px/1.2 system-ui;color:#6b6659;white-space:nowrap}
:is(.scene,.story-ending).speech-scene .speech-bubble p{font:19px/1.4 system-ui;min-height:0;margin:0;color:#302b24;overflow:visible;overflow-wrap:break-word}
.speech-tail{position:absolute;inset:0;width:100%;height:100%;z-index:5;pointer-events:none;overflow:visible}.speech-tail-fill{fill:var(--speech-fill,#fff5dd);stroke:none}.speech-tail-outline{fill:none;stroke:var(--speech-border,#614b35);stroke-width:2;stroke-linejoin:round}
.speech-scene .cutscene-navigation{grid-column:1;grid-row:3;justify-self:end;align-self:end;display:flex;flex-wrap:wrap;justify-content:flex-end;gap:6px;max-width:100%;z-index:5}
.speech-scene .cutscene-navigation button{min-height:44px;min-width:0;padding:9px 14px;font:14px/1.2 system-ui;border-radius:10px;white-space:normal}.speech-scene .cutscene-navigation .quiet{background:#11262be6;border:1px solid #a7b0a777}
@media(max-width:760px){.scene.speech-scene,.story-ending.speech-scene .credits{padding:max(10px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));gap:6px}.speech-scene .scene-header{min-height:60px}.speech-scene .scene-header h1{font-size:28px}:is(.scene,.story-ending).speech-scene .speech-bubble{padding:13px 16px;border-radius:20px}:is(.scene,.story-ending).speech-scene .speech-bubble p{font-size:16px;line-height:1.4}.speech-scene .cutscene-navigation button{padding:8px 11px;font-size:13px}}
@media(max-height:540px) and (orientation:landscape){.scene.speech-scene,.story-ending.speech-scene .credits{grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto;padding:max(8px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));gap:4px}.speech-scene .scene-header{min-height:48px}.scene.speech-scene .scene-header h2{font-size:22px}.speech-scene .scene-header h1{font-size:25px}:is(.scene,.story-ending).speech-scene .speech-bubble{padding:12px 14px}:is(.scene,.story-ending).speech-scene .speech-bubble p{font-size:16px;line-height:1.35}.speech-scene .cutscene-navigation button{font-size:13px;padding:8px 11px}}

/* Reserve either sideways camera cutout; the board observer refits the map. */
@media (max-width:1100px) and (max-height:540px) and (orientation:landscape){
 .game-shell{padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right)}
 .mobile-party{height:106px}
 .page>.topbar{padding-left:max(16px,env(safe-area-inset-left));padding-right:max(16px,env(safe-area-inset-right))}
 .preparation-page .prep-page-inner{padding-left:max(15px,env(safe-area-inset-left));padding-right:max(15px,env(safe-area-inset-right));padding-bottom:calc(24px + env(safe-area-inset-bottom))}
 .sheet-backdrop{padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right)}
 .promotion-composition{padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right)}
}

/* Focus/reveal scrolling must leave controls above the home indicator. */
@media (max-width:760px), (max-width:1100px) and (max-height:540px){
 html,.page,.sheet,.battle-dock,.prep-roster-list{scroll-padding-top:env(safe-area-inset-top);scroll-padding-bottom:env(safe-area-inset-bottom)}
 .battle-dock .selected-unit{min-height:44px}
}

/* Native iPhone landscape: the 4:3 overview uses the full safe height.
   HUD controls live in its natural side margins and never consume map rows. */
@media (orientation:landscape){
 html[data-native-phone="true"] body[data-screen="battle"]{padding:0}
 html[data-native-phone="true"] body[data-screen="battle"] .game-shell{display:block;position:relative;width:100%;height:100dvh;min-height:0;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);overflow:hidden;--native-hud-width:72px}
 html[data-native-phone="true"] .game-shell>.topbar,html[data-native-phone="true"] .game-shell .battle-layout>.sidebar,html[data-native-phone="true"] .game-shell .mobile-party,html[data-native-phone="true"] .game-shell .board-meta,html[data-native-phone="true"] .game-shell .board-bottom,html[data-native-phone="true"] .game-shell .map-controls,html[data-native-phone="true"] .game-shell .range-legend{display:none}
 html[data-native-phone="true"] .game-shell .battle-layout,html[data-native-phone="true"] .game-shell .board-column{display:block;position:relative;width:100%;height:100%;min-height:0;overflow:hidden}
 html[data-native-phone="true"] .game-shell .map-area{display:block;position:absolute;inset:0;min-height:0;background:#0b191e url('./public/assets/title.webp') center/cover no-repeat}
 html[data-native-phone="true"] .game-shell #board-viewport{position:absolute;inset:0;width:100%;height:100%;min-height:0;margin:0;border:0;padding:0;scrollbar-width:none}
 html[data-native-phone="true"] .game-shell #board-viewport canvas{border:0;outline:1px solid #cfb78355}
 html[data-native-phone="true"] .game-shell .native-battle-hud{display:contents}
 html[data-native-phone="true"] .native-hud-left,html[data-native-phone="true"] .native-hud-right{position:absolute;z-index:4;top:50%;transform:translateY(-50%);display:flex;flex-direction:column;gap:6px;width:var(--native-hud-width);max-height:100%;overflow:auto;scrollbar-width:none}
 html[data-native-phone="true"] .native-hud-left{left:4px}html[data-native-phone="true"] .native-hud-right{right:4px}
 html[data-native-phone="true"] .native-battle-hud button{display:flex;align-items:center;justify-content:center;width:100%;flex:none;min-width:44px;min-height:44px;margin:0;padding:6px 3px;border:1px solid #bca57666;border-radius:10px;background:#15262bf2;font-size:12px;line-height:1.15;text-align:center;overflow-wrap:anywhere;box-shadow:0 3px 10px #0004}
 html[data-native-phone="true"] .native-battle-hud button.primary{background:#d7b980;color:#17251e}
 html[data-native-phone="true"] .native-battle-hud [data-do="end"]{background:#35473df5;color:#f1e4c7}
 html[data-native-phone="true"] .native-battle-hud .selected-unit{flex:none;gap:0}
 html[data-native-phone="true"] .native-battle-hud .selected-unit strong{display:block;font-size:12px;white-space:normal}
 html[data-native-phone="true"] .native-battle-hud .selected-unit small{display:block;margin-top:3px;font-size:10px;color:#d4ccaf}
 html[data-native-phone="true"] .native-turn{display:flex;flex-direction:column;gap:3px;min-height:32px;justify-content:center;text-align:center;font-size:10px;color:#f1e4c7;text-shadow:0 1px 3px #000;background:#15262bd9;border-radius:8px;padding:4px 0}
 html[data-native-phone="true"] .native-party-sheet,html[data-native-phone="true"] .native-map-tools{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:12px 0}
 html[data-native-phone="true"] .native-party-sheet button,html[data-native-phone="true"] .native-map-tools button{min-height:44px;min-width:44px}
 html[data-native-phone="true"] .native-turn{min-height:48px;padding:4px 2px}html[data-native-phone="true"] .native-turn small{font-size:10px;color:#bacbbf}
 html[data-native-phone="true"] .native-hud-tip{display:none}

 /* The full scene sits behind compact HUD overlays. Drawing reserves their
    measured heights, including tall weapon labels, to keep fighters clear. */
 html[data-native-phone="true"] .duel-stage.duel-native{display:block;padding:0}
 html[data-native-phone="true"] .duel-native .duel-field{position:absolute;inset:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);width:auto;height:auto;overflow:hidden}
 html[data-native-phone="true"] .duel-native canvas{width:100%;height:100%;object-fit:contain;border-radius:0}
 html[data-native-phone="true"] .duel-native .duel-hud{position:absolute;z-index:2;top:auto;bottom:calc(env(safe-area-inset-bottom) + 6px);left:calc(env(safe-area-inset-left) + 8px);right:calc(env(safe-area-inset-right) + 8px);gap:10px}
 html[data-native-phone="true"] .duel-native .duel-unit{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:3px 8px;padding:6px 10px;background:#192a2dea;border-radius:10px}
 html[data-native-phone="true"] .duel-native .duel-unit>strong{font-size:14px;line-height:1.2}html[data-native-phone="true"] .duel-native .duel-unit>b{font-size:13px}
 html[data-native-phone="true"] .duel-native .duel-unit>span{grid-column:1/-1;min-height:0;margin:0;font-size:11px;line-height:1.2}html[data-native-phone="true"] .duel-native .duel-unit .hp{grid-column:1/-1;margin:1px 0 0;height:5px}
 html[data-native-phone="true"] .duel-native .duel-footer{position:absolute;z-index:2;top:calc(env(safe-area-inset-top) + 6px);bottom:auto;left:calc(env(safe-area-inset-left) + 8px);right:calc(env(safe-area-inset-right) + 8px);gap:8px}
 html[data-native-phone="true"] .duel-native .duel-footer>button{min-height:44px;background:#192a2dea;font-size:12px;padding:8px 12px}

 /* Native preparation is a fixed landscape workspace with one scrollable
    supply panel. Selecting companions never pushes the start button away. */
 html[data-native-phone="true"] body[data-screen="camp"]{height:100dvh;overflow:hidden;padding:0}
 html[data-native-phone="true"] .preparation-page{position:relative;height:100dvh;min-height:0;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);overflow:hidden}
 html[data-native-phone="true"] .preparation-page>.topbar{position:absolute;z-index:2;top:calc(env(safe-area-inset-top) + 6px);right:calc(env(safe-area-inset-right) + 8px);height:44px;min-height:44px;padding:0;background:none;border:0}
 html[data-native-phone="true"] .preparation-page>.topbar>div,html[data-native-phone="true"] .preparation-page>.topbar [data-do="journal"]{display:none}
 html[data-native-phone="true"] .preparation-page>.topbar nav{gap:4px}html[data-native-phone="true"] .preparation-page>.topbar button{min-height:44px;padding:8px;font-size:12px}
 html[data-native-phone="true"] .preparation-page .prep-page-inner{display:grid;grid-template-rows:56px minmax(0,1fr);flex:1;min-height:0;max-width:none;margin:0;padding:0 8px}
 html[data-native-phone="true"] .prep-mission{align-items:center;gap:8px;margin:0;padding-right:190px;min-height:0}html[data-native-phone="true"] .prep-mission>div{min-width:0}
 html[data-native-phone="true"] .prep-mission .eyebrow,html[data-native-phone="true"] .prep-mission p,html[data-native-phone="true"] .prep-mission .prep-readiness{display:none}
 html[data-native-phone="true"] .prep-mission h2{margin:0;font-size:20px;line-height:1.15}html[data-native-phone="true"] .native-prep-mission{flex:none;min-width:64px;min-height:44px;margin-left:auto;padding:8px;font-size:12px}
 html[data-native-phone="true"] .prep-layout{grid-template-columns:138px 170px minmax(0,1fr);gap:8px;align-items:stretch;min-height:0}
 html[data-native-phone="true"] .prep-roster{display:flex;flex-direction:column;min-height:0}html[data-native-phone="true"] .prep-roster>.row{margin:0 0 5px}html[data-native-phone="true"] .prep-roster h3{font-size:18px}html[data-native-phone="true"] .prep-roster>.row>span{font-size:10px}
 html[data-native-phone="true"] .prep-roster-list{display:grid;grid-template-columns:1fr;gap:5px;overflow:auto;min-height:0;align-content:start;padding:2px}
 html[data-native-phone="true"] .prep-roster-unit{min-height:48px;padding:5px;gap:6px;margin:0;border-radius:9px}html[data-native-phone="true"] .prep-roster-unit strong{font-size:13px}html[data-native-phone="true"] .prep-roster-unit small{font-size:10px;margin-top:2px}html[data-native-phone="true"] .prep-roster-status{display:none}html[data-native-phone="true"] .prep-avatar{width:26px;height:36px}
 html[data-native-phone="true"] .native-prep-unit{display:flex;flex-direction:column;min-width:0;min-height:0;text-align:center;background:#192b2eaf;border:1px solid var(--line);border-radius:12px;padding:6px}
 html[data-native-phone="true"] .native-prep-unit h3{font-size:22px;line-height:1.1;margin:0 0 3px}html[data-native-phone="true"] .native-prep-unit .prep-class{font-size:11px;line-height:1.2}
 html[data-native-phone="true"] .native-prep-unit .prep-figure{flex:1;min-height:0;height:auto;margin:4px 0}html[data-native-phone="true"] .native-prep-unit>button{min-height:44px;font-size:12px;padding:6px}
 html[data-native-phone="true"] .prep-detail{display:flex;flex-direction:column;min-height:0;padding:6px;border-radius:12px;overflow:hidden}
 html[data-native-phone="true"] .native-prep-tabs{display:flex;gap:4px;flex:none;padding-bottom:6px}html[data-native-phone="true"] .native-prep-tabs button{flex:1;min-width:44px;min-height:44px;font-size:12px;padding:6px;border-radius:8px}html[data-native-phone="true"] .native-prep-tabs [aria-selected="true"]{border-color:#dfbf7f;background:#3c4032}
 html[data-native-phone="true"] .native-prep-panel{overflow:auto;min-height:0;flex:1;padding:2px 4px 8px;scroll-padding:6px}html[data-native-phone="true"] .prep-detail [hidden]{display:none!important}
 html[data-native-phone="true"] .native-prep-panel .prep-equipment{margin:0;padding:4px 0 0;border:0}html[data-native-phone="true"] .native-prep-panel .prep-equipment>p{font-size:11px;line-height:1.25;margin:0 0 8px}html[data-native-phone="true"] .native-prep-panel legend{font-size:14px;margin-bottom:6px}
 html[data-native-phone="true"] .native-prep-panel .prep-weapons{grid-template-columns:1fr;gap:8px}html[data-native-phone="true"] .native-prep-panel .prep-weapon label{font-size:12px;min-height:16px}html[data-native-phone="true"] .native-prep-panel .prep-weapon select{min-height:44px;margin:3px 0;font-size:12px;padding:6px}html[data-native-phone="true"] .native-prep-panel .prep-weapon p{font-size:11px;line-height:1.25;margin:0}
 html[data-native-phone="true"] .native-prep-panel .prep-services{display:flex;flex-direction:column;gap:8px;margin:0}html[data-native-phone="true"] .native-prep-panel .prep-services>details{width:100%}
 html[data-native-phone="true"] .native-prep-panel .prep-options>summary{min-height:44px;padding:8px;font-size:12px}html[data-native-phone="true"] .native-prep-panel .prep-options>summary>span{font-size:12px}html[data-native-phone="true"] .native-prep-panel .prep-options>summary>small{font-size:10px}html[data-native-phone="true"] .native-prep-panel .prep-promotion{margin-top:8px}
 html[data-native-phone="true"] .preparation-page .prep-rest-note{display:none}html[data-native-phone="true"] .preparation-page .prep-start{position:static;flex:none;min-height:56px;padding:6px 8px;gap:8px;border:0;background:#112126}
 html[data-native-phone="true"] .prep-start>div{display:flex;align-items:center;gap:8px;min-width:0}html[data-native-phone="true"] .prep-start strong{font-size:11px;line-height:1.3}html[data-native-phone="true"] .prep-start small{display:none}html[data-native-phone="true"] .prep-start .prep-coins{font-size:11px;flex:none}html[data-native-phone="true"] .prep-start>button{min-width:150px;min-height:44px;font-size:14px;padding:8px}
}
@media (orientation:landscape) and (max-width:700px){html[data-native-phone="true"] .prep-layout{grid-template-columns:112px 135px minmax(0,1fr)}html[data-native-phone="true"] .prep-roster-unit small{font-size:9px}html[data-native-phone="true"] .native-prep-unit h3{font-size:20px}}

/* Native pre-fight windows have a pinned action bar and compact data cards.
   Target/item pickers handle variable lists without adding page-height rows. */
@media (orientation:landscape){
 html[data-native-phone="true"] .native-window-backdrop{align-items:center;justify-content:center;padding:calc(env(safe-area-inset-top) + 8px) calc(env(safe-area-inset-right) + 8px) calc(env(safe-area-inset-bottom) + 8px) calc(env(safe-area-inset-left) + 8px)}
 html[data-native-phone="true"] .sheet.native-window{display:flex;flex-direction:column;gap:6px;width:min(760px,100%);height:min(340px,calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px));max-height:100%;margin:0;padding:8px;border-radius:18px;border:1px solid #b6c9c14d;background:#192a30f5;box-shadow:0 14px 50px #0006;animation:none;overflow:hidden}
 html[data-native-phone="true"] .native-window .sheet-handle{display:none}html[data-native-phone="true"] .native-window .sheet-close{right:8px;top:8px;min-height:44px;min-width:44px;font-size:24px}
 html[data-native-phone="true"] .native-window-header{display:flex;align-items:center;gap:8px;flex:none;min-height:44px;padding-right:50px;min-width:0}
 html[data-native-phone="true"] .native-window-header h2{flex:1;min-width:0;margin:0;padding:0;font:400 18px/1.15 -apple-system,BlinkMacSystemFont,sans-serif;overflow-wrap:anywhere}html[data-native-phone="true"] .native-window-header>span{font-size:12px;color:#b6c9bf}
 html[data-native-phone="true"] .native-window-header select{width:auto;max-width:42%;min-width:112px;font-size:12px}html[data-native-phone="true"] .native-window-header>button{min-width:44px;min-height:44px;padding:6px}
 html[data-native-phone="true"] .native-window-body{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;padding:0 4px}
 html[data-native-phone="true"] .native-window :is(button,select){min-height:44px;min-width:44px;font-size:13px;padding:6px 8px;border-radius:10px}html[data-native-phone="true"] .native-window button:disabled{opacity:1;color:#91a49a;background:#223138;border-color:#51635b}
 html[data-native-phone="true"] .native-window p{font-size:12px;line-height:1.3;margin:6px 0}html[data-native-phone="true"] .native-window h3{font:400 14px/1.15 -apple-system,BlinkMacSystemFont,sans-serif;margin:0}
 html[data-native-phone="true"] .native-window-footer{display:flex;gap:6px;flex:none;min-height:44px}html[data-native-phone="true"] .native-window-footer>button{flex:1;margin:0;min-width:0}html[data-native-phone="true"] .native-window-footer #cancel{margin:0}
 html[data-native-phone="true"] .native-forecast .native-window-body,html[data-native-phone="true"] .native-equipment .native-window-body{overflow:hidden}
 html[data-native-phone="true"] .native-matchup{display:grid;grid-template-columns:1fr 1fr;gap:8px}
 html[data-native-phone="true"] .native-matchup-unit{min-width:0;padding:6px;display:grid;gap:4px;border:1px solid #a6c4b644;border-top:2px solid var(--teal);border-radius:12px;background:#102227}
 html[data-native-phone="true"] .native-matchup-unit.enemy{border-top-color:var(--red)}html[data-native-phone="true"] .native-matchup-name{display:flex;align-items:center;gap:6px;min-height:20px}html[data-native-phone="true"] .native-matchup-name h3{flex:1;min-width:0;overflow-wrap:anywhere}html[data-native-phone="true"] .native-matchup-name>span{flex:none;font-size:11px;white-space:nowrap;color:#d4d4bd}
 html[data-native-phone="true"] .native-matchup-unit>select{width:100%;min-width:0;font-size:12px}html[data-native-phone="true"] .native-weapon-name{display:flex;align-items:center;min-height:44px;font-size:12px;line-height:1.15;overflow-wrap:anywhere;padding:4px 8px;background:#223138;border-radius:10px}
 html[data-native-phone="true"] .native-strike{display:grid;grid-template-columns:1fr 1fr;gap:4px;align-items:center}html[data-native-phone="true"] .native-strike strong{font:400 21px/1.1 -apple-system,BlinkMacSystemFont,sans-serif}html[data-native-phone="true"] .native-strike b{font-size:13px}html[data-native-phone="true"] .native-strike small{display:block;font-size:11px;line-height:1.2;color:#bacbbd;margin-top:2px}
 html[data-native-phone="true"] .native-matchup-unit>p{font-size:11px;line-height:1.2;margin:0}html[data-native-phone="true"] .native-window p.native-forecast-note{font-size:11px;line-height:1.25;margin:5px 0 0}
 html[data-native-phone="true"] .native-equipment-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}html[data-native-phone="true"] .native-equipment-grid>section{min-width:0;display:flex;flex-direction:column;gap:6px}html[data-native-phone="true"] .native-equipment-grid select{width:100%;min-width:0}html[data-native-phone="true"] .native-equipment-grid p{margin:0}html[data-native-phone="true"] .native-equipment-grid small{font-size:11px;color:#b6c9bf}
 html[data-native-phone="true"] .native-window.native-unit,html[data-native-phone="true"] .native-window.native-mission,html[data-native-phone="true"] .native-window.native-compact{height:auto}
 html[data-native-phone="true"] .native-unit .stat-grid{grid-template-columns:repeat(7,minmax(0,1fr));gap:4px;margin:8px 0}html[data-native-phone="true"] .native-unit .stat-grid b{font-size:17px}html[data-native-phone="true"] .native-unit .stat-grid small{font-size:10px;letter-spacing:0}html[data-native-phone="true"] .native-unit .experience{font-size:12px}html[data-native-phone="true"] .native-unit .xp-track{height:5px}
 html[data-native-phone="true"] .native-promotion-gains{display:grid;grid-template-columns:repeat(6,1fr);gap:4px;text-align:center;margin:6px 0}html[data-native-phone="true"] .native-promotion-gains strong{font-size:17px}html[data-native-phone="true"] .native-promotion-gains small{display:block;font-size:10px}
 html[data-native-phone="true"] .native-prep-panel{overflow:hidden;padding-bottom:4px}
 html[data-native-phone="true"] .native-prep-gear{display:grid;gap:8px}html[data-native-phone="true"] .native-prep-gear label{display:flex;justify-content:space-between;gap:4px;align-items:center;font-size:11px;line-height:1.2;margin:0 0 4px}html[data-native-phone="true"] .native-prep-gear label span{font-size:10px;color:#b6c9bf;text-align:right}html[data-native-phone="true"] .native-prep-gear select{width:100%;min-width:0;min-height:44px;padding:6px;font-size:12px;margin:0}
 html[data-native-phone="true"] .native-prep-choice{display:flex;flex-direction:column;gap:6px;min-width:0}html[data-native-phone="true"] .native-prep-choice select{width:100%;min-width:0;min-height:44px;padding:6px;font-size:12px}html[data-native-phone="true"] .native-prep-choice p{font-size:11px;line-height:1.25;margin:0}html[data-native-phone="true"] .native-prep-choice button{min-height:44px;padding:6px;font-size:12px}html[data-native-phone="true"] .native-prep-choice .row{gap:6px}html[data-native-phone="true"] .native-prep-choice .row>button{flex:1;min-width:0}
}

/* Build 5: persistent native map tools and grouped preferences. */
.native-map-done{display:none}
@media(orientation:landscape){
 html[data-native-phone="true"] .native-battle-hud button{overflow-wrap:normal;word-break:normal;font-size:11px}
 html[data-native-phone="true"] .native-battle-hud button:disabled{opacity:1;color:#9baaa6;background:#263236;border-color:#687873}
 html[data-native-phone="true"] .native-turn{gap:2px;min-height:48px;font-size:11px}
 html[data-native-phone="true"] .native-turn span:first-of-type{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 html[data-native-phone="true"] .native-turn small{font-size:10px}
 html[data-native-phone="true"] .native-hud-left,html[data-native-phone="true"] .native-hud-right{gap:5px;overflow:hidden}
 html[data-native-phone="true"] .game-shell.native-map-tools-open .map-controls{display:flex;position:absolute;left:calc(var(--native-hud-width) + 8px);right:calc(var(--native-hud-width) + 8px);top:0;width:auto;height:52px;min-height:52px;z-index:5;gap:3px;padding:4px;justify-content:center;border-radius:12px;border:1px solid #bca57655;background:#15262bf5}
 html[data-native-phone="true"] .game-shell.native-map-tools-open .map-controls button{min-width:44px;min-height:44px;font-size:11px;padding:4px}
 html[data-native-phone="true"] .game-shell.native-map-tools-open #map-zoom{display:block;min-width:34px;font-size:10px}
 html[data-native-phone="true"] .game-shell.native-map-tools-open .native-map-done{display:block}
 html[data-native-phone="true"] .native-context-actions{display:flex;flex-direction:column;gap:6px}
 html[data-native-phone="true"] .native-context-actions label,html[data-native-phone="true"] .native-preferences-grid label{display:flex;flex-direction:column;gap:3px;font-size:12px}
 html[data-native-phone="true"] .native-context-actions select,html[data-native-phone="true"] .native-context-actions button,html[data-native-phone="true"] .native-preferences-grid select,html[data-native-phone="true"] .native-preferences-grid button{min-height:44px;margin:0}
 html[data-native-phone="true"] .native-context-actions p{margin:0;font-size:11px}
 html[data-native-phone="true"] .native-preferences-tabs{display:flex;gap:5px;flex:none}
 html[data-native-phone="true"] .native-preferences-tabs button{flex:1;min-height:44px;margin:0;font-size:13px}
 html[data-native-phone="true"] .native-preferences-tabs [aria-pressed="true"]{background:#d7b980;color:#17251e}
 html[data-native-phone="true"] .native-preferences-grid{display:grid;grid-template-columns:1fr 1fr;gap:6px}
 html[data-native-phone="true"] .native-preferences-grid .native-toggle,html[data-native-phone="true"] .native-toggle{display:flex;flex-direction:row;align-items:center;gap:6px;min-height:44px;padding:4px;border:1px solid #a0b6ab44;border-radius:10px;font-size:12px}
 html[data-native-phone="true"] .native-toggle input{min-width:24px;min-height:24px;margin:0}
 html[data-native-phone="true"] .native-audio-grid{display:grid;grid-template-columns:1fr 1fr;gap:5px 10px}
 html[data-native-phone="true"] .native-audio-master{display:flex;flex-direction:column;gap:5px}
 html[data-native-phone="true"] .native-audio-grid button{min-height:44px;margin:0}
 html[data-native-phone="true"] .native-audio-grid label{font-size:12px;line-height:16px;margin:0}
 html[data-native-phone="true"] .native-audio-grid input[type="range"]{height:44px;min-height:44px;width:100%;margin:0;padding:0;display:block}
 html[data-native-phone="true"] .native-audio-grid #audio-status,html[data-native-phone="true"] .native-audio-grid #audio-retry{grid-column:1/-1;margin:0;font-size:11px}
 html[data-native-phone="true"] .native-audio-grid [hidden]{display:none}
}

/* A shared Roman palette and compact carved framing for the native menus. */
@media(orientation:landscape){
 html[data-native-phone="true"] :is(button,select){border-radius:4px;border-color:#c6a26c70;background:linear-gradient(180deg,#2b3838,#18282d);color:#eee3ce;box-shadow:inset 0 1px #e5c89512,0 2px 5px #07101233}
 html[data-native-phone="true"] button.primary{background:linear-gradient(135deg,#edd29a,#c59a5f);border-color:#e6c58d;color:#172124}
 html[data-native-phone="true"] button:disabled{opacity:1;color:#9ca6a0;border-color:#8f8a6b55;background:#253135;box-shadow:none}
 html[data-native-phone="true"] button:focus-visible,html[data-native-phone="true"] select:focus-visible{outline-color:#ffe3a5}
 html[data-native-phone="true"] input:is([type="checkbox"],[type="range"]){accent-color:#d4b479}
 html[data-native-phone="true"] .sheet.native-window{border-radius:8px;border-color:#c6a26c8a;background:linear-gradient(135deg,#273331fa,#142429fa);box-shadow:inset 0 0 0 3px #c6a26c12,0 14px 50px #0008}
 html[data-native-phone="true"] .native-window-header{border-bottom:1px solid #c6a26c55}
 html[data-native-phone="true"] .native-window-header h2{font:400 22px/1.1 'Cormorant Garamond',Georgia,serif;color:#edd5a1;letter-spacing:.02em;overflow-wrap:normal}
 html[data-native-phone="true"] .native-window h3{font:400 18px/1.1 'Cormorant Garamond',Georgia,serif;color:#edd5a1}
 html[data-native-phone="true"] .native-window :is(button,select){border-radius:4px;border-color:#c6a26c70;background:linear-gradient(180deg,#2b3838,#18282d)}
 html[data-native-phone="true"] .native-window button.primary{background:linear-gradient(135deg,#edd29a,#c59a5f);border-color:#e6c58d;color:#172124}
 html[data-native-phone="true"] .native-window button:disabled{background:#253135;color:#9ca6a0;border-color:#8f8a6b55}
 html[data-native-phone="true"] .native-window-footer{padding-top:0;border-top:1px solid #c6a26c33}
 html[data-native-phone="true"] .native-scroll-menu .native-window-body>.eyebrow{font-size:10px;letter-spacing:1px;margin:4px 0 8px}
 html[data-native-phone="true"] .native-scroll-menu .native-window-body :is(button,select){min-height:44px}
 html[data-native-phone="true"] .native-preferences-tabs [aria-pressed="true"],html[data-native-phone="true"] .native-prep-tabs [aria-selected="true"]{background:linear-gradient(180deg,#554934,#39382a);border-color:#dfbf7f;color:#f3e4c6}
 html[data-native-phone="true"] .native-battle-hud button{border-radius:4px;border-color:#c6a26c70;background:linear-gradient(180deg,#2b3838fa,#18282dfa)}
 html[data-native-phone="true"] .native-battle-hud button.primary{background:linear-gradient(135deg,#edd29a,#c59a5f);border-color:#e6c58d;color:#172124}
 html[data-native-phone="true"] .native-turn,html[data-native-phone="true"] .native-prep-unit,html[data-native-phone="true"] .native-matchup-unit,html[data-native-phone="true"] .native-weapon-name{border-radius:4px}
 html[data-native-phone="true"] .native-prep-unit{border-color:#c6a26c55;background:linear-gradient(180deg,#2b3838cc,#18282dcc)}
 html[data-native-phone="true"] .native-prep-unit h3{font-family:'Cormorant Garamond',Georgia,serif;color:#edd5a1}
 html[data-native-phone="true"] .prep-roster-unit.selected{border-color:#dfbf7f;background:#39382a}
 html[data-native-phone="true"] .game-shell.native-map-tools-open .map-controls{border-radius:4px;border-color:#c6a26c70;background:#18282df5}
}
@media(orientation:landscape) and (max-width:620px){
 html[data-native-phone="true"] .prep-roster>.row{display:none}
 html[data-native-phone="true"] .prep-roster-list{gap:4px}
 html[data-native-phone="true"] .prep-roster-unit{min-height:44px;height:44px;padding:3px}
 html[data-native-phone="true"] .prep-roster-unit small{display:none}
}
/* Nearby interactions have a named map button while Undo and More stay visible. */
@media(orientation:landscape){
 html[data-native-phone="true"] .native-context-action>span{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;line-height:1.15}
 html[data-native-phone="true"] .native-turn small{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
}

/* Battle control groups flow with the roster instead of sharing fixed offsets. */
.battle-gutter{display:contents}
.selected-summary .unit-details{flex:none;min-height:44px}
.selected-summary .selected-unit:after{content:none!important}
@media (min-width:761px) and (min-height:541px), (min-width:1101px){
 .game-shell .battle-gutter{position:absolute;z-index:4;left:12px;top:10px;bottom:12px;width:280px;display:flex;flex-direction:column;gap:8px;min-height:0;pointer-events:none}
 .game-shell .battle-gutter>*{pointer-events:auto}
 .game-shell .battle-gutter :is(.board-meta,.map-controls,.mobile-party,.range-legend,.battle-dock){position:static;inset:auto;width:100%;max-height:none;flex:none;margin:0}
 .game-shell .battle-gutter .map-controls{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;padding:6px}
 .game-shell .battle-gutter #map-zoom{text-align:center}
 .game-shell .battle-gutter .map-controls #zoom-fit{grid-column:1;grid-row:2;width:auto}
 .game-shell .battle-gutter .map-controls #zoom-unit{grid-column:2;grid-row:2}
 .game-shell .battle-gutter .map-controls #zoom-exit{grid-column:3;grid-row:2}
 .game-shell .battle-gutter .map-controls small{display:none}
 .game-shell .battle-gutter .mobile-party{height:auto;min-height:0;max-height:108px;overflow:auto}
 .game-shell .battle-gutter .mobile-party button{flex:1 1 45%;height:44px}
 .game-shell .battle-gutter .range-legend{font-size:11px;padding:7px 10px;max-height:72px}
 .game-shell .battle-gutter .battle-dock{padding:8px;min-height:0;flex:0 1 auto;overflow:auto;margin-top:auto}
 .game-shell .battle-dock .selected-summary{display:flex;gap:6px;margin-bottom:6px}
 .game-shell .battle-dock .selected-unit{border:0;min-height:44px;pointer-events:none}
 .game-shell .battle-dock .selected-unit .mobile-avatar{display:none}
 .game-shell .battle-dock .selected-unit strong{font-size:14px;white-space:normal}
 .game-shell .battle-dock .selected-unit strong small{display:block;margin:2px 0 0}
 .game-shell .battle-dock .selected-unit>span>span{display:none}
 .game-shell .battle-dock .context-actions{grid-template-columns:minmax(0,1fr) minmax(0,1.4fr) minmax(0,.8fr);gap:5px;margin:5px 0}
 .game-shell .battle-dock .context-actions>[data-action="attack"]{grid-column:auto}
 .game-shell .battle-dock .dock-interactions{grid-template-columns:1fr}
 .game-shell .battle-dock .context-actions button{font-size:12px;min-height:44px;overflow-wrap:normal}
 .game-shell .battle-dock .dock-toolbar{display:grid;grid-template-columns:1fr 1fr;gap:5px}
 .game-shell .battle-dock .dock-toolbar [data-action="undo"]{grid-column:1/-1}
 .game-shell .battle-dock .dock-toolbar [data-do="end"]{grid-column:auto;max-width:none;margin:0}
 .game-shell.commands-hidden .battle-gutter :is(.mobile-party,.range-legend,.battle-dock){display:none}
}
@media (min-width:761px) and (min-height:541px) and (max-height:850px), (min-width:1101px) and (max-height:850px){
 .game-shell .battle-gutter .range-legend{display:none}
}
@media (min-width:761px) and (min-height:541px) and (max-height:700px), (min-width:1101px) and (max-height:700px){
 .game-shell .battle-gutter .map-controls{display:none}
}
@media(orientation:landscape){
 html[data-native-phone="true"] .battle-gutter{display:contents}
 html[data-native-phone="true"] .native-battle-hud button{hyphens:none;overflow-wrap:normal}
 html[data-native-phone="true"] .native-context-action>span{-webkit-line-clamp:unset;overflow:visible}
}

.native-equipment-short{display:none}
@media(orientation:landscape){
 html[data-native-phone="true"] .native-turn{flex:none}
 html[data-native-phone="true"] .native-turn strong{white-space:nowrap;font-size:11px}
 html[data-native-phone="true"] .native-battle-hud .native-equipment-short{display:none}
}
@media(orientation:landscape) and (max-width:620px){
 html[data-native-phone="true"] .native-battle-hud .native-equipment-full{display:none}
 html[data-native-phone="true"] .native-battle-hud .native-equipment-short{display:inline}
}
@media(orientation:landscape){
 html[data-native-phone="true"] .native-turn{gap:1px;padding:3px 2px;line-height:1.15}
 html[data-native-phone="true"] .native-turn small{line-height:1.15}
}
/* A zoomed or shallow browser keeps the same groups in a wider right rail.
   Map tools open from Map, leaving the full action row visible. */
@media(orientation:landscape) and (min-width:568px) and (max-width:1100px) and (max-height:540px){
 html:not([data-native-phone="true"]) .game-shell .battle-layout,
 html:not([data-native-phone="true"]) .game-shell .board-column{display:block;position:relative;height:100%;min-height:0;overflow:hidden}
 html:not([data-native-phone="true"]) .game-shell .battle-gutter{display:flex;flex-direction:column;gap:8px;position:absolute;z-index:4;right:8px;left:auto;top:8px;bottom:8px;width:236px;min-height:0}
 html:not([data-native-phone="true"]) .game-shell .battle-gutter :is(.board-meta,.mobile-party,.battle-dock){position:static;inset:auto;width:100%;height:auto;max-height:none;flex:none;margin:0;padding:6px}
 html:not([data-native-phone="true"]) .game-shell .battle-gutter .board-meta{min-height:30px;padding:4px 6px;font-size:10px;letter-spacing:0;gap:4px}
 html:not([data-native-phone="true"]) .game-shell .battle-gutter :is(.map-controls,.range-legend){display:none}
 html:not([data-native-phone="true"]) .game-shell .battle-gutter .mobile-party{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px;overflow:auto;max-height:108px}
 html:not([data-native-phone="true"]) .game-shell .battle-gutter .mobile-party button{height:44px;min-width:0;gap:5px;margin:0;font-size:12px}
 html:not([data-native-phone="true"]) .game-shell .mobile-party .mobile-avatar{display:none}
 html:not([data-native-phone="true"]) .game-shell .battle-gutter .battle-dock{min-height:0;flex:0 1 auto;overflow:auto;margin-top:auto;padding:7px}
 html:not([data-native-phone="true"]) .game-shell .selected-summary{display:flex;gap:5px;margin:0 0 5px}
 html:not([data-native-phone="true"]) .game-shell .selected-unit{min-width:0;min-height:44px}
 html:not([data-native-phone="true"]) .game-shell .selected-unit strong{white-space:normal;font-size:14px}
 html:not([data-native-phone="true"]) .game-shell .selected-unit strong small{display:block;margin:2px 0 0}
 html:not([data-native-phone="true"]) .game-shell .selected-unit :is(.mobile-avatar,span>span){display:none}
 html:not([data-native-phone="true"]) .game-shell .battle-dock .context-actions{grid-template-columns:minmax(0,1fr) minmax(0,1.5fr) minmax(0,.8fr);gap:5px;margin:5px 0}
 html:not([data-native-phone="true"]) .game-shell .battle-dock .context-actions>[data-action]{grid-column:auto;grid-row:auto}
 html:not([data-native-phone="true"]) .game-shell .battle-dock .dock-interactions{grid-template-columns:1fr}
 html:not([data-native-phone="true"]) .game-shell .battle-dock .context-actions button{font-size:12px;min-height:44px}
 html:not([data-native-phone="true"]) .game-shell .battle-dock .dock-toolbar{grid-template-columns:repeat(2,minmax(0,1fr));gap:5px}
 html:not([data-native-phone="true"]) .game-shell .battle-dock .dock-toolbar [data-do="end"]{grid-column:auto}
 html:not([data-native-phone="true"]) .game-shell .map-area{position:absolute;inset:0 252px 0 0;display:block;min-height:0}
 html:not([data-native-phone="true"]) .game-shell #board-viewport{position:absolute;inset:0;min-height:0;padding:0;width:100%;height:100%}
}

/* Guest status shares the HP line so names retain the compact rail height. */
.mobile-party .guest-party-label{white-space:nowrap;font-size:10px}

@media(max-width:760px),(max-height:540px){
 .topbar .cloud-status-button{min-width:44px;min-height:44px;padding:6px}
 .topbar .cloud-status-label{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
 .title-cloud-status{max-width:calc(100% - 86px)}
 .title-cloud-status .cloud-status-button{font-size:12px;white-space:normal;text-align:left}
 .cloud-choice{grid-template-columns:1fr}
 .native-cloud .cloud-party{grid-template-columns:repeat(2,minmax(0,1fr))}
 .native-cloud .cloud-party li{font-size:12px;min-width:0}
 .title-actions .title-cloud-invite{flex-basis:100%}
}
@media(max-width:760px){
 .preparation-page>.topbar:has(.cloud-status-button){height:auto;min-height:52px;flex-wrap:wrap;padding-bottom:8px}
 .preparation-page>.topbar:has(.cloud-status-button) nav{max-width:100%;flex-wrap:wrap;gap:4px}
}

/* The selected companion is the party picker, leaving room for every action. */
@media(orientation:landscape){
 html[data-native-phone="true"] .native-battle-hud button.native-turn{flex:none;display:flex;flex-direction:column;gap:1px;min-height:62px;padding:3px 2px;line-height:1.15}
 html[data-native-phone="true"] .native-turn>span{display:block;max-width:100%}
 html[data-native-phone="true"] .native-hud-left,html[data-native-phone="true"] .native-hud-right{overflow:auto;overscroll-behavior:contain;scrollbar-width:thin}
 html[data-native-phone="true"] .native-preferences .native-window-footer{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(0,1fr)}
 html[data-native-phone="true"] .native-preferences .native-window-footer:has(#native-preferences-back){grid-template-columns:minmax(0,2fr) minmax(0,1fr) minmax(0,1fr)}
}
/* At short landscape heights, turn controls occupy two rows above the board.
   The camera reserves this height; the controls never sit on top of each other. */
@media(orientation:landscape) and (max-height:360px), (orientation:landscape) and (max-width:740px){
 html[data-native-phone="true"] .native-hud-left{top:4px;bottom:4px;transform:none;max-height:none;justify-content:center}
 html[data-native-phone="true"] .native-turn small{display:none}
 html[data-native-phone="true"] .native-hud-right{display:grid;grid-template-columns:repeat(4,minmax(44px,1fr));gap:5px;left:calc(var(--native-hud-width) + 8px);right:4px;top:4px;bottom:auto;width:auto;max-height:96px;transform:none;overflow:visible;align-items:stretch}
 html[data-native-phone="true"] .native-hud-right button{width:auto;min-width:0;padding:4px;min-height:44px}
 html[data-native-phone="true"] .native-hud-right [data-do="end"],html[data-native-phone="true"] .native-hud-right [data-do="result"]{grid-column:span 2}
 html[data-native-phone="true"] .game-shell.native-map-tools-open .map-controls{top:104px}
}

@media(orientation:landscape) and (max-height:360px), (orientation:landscape) and (max-width:740px){
 html[data-native-phone="true"] .game-shell.native-map-tools-open .map-controls{display:grid;grid-template-columns:repeat(4,minmax(44px,1fr));height:100px;min-height:100px;max-height:none}
 html[data-native-phone="true"] .game-shell.native-map-tools-open #map-zoom{grid-column:2;grid-row:1;text-align:center}
 html[data-native-phone="true"] .game-shell.native-map-tools-open #zoom-out{grid-column:1;grid-row:1}
 html[data-native-phone="true"] .game-shell.native-map-tools-open #zoom-in{grid-column:3;grid-row:1}
 html[data-native-phone="true"] .game-shell.native-map-tools-open #zoom-done{grid-column:4;grid-row:1}
 html[data-native-phone="true"] .game-shell.native-map-tools-open #zoom-fit{grid-column:1 / span 2;grid-row:2}
 html[data-native-phone="true"] .game-shell.native-map-tools-open #zoom-unit{grid-column:3;grid-row:2}
 html[data-native-phone="true"] .game-shell.native-map-tools-open #zoom-exit{grid-column:4;grid-row:2}
}

/* Game settings fit their pinned footer at landscape sizes, including the
   smallest safe-area case, so the last choice never looks covered by Done. */
@media(orientation:landscape){
 html[data-native-phone="true"] .native-preferences-game{grid-template-columns:repeat(3,minmax(0,1fr));gap:4px}
 html:root[data-native-phone="true"] body #modal .native-preferences .native-preferences-game>label:not(.native-toggle){display:flex;flex-direction:column;align-items:stretch;min-width:0;gap:3px}
 html:root[data-native-phone="true"] body #modal .native-preferences .native-preferences-game select{flex:none;width:100%;min-width:44px}
}
@media(orientation:landscape) and (max-height:360px), (orientation:landscape) and (max-width:740px){
 html[data-native-phone="true"] .native-preferences-game{grid-template-columns:repeat(4,minmax(0,1fr))}
}

/* Preparation title and controls share a flow row, including Mission and Ledger.
   Intrinsic button widths replace the old fixed 190px overlap allowance. */
@media (orientation:landscape){
 html[data-native-phone="true"] .preparation-page>.topbar{position:static;height:auto;min-height:56px;padding:0 8px;display:flex;gap:8px;align-items:center;flex-wrap:wrap;flex:none}
 html[data-native-phone="true"] .preparation-page>.topbar>.prep-mission{display:flex;flex:1 1 120px;min-width:0;padding:0;margin:0;overflow:hidden}
 html[data-native-phone="true"] .preparation-page>.topbar>.prep-mission>div{min-width:0}
 html[data-native-phone="true"] .preparation-page>.topbar .prep-mission h2{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 html[data-native-phone="true"] .preparation-page>.topbar nav{display:flex;flex:0 1 auto;flex-wrap:wrap;justify-content:flex-end;gap:4px;max-width:100%;min-width:0}
 html[data-native-phone="true"] .preparation-page>.topbar nav button{flex:none;min-width:44px;min-height:44px;margin:0}
 html[data-native-phone="true"] .preparation-page .prep-page-inner{grid-template-rows:minmax(0,1fr)}
 html[data-native-phone="true"] #modal .battle-detail-sheet .captive-heading{height:100px;margin-bottom:8px}
}

/* Work/collapse/approach are brief accents; navigation never waits on them. */
.opening-motion.carrying{animation:opening-carry-step .35s ease-out both}
.opening-motion.collapse{animation:opening-collapse .22s ease-out both}
.opening-motion.approach{animation:opening-approach .35s ease-out both}
.opening-motion.withdraw-step{animation:opening-withdraw-step .25s ease-out both}
@keyframes opening-carry-step{from{translate:18px 0}to{translate:0 0}}
@keyframes opening-collapse{from{translate:0 -12px}to{translate:0 0}}
@keyframes opening-approach{from{translate:275px 0}to{translate:0 0}}
@keyframes opening-withdraw-step{from{translate:-275px 0}to{translate:0 0}}
@keyframes opening-intervene{from{translate:100px 0}to{translate:0 0}}
.opening-stage[data-reduced-motion="true"] .opening-motion{animation:none}
@media(prefers-reduced-motion:reduce){.opening-motion{animation:none}}

@media(orientation:landscape){
 html[data-native-phone="true"] .native-prep-tabs button{min-width:0;font-size:11px;padding:6px 3px}
 html[data-native-phone="true"] .prep-promotion-status{padding:2px}
 html[data-native-phone="true"] .native-trade .trade-choices{grid-template-columns:1fr 1fr;gap:12px}
 html[data-native-phone="true"] .native-trade label{font-size:12px}
 html[data-native-phone="true"] .native-trade select{font-size:12px}
 html[data-native-phone="true"] .native-trade p{font-size:12px;line-height:1.3;margin:6px 0}
}

.door-key-item{display:flex;gap:12px;align-items:center;padding:12px;border:1px solid #8c7952;margin:12px 0}.door-key-item p{font-size:14px;margin:5px 0}.door-key-item img,.door-key-acquired img{object-fit:contain;filter:none;box-shadow:none;flex-shrink:0}.enemy-key-drop strong{color:#a7ebd6}.door-key-acquired{text-align:center}.door-key-item button{min-height:44px}
