/* v3.6.1 mobile refinement; layout remains driven by content and safe areas. */
:root{--nexus-visible-height:100dvh;--nexus-visible-top:0px;--nexus-keyboard-height:0px}
button,a,input,select,textarea{-webkit-tap-highlight-color:transparent}button{touch-action:manipulation}
.mobile-menu-toggle{display:none}.mobile-scroll-lock{position:fixed;left:0;right:0;width:100%;overflow:hidden;overscroll-behavior:none}
.mobile-menu:not([open]){display:none}.mobile-menu{position:fixed;inset:auto 0 max(8px,env(safe-area-inset-bottom));width:min(540px,calc(100% - 16px));max-width:calc(100% - 16px);max-height:calc(var(--nexus-visible-height) - 16px);margin:0 auto;padding:0 20px 20px;background:linear-gradient(150deg,#1a2438,#111c2c 65%);border:1px solid #43536c;border-radius:24px;color:#f2f5fc;box-shadow:0 20px 90px #020812aa;overflow:auto;overscroll-behavior:contain;animation:mobile-menu-in 180ms ease-out}
.mobile-menu::backdrop{background:#030913aa;backdrop-filter:blur(5px)}.mobile-menu-grip{height:26px;display:flex;align-items:center;justify-content:center;touch-action:none;cursor:grab}.mobile-menu-grip span{width:42px;height:4px;border-radius:4px;background:#657187}.mobile-menu-head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin:0 0 18px}.mobile-menu-head .eyebrow{font-size:9px;letter-spacing:.12em}.mobile-menu h2{font-size:25px;letter-spacing:-.04em;margin:5px 0 0}.mobile-menu-head .icon-button{width:44px;height:44px;min-width:44px;border-radius:13px;background:#26334b;flex-shrink:0}.mobile-account{width:100%;display:flex;align-items:center;gap:13px;background:linear-gradient(115deg,#393257,#25394b);border:1px solid #675c8a;border-radius:15px;padding:15px;color:#eee9ff;text-align:left;margin-bottom:18px;min-height:72px}.mobile-account-icon{width:38px;height:38px;display:grid;place-items:center;border-radius:11px;background:#b39cff25;flex-shrink:0}.mobile-account>span:nth-child(2){flex:1;min-width:0}.mobile-account strong{display:block;font-size:14px;overflow-wrap:anywhere}.mobile-account small{display:block;font-size:11px;color:#c0bdd3;margin-top:4px}.mobile-account .studio-icon{width:23px;height:23px}.mobile-menu-links{display:grid;grid-template-columns:1fr 1fr;gap:9px}.mobile-menu-links button{display:flex;align-items:center;text-align:left;gap:11px;min-height:72px;padding:12px;background:#1d2a40;border:1px solid #35465f;color:#e0e9f8;border-radius:13px;font-size:14px;font-weight:650}.mobile-menu-links button>span:first-child{flex-shrink:0;color:#b6b1ed}.mobile-menu-links .studio-icon{width:22px;height:22px}.mobile-menu-links small{display:block;margin-top:4px;font-size:11px;font-weight:400;line-height:1.35;color:#9eafc8}.mobile-menu-links button.active{background:#a897ff1c;border-color:#9384c8;color:#e8deff}.mobile-menu-tools{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:18px;padding-top:17px;border-top:1px solid #34435c}.mobile-menu-tools button{display:flex;align-items:center;justify-content:center;gap:9px;min-height:48px;border:1px solid #46536c;border-radius:11px;background:#263248;color:#d1dbef;font-size:12px;font-weight:650}.mobile-menu-tools .studio-icon{width:19px;height:19px}
@keyframes mobile-menu-in{from{opacity:.4;translate:0 20px}to{opacity:1;translate:0 0}}
@media(max-width:850px),(pointer:coarse) and (max-width:1180px){
 .sidebar{display:none}.shell{display:block;min-width:0}.crumb{display:none}.topbar{position:sticky;top:0;height:calc(64px + env(safe-area-inset-top));padding:max(0px,env(safe-area-inset-top)) max(14px,env(safe-area-inset-right)) 0 max(14px,env(safe-area-inset-left));z-index:100;background:#0d1523f2;display:flex;align-items:center;justify-content:space-between;gap:12px}
 .mobile-brand{display:flex;align-items:center;gap:8px;font-size:13px;font-weight:800;letter-spacing:-.025em;min-width:0}.mobile-brand .brand-mark{width:32px;height:32px;border-radius:10px;flex-shrink:0}.mobile-brand small{display:block;font-size:8px;letter-spacing:.14em;color:#a3b2ca}.top-actions{display:flex;gap:8px;flex-shrink:0}.mobile-menu-toggle{display:inline-flex;order:3}.topbar .top-actions>[data-settings],.topbar .online-pill,.topbar .top-avatar{display:none}.topbar .chat-toggle{display:inline-flex}.topbar .icon-button{width:44px;height:44px;min-width:44px}
 .content{padding:22px max(16px,env(safe-area-inset-right)) calc(98px + env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left))!important}.mobile-nav{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));position:fixed;left:0;right:0;bottom:0;z-index:1500;background:#111b2cf5;border-top:1px solid #394662;padding:7px max(8px,env(safe-area-inset-right)) max(7px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));backdrop-filter:blur(14px)}.mobile-nav button{border:0;background:none;color:#96a8c4;min-width:0;min-height:52px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;border-radius:11px;font-size:10px;font-weight:650}.mobile-nav .studio-icon{width:22px;height:22px}.mobile-nav button.active,.mobile-nav button[aria-expanded=true]{background:#a897ff1c;color:#d8c9ff}.mobile-overlay-open .mobile-nav,.mobile-keyboard-open .mobile-nav{visibility:hidden;pointer-events:none}
 input:not([type=checkbox]):not([type=radio]),select,textarea,.chat-form input,.room-chat-form input,.library-search input{font-size:16px!important;min-height:48px}.small-btn,.btn,.filter,.text-link,.join-code button,.room-chat-form button,.chat-form button{min-height:44px}.icon-button{min-height:44px;min-width:44px}.filter-bar{gap:6px}.filter{padding:10px 12px}.library-search{min-height:48px}.library-search input{padding:10px 12px}.room-toolbar,.join-code,.friend-form{min-width:0}.join-code{width:100%}.join-code input{min-width:0;flex:1}.friend-form{flex-wrap:wrap}.friend-form input{min-width:0;flex:1 1 180px}.friend-form .btn{flex:1 1 auto}.profile-card{max-width:none}.profile-head h2{overflow-wrap:anywhere}.social-row{flex-wrap:wrap}.social-row>div{min-width:0}.game-footer{gap:10px;flex-wrap:wrap}.game-footer small{flex:1 1 90px}.game-footer .small-btn{flex-shrink:0}.section-head{gap:12px}.section-head>div{min-width:0}.section-head .text-link{white-space:normal;text-align:right}
 .modal-overlay{position:fixed;top:var(--nexus-visible-top);bottom:auto;height:var(--nexus-visible-height);padding:12px;align-items:center;overflow:hidden}.modal-overlay>.panel{max-height:calc(var(--nexus-visible-height) - 24px);overflow-y:auto;overscroll-behavior:contain;max-width:100%;min-width:0}.room-modal{width:100%}.modal-close{width:44px;min-width:44px;height:44px;min-height:44px}.auth-panel .modal-close,#create-modal .modal-close{position:sticky;top:0;right:auto;float:right;margin:-2px -2px 2px 8px;background:#26334b;border-radius:11px;z-index:3}.room-modal-header{gap:12px}.room-modal-header>div{min-width:0}.room-modal h2{overflow-wrap:anywhere}
 .studio-dialog[open]{position:fixed;top:calc(var(--nexus-visible-top) + var(--nexus-visible-height)/2);left:0;right:0;bottom:auto;margin:0 auto;transform:translateY(-50%);max-height:calc(var(--nexus-visible-height) - 24px);max-width:calc(100% - 24px);padding:20px;overscroll-behavior:contain}.setting-row>span{min-width:0;flex:1}.setting-row select{min-width:112px;width:45%;max-width:148px;flex:none;padding:10px 8px}.setting-row small{max-width:none}.setting-row input{min-width:24px;width:24px;height:24px}.guide-dialog img{width:calc(100% + 40px);margin:-20px -20px 16px}.share-actions input{flex-basis:100%}.share-actions .small-btn{flex:1 1 auto}.matchmaking-controls select{width:100%}.matchmaking-controls .btn{flex:1}.toast{bottom:calc(82px + env(safe-area-inset-bottom))}.mobile-keyboard-open .toast{bottom:calc(var(--nexus-keyboard-height) + 16px)}
 .rightbar{display:none}body.chat-open .rightbar{position:fixed;top:var(--nexus-visible-top);bottom:auto;height:var(--nexus-visible-height);width:min(390px,100%);padding:20px max(18px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(18px,env(safe-area-inset-left));overflow:hidden}.chat-messages{overscroll-behavior:contain}.chat-form{flex-shrink:0}.chat-form button{width:48px}.chat-disclaimer{flex-shrink:0}.chat-drawer-close{width:44px;height:44px}.chat-person{margin-top:10px}.chat-divider{margin-top:18px}
 .nav-top,.wrap header{height:auto;min-height:64px}.back-link,.back,.game-tools button{min-height:44px;display:inline-flex;align-items:center}.game-tools{gap:8px}.game-tools .icon-button{width:44px;height:44px;min-width:44px}.touch-controls button,.mobile-controls button{min-height:48px}.mobile-keyboard-open .content{padding-bottom:24px!important}
}
@media(max-width:370px){.mobile-menu{padding:0 15px 15px}.mobile-menu h2{font-size:22px}.mobile-menu-links button{padding:11px;gap:8px;min-height:72px;font-size:13px}.mobile-menu-links small{font-size:10.5px}.mobile-menu-links .studio-icon{width:20px;height:20px}.mobile-menu-tools button{font-size:11px;gap:7px}.hero-actions{flex-wrap:wrap}.hero-actions .btn{flex-basis:100%}.filter{font-size:11px;padding:10px 9px}.progress-metric strong{font-size:22px}.setting-row{gap:9px;font-size:13px}.setting-row small{font-size:10px}}
@media(max-height:520px) and (orientation:landscape){.topbar{min-height:52px;height:calc(52px + env(safe-area-inset-top))}.mobile-nav{padding-top:3px;padding-bottom:max(3px,env(safe-area-inset-bottom))}.mobile-nav button{min-height:44px;flex-direction:row;gap:7px}.content{padding-bottom:calc(74px + env(safe-area-inset-bottom))!important}.mobile-menu{width:min(780px,calc(100% - 24px));max-height:calc(var(--nexus-visible-height) - 12px);padding:0 18px 12px}.mobile-menu-grip{height:20px}.mobile-menu-head{margin-bottom:10px}.mobile-menu h2{font-size:21px}.mobile-account{padding:10px;margin-bottom:10px;min-height:52px}.mobile-account-icon{width:30px;height:30px}.mobile-menu-links{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.mobile-menu-links button{min-height:55px;padding:8px 12px}.mobile-menu-tools{padding-top:10px;margin-top:10px}.mobile-menu-tools button{min-height:44px}.mobile-menu-links small{font-size:9px}.toast{bottom:calc(64px + env(safe-area-inset-bottom))}.chat-person{display:none}.chat-divider{margin-top:8px}.right-title{min-height:36px}.chat-disclaimer{margin:7px 0 0}.studio-dialog .guide-dialog img{display:none}}
@media(prefers-reduced-motion:reduce){.mobile-menu{animation:none}}
body[data-motion=reduce] .mobile-menu{animation:none}
/* Landscape arcade: reserve a column for controls rather than stacking below the canvas. */
@media (orientation:landscape) and (max-height:550px) and (min-width:600px){
 body[data-game] .content-selector.locked{display:none}body[data-game] .arcade-layout{margin-top:8px;gap:10px}body[data-game] .game-unit{display:grid;grid-template-columns:minmax(0,1fr) 210px;align-items:start}body[data-game] .game-hud{grid-column:1;grid-row:1;min-height:44px}body[data-game] .hud-item{padding:5px 8px}body[data-game] .hud-item strong{font-size:18px}body[data-game] .hud-item>span{font-size:8px}
 body[data-game] .game-surface{grid-column:1;grid-row:2;justify-self:center;width:min(100%,calc((var(--nexus-visible-height) - 132px)*960/540));height:auto;min-height:0;max-height:none;aspect-ratio:960/540}body[data-game=pinball] .game-surface{width:min(100%,calc((var(--nexus-visible-height) - 132px)*700/970));aspect-ratio:700/970}body[data-game=pulse] .game-surface{width:min(100%,calc(var(--nexus-visible-height) - 132px));aspect-ratio:1}
 body[data-game] .touch-controls{grid-column:2;grid-row:2;display:grid;grid-template-columns:1fr 1fr;padding:10px;gap:8px;align-self:start}body[data-game] .touch-controls:empty{display:none}body[data-game] .touch-controls button{min-width:0;min-height:48px;max-width:none;font-size:12px}body[data-game] .touch-controls button:last-child:nth-child(odd){grid-column:1/-1}
 body[data-game] .control-strip{grid-column:2;grid-row:1;padding:5px;min-height:44px;border-top:0;gap:0}body[data-game] .control-strip>span{display:none}body[data-game] .control-strip>div{display:flex;width:100%;gap:4px;justify-content:stretch}body[data-game] .control-strip .btn{flex:1;padding:5px 3px;font-size:10px;letter-spacing:0;min-height:44px}
 body[data-game] .screen-overlay{padding:8px;overflow:hidden}body[data-game] .overlay-inner{max-height:100%;overflow-y:auto;overscroll-behavior:contain;max-width:100%;width:100%}body[data-game] .overlay-mark,body[data-game] .overlay-inner>.overline{display:none}body[data-game] .overlay-inner h2{font-size:21px;margin:4px 0 8px}body[data-game] .overlay-inner p:not(.overline){font-size:12px;line-height:1.4;margin-bottom:10px}body[data-game] .overlay-inner>.btn{min-height:44px;max-width:100%;padding:8px;font-size:11px}body[data-game] .run-summary{margin:8px 0;gap:5px}body[data-game] .run-summary>div{padding:5px}body[data-game] .run-summary strong{font-size:17px}
 body[data-game=defense] .arcade-layout{grid-template-columns:minmax(0,1fr) 210px}body[data-game=defense] .game-unit{display:block}body[data-game=defense] .game-surface{width:min(100%,calc((var(--nexus-visible-height) - 190px)*900/600));aspect-ratio:900/600;margin:0 auto}body[data-game=defense] .control-strip{padding:6px}.info-rail{min-width:0}body[data-game=defense] .info-rail{display:block;max-height:calc(var(--nexus-visible-height) - 88px);overflow-y:auto;overscroll-behavior:contain}body[data-game=defense] .info-rail>.rail-block{display:none}body[data-game=defense] .info-rail>.rail-block:last-child{display:block;padding:10px}body[data-game=defense] #game-panel{font-size:11px}body[data-game=defense] #game-panel h3{font-size:13px;margin:8px 0!important}body[data-game=defense] #game-panel .mini-row{padding:3px 0}body[data-game=defense] #game-panel .history-note{font-size:10px;line-height:1.4;margin:6px 0}body[data-game=defense] .tower-select{gap:5px}body[data-game=defense] .tower-select button,body[data-game=defense] .tower-ops button{min-height:44px;font-size:12px}body[data-game=defense] .wave-btn{min-height:44px;margin-top:6px}
 body[data-game=snake] .wrap{padding:8px;width:calc(100% - 16px)}body[data-game=snake] header{min-height:52px;height:52px;padding-bottom:0}body[data-game=snake] .headline,body[data-game=snake] footer{display:none}body[data-game=snake] .layout{display:block;margin-top:8px}body[data-game=snake] .arena{display:grid;grid-template-columns:minmax(0,1fr) 210px}body[data-game=snake] .hud{grid-column:1;grid-row:1;padding:5px 8px;min-height:44px}body[data-game=snake] .hud label{font-size:8px}body[data-game=snake] .hud strong{font-size:18px}body[data-game=snake] .board{grid-column:1;grid-row:2;width:min(100%,calc(var(--nexus-visible-height) - 128px));margin:0 auto 0}body[data-game=snake] .mobile-controls{display:block;grid-column:2;grid-row:2;padding:8px 4px}body[data-game=snake] .mobile-controls button{width:54px;height:48px;min-height:48px;margin:3px}body[data-game=snake] .bottom{grid-column:2;grid-row:1;padding:5px;min-height:44px;border-top:0;display:block}body[data-game=snake] .bottom>span{display:none}body[data-game=snake] .bottom>div{display:flex;gap:4px}body[data-game=snake] .bottom button{flex:1;min-height:44px;padding:5px;margin:0;font-size:11px}body[data-game=snake] aside{margin-top:14px}body[data-game=snake] .overlay-content{max-height:100%;overflow-y:auto;padding:8px;width:100%}body[data-game=snake] .snake-icon,body[data-game=snake] .overlay-content>.eyebrow{display:none}body[data-game=snake] .overlay h2{font-size:21px}body[data-game=snake] .overlay p:not(.eyebrow){font-size:12px;line-height:1.4}
}
