#mobileQuickBar,#mobileGameMenu,#mobileLobbyTools,#mobileLaunch{display:none}
body.mobile-ui{--mobile-safe-bottom:env(safe-area-inset-bottom,0px);--mobile-safe-top:env(safe-area-inset-top,0px);overscroll-behavior:none}
body.mobile-ui button,body.mobile-ui a,body.mobile-ui input,body.mobile-ui select,body.mobile-ui textarea{-webkit-tap-highlight-color:transparent}
body.mobile-ui button:hover{transform:none}
body.mobile-ui input,body.mobile-ui select,body.mobile-ui textarea{font-size:16px!important}
body.mobile-ui #lobby{height:100dvh;max-height:100dvh;padding:18px 12px calc(90px + var(--mobile-safe-bottom));display:block;overflow-x:hidden;overflow-y:auto;align-items:start;backdrop-filter:none}
body.mobile-ui .lobby-shell{width:100%;max-width:540px;margin:0 auto}
body.mobile-ui .lobby-grid{display:flex;flex-direction:column;gap:14px;width:100%;min-width:0}
body.mobile-ui .lobby-side:first-child{display:none}
body.mobile-ui .rooms-column,body.mobile-ui .player-card{width:100%;min-width:0}
body.mobile-ui .rooms-column{order:0}body.mobile-ui .player-card{order:1;padding:20px!important}
body.mobile-ui .lobby-heading{margin:12px 0 18px}body.mobile-ui .vespotr-lobby-logo{width:230px!important;max-width:75vw!important}body.mobile-ui .lobby-heading p{font-size:9px;letter-spacing:2px}
body.mobile-ui .account-nav{margin:0 0 12px;gap:6px;display:grid;grid-template-columns:1fr 1fr 1.2fr}
body.mobile-ui .account-nav button,body.mobile-ui .account-nav a{min-height:44px;font-size:11px!important;text-align:center;padding:10px 6px;display:flex;align-items:center;justify-content:center;letter-spacing:0}
body.mobile-ui .account-nav span{grid-column:1/-1;margin:0;font-size:10px;overflow-wrap:anywhere}
body.mobile-ui .vespotr-account-links{margin:0}body.mobile-ui .vespotr-account-links a{letter-spacing:0;font-size:11px}
body.mobile-ui #mobileLobbyTools{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin:0 0 14px}
#mobileLobbyTools button{min-height:44px;border:1px solid #31465f;border-radius:9px;background:#132237;color:#c9dcf2;font:12px system-ui}
body.mobile-ui .room-panel{padding:16px}body.mobile-ui #roomSelect{font-size:14px!important;min-height:46px}body.mobile-ui .room-panel .room-sub,body.mobile-ui .room-panel .local-note,body.mobile-ui .mode-panel{display:none}
body.mobile-ui .player-card .label{font-size:11px;letter-spacing:.7px}body.mobile-ui .player-card input#name{min-height:48px}body.mobile-ui #skinGallery{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}body.mobile-ui #skinGallery button{min-height:76px;padding:9px}body.mobile-ui #skinGallery span{font-size:11px}body.mobile-ui .player-card .skin{width:40px;height:40px}body.mobile-ui #cellPreview{width:76px;height:76px;margin:18px auto}
body.mobile-ui .lobby-caption{font-size:10px;line-height:1.6;flex-wrap:wrap}body.mobile-ui .entry-actions{grid-template-columns:1fr 90px}body.mobile-ui .entry-actions button{min-height:48px}
body.mobile-ui:not(.game-active) #communityEntry,body.mobile-ui:not(.game-active) #opsEntry,body.mobile-ui:not(.game-active) #footer,body.mobile-ui:not(.game-active) #settingsOpen,body.mobile-ui:not(.game-active) #adminLink,body.mobile-ui:not(.game-active) #connectionBadge{display:none!important}
body.mobile-ui:not(.game-active) #mobileLaunch{position:fixed;display:grid;grid-template-columns:1fr 84px;gap:8px;bottom:0;left:0;right:0;z-index:60;padding:10px 12px calc(10px + var(--mobile-safe-bottom));border-top:1px solid #334a5d;background:#0b1727f7;backdrop-filter:blur(12px)}
#mobileLaunch button{min-height:48px;border:1px solid #40586e;border-radius:10px;background:#1d3048;color:#d3e5f9;font:700 14px system-ui}#mobileLaunch #mobilePlay{background:#a5ff74;color:#152b18;border-color:#a5ff74}#mobileLaunch button:disabled{opacity:.45}
body.mobile-ui:has(dialog[open]) #mobileLaunch,body.mobile-ui:has(#settings[style*="flex"]) #mobileLaunch,body.mobile-ui:has(#help[style*="flex"]) #mobileLaunch{display:none!important}
body.mobile-ui.game-active .top,body.mobile-ui.game-active #roundInfo,body.mobile-ui.game-active #communityEntry,body.mobile-ui.game-active #opsEntry,body.mobile-ui.game-active #settingsOpen,body.mobile-ui.game-active #adminLink,body.mobile-ui.game-active #roundChampion,body.mobile-ui.game-active #eventRail{display:none!important}
body.mobile-ui.game-active #rightHudRail{display:contents!important}
body.mobile-ui.game-active #roomTitleBar{top:calc(10px + var(--mobile-safe-top));left:12px;right:74px;transform:none;width:auto;max-width:none;min-height:42px;padding:9px 12px;gap:9px;z-index:40}
body.mobile-ui.game-active #roomTitle{font-size:13px;letter-spacing:.8px}body.mobile-ui.game-active #roomCountdown{font-size:22px;margin:0}body.mobile-ui.game-active .room-timer-group{padding-left:10px;gap:0}body.mobile-ui.game-active #roomTitleBar small{display:none}
body.mobile-ui.game-active #pause{display:block;top:calc(10px + var(--mobile-safe-top));right:12px;width:50px;height:42px;overflow:hidden;padding:8px 0;font-size:10px;border-radius:10px;z-index:41}
body.mobile-ui.game-active #stats{top:calc(61px + var(--mobile-safe-top));left:12px;right:auto;display:flex;gap:0;z-index:35}
body.mobile-ui.game-active #stats .stat{min-width:88px;padding:7px 10px}body.mobile-ui.game-active #stats .stat:not(:first-child){display:none}body.mobile-ui.game-active #stats strong{font-size:19px;margin-top:2px}body.mobile-ui.game-active #stats small{font-size:8px}
body.mobile-ui.game-active #connectionBadge{display:flex;top:calc(65px + var(--mobile-safe-top));right:12px;left:auto;max-width:210px;padding:6px 9px;font-size:9px;z-index:35}
body.mobile-ui.game-active #combo{top:calc(113px + var(--mobile-safe-top));font-size:16px;max-width:calc(100vw - 24px)}body.mobile-ui.game-active #toast{top:calc(158px + var(--mobile-safe-top));font-size:12px;max-width:calc(100vw - 24px);max-height:58px}
body.mobile-ui.game-active #serverNotices{top:calc(110px + var(--mobile-safe-top));width:calc(100vw - 24px);z-index:65}body.mobile-ui #serverNotices article{padding:10px 12px}body.mobile-ui #serverNotices article:not(:last-child){display:none}
body.mobile-ui.game-active #goldHUD,body.mobile-ui.game-active #chatBox,body.mobile-ui.game-active #board,body.mobile-ui.game-active #map{display:none!important}
body.mobile-ui.game-active[data-mobile-panel=gold] #goldHUD,body.mobile-ui.game-active[data-mobile-panel=chat] #chatBox,body.mobile-ui.game-active[data-mobile-panel=board] #board{display:block!important;position:fixed!important;inset:calc(113px + var(--mobile-safe-top)) 12px auto 12px!important;width:auto!important;max-width:none!important;transform:none!important;max-height:calc(100dvh - 320px)!important;overflow:auto!important;padding:16px!important;z-index:48!important;background:#0b1a2cf7!important;box-shadow:0 12px 45px #0008}
body.mobile-ui.game-active #goldHUD button{min-height:44px;padding:10px 12px;font-size:12px;margin:8px 6px 6px 0}body.mobile-ui.game-active #goldHUD strong{font-size:23px}body.mobile-ui.game-active #goldHUD small{font-size:12px}body.mobile-ui.game-active #goldRoomStatus{font-size:11px}
body.mobile-ui.game-active #chatMessages{display:block!important;height:145px!important;font-size:13px}body.mobile-ui.game-active #chatForm{display:grid;grid-template-columns:70px minmax(0,1fr) 60px;gap:6px;align-items:center}body.mobile-ui.game-active #chatForm input,body.mobile-ui.game-active #chatForm select{width:100%!important;min-width:0!important;min-height:44px!important;padding:8px!important;margin:0!important}body.mobile-ui.game-active #chatForm button{min-height:44px;font-size:11px;padding:5px}body.mobile-ui .chat-title{font-size:10px;margin-bottom:9px}
body.mobile-ui.game-active #board h3{font-size:11px;margin:0 0 12px}body.mobile-ui.game-active #board .row{font-size:13px;margin:13px 0}
body.mobile-ui.game-active[data-mobile-panel=map] #map{display:block!important;position:fixed!important;top:calc(114px + var(--mobile-safe-top))!important;right:12px!important;bottom:auto!important;width:150px!important;height:150px!important;z-index:48}
body.mobile-ui.game-active #mobileQuickBar{display:grid;position:fixed;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;left:12px;right:12px;bottom:calc(145px + var(--mobile-safe-bottom));z-index:46}
#mobileQuickBar button{height:44px;background:#12243ae8;border:1px solid #3b536e;border-radius:10px;color:#cde2fa;font:600 11px system-ui;touch-action:manipulation}#mobileQuickBar button[aria-expanded=true]{background:#a5ff74;color:#162719;border-color:#a5ff74}
body.mobile-ui.game-active[data-mobile-panel=menu] #mobileGameMenu{display:grid;grid-template-columns:1fr 1fr;gap:9px;position:fixed;top:calc(113px + var(--mobile-safe-top));bottom:calc(201px + var(--mobile-safe-bottom));left:12px;right:12px;overflow:auto;background:#0b1a2cf7;border:1px solid #425b76;border-radius:15px;padding:16px;z-index:48;align-content:start}#mobileGameMenu strong{grid-column:1/-1;font-size:12px;color:#adceee;margin-bottom:6px}#mobileGameMenu button,#mobileGameMenu a{min-height:46px;background:#1b3048;border:1px solid #3b536e;border-radius:9px;padding:11px;color:#dceaff;font:12px system-ui;text-align:center;text-decoration:none;display:flex;align-items:center;justify-content:center}
body.mobile-ui.game-active #joystick:not([hidden]){display:flex!important;left:16px;bottom:calc(21px + var(--mobile-safe-bottom));width:104px;height:104px;z-index:45}body.mobile-ui #joystick:before{display:none}body.mobile-ui #joystickKnob{width:44px;height:44px}
body.mobile-ui.game-active .controls{position:fixed;left:auto!important;right:12px!important;bottom:calc(30px + var(--mobile-safe-bottom))!important;transform:none!important;display:flex;flex-wrap:nowrap;width:auto;max-width:calc(100vw - 140px);padding:5px;gap:6px;z-index:45;background:#0b192d99}
body.mobile-ui.game-active .controls button{min-width:54px;min-height:62px;padding:8px;font-size:12px;border-radius:12px;touch-action:none}body.mobile-ui.game-active .controls #split{background:#a5ff74;color:#102b16;font-weight:800;border-color:#a5ff74}body.mobile-ui.game-active .controls #eject{background:#153b4e;border-color:#4694ad}
body.mobile-ui.game-active #spectatorBar{bottom:calc(25px + var(--mobile-safe-bottom));width:calc(100vw - 24px);max-height:110px;overflow:auto;padding:9px;gap:6px;font-size:12px}body.mobile-ui #spectatorBar button{min-height:44px}
body.mobile-ui.game-active .powerBar{bottom:calc(202px + var(--mobile-safe-bottom));max-width:calc(100vw - 24px);white-space:nowrap}body.mobile-ui .powerBar button{min-height:40px}
body.mobile-ui #settings,body.mobile-ui #help,body.mobile-ui #end{padding:8px;z-index:150}body.mobile-ui #settings .card,body.mobile-ui #help .card,body.mobile-ui #end .card{width:100%!important;max-width:540px;max-height:calc(100dvh - 16px);overflow:auto;padding:20px!important;border-radius:16px}
body.mobile-ui dialog{width:calc(100vw - 16px)!important;max-width:540px!important;max-height:calc(100dvh - 16px)!important;height:auto;padding:16px!important;border-radius:16px}body.mobile-ui .hubDialog,body.mobile-ui .opsDialog{height:calc(100dvh - 16px)!important}body.mobile-ui .hubContent,body.mobile-ui .opsContent{grid-template-columns:1fr}body.mobile-ui .hubDialog header,body.mobile-ui .opsDialog header{gap:10px;align-items:start}body.mobile-ui .hubDialog h2,body.mobile-ui .opsDialog h2{font-size:22px}body.mobile-ui .hubDialog header button,body.mobile-ui .opsDialog header button{min-width:82px;min-height:44px;margin:0}body.mobile-ui .hubNav,body.mobile-ui .opsDialog nav{flex-wrap:nowrap;overflow-x:auto;max-width:100%;padding:10px 0;top:-16px}body.mobile-ui .hubNav button,body.mobile-ui .opsDialog nav button{flex-shrink:0;min-height:44px;white-space:nowrap}body.mobile-ui .hubRow{align-items:start;flex-wrap:wrap}body.mobile-ui .hubActions{width:100%;justify-content:start}body.mobile-ui .hubDialog button,body.mobile-ui .opsDialog button{min-height:44px}body.mobile-ui .hubForm{align-items:stretch}body.mobile-ui .hubForm button{flex:1 0 100%}body.mobile-ui .hubCard,body.mobile-ui .opsCard{padding:16px}body.mobile-ui .hubDialog input,body.mobile-ui .hubDialog select,body.mobile-ui .opsDialog input,body.mobile-ui .opsDialog select{min-height:46px}body.mobile-ui .quest-row{gap:10px;flex-wrap:wrap}body.mobile-ui .quest-row button{min-height:44px}
body.mobile-ui #demoToolbar{display:none!important}body.mobile-ui.mobile-demo-tools #demoToolbar{display:flex!important;position:fixed;top:115px;bottom:auto;left:12px;right:12px;transform:none;width:auto;max-width:none;max-height:calc(100dvh - 235px);overflow:auto;z-index:90;padding:12px;gap:8px;font-size:11px}body.mobile-ui #demoToolbar button,body.mobile-ui #demoToolbar select{min-height:44px;font-size:12px}body.mobile-ui #demoToolbar select{width:100%}
@media(max-height:540px){body.mobile-ui.game-active #mobileQuickBar{left:auto;right:12px;bottom:calc(105px + var(--mobile-safe-bottom));width:320px}body.mobile-ui.game-active #joystick:not([hidden]){width:90px;height:90px;bottom:16px}body.mobile-ui.game-active .controls{bottom:18px!important}body.mobile-ui.game-active[data-mobile-panel=menu] #mobileGameMenu{left:120px;bottom:155px;grid-template-columns:repeat(3,1fr)}body.mobile-ui.game-active[data-mobile-panel=gold] #goldHUD,body.mobile-ui.game-active[data-mobile-panel=chat] #chatBox,body.mobile-ui.game-active[data-mobile-panel=board] #board{left:120px!important;right:12px!important;top:64px!important;max-height:calc(100dvh - 220px)!important}body.mobile-ui.game-active #stats{top:65px}body.mobile-ui.game-active #chatMessages{height:65px!important}body.mobile-ui.game-active #toast{top:110px}body.mobile-ui.game-active #roomTitleBar{right:340px}body.mobile-ui.game-active #connectionBadge{top:12px;right:76px}body.mobile-ui.game-active #combo{top:65px}}
/* Keep padded cards and form fields inside narrow phone screens. */
body.mobile-ui #lobby *,body.mobile-ui #mobileGameMenu *,body.mobile-ui #mobileLaunch *{box-sizing:border-box}
body.mobile-ui .player-card,body.mobile-ui .rooms-column{max-width:100%}
body.mobile-ui #name,body.mobile-ui #inviteCode{width:100%;max-width:100%;min-width:0}
body.mobile-ui.mobile-keyboard #mobileQuickBar,body.mobile-ui.mobile-keyboard #joystick,body.mobile-ui.mobile-keyboard .controls{display:none!important}
body.mobile-ui.mobile-keyboard[data-mobile-panel="chat"] #chatBox{top:auto!important;bottom:calc(100dvh - var(--keyboard-top) + 8px)!important;max-height:220px!important}
body.mobile-ui.mobile-keyboard #chatMessages{height:80px!important}
body.mobile-ui.game-active #joystick:not([hidden]){width:min(var(--joystick-size,144px),48dvh,30dvw);height:min(var(--joystick-size,144px),48dvh,30dvw);opacity:var(--joystick-opacity,.85)}
body.mobile-ui #joystickKnob{width:42%;height:42%}
#joystickSettings{border-top:1px solid #31465e;margin-top:20px;padding-top:14px}
#joystickSettings h3{margin:0 0 14px}#joystickSettings p{font-size:12px;color:#9aadc5;line-height:1.5}
#joystickSettings input[type=range]{width:100%;min-height:44px;accent-color:#a5ff74}
#joystickSettings output{float:right;color:#a5ff74}
#joystickPreview{width:var(--joystick-size,144px);height:var(--joystick-size,144px);max-width:200px;max-height:200px;border:2px solid #528fa6;background:#15344888;border-radius:50%;display:grid;place-items:center;margin:14px auto;opacity:var(--joystick-opacity,.85)}
#joystickPreview span{width:42%;height:42%;border-radius:50%;background:#36758a;border:2px solid #9fe8ff}
