/* 5.0: viewport-safe layout overrides. */
html{min-height:100%;overflow-x:hidden}body{min-height:100dvh}#app{padding-left:max(10px,env(safe-area-inset-left));padding-right:max(10px,env(safe-area-inset-right))}body:not(.playing){overflow:auto!important}#lobby{height:auto!important;min-height:calc(100dvh - 46px);overflow:visible!important;padding:10px 0 20px}.mobile-selection{height:auto!important;grid-template-columns:minmax(0,.75fr) minmax(0,1fr) minmax(0,1.05fr);align-items:start;gap:10px}.mobile-selection .showcase{height:clamp(240px,70dvh,450px);min-height:0}.pick,.mode-panel{min-width:0;min-height:0}.mobile-selection #roster{flex:none;grid-auto-rows:clamp(70px,22dvh,126px)}.mobile-selection .primary{flex-shrink:0;min-height:48px;margin-top:8px}.mode-panel{padding-bottom:8px}.modes button{min-width:0;overflow-wrap:anywhere}.options{flex-wrap:wrap}.mobile-selection .ladder-feature{flex-wrap:wrap}.mobile-selection .record{display:block!important}.modes button[data-mode=online]{border-color:#9c85d7}.mobile-selection .mode-panel #play{position:sticky;bottom:max(8px,env(safe-area-inset-bottom));z-index:2;box-shadow:0 4px 0 #96752d,0 0 0 5px #101b29}.game-top{pointer-events:none}.game-top button{pointer-events:auto}#overlay{overflow:auto;max-height:100dvh}.controls{touch-action:none}
@media(max-width:720px){.mobile-selection{grid-template-columns:minmax(0,1fr) minmax(0,1.1fr)}.mobile-selection .showcase{display:none}.mobile-selection .modes button{min-height:48px}.mobile-selection .primary{font-size:11px}.mobile-selection .ladder-feature{padding:8px}.creator-signature{font-size:8px}}
@media(orientation:portrait){header{height:54px}.edition{display:none}.mobile-selection{grid-template-columns:1fr}.mobile-selection #roster{grid-auto-rows:100px}.mobile-selection .mode-panel{padding-top:12px}.mobile-selection .special-info p{display:block}.mobile-selection .modes button{min-height:60px}dialog[open]{visibility:visible;pointer-events:auto}dialog::backdrop{background:#0009}}
@media(orientation:landscape) and (max-height:300px){.mobile-selection .special-info,.creator-signature{display:none}.mobile-selection #roster{grid-auto-rows:70px}.actions,.movement{grid-template-columns:repeat(2,60px);grid-template-rows:repeat(2,56px);width:126px;height:118px;gap:6px}.actions .face-buttons button,.actions #specialButton,.actions .face-buttons .block,.movement button,.movement .jump,.movement .dodge{width:60px;height:56px;min-width:60px;min-height:56px}.game-top{top:2px}}
.online-dialog{width:min(650px,94vw);max-height:90dvh;overflow:auto;padding:20px;background:linear-gradient(135deg,#26384d,#101b29);border:1px solid #9c85d7;border-radius:12px}.online-dialog h2{margin:8px 0;font-size:28px}.online-dialog input{width:100%;padding:12px;margin:5px 0 10px;color:white;background:#101b29;border:1px solid #63728a;border-radius:6px;font-size:16px}.online-dialog .room-actions{display:flex;gap:8px;flex-wrap:wrap}.online-dialog .room-actions button{flex:1;min-width:130px;padding:12px}.online-dialog p{font-size:13px;line-height:1.5;color:#c4d1e0}.online-dialog #roomCode{font-size:24px;color:#f5ce4e;font-weight:900;letter-spacing:3px}.online-dialog .secondary{padding:12px;margin:6px 0}#networkStatus{font-size:10px;color:#d6baff;background:#101b29ba;padding:4px;border-radius:4px;pointer-events:none}.online-dialog #onlineError{color:#ffb6a7}
@media(orientation:landscape){body.playing{overflow:hidden!important}body.playing header{display:none}body.playing #app{padding:0}#game{height:100dvh;padding:0;margin:0}#stage{height:100dvh;width:100%;max-width:none;border:0;border-radius:0}canvas{width:100%;height:100%;object-fit:contain}.game-top{position:fixed;top:5px;left:max(10px,env(safe-area-inset-left));right:max(10px,env(safe-area-inset-right));z-index:3;margin:0}.game-top .icon{background:#101b29bd}.game-top>span{display:none}.controls{position:fixed;bottom:max(10px,env(safe-area-inset-bottom));left:max(10px,env(safe-area-inset-left));right:max(10px,env(safe-area-inset-right));max-width:none;z-index:2;min-height:0;padding:0;align-items:flex-end;pointer-events:none}.controls button{pointer-events:auto}.control-tip,.game-hint,.game-settings{display:none}#overlay{position:fixed;z-index:5}}
/* Keep the start action in the first screen, scroll mode choices if space is short. */
@media(orientation:landscape){.mobile-selection .mode-panel{height:calc(100dvh - 66px);max-height:560px;padding:0 0 4px}.mobile-selection .modes{flex:1!important;min-height:60px;overflow-y:auto;grid-auto-rows:minmax(42px,1fr);align-content:start}.mobile-selection .modes button{min-height:42px;padding:7px}.mobile-selection .ladder-feature{flex:none;min-height:46px;padding:6px 8px;margin:6px 0}.mobile-selection .ladder-feature strong{margin:2px 0}.mobile-selection .options{flex:none;margin:0}.mobile-selection .mode-panel #play{position:static;flex:none;margin-top:7px;min-height:44px;padding:12px 8px;box-shadow:0 4px 0 #96752e}.mobile-selection .mode-panel .record{display:none!important}}
@media(orientation:landscape) and (max-height:480px){.mobile-selection .options p{display:none}.mobile-selection .options{justify-content:flex-end}.mobile-selection .ladder-feature button{padding:8px}.mobile-selection .options select{padding:4px}}
@media(orientation:landscape) and (max-height:300px){.mobile-selection .options,.mobile-selection .ladder-feature .new-pill{display:none}.mobile-selection .ladder-feature{min-height:36px}.mobile-selection .mode-panel #play{min-height:42px}}
@media(orientation:landscape) and (max-height:380px){.mobile-selection .modes small{display:none}}
