/* POKEMON RIMBA v11.5 — mobile fluid layouts. Loaded AFTER the legacy UI sheets.
   Distinct portrait and landscape safe zones; no orientation lock. */
:root{--ui-safe-top:env(safe-area-inset-top,0px);--ui-safe-right:env(safe-area-inset-right,0px);--ui-safe-bottom:env(safe-area-inset-bottom,0px);--ui-safe-left:env(safe-area-inset-left,0px)}
html,body,#app{width:100%;height:100%;height:100dvh;max-width:100%;overflow:hidden;-webkit-text-size-adjust:100%}#rotate,#rotate-gate15{display:none!important}body.portrait-ok #rotate{display:none!important}
button{-webkit-tap-highlight-color:transparent;user-select:none}button:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid #f8d18b!important;outline-offset:2px}button .glyph9,.icon9 svg{display:block;flex:none}button.icon9,.icon-button,.menu-orbs9 .icon9{display:inline-flex;align-items:center;justify-content:center;aspect-ratio:1;line-height:1;border-radius:13px!important;box-shadow:inset 0 1px rgba(255,239,196,.12),0 3px 10px rgba(0,0,0,.18);transition:background-color .15s,transform .15s,border-color .15s}button.icon9:active,.menu-orbs9 .icon9:active{transform:scale(.94)}.icon9 .glyph9,.menu-orbs9 .glyph9{width:65%;height:65%;stroke-width:1.9}#modal{position:fixed;inset:0;z-index:60;min-width:0;padding:max(8px,var(--ui-safe-top)) max(8px,var(--ui-safe-right)) max(8px,var(--ui-safe-bottom)) max(8px,var(--ui-safe-left))}#modal .modal-card{min-width:0;max-width:100%;max-height:calc(100dvh - max(8px,var(--ui-safe-top)) - max(8px,var(--ui-safe-bottom)) - 8px);overflow:hidden}#modal #modal-body{min-width:0;min-height:0;overflow-x:hidden!important;overflow-y:auto!important;touch-action:pan-y;-webkit-overflow-scrolling:touch;overscroll-behavior:contain}#modal #modal-body>*{max-width:100%;min-width:0}#modal .modal-card :is(.detail-tabs13,.metric-row13,.icon-actions13,.region-tabs12){max-width:100%;flex-wrap:wrap}#modal :is(.pet-grid7,.draft-grid,.chapter-grid,.knowledge-grid,.atlas-grid9,.rescue-grid14){min-width:0}#modal :is(button,select,input){max-width:100%}#toast{z-index:250;max-width:min(92vw,450px);pointer-events:none}#evolution6{z-index:80}
/* Both orientations: prevent unused legacy controls sitting invisibly above the arena. */
#game.adventure9 .topbar{display:none!important}#game.adventure9 .play-layout{inset:0!important;width:100%!important;height:100%!important;min-height:0!important;min-width:0!important}#game.adventure9 .world-wrap{height:100%!important;width:100%!important;min-width:0!important}#game.adventure9 #world{display:block;width:100%;height:100%;object-fit:contain;touch-action:none}#game.adventure9 .hud9{z-index:19;overflow:visible}#game.adventure9 .hud9 button{touch-action:manipulation}#game.adventure9 #sidebar{box-sizing:border-box;min-width:0!important;overflow:hidden!important}#game.adventure9 #dock{min-width:0!important;box-sizing:border-box;overflow:hidden!important;pointer-events:auto}#game.adventure9 #dock .bench-grid9{min-width:0;grid-template-columns:repeat(9,minmax(0,1fr));gap:clamp(2px,.55vw,6px)}#game.adventure9 #dock .roster-cell8{min-width:0!important;width:100%!important;overflow:hidden;touch-action:pan-x}#game.adventure9 #dock canvas{max-width:100%!important;object-fit:contain}.leader9,.leader-handle9{min-width:0}.leader9 b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.hud-tools9,.quick-rail9,.gold-hud9,.commander9,.field-commands9{z-index:23}.round-hud9{z-index:21}.shop9{z-index:29}.shop9 .recruit-panel9{min-width:0!important;max-width:100%;clip-path:none!important;border-radius:16px;overflow:hidden}.recruit-stage9{min-width:0;min-height:0}.recruit-unit9,.recruit-buy9{min-width:0}.recruit-buy9>b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}
/* The homepage is independent from gameplay orientation. */
#menu{overflow:hidden;min-height:0;min-width:0;box-sizing:border-box}#menu .menu-brand,#menu .menu-actions,#menu .menu-footer{min-width:0}#menu .menu-actions .quest9{width:100%;min-width:0;max-width:100%}#menu .menu-orbs9{display:flex;align-items:center;justify-content:center;gap:clamp(8px,2vw,16px);flex-wrap:nowrap}#menu .menu-orbs9 .icon9{width:clamp(35px,6.5vh,46px);height:clamp(35px,6.5vh,46px);padding:9px}#menu .menu-footer{justify-content:space-between;min-width:0;gap:10px}#menu .menu-footer button{display:inline-flex;align-items:center;gap:7px;white-space:nowrap;border-radius:10px}#menu .menu-footer .glyph9{width:16px;height:16px}
/* Standard wide phones, including iPhone landscape and small Android screens. */
@media (orientation:landscape) and (max-height:600px){
 #menu{display:grid!important;position:absolute;inset:0;grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;grid-template-rows:minmax(0,1fr) auto!important;align-items:center;gap:clamp(6px,2vw,24px)!important;padding:max(7px,var(--ui-safe-top)) max(16px,var(--ui-safe-right)) max(7px,var(--ui-safe-bottom)) max(16px,var(--ui-safe-left))!important}
 #menu .menu-brand,#menu .menu-actions,#menu .menu-footer{position:relative!important;left:auto!important;right:auto!important;top:auto!important;bottom:auto!important;width:100%!important;max-width:none!important;align-self:center;transform:none!important;margin:0!important}
 #menu .menu-brand{text-align:left!important}#menu .menu-brand h1{font-size:clamp(26px,6.1vw,58px)!important;line-height:.92!important;margin:clamp(4px,2vh,11px) 0!important}#menu .menu-brand .subtitle{font-size:clamp(7px,1.45vw,11px)!important;letter-spacing:.12em!important}#menu .menu-brand p{display:block;font-size:clamp(8px,1.25vw,11px)!important;margin:7px 0!important}#menu .menu-badges{gap:5px;margin-top:7px}#menu .menu-badges span{font-size:7px;padding:4px 5px}
 #menu .menu-actions{justify-self:stretch;display:grid;gap:clamp(4px,1.4vh,8px)!important}#menu .quest9{min-height:clamp(45px,15vh,65px)!important;max-height:65px;padding:5px 9px!important;gap:8px!important;border-radius:12px!important}#menu .quest9 .quest-icon9{flex:0 0 28px;height:28px}#menu .quest9 b{font-size:clamp(12px,2.2vw,17px)!important}#menu .quest9 em{display:none!important}#menu .quest9 small{font-size:7px!important}#menu .menu-orbs9{margin:0!important;gap:12px}#menu .menu-footer{grid-column:1/-1;align-self:end;padding:0 0 1px;font-size:8px!important}#menu .menu-footer button{min-height:27px;padding:4px 8px;font-size:9px!important}
 #game.adventure9 .round-hud9{left:50%!important;top:calc(var(--ui-safe-top) + 5px)!important;width:min(40vw,330px)!important;max-width:calc(100% - 235px)!important;transform:translateX(-50%)}#game.adventure9 .hud-tools9{right:calc(var(--ui-safe-right) + 8px)!important;top:calc(var(--ui-safe-top) + 6px)!important;gap:4px!important}#game.adventure9 .hud-tools9 .icon9{width:27px!important;height:27px!important;padding:5px!important}
 #game.adventure9 .quick-rail9{left:calc(var(--ui-safe-left) + 8px)!important;top:calc(var(--ui-safe-top) + 54px)!important;gap:7px!important}#game.adventure9 .quick-rail9 .icon9{width:29px!important;height:29px!important;padding:5px!important}#game.adventure9 .synergy-tray9{left:calc(var(--ui-safe-left) + 43px)!important;top:calc(var(--ui-safe-top) + 54px)!important;width:68px!important;max-height:calc(100dvh - 173px)!important;overflow-y:auto;overscroll-behavior:contain}#game.adventure9 #sidebar{right:calc(var(--ui-safe-right) + 7px)!important;top:calc(var(--ui-safe-top) + 48px)!important;bottom:auto!important;height:min(166px,calc(100dvh - var(--ui-safe-top) - var(--ui-safe-bottom) - 151px))!important;min-height:0!important;width:108px!important}#game.adventure9 .leader-list9{height:calc(100% - 22px);overflow:hidden}#game.adventure9 .leader9{min-height:0!important;padding:1px 3px!important}
 #game.adventure9 #dock{left:calc(var(--ui-safe-left) + 72px)!important;right:calc(var(--ui-safe-right) + 98px)!important;bottom:calc(var(--ui-safe-bottom) + 8px)!important;height:68px!important;padding:0!important;gap:4px!important}#game.adventure9 .bench-title9{font-size:8px!important;min-height:10px}.bench-title9 small{display:none}#game.adventure9 .commander9{left:calc(var(--ui-safe-left) + 8px)!important;bottom:calc(var(--ui-safe-bottom) + 8px)!important;display:flex!important;flex-direction:column-reverse!important;gap:9px!important;width:53px!important}#game.adventure9 .commander-avatar9{width:47px!important;height:47px!important}#game.adventure9 .level-orb9{width:43px!important;height:43px!important}#game.adventure9 .gold-hud9{right:calc(var(--ui-safe-right) + 8px)!important;bottom:calc(var(--ui-safe-bottom) + 8px)!important;width:76px!important;display:flex!important;flex-direction:column-reverse!important;align-items:center;gap:10px!important}#game.adventure9 .gold-orb9{width:70px!important;height:70px!important}#game.adventure9 .battle-go9{width:37px!important;height:37px!important;min-height:37px!important;padding:8px!important}#game.adventure9 .field-commands9{right:calc(var(--ui-safe-right) + 103px)!important;bottom:calc(var(--ui-safe-bottom) + 86px)!important;gap:5px!important}
 #game.adventure9 .recruit-panel9{left:clamp(35px,7vw,80px)!important;right:clamp(35px,8vw,86px)!important;top:clamp(44px,13vh,70px)!important;height:clamp(180px,65vh,320px)!important;padding:0 9px!important}#game.adventure9 .recruit-buy9>b{font-size:clamp(10px,1.5vw,14px)!important}#game.adventure9 .recruit-buy9>small{font-size:8px!important;white-space:normal;text-align:center}#game.adventure9 .recruit-foot9{flex:0 0 44px!important}#game.adventure9 .recruit-head9{flex:0 0 32px!important}
}
/* Portrait: arena remains usable; controls dock in the lower safe area rather than blocking the board. */
@media (orientation:portrait) and (max-width:900px){
 #menu{position:absolute;inset:0;display:grid!important;grid-template-columns:minmax(0,1fr)!important;grid-template-rows:minmax(0,.9fr) minmax(0,1.1fr) auto!important;align-items:center;gap:clamp(8px,2vh,18px)!important;padding:calc(var(--ui-safe-top) + 18px) calc(var(--ui-safe-right) + 17px) calc(var(--ui-safe-bottom) + 10px) calc(var(--ui-safe-left) + 17px)!important}
 #menu .menu-brand,#menu .menu-actions,#menu .menu-footer{position:relative!important;top:auto!important;left:auto!important;bottom:auto!important;right:auto!important;transform:none!important;margin:0!important;width:100%!important;max-width:100%!important}#menu .menu-brand{text-align:center!important;align-self:end!important;padding:0!important}#menu .menu-brand h1{font-size:clamp(34px,10.7vw,66px)!important;line-height:.95!important;margin:clamp(8px,2vh,16px) 0!important}#menu .menu-brand .subtitle{font-size:clamp(8px,2.4vw,12px)!important;letter-spacing:.16em!important;max-width:none!important}#menu .menu-brand p{display:none!important}#menu .menu-badges{display:flex;justify-content:center;flex-wrap:wrap;gap:5px!important;margin-top:12px}#menu .menu-badges span{font-size:8px!important}#menu .menu-actions{align-self:center!important;justify-self:center!important;display:grid;gap:clamp(7px,1.7vh,13px)!important;max-width:390px!important}#menu .quest9{min-height:clamp(57px,9.5vh,80px)!important;max-height:85px!important;padding:10px 13px!important;border-radius:14px!important;gap:12px!important}#menu .quest9 b{font-size:clamp(16px,4.7vw,21px)!important}#menu .quest9 em{display:block!important;font-size:clamp(9px,2.6vw,11px)!important}#menu .quest9 small{font-size:8px!important}#menu .menu-orbs9{margin:4px auto 0!important;gap:clamp(12px,4vw,24px)!important}#menu .menu-orbs9 .icon9{width:clamp(41px,11vw,52px)!important;height:clamp(41px,11vw,52px)!important;padding:10px!important}#menu .menu-footer{align-self:end!important;min-height:30px!important;font-size:9px!important}#menu .menu-footer button{min-height:32px!important;padding:5px 8px;font-size:10px!important}
 #game.adventure9 .round-hud9{top:calc(var(--ui-safe-top) + 8px)!important;left:49%!important;transform:translateX(-50%)!important;width:calc(100vw - 162px)!important;max-width:260px!important;min-width:145px!important}#game.adventure9 .round-track9{height:27px!important;gap:2px!important;font-size:8px!important}#game.adventure9 .round-track9>b{min-width:28px;height:28px;font-size:17px!important}#game.adventure9 .round-track9>span{padding:3px!important;font-size:7px!important}#game.adventure9 .round-caption9{font-size:8px!important}#game.adventure9 .round-caption9>button{font-size:8px!important;max-width:55%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 #game.adventure9 .hud-tools9{top:calc(var(--ui-safe-top) + 7px)!important;right:calc(var(--ui-safe-right) + 5px)!important;width:66px!important;display:grid!important;grid-template-columns:repeat(2,29px)!important;gap:4px!important}#game.adventure9 .hud-tools9 .icon9{width:29px!important;height:29px!important;min-height:29px!important;padding:6px!important;border-radius:9px!important}#game.adventure9 .quick-rail9{left:calc(var(--ui-safe-left) + 6px)!important;top:calc(var(--ui-safe-top) + 77px)!important;gap:6px!important}#game.adventure9 .quick-rail9 .icon9{width:34px!important;height:34px!important;min-height:34px!important;padding:8px!important}#game.adventure9 .synergy-tray9{left:calc(var(--ui-safe-left) + 47px)!important;top:calc(var(--ui-safe-top) + 78px)!important;width:68px!important;max-height:min(245px,calc(100dvh - 285px))!important;overflow-y:auto!important;overscroll-behavior:contain;scrollbar-width:thin}#game.adventure9 .synergy-grid9{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:2px!important}#game.adventure9 .synergy-grid9 img{width:20px!important;height:20px!important}
 #game.adventure9 #sidebar{top:calc(var(--ui-safe-top) + 83px)!important;right:calc(var(--ui-safe-right) + 7px)!important;left:auto!important;bottom:auto!important;width:105px!important;height:min(210px,calc(100dvh - 300px))!important;padding:0!important;overflow:hidden!important}#game.adventure9 .leader-handle9{height:25px!important;min-height:25px!important}#game.adventure9 .leader-list9{height:calc(100% - 26px)!important;overflow:hidden!important}#game.adventure9 .leader9{height:calc(100% / 6)!important;min-height:0!important;padding:1px 3px!important;gap:2px!important}#game.adventure9 .leader9 svg{width:20px!important;height:20px!important}#game.adventure9 .leader9 b{font-size:9px!important}#game.adventure9 .leader9 small{font-size:7px!important}
 #game.adventure9 #dock{left:calc(var(--ui-safe-left) + 10px)!important;right:calc(var(--ui-safe-right) + 10px)!important;bottom:calc(var(--ui-safe-bottom) + 112px)!important;height:69px!important;display:flex!important;flex-direction:column!important;gap:4px!important;border:1px solid #9aae8566!important;border-radius:11px!important;padding:4px!important;background:#092a25ed!important;backdrop-filter:blur(6px)}#game.adventure9 .bench-title9{font-size:9px!important;line-height:11px!important;flex:none!important}#game.adventure9 #dock .roster-cell8{padding:1px!important;border-radius:5px!important}#game.adventure9 #dock .roster-cell8 small{font-size:8px!important}#game.adventure9 #dock .roster-cell8 canvas{max-height:43px!important}#game.adventure9 .commander9{left:calc(var(--ui-safe-left) + 10px)!important;bottom:calc(var(--ui-safe-bottom) + 8px)!important;width:55px!important;display:flex!important;flex-direction:column-reverse!important;gap:5px!important;align-items:center!important}#game.adventure9 .commander-avatar9{width:49px!important;height:49px!important}#game.adventure9 .level-orb9{width:49px!important;height:49px!important}#game.adventure9 .gold-hud9{right:calc(var(--ui-safe-right) + 10px)!important;bottom:calc(var(--ui-safe-bottom) + 8px)!important;display:flex!important;flex-direction:column-reverse!important;align-items:center!important;width:72px!important;gap:8px!important}#game.adventure9 .gold-orb9{width:69px!important;height:69px!important;padding:7px!important}#game.adventure9 .gold-orb9>b{font-size:23px!important}#game.adventure9 .battle-go9{width:41px!important;height:41px!important;min-height:41px!important;padding:9px!important}#game.adventure9 .field-commands9{right:calc(var(--ui-safe-right) + 101px)!important;bottom:calc(var(--ui-safe-bottom) + 48px)!important;display:flex!important;gap:7px!important}#game.adventure9 .field-commands9 .icon9{width:39px!important;height:39px!important;min-height:39px!important;padding:8px!important}#game.adventure9 .capacity9{pointer-events:none;top:35%!important;opacity:.17;font-size:65px!important}
 #game.adventure9 .recruit-panel9{top:calc(var(--ui-safe-top) + 97px)!important;bottom:calc(var(--ui-safe-bottom) + 187px)!important;height:auto!important;left:calc(var(--ui-safe-left) + 9px)!important;right:calc(var(--ui-safe-right) + 9px)!important;display:flex!important;flex-direction:column!important;padding:0 6px!important}#game.adventure9 .recruit-head9{flex:0 0 37px!important;min-height:37px!important;padding:0 7px!important}#game.adventure9 .recruit-head9>span{font-size:9px!important;letter-spacing:0!important}#game.adventure9 .recruit-stage9{grid-template-columns:repeat(3,minmax(0,1fr))!important;grid-template-rows:repeat(2,minmax(0,1fr))!important;gap:4px!important;padding:5px!important;overflow-y:auto}#game.adventure9 .recruit-buy9{gap:0!important;min-height:0!important;padding:2px!important}#game.adventure9 .recruit-buy9 canvas{max-height:none!important;min-height:24px!important;height:100%!important}#game.adventure9 .recruit-buy9>b{font-size:12px!important;line-height:14px!important}#game.adventure9 .recruit-buy9>small{font-size:8px!important;line-height:10px!important;min-height:10px!important;white-space:normal!important;text-align:center}#game.adventure9 .recruit-cost9{font-size:12px!important;line-height:14px!important}#game.adventure9 .recruit-types9{min-height:15px!important;gap:2px!important}#game.adventure9 .recruit-types9 img{width:14px!important;height:14px!important}#game.adventure9 .recruit-detail9{top:1px!important;right:1px!important}#game.adventure9 .recruit-foot9{flex:0 0 43px!important;min-height:43px!important;padding:2px 5px!important;gap:4px!important}#game.adventure9 .recruit-tip9 span{display:none!important}#game.adventure9 .recruit-tip9 b{font-size:9px!important}#game.adventure9 .reroll9{width:40px!important;height:40px!important}#game.adventure9 .shop-lock9 span{display:none!important}
 #game.sim4:not(.hidden){display:grid!important;grid-template-rows:calc(42px + var(--ui-safe-top)) minmax(0,1fr) calc(170px + var(--ui-safe-bottom))!important;min-height:0}#game.sim4 .topbar{min-height:0!important;height:auto!important;padding:var(--ui-safe-top) 8px 0!important;gap:5px!important}#game.sim4 .game-logo{font-size:10px!important}#game.sim4 #top-info{gap:4px!important;font-size:9px!important;white-space:nowrap;overflow:hidden}#game.sim4 #top-info .resource{display:none}#game.sim4 .play-layout{position:relative!important;inset:auto!important;display:block!important;width:100%!important;height:100%!important;min-height:0!important;padding:0!important}#game.sim4 .world-wrap{height:100%!important;width:100%!important;max-width:100%!important}#game.sim4 #sidebar{position:absolute;top:10px;left:7px;width:min(122px,31vw)!important;max-height:min(46%,275px);height:auto;overflow-y:auto!important;z-index:12;border-radius:10px!important;background:#0a2b25e8!important;padding:6px!important;font-size:10px!important}#game.sim4 #sidebar .side-title{font-size:8px!important}#game.sim4 #sidebar button{min-height:27px!important;padding:4px!important}#game.sim4 #dock{position:relative!important;inset:auto!important;display:flex!important;flex-direction:column!important;min-width:0!important;height:auto!important;min-height:0!important;padding:5px 8px calc(var(--ui-safe-bottom) + 5px)!important;gap:4px!important;overflow:hidden!important}#game.sim4 .sim-tools{display:flex!important;width:100%;flex:1;min-height:0;overflow-x:auto;overflow-y:hidden;scrollbar-width:thin;touch-action:pan-x}#game.sim4 .map-tool,#game.sim4 .tool{min-width:64px!important;max-width:74px!important;flex:0 0 67px!important;min-height:0!important;height:100%!important;padding:5px 3px!important}#game.sim4 .sim-controls{display:flex!important;width:100%;flex:0 0 37px!important;overflow-x:auto;gap:4px!important;scrollbar-width:thin}#game.sim4 .sim-controls button{flex:0 0 auto;min-height:32px!important;padding:4px 9px!important}#game.sim4 .topbar .icon-button{min-width:30px!important;min-height:30px!important;padding:3px!important}#game.sim4 #phase-label{font-size:9px;max-width:calc(100% - 125px);left:auto;right:6px}#game.sim4 #world-tip{font-size:9px;max-width:calc(100% - 125px);left:auto;right:6px;text-align:right}
 #modal .modal-card{height:calc(100dvh - var(--ui-safe-top) - var(--ui-safe-bottom) - 20px)!important;width:calc(100vw - var(--ui-safe-left) - var(--ui-safe-right) - 14px)!important;max-height:none!important;border-radius:14px!important}#modal #modal-head{flex:0 0 45px!important;min-height:45px!important;padding:5px 9px!important}#modal #modal-head h2{font-size:clamp(15px,4.2vw,19px)!important;line-height:1.2!important}#modal #modal-body{padding:9px!important;display:block!important;overflow-y:auto!important}#modal :is(.rescue-grid14,.stat-tiles13,.stats-grid10,.care-grid13,.life-needs13){grid-template-columns:repeat(2,minmax(0,1fr))!important}#modal :is(.skill-grid13,.detail-tabs13){gap:5px}#modal .detail-tabs13>button{min-height:34px!important}#modal .pokemon-hero13{gap:8px!important;flex-wrap:wrap}#modal .pokemon-hero13 h3{font-size:18px!important}#modal .pokemon-hero13>canvas{width:65px!important;height:60px!important}#modal .draft-screen9{overflow-y:auto;max-height:100%}#modal .draft-line9{flex-direction:column;flex:0 0 auto!important}#modal :is(.draft-grid,.atlas-grid9,.chapter-grid){grid-template-columns:repeat(2,minmax(0,1fr))!important}#modal input:not([type=radio]):not([type=checkbox]):not([type=range]){font-size:16px!important}
}
@media (orientation:portrait) and (max-width:380px){#menu .menu-brand h1{font-size:38px!important}#menu .quest9{min-height:54px!important;padding:7px 10px!important}#menu .quest9 em{font-size:8px!important}#game.adventure9 .round-hud9{left:48%!important;width:calc(100vw - 152px)!important}#game.adventure9 #sidebar{width:94px!important}#game.adventure9 .synergy-tray9{width:62px!important}#game.adventure9 #dock{bottom:calc(var(--ui-safe-bottom) + 113px)!important}#game.adventure9 .field-commands9{right:calc(var(--ui-safe-right) + 94px)!important}}
@media (orientation:portrait) and (max-height:680px){#menu{grid-template-rows:minmax(0,.82fr) minmax(0,1.18fr) auto!important;gap:5px!important;padding-top:calc(var(--ui-safe-top) + 8px)!important}#menu .menu-brand h1{font-size:clamp(30px,9vw,46px)!important;margin:5px 0!important}#menu .menu-badges{margin-top:5px!important}#menu .quest9{min-height:49px!important;max-height:60px!important;padding:5px 11px!important}#menu .menu-orbs9{margin-top:0!important}#menu .menu-orbs9 .icon9{width:38px!important;height:38px!important}#game.adventure9 .synergy-tray9{max-height:155px!important}#game.adventure9 #sidebar{height:min(170px,calc(100dvh - 300px))!important}#game.adventure9 #dock{bottom:calc(var(--ui-safe-bottom) + 105px)!important;height:61px!important}#game.adventure9 .recruit-panel9{top:calc(var(--ui-safe-top) + 86px)!important;bottom:calc(var(--ui-safe-bottom) + 170px)!important}#game.sim4{grid-template-rows:42px minmax(0,1fr) calc(145px + var(--ui-safe-bottom))!important}}
@media (orientation:landscape) and (max-height:350px){#game.adventure9 .synergy-tray9{max-height:calc(100dvh - 144px)!important}#game.adventure9 #sidebar{height:min(132px,calc(100dvh - 137px))!important}#game.adventure9 #dock{height:56px!important;bottom:calc(var(--ui-safe-bottom) + 6px)!important}#game.adventure9 .commander9{gap:3px!important}#game.adventure9 .commander-avatar9{width:40px!important;height:40px!important}#game.adventure9 .level-orb9{width:38px!important;height:38px!important}#game.adventure9 .gold-orb9{width:57px!important;height:57px!important}#game.adventure9 .gold-hud9{gap:6px!important}#game.adventure9 .battle-go9{width:30px!important;height:30px!important;min-height:30px!important}#game.adventure9 .field-commands9{bottom:calc(var(--ui-safe-bottom) + 71px)!important}#game.adventure9 .recruit-panel9{top:12%!important;height:67vh!important}}
@media (prefers-reduced-motion:reduce){.icon9,.menu-orbs9 .icon9{transition:none!important}}
/* Portrait uses a real central two-row roster: command orbs remain in side lanes. */
@media (orientation:portrait) and (max-width:900px){
 #game.adventure9 #dock{left:calc(var(--ui-safe-left) + 70px)!important;right:calc(var(--ui-safe-right) + 84px)!important;bottom:calc(var(--ui-safe-bottom) + 8px)!important;height:104px!important;gap:3px!important;padding:4px!important;border-radius:12px!important}
 #game.adventure9 #dock .bench-grid9{display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr))!important;grid-template-rows:repeat(2,minmax(0,1fr))!important;gap:3px!important;min-height:0!important}
 #game.adventure9 #dock .roster-cell8{height:100%!important;min-height:0!important;padding:1px!important}
 #game.adventure9 #dock .roster-cell8 canvas{height:calc(100% - 8px)!important;max-height:37px!important}
 #game.adventure9 .field-commands9{bottom:calc(var(--ui-safe-bottom) + 119px)!important;right:calc(var(--ui-safe-right) + 84px)!important}
 #game.adventure9 .field-commands9 .icon9{width:35px!important;height:35px!important;min-height:35px!important}
 #game.adventure9 .commander9{flex-direction:column-reverse!important}#game.adventure9 .gold-hud9{flex-direction:column-reverse!important}
}
@media (orientation:portrait) and (max-height:680px){#game.adventure9 #dock{height:96px!important}#game.adventure9 .field-commands9{bottom:calc(var(--ui-safe-bottom) + 108px)!important}}
/* Modern line icons for the habitat header and arena zoom actions. */
#game .topbar .modern-icon15,#arena-nav3 .modern-icon15{display:inline-flex;align-items:center;justify-content:center;border-radius:10px!important;background:linear-gradient(145deg,#245145,#10332d)!important;border:1px solid #85a48580!important;color:#f3d99d!important;padding:6px!important}#game .topbar .modern-icon15 .glyph9,#arena-nav3 .modern-icon15 .glyph9{width:21px;height:21px;max-width:100%;max-height:100%}#arena-nav3 .modern-icon15{width:35px;min-width:35px;height:35px;min-height:35px}
/* Switching from habitat to main menu must always hide the old game layer. */
#game.hidden,#menu.hidden{display:none!important}
/* Give all six league entries a full touch target inside their grid track. */
@media (orientation:portrait) and (max-width:900px){#game.adventure9 #sidebar .leader-list9{display:grid!important;grid-template-rows:repeat(6,minmax(0,1fr))!important;min-height:0!important}#game.adventure9 #sidebar .leader9{height:100%!important;max-height:none!important;min-height:0!important;align-self:stretch!important}}
