/* B3.14: this is the owner of compact menu and mobile HUD geometry.
 * Layout classes are projected from the actual visible viewport, not UA alone. */
.lobbyAux{display:flex;gap:8px}.lobbyAux button{flex:1}
#shopDetail{display:none}
body.compactUi{--ui-gap:8px;--ui-edge:8px;--ui-top:calc(var(--vvtop,0px) + max(8px,env(safe-area-inset-top)));--ui-left:calc(var(--vvleft,0px) + max(8px,env(safe-area-inset-left)));--ui-right:max(8px,env(safe-area-inset-right));--ui-bottom:max(8px,env(safe-area-inset-bottom));--menu-width:min(820px,calc(var(--ui-width,100vw) - max(8px,env(safe-area-inset-left)) - max(8px,env(safe-area-inset-right))));--menu-height:calc(var(--ui-height,100dvh) - max(8px,env(safe-area-inset-top)) - max(8px,env(safe-area-inset-bottom)))}
body.compactUi .modal{left:var(--vvleft,0px);top:var(--vvtop,0px);right:auto;bottom:auto;width:var(--ui-width,100vw);height:var(--ui-height,100dvh);padding:max(8px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left))}
body.compactUi .modal>.panel,body.compactUi .settingsShell{padding:12px!important;max-height:100%!important;max-width:100%!important;width:min(760px,100%)!important;margin:0!important;border-radius:8px;overscroll-behavior:contain}
body.compactUi .modal h2{font-size:20px;margin:5px 0 8px}
body.compactUi .modal button,body.compactUi .settingsTabs button,body.compactUi .settingsRow button{min-height:44px!important;font-size:13px!important}
body.compactUi input:not([type="range"]):not([type="checkbox"]),body.compactUi select{font-size:16px;min-height:44px}
body.compactUi .settingsShell{display:flex;flex-direction:column;overflow:hidden!important;height:100%}
body.compactUi .settingsHead{flex:none;position:static;padding:0 0 8px;margin:0!important}
body.compactUi .settingsTabs{display:flex;flex:none;overflow:auto;gap:6px;padding-bottom:8px;touch-action:pan-x}
body.compactUi .settingsTabs button{flex:0 0 auto;padding:8px 10px;margin:0}
body.compactUi .settingsPage:not(.hidden){min-height:0;overflow:auto;flex:1;touch-action:pan-y;overscroll-behavior:contain}
body.compactUi .settingsPage p{font-size:12px;line-height:1.5}
body.compactUi #controlsHelp{display:none}
body.compactUi #controlPreview{height:180px}
body.compactUi #prep{top:var(--ui-top)!important;left:var(--vvcenterx,50vw)!important;transform:translateX(-50%)!important;width:var(--menu-width)!important;max-height:var(--menu-height)!important;padding:10px!important;overflow:auto;min-width:0}
body.compactUi #prep .prepTitle{position:sticky;top:-10px;z-index:2;background:#17221ff5;padding:6px 0;margin:0 0 8px;min-height:44px;display:flex;justify-content:space-between}
body.compactUi #prep .prepTitle>div:first-child{width:auto!important;text-align:left!important}
body.compactUi #prep .prepTitle b{font-size:16px}body.compactUi #prep .prepTitle .eyebrow{font-size:9px}
body.compactUi #prep .prepTitle button{position:static!important;min-width:44px;min-height:44px;font-size:12px!important}
body.compactUi #prep button:not(.upgradeCard):not(.shopCard){min-height:44px!important;font-size:13px!important}
body.compactUi #stageLoadout .loadoutCard{width:100%!important;min-height:0}
body.compactUi .loadoutArt,body.compactUi .weaponIllustration{height:68px!important;min-height:68px!important}
body.compactUi .loadoutBody{padding:5px 8px}body.compactUi .loadoutBody h3{font-size:16px;margin:3px 0}body.compactUi .loadoutBody p{font-size:12px!important;line-height:1.4!important}
body.compactUi #bladeLoadout h3{font-size:14px;margin:2px 0 6px}
body.compactUi #bladeChoices{display:flex;flex-direction:column;gap:6px}
body.compactUi #bladeChoices button{min-height:44px!important;padding:5px 8px;text-align:left}
body.compactUi #bladeChoices button b{font-size:13px!important}body.compactUi #bladeChoices button small{font-size:11px!important;line-height:1.3}
body.compactUi #offers,body.compactUi #shopOffers{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
body.mobile .shopWorkspace.hasSelection{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);gap:10px;align-items:start}
body.mobile .shopWorkspace.hasSelection #shopOffers{grid-template-columns:repeat(2,minmax(0,1fr))}
body.mobile .shopWorkspace.hasSelection #shopDetail{display:flex;flex-direction:column;gap:8px;min-width:0;background:#211f18;border:1px solid #9a8660;padding:10px}
body.mobile #shopDetailBack{display:none}
body.mobile #shopDetailName{font-size:17px}body.mobile #shopDetailLevel,body.mobile #shopDetailReason{display:block;font-size:12px;line-height:1.4;color:#cbb98b}
body.mobile #shopDetailDesc{font-size:13px;line-height:1.5;margin:8px 0}body.mobile #shopDetailPrice{font-size:15px;color:#eaca82}
body.mobile #shopDetailBuy{margin:0}
body.mobile .shopCard[aria-pressed="true"]{border-color:#ffe5a0;box-shadow:inset 0 0 0 1px #ffe5a0}
body.mobile[data-ui-width="narrow"] .shopWorkspace.hasSelection{grid-template-columns:minmax(0,1fr)}
body.mobile[data-ui-width="narrow"] .shopWorkspace.hasSelection #shopOffers{display:none}
body.mobile[data-ui-width="narrow"] #stageShop:has(.shopWorkspace.hasSelection) .shopActions{display:none}
body.mobile[data-ui-width="narrow"] #shopDetailBack{display:block;margin:0;text-align:left}
body.compactUi #offers .upgradeCard,body.compactUi .shopCard{min-height:130px;height:auto;max-height:none;padding:0!important;min-width:0;overflow:hidden}
body.compactUi #offers .cardArt,body.compactUi .shopCard .cardArt{height:36px!important;flex-basis:36px!important;font-size:22px!important}
body.compactUi #offers .cardBody,body.compactUi .shopCard .cardBody{padding:7px!important;gap:4px}
body.compactUi #offers .cardBody b,body.compactUi .shopCard b{font-size:14px!important;overflow-wrap:anywhere}
body.compactUi #offers .cardBody small,body.compactUi .shopCard small{font-size:12px!important;line-height:1.4!important;white-space:normal!important;display:block!important;-webkit-line-clamp:unset!important;max-height:none!important;overflow:visible!important}
body.compactUi .shopPrice{font-size:13px!important}body.compactUi #waveReport{font-size:11px;line-height:1.4;margin:0 0 8px}
body.compactUi .shopActions,body.compactUi .rerollRow{position:sticky;bottom:-10px;background:#17221ff5;padding:8px 0;margin:0;z-index:2}
body.compactUi .shopActions{display:flex;gap:8px}body.compactUi .shopActions button{flex:1}
body.compactUi #routeChoices{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
body.compactUi #routeChoices .routeCard{padding:10px;min-height:150px;gap:6px}
body.compactUi .routeName{font-size:18px}body.compactUi .routeFeature,body.compactUi .routeEnemies,body.compactUi .routeBoss,body.compactUi .routeVotes,body.compactUi #routeStatus{font-size:12px;line-height:1.4}
body.compactUi.fieldPreparing #prep{top:calc(var(--ui-top) + 64px)!important;width:min(380px,calc(var(--ui-width) - 32px))!important;max-height:calc(var(--menu-height) - 140px)!important}
body.compactUi.fieldPreparing #prep .prepTitle{position:static;min-height:44px;padding:0;margin:0 0 4px}
body.mobile #playerHud{top:var(--ui-top)!important;left:var(--ui-left)!important;bottom:auto!important;width:110px!important;padding:5px 6px!important;gap:2px;min-height:0}
body.mobile #playerHud .weapon{margin:0!important}body.mobile #playerHud .weapon span{font-size:11px!important;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}body.mobile #playerHud .weapon strong{font-size:16px!important}
body.mobile #hpText{font-size:12px}body.mobile #reloadText{font-size:10px!important;max-width:100%;min-height:0}
body.mobile #toolbar:not(.hidden){top:var(--ui-top)!important;right:calc(max(8px,env(safe-area-inset-right)) + max(0px,100vw - var(--vvleft,0px) - var(--ui-width,100vw)))!important;bottom:auto!important;display:flex!important;gap:8px!important}
body.mobile #toolbar #moreBtn,body.mobile #toolbar #minimapToggle{width:44px;min-width:44px!important;height:44px;min-height:44px!important;font-size:12px!important;padding:4px!important}
body.mobile #toolbarActions{top:48px!important;bottom:auto!important;padding:6px;max-height:calc(var(--ui-height) - 70px)!important;touch-action:pan-y;overscroll-behavior:contain}
body.mobile #toolbarActions button{min-height:44px!important;font-size:13px!important;padding:8px!important}
body.mobile #hud,body.mobile[data-boss="true"] #boss{top:var(--ui-top)!important;left:var(--hud-center-left,122px)!important;transform:none!important;min-width:0!important;width:var(--hud-center-width,calc(var(--ui-width) - 238px))!important;max-width:none;padding:4px 6px!important;gap:6px!important}
body.mobile #hud>.wave,body.mobile #hud>.core,body.mobile #hud>.tickets{min-height:0;padding:0}
body.mobile #hud .wave{flex:none}body.mobile #hud .wave strong{font-size:18px!important}body.mobile #hud .wave span{font-size:11px}
body.mobile #hud .core{flex:1;width:auto!important;min-width:0;font-size:11px}body.mobile #hud .core>div:first-child span{max-width:58%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body.mobile #hud .core b{font-size:11px;white-space:nowrap}body.mobile #hud .tickets strong{font-size:15px!important}
body.mobile #hud .bar{margin-top:4px;height:5px}
body.mobile #boss .bossName{font-size:15px!important;letter-spacing:1px}body.mobile #boss .bossHead{gap:5px;margin-bottom:3px;flex-wrap:nowrap}
body.mobile #boss .bossHp{font-size:10px}body.mobile #boss .bossState{font-size:11px!important}body.mobile #boss .bossBar{height:10px!important}
body.mobile #objective{top:var(--hud-objective-top,calc(var(--ui-top) + 49px))!important;left:var(--hud-center-mid,var(--vvcenterx,50vw))!important;max-width:var(--hud-center-width,calc(var(--ui-width) - 250px))!important;font-size:11px!important;padding:3px 6px!important}
body.mobile #coreAlert{top:var(--hud-alert-top,calc(var(--ui-top) + 75px))!important;font-size:12px}
body.mobile #team:not(.hidden){top:var(--hud-team-top,calc(var(--ui-top) + 80px))!important;left:var(--ui-left);max-width:110px;font-size:11px!important;padding:2px!important;pointer-events:none}
body.mobile #connection{top:var(--hud-connection-top,calc(var(--ui-top) + 50px));right:calc(var(--ui-right) + max(0px,100vw - var(--vvleft,0px) - var(--ui-width,100vw)));font-size:10px;padding:2px 5px}
body.mobile #connection #perf{display:none}body.mobile .combatBtn{min-width:44px;min-height:44px;font-size:11px!important}
body.mobile:has(#lobby:not(.hidden)) #connection{display:none!important}
body.mobile #desktopAbilityBar,body.mobile .ultimateSkillHud{display:none!important}
body.mobile[data-input="menu"] #hud,body.mobile[data-input="menu"] #boss,body.mobile[data-input="menu"] #toolbar,body.mobile[data-input="menu"] #connection,body.mobile[data-input="menu"] #objective,body.mobile[data-input="menu"] #trainingStats{display:none!important}
body.mobile:has(.modal:not(.hidden)) #hud,body.mobile:has(.modal:not(.hidden)) #boss,body.mobile:has(.modal:not(.hidden)) #toolbar,body.mobile:has(.modal:not(.hidden)) #connection,body.mobile:has(.modal:not(.hidden)) #playerHud,body.mobile:has(.modal:not(.hidden)) #team,body.mobile:has(.modal:not(.hidden)) #objective,body.mobile:has(.modal:not(.hidden)) #trainingStats{display:none!important}
body.compactUi #upgradesPanel{left:var(--vvleft,0px);top:var(--vvtop,0px);width:var(--ui-width);height:var(--ui-height);padding:8px}
body.compactUi .upgradesShell{width:min(760px,100%);height:100%;max-height:100%;padding:10px!important;display:flex;flex-direction:column;overflow:hidden}
body.compactUi .upgradesHead{position:static;flex:none;padding:0 0 8px}body.compactUi .upgradesHead h2{font-size:18px;margin:0}body.compactUi #closeUpgrades{min-height:44px;min-width:44px}
body.compactUi #upgradeInventory{min-height:0;overflow:auto;touch-action:pan-y}body.compactUi .ownedUpgrade{font-size:13px}body.compactUi .ownedUpgrade small{font-size:12px!important}
body.compactUi .combatReportShell{max-height:calc(var(--ui-height) - 90px);overflow:auto;width:min(640px,calc(var(--ui-width) - 24px))}
body.compactUi .resultWave strong{font-size:36px}body.compactUi #resultStats{font-size:13px;line-height:1.5}
@media(orientation:portrait){
 body.compactUi #offers,body.compactUi #shopOffers,body.compactUi #routeChoices{grid-template-columns:minmax(0,1fr)}
}

body.compactUi #waiting button{min-height:44px!important;font-size:14px!important;padding:8px!important;margin:0}


/* B3.64.4: settings tabs must not inherit .modal button {width:100%}. */
body.compactUi .settingsModal .settingsShell{box-sizing:border-box;min-height:0;max-height:100%!important;height:100%!important;overflow:hidden!important;display:flex;flex-direction:column;padding:clamp(8px,1.6vh,12px)!important}
body.compactUi .settingsModal .settingsHead{flex:none;min-height:48px;gap:10px}
body.compactUi .settingsModal .settingsHead button{width:auto!important;min-width:60px;flex:none;margin:0!important}
body.compactUi .settingsModal .settingsTabs{display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr))!important;gap:4px;margin:4px 0 6px!important;padding:0!important;min-height:44px;overflow:visible!important;touch-action:manipulation}
body.compactUi .settingsModal .settingsTabs button{box-sizing:border-box;display:block;min-width:0!important;width:100%!important;max-width:100%!important;min-height:44px!important;flex:none!important;margin:0!important;padding:6px 1px!important;white-space:nowrap;font-size:clamp(10px,2.1vw,13px)!important;touch-action:manipulation}
body.compactUi .settingsModal .settingsPage:not(.hidden){flex:1;min-height:0;overflow-x:hidden;overflow-y:auto;-webkit-overflow-scrolling:touch;touch-action:pan-y;overscroll-behavior:contain;padding-bottom:max(14px,env(safe-area-inset-bottom))}
body.compactUi .settingsModal .settingsRow button{min-width:0;flex:1}
body.compactUi #controlPreview{height:155px!important;flex:none}
body.compactUi .diagnosticActions{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.5fr)}
body.compactUi .diagnosticActions button{width:100%!important;margin:0!important;white-space:normal}
body.compactUi .settingsPage textarea{width:100%;font-size:12px;min-height:72px;max-height:140px;resize:vertical;user-select:text;touch-action:pan-y}
/* State change shrinks the whole card, not only hidden child contents. */
body.compactUi #prep.folded:not(.hidden),body.compactUi.loadoutChoosing #prep.folded:not(.hidden),body.compactUi.fieldPreparing #prep.folded:not(.hidden){box-sizing:border-box;position:fixed!important;width:min(430px,calc(var(--ui-width,100vw) - 24px))!important;height:56px!important;min-height:56px!important;max-height:56px!important;top:calc(var(--ui-top) + 48px)!important;left:var(--vvcenterx,50vw)!important;transform:translateX(-50%)!important;bottom:auto!important;overflow:hidden!important;padding:5px 9px!important;gap:0!important;pointer-events:auto!important}
body.compactUi #prep.folded .prepTitle{position:static!important;flex:0 0 auto!important;min-height:44px!important;height:44px!important;max-height:44px!important;padding:0!important;margin:0!important;gap:7px}
body.compactUi #prep.folded .prepTitle button{min-width:52px!important;width:auto!important;min-height:44px!important}
body.compactUi #prep.folded #prepBody,body.compactUi #prep.folded #prepWaiting,body.compactUi #prep.folded .shopHeader{display:none!important}
body.compactUi #prep.folded #prepStageTitle{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* Preserve absolute touch-control placement on press; global button:active only applies visual feedback. */
@media (pointer:coarse){
 body.mobile #touchUI .combatBtn:active,
 body.mobile #touchUI .contextAction:active{transform:translate(-50%,-50%) scale(var(--touch-scale,1))!important;filter:brightness(1.12)}
}
