/* Use the actual visual viewport, including changes to mobile browser chrome. */
:root{--game-height:100svh;--game-width:100vw}
@supports(height:100dvh){:root{--game-height:100dvh}}
.screen-toggle{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-width:44px;min-height:44px;padding:7px 10px;border:1px solid var(--glass-border);border-radius:8px;background:var(--color-night-2);color:var(--color-ink);font-size:11px;touch-action:manipulation;white-space:nowrap}
.screen-toggle svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex:none}
.screen-contract{display:none}.is-fullscreen .screen-expand{display:none}.is-fullscreen .screen-contract{display:block}
.nav-screen-toggle,.arena-screen-toggle,.title-screen-toggle{display:none}
.mobile-browser .nav-screen-toggle{display:inline-flex}
.mobile-browser .title-screen-toggle{position:absolute;display:inline-flex;right:max(12px,env(safe-area-inset-right));top:max(12px,env(safe-area-inset-top));z-index:2}
.native-app [data-screen-action]{display:none!important}
.hub-battle-actions{grid-template-columns:repeat(3,minmax(0,1fr))}.native-app .hub-battle-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
.screen-notice{position:fixed;left:50%;bottom:max(18px,env(safe-area-inset-bottom));transform:translateX(-50%);width:max-content;max-width:min(90vw,460px);padding:12px;border:1px solid #73afc5;border-radius:10px;background:#07172bf5;color:#e5f6ff;font-size:12px;line-height:1.5;z-index:6100;pointer-events:none}
.screen-notice.in-dialog{position:static;transform:none;max-width:100%;width:auto;margin-top:10px;pointer-events:auto}
#title-screen{height:var(--game-height);bottom:auto}.title-content{min-height:100%}.title-confirm[open]{height:var(--game-height)}
#modal{max-height:calc(var(--game-height) - 20px)}#modal:not(.formation-editor) #modal-content{max-height:calc(var(--game-height) - 88px);overflow-y:auto}
#modal.formation-editor{height:calc(var(--game-height) - 12px);max-height:calc(var(--game-height) - 12px)}
#run-result-dialog{max-height:var(--game-height)}.mobile-browser .management{max-height:calc(var(--game-height) - 12px)}
.story-dialog{height:var(--game-height)}.landscape-play .management{height:calc(var(--game-height) - 12px);max-height:calc(var(--game-height) - 12px)}
@media(min-width:640px) and (orientation:landscape){
 .landscape-play .workbench{height:var(--game-height)}
 .mobile-browser.landscape-play .arena-header{grid-template-columns:minmax(64px,1fr) minmax(78px,1.14fr) minmax(38px,.55fr) 44px 44px 44px}
 .mobile-browser.landscape-play .arena-screen-toggle{display:flex;flex-direction:column;grid-column:5;grid-row:1;width:44px;height:44px;min-width:44px;padding:3px;gap:1px;pointer-events:auto;font-size:7px}
 .mobile-browser.landscape-play #hub-menu-btn{grid-column:6}
}
@media(max-width:360px){.mobile-browser:not(.landscape-play) .brand>div{display:none}.mobile-browser:not(.landscape-play) .nav-slab{gap:8px}}
@media(min-width:640px) and (orientation:landscape) and (max-height:299px){
 .landscape-play .party-strip{min-height:0;overflow:hidden}
 .landscape-play #party-slots{grid-template-rows:repeat(5,52px);overflow-y:auto;min-height:0;overscroll-behavior:contain;padding-right:2px}
 .landscape-play .crew-card{min-height:52px;max-height:52px}
 .landscape-play .reserve-panel{flex:none}
}
/* Portrait keeps crew beneath the fight; each card's Switch has its own full row. */
@media(orientation:portrait),(max-width:639px){
 html:has(body.neon-game:not(.landscape-play):not(.title-open)){height:auto;overflow-y:auto}
 body.neon-game:not(.landscape-play):not(.title-open){height:auto;min-height:var(--game-height);overflow-x:clip!important;overflow-y:visible!important}
 .neon-game:not(.landscape-play) .workbench{height:auto;min-height:0;padding:0 8px max(12px,env(safe-area-inset-bottom));width:100%;max-width:650px}
 .mobile-browser:not(.landscape-play) .nav-slab{position:sticky;top:0;z-index:40;min-height:44px;height:44px;padding:3px 8px;max-width:650px;margin:auto;background:#07182bf5;border-bottom:1px solid var(--glass-border)}
 .mobile-browser:not(.landscape-play) .header-actions{gap:3px}.mobile-browser:not(.landscape-play) .header-actions>button{min-height:44px;min-width:44px;padding:3px;font-size:10px}
 .mobile-browser:not(.landscape-play) .nav-screen-toggle{flex-direction:column;gap:1px;font-size:7px!important}
 .mobile-browser:not(.landscape-play) .brand{gap:5px}.mobile-browser:not(.landscape-play) .brand h1{font-size:11px}.mobile-browser:not(.landscape-play) .brand small{font-size:7px}.mobile-browser:not(.landscape-play) .edition{display:none}
 .neon-game:not(.landscape-play) .arcade-grid{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto auto;gap:5px;height:auto;min-height:0;overflow:visible;max-width:650px;width:100%}
 body.neon-game:not(.landscape-play) .arcade-grid>.battle-shell,body.neon-game:not(.landscape-play) .arcade-grid>.battle-shell:has(.battle-overlay:not([hidden]) .replay-panel){height:clamp(350px,calc(var(--game-height) * .56),500px)!important;min-height:350px!important;max-height:none!important;aspect-ratio:auto}
 .neon-game:not(.landscape-play) .arcade-grid>#weapon-quickbar{position:static;grid-column:1;grid-row:2;width:100%;height:auto;margin:0}
 .neon-game:not(.landscape-play):has(.battle-overlay:not([hidden]) .replay-panel) .arcade-grid>#weapon-quickbar{display:none}
 .neon-game:not(.landscape-play) .combat-dock{position:static;grid-column:1;grid-row:3;display:flex;flex-direction:column;height:auto;min-height:0;max-height:none;overflow:visible;padding:4px 0;gap:8px}
 .neon-game:not(.landscape-play) .party-strip{display:flex;flex-direction:column;align-items:stretch;min-height:0;overflow:visible;padding:0;gap:4px}
 .neon-game:not(.landscape-play) .party-caption{display:flex;align-items:center;gap:6px;flex-wrap:wrap;height:auto;min-height:18px;margin:0}
 .neon-game:not(.landscape-play) .party-caption .formation-actions{margin-left:auto}.neon-game:not(.landscape-play) .party-caption .formation-actions button{min-height:44px;padding:4px 6px;font-size:10px}
 .neon-game:not(.landscape-play):is([data-play-state=running],[data-play-state=paused]) .formation-actions,.neon-game:not(.landscape-play):is([data-play-state=running],[data-play-state=paused]) #reserve-edit{display:none}
 .neon-game:not(.landscape-play) .crew-instruction{display:block;font-size:10px;line-height:1.4;margin:0 0 2px;color:#bbd3e0}
 .neon-game:not(.landscape-play) #party-slots{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));grid-template-rows:auto;gap:4px;width:100%;height:auto;min-height:0;overflow:visible;align-items:stretch}
 .neon-game:not(.landscape-play) #party-slots .crew-card{display:flex!important;flex-direction:column!important;min-width:0;height:auto!important;min-height:0;padding:0;gap:0}
 .neon-game:not(.landscape-play) #party-slots .skill-trigger{display:grid!important;grid-template-columns:minmax(0,1fr)!important;grid-template-rows:48px 15px 24px 13px minmax(22px,auto)!important;gap:1px;justify-items:center;text-align:center;flex:1;min-width:0;min-height:130px;padding:4px 2px 8px!important}
 .neon-game:not(.landscape-play) #party-slots .slot-art{grid-column:1!important;grid-row:1!important;width:48px!important;height:48px!important;min-width:0!important;max-width:100%;object-fit:cover!important;object-position:center 35%!important;margin:0;padding:0;border-radius:7px}
 .neon-game:not(.landscape-play) #party-slots .skill-trigger strong{grid-column:1;grid-row:2;line-height:15px;font-size:10px;padding-right:0;max-width:100%;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 .neon-game:not(.landscape-play) #party-slots .crew-role{grid-column:1;grid-row:3;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:8px;line-height:11px;white-space:normal;text-align:center;width:100%;overflow:hidden}
 .neon-game:not(.landscape-play) #party-slots .skill-status{grid-column:1;grid-row:4;position:static;max-width:100%;font-size:8px;line-height:13px;white-space:nowrap}
 .neon-game:not(.landscape-play) #party-slots .unit-work{grid-column:1!important;grid-row:5!important;display:flex!important;flex-direction:column;gap:0;width:100%;min-height:20px;max-height:30px;padding:0;font-size:8px!important;line-height:10px;white-space:normal;text-align:center;overflow:hidden}
 .neon-game:not(.landscape-play) #party-slots .action-meter{left:3px;right:3px;bottom:1px;height:3px}
 .neon-game:not(.landscape-play) #party-slots .crew-swap,.neon-game:not(.landscape-play) #party-slots .crew-awakening{display:flex!important;align-items:center;justify-content:center;min-width:0;min-height:44px;height:44px;width:100%;flex:none;padding:3px;font-size:10px;border-top:1px solid var(--glass-border);border-radius:0}
 .neon-game:not(.landscape-play) #party-slots .crew-empty{min-height:174px!important;justify-content:center;align-items:center}
 .neon-game:not(.landscape-play) .swap-and-skill{display:block;position:static;min-width:0;max-width:100%;padding:0}
 .neon-game:not(.landscape-play) .reserve-panel{width:100%;max-width:100%;padding:7px;border-radius:10px;background:var(--color-night-2)}
 .neon-game:not(.landscape-play) .reserve-title{display:flex;flex-wrap:wrap;align-items:center;gap:4px;margin:0 0 4px}.neon-game:not(.landscape-play) .reserve-title small{flex:1;min-width:0;white-space:normal}
 .neon-game:not(.landscape-play) .reserve-rail.has-reserves{display:block;width:100%;overflow:visible;min-height:54px}
 .neon-game:not(.landscape-play) .reserve-rail.has-reserves>.bench-choice{display:grid;grid-template-columns:44px minmax(0,1fr) 64px;grid-template-rows:1fr 16px;gap:0 6px;width:100%;max-width:100%;min-height:54px;height:auto;padding:3px 7px;white-space:normal}
 .neon-game:not(.landscape-play) .bench-choice>img{grid-column:1;grid-row:1/3;width:44px;height:48px;object-fit:contain}.neon-game:not(.landscape-play) .bench-choice>span{grid-column:2;grid-row:1;min-width:0}.neon-game:not(.landscape-play) .bench-choice>b{grid-column:3;grid-row:1/3}.neon-game:not(.landscape-play) .bench-work{grid-column:2;grid-row:2;font-size:9px;white-space:nowrap}
 .neon-game:not(.landscape-play):is([data-play-state=running],[data-play-state=paused]) .combat-dock:has(.crew-card.selected) .swap-and-skill{position:fixed;left:max(8px,env(safe-area-inset-left));right:max(8px,env(safe-area-inset-right));bottom:max(6px,env(safe-area-inset-bottom));z-index:45;padding:0;filter:drop-shadow(0 -5px 12px #0009)}
 body.neon-game:not(.landscape-play):is([data-play-state=running],[data-play-state=paused]):has(.crew-card.selected){padding-bottom:132px}
 .neon-game:not(.landscape-play) .replay-panel.ready-panel{grid-template-columns:30% minmax(0,70%);grid-template-rows:minmax(0,1fr);align-content:stretch;height:100%;gap:4px}
 .neon-game:not(.landscape-play) .battle-overlay:has(.replay-panel){top:calc(var(--hud-height) + 6px);bottom:6px;padding:5px;min-height:0}
 .neon-game:not(.landscape-play) .replay-art>img{height:100%;width:100%;object-fit:contain}.neon-game:not(.landscape-play) .replay-art>span{display:none}
 .neon-game:not(.landscape-play) .replay-content{padding:0 3px 0 0;gap:4px;align-content:center}.neon-game:not(.landscape-play) .replay-heading{height:24px}.neon-game:not(.landscape-play) .replay-heading>img{height:24px}.neon-game:not(.landscape-play) .ready-word{font-size:22px}.neon-game:not(.landscape-play) .replay-heading>small{font-size:8px}
 .neon-game:not(.landscape-play) .replay-goal{min-height:36px;padding:3px 5px;gap:4px}.neon-game:not(.landscape-play) .replay-goal strong{font-size:9px}.neon-game:not(.landscape-play) .replay-goal small{font-size:8px}.neon-game:not(.landscape-play) .replay-goal em{font-size:9px}.neon-game:not(.landscape-play) .replay-goal>b{font-size:16px}
 .neon-game:not(.landscape-play) .replay-start.primary-btn{min-height:44px!important;font-size:13px;padding:5px 8px}.neon-game:not(.landscape-play) .replay-content .ready-tools>button{min-height:44px;font-size:10px;padding:4px}
 .neon-game:not(.landscape-play) .battle-shell{scroll-margin-top:48px}
 .mobile-browser:not(.landscape-play) .title-content{height:auto;min-height:calc(var(--game-height) - 76px);width:100%;max-width:460px;margin:auto;padding:clamp(56px,10vh,100px) 22px 20px;justify-content:flex-start}
 .mobile-browser:not(.landscape-play) .title-content h1 img{max-height:78px}.mobile-browser:not(.landscape-play) .title-credit{font-size:10px;line-height:1.35;margin-bottom:8px}.mobile-browser:not(.landscape-play) .title-description{font-size:12px;line-height:1.4;margin-bottom:12px}
 .mobile-browser:not(.landscape-play) .title-menu{width:100%;gap:6px}.mobile-browser:not(.landscape-play) .title-menu button{min-height:44px;padding:8px 14px}.mobile-browser:not(.landscape-play) .language-controls{margin:8px 0 0}
 .mobile-browser:not(.landscape-play) .title-footer{position:static;left:auto;right:auto;bottom:auto;width:100%;max-width:460px;margin:auto;padding:0 22px 16px;min-height:60px;justify-content:flex-start}
}
