/* Continuous menus and unobstructed team placement, portrait and landscape. */
html,body,#app{overscroll-behavior:none}
button{touch-action:manipulation}
#world{touch-action:none!important;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
#modal .modal-card{display:flex!important;flex-direction:column!important;max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px)!important;min-height:0!important}
#modal #modal-head{flex:0 0 auto!important}
#modal #modal-body{display:block!important;flex:1 1 auto!important;min-height:0!important;overflow:auto!important;overscroll-behavior:contain;touch-action:pan-y!important;padding:12px!important;-webkit-overflow-scrolling:touch}
#modal #page-stage4{display:block!important;height:auto!important;min-height:0!important;overflow:visible!important;max-height:none!important;touch-action:pan-y!important}
#page-nav4,.panel-pager13,.pet-nav4,.tool-pager4{display:none!important}
#modal .draft-screen9,#modal .berry-panel13{height:auto!important;overflow:visible!important;display:block!important}
#modal .draft-pool9,#modal .berry-cards13,#modal .rescue-grid14,#modal .support-pets14,#modal .codex-grid{display:grid!important;grid-template-columns:repeat(auto-fit,minmax(125px,1fr))!important;height:auto!important;max-height:none!important;overflow:visible!important;gap:9px!important}
#modal .draft-line9{position:static!important;max-height:none!important}
#modal .draft-commit9{position:sticky!important;bottom:-12px;background:#102c27f5;padding:10px!important;margin:12px -6px -6px;z-index:2;display:flex;gap:8px;flex-wrap:wrap}
#modal .detail-tabs13,#modal .berry-filters13,#modal .region-tabs12{display:flex!important;flex-wrap:wrap!important;height:auto!important;overflow:visible!important;gap:5px}
#modal input,#modal select,#modal textarea{font-size:16px!important}
#modal .berry-cards13{grid-template-columns:repeat(auto-fit,minmax(190px,1fr))!important}
#modal .support-pets14 button,#modal .rescue-grid14>div{min-width:0!important;height:auto!important;min-height:130px}
#modal details{padding:10px 0;border-bottom:1px solid #ffffff20}
#modal summary{cursor:pointer;min-height:42px;align-content:center;font-weight:700}
.list-grid16{display:grid;grid-template-columns:repeat(auto-fit,minmax(135px,1fr));gap:9px;margin:12px 0}
.list-grid16>button,.list-grid16>div{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;padding:10px;background:#153b32;border:1px solid #476553;border-radius:12px;color:#fff1d3;min-width:0;text-align:center}
.list-grid16 canvas{width:68px;height:55px;object-fit:contain}
.list-grid16 small{font-size:11px;line-height:1.5;color:#b7cabc;overflow-wrap:anywhere}
.pet-list16{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:9px;margin:12px 0}
.pet-list16>button{display:flex;align-items:center;text-align:left;gap:10px;padding:9px;border-radius:12px}
.pet-list16 canvas{width:60px;height:60px;flex-shrink:0}
.pet-list16 b,.pet-list16 small{display:block;margin:3px 0}
.deploy-open16{min-height:40px!important;min-width:90px!important;padding:8px 12px!important;background:#e5c57c!important;color:#142f28!important;border:1px solid #fff0b9!important;border-radius:12px!important;font-weight:800!important;font-size:12px!important}
body.dragging16 #hud9,body.dragging16 #sidebar,body.dragging16 #shop9,body.dragging16 #inspector,body.dragging16 #arena-nav3{visibility:hidden!important;pointer-events:none!important}
body.dragging16 #dock{opacity:.18!important;pointer-events:none!important}
#deploy16{position:fixed;inset:0;z-index:1000;box-sizing:border-box;padding:calc(env(safe-area-inset-top) + 8px) max(10px,env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 8px) max(10px,env(safe-area-inset-left));background:#0a201e;color:#fff0d3;display:grid;grid-template-rows:auto minmax(0,1fr) 100px;gap:10px;touch-action:none;overscroll-behavior:none;font:14px system-ui,sans-serif}
#deploy16.hidden{display:none!important}
#deploy16 header{display:flex;justify-content:space-between;align-items:center;gap:12px;min-height:44px}
#deploy16 header b{font-size:18px}
#deploy16 small{display:block;font-size:11px;line-height:1.4;color:#c0d1c5}
#deploy16 button{color:inherit;background:#24473c;border:1px solid #557260;border-radius:9px;min-height:40px;font:inherit;cursor:pointer;padding:6px}
#deploy16 header button{background:#e7cd8f;color:#143329;font-weight:800;min-width:92px}
.deploy-body16{display:grid;grid-template-columns:minmax(0,1fr) 160px;gap:12px;min-height:0;max-width:1000px;width:100%;justify-self:center}
.deploy-board16{display:grid;grid-template-columns:repeat(var(--cols16,8),minmax(0,1fr));grid-template-rows:repeat(var(--rows16,8),minmax(0,1fr));gap:3px;min-height:0;min-width:0}
#deploy16 .cell16{position:relative;min-width:0;min-height:0;padding:0;background:#284b37;overflow:hidden;display:flex;align-items:center;justify-content:center;flex-direction:column}
#deploy16 .cell16.terrain-water{background:#23536a}#deploy16 .cell16.terrain-rock{background:#535348}#deploy16 .cell16.terrain-lava{background:#764834}
#deploy16 .cell16.blocked16{background:#172323;color:#ab7971;border-color:#344039}
#deploy16 .cell16 canvas{height:calc(100% - 12px);max-height:60px;width:100%;object-fit:contain;pointer-events:none}
#deploy16 .cell16 small{font-size:9px;max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;position:absolute;bottom:0;left:0;right:0;background:#112c22c9}
#deploy16 .chosen16,#deploy16 .hover16{border:2px solid #ffdb89!important;background:#3d6548;box-shadow:inset 0 0 0 1px #ffdb89}
.deploy-body16 aside{display:flex;flex-direction:column;gap:9px;min-height:0;overflow:auto;touch-action:pan-y}
.deploy-body16 aside p{font-size:12px;line-height:1.5;color:#c4d0bf;margin:0 0 auto}
.deploy-roster16{display:flex;gap:8px;overflow-x:auto;overflow-y:hidden;touch-action:pan-x;padding:2px 0;min-width:0}
#deploy16 .deploy-roster16 button{flex:0 0 105px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;padding:3px;touch-action:pan-x;min-width:0}
#deploy16 .deploy-roster16 canvas{height:48px;width:70px;pointer-events:none}
#deploy16 .deploy-roster16 b{font-size:11px;overflow:hidden;text-overflow:ellipsis;max-width:100%;white-space:nowrap}
#deploy16 .deploy-roster16 small{font-size:10px}
#game.sim4 #sidebar{overflow:auto!important}
#game.sim4 #sidebar>button{width:100%;min-height:38px!important;margin:3px 0;font-size:11px!important}
.tool-strip{display:flex!important;overflow-x:auto!important;touch-action:pan-x!important;gap:6px}
.tool-strip>button{flex:0 0 auto!important}
@media(orientation:portrait){
 #deploy16{grid-template-rows:auto minmax(0,1fr) 96px;gap:8px}
 .deploy-body16{grid-template-columns:1fr;grid-template-rows:minmax(0,1fr) auto;gap:8px}
 .deploy-body16 aside{display:grid;grid-template-columns:repeat(3,1fr);gap:5px;overflow:visible}
 .deploy-body16 aside b{grid-column:1/-1;font-size:13px}
 .deploy-body16 aside p{grid-column:1/-1;font-size:11px;min-height:30px}
 #deploy16 .cell16 small{font-size:8px}
 #game.adventure9 .field-commands9{max-width:calc(100vw - 160px);flex-wrap:wrap!important;justify-content:flex-end;gap:5px!important}
 #game.adventure9 .deploy-open16{min-width:85px!important;min-height:38px!important}
 #modal .modal-card{width:calc(100vw - 16px)!important;max-width:760px!important}
}
@media(orientation:landscape) and (max-height:500px){
 #deploy16{grid-template-rows:42px minmax(0,1fr) 78px;gap:5px}
 #deploy16 header b{font-size:15px}
 .deploy-body16{grid-template-columns:minmax(0,1fr) 165px;gap:10px}
 .deploy-body16 aside{gap:4px}.deploy-body16 aside p{font-size:10px}
 #deploy16 .deploy-roster16 canvas{height:32px;width:55px}
 #deploy16 .deploy-roster16 button{flex-basis:100px}
 #deploy16 .cell16 small{font-size:8px;background:#112c22df}
 #deploy16 .cell16 canvas{height:100%;max-height:36px}
 .deploy-board16{gap:2px}
 #deploy16 .deploy-body16 aside button{min-height:32px;font-size:11px}
}

#modal{z-index:1100!important}
@media(orientation:portrait) and (max-width:900px){
 #game.adventure9 .world-wrap{position:absolute!important;top:86px!important;bottom:160px!important;height:auto!important;left:0;right:0;overflow:hidden}
 #game.adventure9 #world{object-fit:cover!important;object-position:25% 50%}
 #game.adventure9 #sidebar{top:86px!important;height:31px!important;max-height:calc(100dvh - 270px)!important;overflow:auto!important}
 #game.adventure9 #sidebar:not(.leaders-folded9){height:210px!important}
 #game.adventure9 .synergy-tray9:not(.compact9){max-height:180px!important}
 #game.adventure9 .field-commands9{bottom:calc(var(--ui-safe-bottom) + 117px)!important}
}
