/* Mobile gameplay stays in document flow, with TOP20 available below it. */
@media (max-width:1024px), (hover:none) and (pointer:coarse) {
 html:has(body.portal-game), body.portal-game {width:100%;height:auto!important;min-height:100%;overflow-x:hidden!important;overflow-y:auto!important;overscroll-behavior-y:auto!important;touch-action:pan-y;background:#faf7ef}
 body.portal-game>.game-page {display:block!important;position:relative!important;inset:auto!important;width:100%!important;height:auto!important;min-height:0!important;margin:0!important;padding:0!important;overflow:visible!important}
 body.portal-game :is(.mobile-orientation,.landscape-gate){display:none!important}
 body.portal-game .play-layout{display:block!important;min-width:0}
 body.portal-game .game-shell {position:relative!important;inset:auto!important;width:100%!important;max-width:100%!important;margin:0!important;flex-shrink:0;}
 body.portal-game .leaderboard {display:block!important;position:relative!important;inset:auto!important;visibility:visible!important;width:calc(100% - 24px)!important;max-width:900px;margin:24px auto!important;padding:16px!important;box-sizing:border-box;}
 body.portal-game .leaderboard__table-wrap {overflow-x:auto!important;touch-action:pan-x pan-y;-webkit-overflow-scrolling:touch}
 body.portal-game .leaderboard table {width:100%;min-width:340px}
 body.portal-game .cg-other-games {display:block!important;width:100%;padding:24px 12px;box-sizing:border-box}
 body.portal-game .mobile-game-nav {display:flex!important;position:relative;justify-content:center;gap:20px;padding:12px max(12px,env(safe-area-inset-right)) 12px max(12px,env(safe-area-inset-left));background:#faf7ef;font-size:14px;font-weight:800;}
 .mobile-game-nav a{color:#0849a2;min-height:44px;display:flex;align-items:center}
 body.portal-game :is(.game-overlay,.game-overlay__content) {overscroll-behavior:contain;touch-action:pan-y}
 body.portal-game .game-overlay {max-height:calc(100% - 16px)!important;overflow-y:auto!important;-webkit-overflow-scrolling:touch}
 body.portal-game :is(input,select,textarea){font-size:16px!important}
 body.portal-game :is(.touch-control,.touch-throttle__button,.touch-joystick,#actionButton){touch-action:none;}
}
.mobile-game-nav{display:none}
@media (max-width:1024px) and (orientation:portrait), (hover:none) and (pointer:coarse) and (orientation:portrait) {
 body.portal-game:not(.portal-game--sztorm) .game-shell {display:grid!important;grid-template-rows:48px minmax(0,1fr)!important;height:75svh!important;min-height:470px;max-height:800px}
 body.portal-game:not(.portal-game--sztorm) .game-hud {height:48px!important;min-height:0!important;padding-top:0!important}
 body.portal-game:not(.portal-game--sztorm) .game-stage {position:relative;width:100%;height:100%!important;min-height:0!important;aspect-ratio:auto!important;overflow:hidden}
 body.portal-game.portal-game--wieza .game-stage {display:flex;align-items:center;justify-content:center}
 body.portal-game.portal-game--wieza #gameCanvas {width:100%!important;height:auto!important;aspect-ratio:4/3}
 body.portal-game.portal-game--wieza .touch-controls {display:flex;bottom:12px;}
 body.portal-game.portal-game--cumowanie .touch-controls {position:absolute!important;bottom:0!important;left:0!important;right:0!important;}
 body.portal-game.portal-game--los .game-overlay {display:block!important}
 body.portal-game--sztorm .game-shell {height:auto!important}
}
@media (max-width:1024px) and (orientation:landscape), (hover:none) and (pointer:coarse) and (orientation:landscape) {
 body.portal-game:not(.portal-game--sztorm) .game-shell {height:100svh!important;max-height:none!important}
 body.portal-game--sztorm .game-shell{max-width:520px!important;margin:auto!important}
}
@media (max-width:1024px) and (orientation:portrait), (hover:none) and (pointer:coarse) and (orientation:portrait) {
 body.portal-game:is(.portal-game--wieza,.portal-game--los,.portal-game--cumowanie) .game-shell {height:auto!important;min-height:0!important;max-height:none!important;grid-template-rows:48px auto!important}
 body.portal-game.portal-game--wieza .game-stage {height:calc(75vw + 100px)!important;align-items:flex-start}
 body.portal-game.portal-game--cumowanie .game-stage {height:calc(57vw + 165px)!important;align-items:flex-start!important}
 body.portal-game.portal-game--cumowanie #gameCanvas {width:100%!important;height:auto!important;aspect-ratio:1280/720}
 body.portal-game.portal-game--los .game-stage {height:max(230px,50vw)!important;align-items:center!important}
 body.portal-game:is(.portal-game--wieza,.portal-game--los,.portal-game--cumowanie) .game-stage:is(.is-menu,.is-over,.is-paused) {min-height:min(580px,80svh)!important}
 body.portal-game.portal-game--cumowanie .game-stage:has(.game-overlay:not(.is-hidden)) {min-height:min(580px,80svh)!important}
}

@media (max-width:1024px) and (orientation:portrait), (hover:none) and (pointer:coarse) and (orientation:portrait) {
 body.portal-game.portal-game--cumowanie .touch-controls {height:155px!important;top:auto!important;padding-bottom:10px!important}
 body.portal-game.portal-game--cumowanie .touch-joystick {--joystick-size:96px}
}
