/* One layout owns the mobile controls, including installed Android windows. */
:root{--touchyou-safe-top:env(safe-area-inset-top,0px);--touchyou-safe-bottom:env(safe-area-inset-bottom,0px)}
html.touchyou-native{--touchyou-safe-top:max(env(safe-area-inset-top,0px),32px);--touchyou-safe-bottom:max(env(safe-area-inset-bottom,0px),48px)}
@media(max-width:700px){
 html,body{width:100%;height:100%;overflow:hidden}
 body header,body.install-available header{position:fixed;top:var(--touchyou-safe-top);left:0;right:0;height:auto;min-height:96px;display:grid;grid-template-columns:minmax(0,1fr) 50px;align-items:center;gap:12px;padding:24px 14px 10px;box-sizing:border-box}
 header .brand{position:static;min-width:0;gap:4px}
 header .brand img.brand-logo{display:block;width:min(205px,100%);height:auto;max-height:45px;object-fit:contain}
 header .brand small{font-size:9px;line-height:1.4}
 header .profile-button{position:static;width:50px;height:50px;margin:0}
 body header #install:not([hidden]){position:static;grid-column:1/-1;grid-row:2;width:100%;margin:0;height:auto;min-height:42px;white-space:normal}
 #modeLabel.gps-status-label{top:calc(3px + var(--touchyou-safe-top));font-size:9px;max-width:calc(100% - 28px)}
 body .top-pills,body.install-available .top-pills{position:fixed;top:var(--touchyou-controls-top,160px);left:14px;right:14px;display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-start;gap:8px;max-width:none}
 body .top-pills #mapSharing{order:0;margin-right:auto}
 body .top-pills #mapOptions{position:static;order:1;margin:0;flex:none}
 body .top-pills #mapLimit{order:2}
 body .top-pills #zombieTestButton,body .top-pills #statsButton{position:static;order:3;left:auto;top:auto;min-height:40px;padding:8px 11px;font-size:12px;flex:none;margin:0}
 body .top-pills #gamesOnlineButton{position:static;order:4;margin:0;min-height:40px;padding:5px 10px;font-size:11px;gap:5px;border-radius:16px;box-shadow:0 3px 10px #571e9225}
 #gamesOnlineButton .games-orbit{width:25px;height:25px;font-size:21px}
 body .map-tools,body.install-available .map-tools{top:var(--touchyou-tools-top,260px);right:14px;display:flex;flex-direction:row;gap:2px;padding:4px}
 body .map-tools button{width:40px;height:40px;margin:0!important}
 body .main-nav{left:10px;right:10px;width:auto;bottom:calc(12px + var(--touchyou-safe-bottom));padding:5px;gap:1px;grid-template-columns:repeat(5,minmax(0,1fr));box-sizing:border-box}
 body .main-nav button{font-size:clamp(9px,2.7vw,12px);min-height:60px;padding:3px 0;gap:3px;line-height:1.2}
 body .main-nav svg{width:29px;height:29px;flex:none}
 body .main-nav button span{white-space:normal;text-align:center;overflow-wrap:normal}
 body .sheet,body .sheet:not(.collapsed){top:auto;bottom:var(--touchyou-sheet-bottom,120px);max-height:var(--touchyou-sheet-max,45dvh);height:auto;display:flex;flex-direction:column;overflow:hidden}
 body .sheet.collapsed{height:auto;min-height:78px}
 body .sheet-toggle{flex:none;padding:10px 16px 12px}
 body .sheet-summary strong{font-size:18px;line-height:1.25}
 body .sheet-summary small{font-size:12px}
 body .sheet:not(.collapsed) #sheetBody{flex:1;min-height:0;max-height:none;overflow-y:auto;overscroll-behavior:contain;padding:14px 17px 22px}
 body #toast{position:static;inset:auto;transform:none;max-width:none;width:auto;margin:8px;flex:none;pointer-events:none;font-size:13px;padding:12px 16px}
 body .map-options-panel,body.install-available .map-options-panel{top:var(--touchyou-tools-top,260px);max-height:calc(100dvh - var(--touchyou-tools-top,260px) - var(--touchyou-safe-bottom) - 20px)}
 body #selection,body #alertBanner,body.install-available #selection,body.install-available #alertBanner{top:calc(var(--touchyou-tools-top,260px) + 56px);left:14px;right:14px}
 body dialog{max-height:calc(100dvh - var(--touchyou-safe-top) - var(--touchyou-safe-bottom) - 28px);overscroll-behavior:contain}
 body #gamesOnlineDialog{max-height:calc(100dvh - var(--touchyou-safe-top) - var(--touchyou-safe-bottom) - 28px)}
 body #zombieTestDialog{top:var(--touchyou-safe-top);bottom:var(--touchyou-safe-bottom);height:calc(100dvh - var(--touchyou-safe-top) - var(--touchyou-safe-bottom))}
}

/* Dialogs stay between the Android system bars, including with large text. */
@media(max-width:700px){
 body dialog,body #geoGuideDialog,body #gamesOnlineDialog{position:fixed;inset:calc(var(--touchyou-safe-top) + 14px) 0 calc(var(--touchyou-safe-bottom) + 14px);margin:auto;max-height:calc(100dvh - var(--touchyou-safe-top) - var(--touchyou-safe-bottom) - 28px);overflow-y:auto;scrollbar-width:thin;scroll-padding-block:20px}
 body #geoGuideDialog{padding:24px 22px;width:min(440px,calc(100vw - 28px))}
 body #geoGuideDialog .close{position:absolute;top:12px;right:12px;margin:0;float:none;width:40px;height:40px}
 body #geoGuideDialog .geo-guide-icon{width:54px;height:54px;font-size:36px;margin:0 auto 12px}
 body #geoGuideDialog h2{font-size:clamp(23px,6.4vw,27px);line-height:1.2;margin:8px 0 12px;padding:0;overflow-wrap:break-word}
 body #geoGuideDialog p{font-size:14px;line-height:1.5;margin:12px 0}
 body #geoGuideDialog .geo-guide-sharing{font-size:12px}
 body #profileDialog h2{font-size:26px;line-height:1.2}
 body #profileForm .character-stage{height:210px;padding-top:28px}
 body #profileForm .character-stage:has([data-silhouette]:not([data-silhouette=classic])){height:245px}
}
#geoGuideDialog p{color:#fff}
#geoGuideDialog .geo-guide-instruction{color:#442575}
#geoGuideDialog .geo-guide-kicker{color:#fff}

/* Visible panel action and a compact welcome with an always available close. */
.sheet-summary{gap:12px;flex-wrap:wrap}
.sheet-summary>span:first-child{flex:1 1 160px}
.sheet-action{display:inline-flex;align-items:center;justify-content:center;gap:7px;flex:none;min-height:44px;padding:8px 12px;border-radius:14px;background:#7350a1;color:#fff;font-size:14px;font-weight:750;box-shadow:0 3px 10px #51307425}
body #sheetArrow{display:inline;transform:none;color:inherit;font-size:22px;line-height:1}
body #onboardingDialog{padding:14px;width:min(420px,calc(100vw - 32px));max-height:min(640px,calc(100dvh - var(--touchyou-safe-top) - var(--touchyou-safe-bottom) - 32px));overflow:hidden}
body #onboardingDialog[open]{display:flex;flex-direction:column}
#onboardingDialog .onboarding-toolbar{display:flex;justify-content:flex-end;flex:none;padding-bottom:6px}
body #onboardingDialog .close{position:static;float:none;margin:0;display:inline-flex;align-items:center;gap:10px;min-height:44px;padding:6px 14px;background:#eee2fa;color:#513074;border:1px solid #c8afe2;border-radius:14px;font-size:24px;line-height:1}
#onboardingDialog .close span{font-size:14px;font-weight:750}
#onboardingDialog .onboarding-content{min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:0 6px 4px;scrollbar-width:thin}
body #onboardingDialog .onboarding-art{margin:0 0 12px;border-radius:16px}
body #onboardingDialog .onboarding-art svg{height:85px;width:100%}
body #onboardingDialog .eyebrow{font-size:10px;letter-spacing:1px;margin:6px 0}
body #onboardingDialog h2{font-size:clamp(21px,5.8vw,25px);line-height:1.2;margin:12px 0;padding:0}
body #onboardingDialog p{font-size:14px;line-height:1.5;margin:12px 0}
body #onboardingDialog p.fineprint{font-size:12px;line-height:1.5}
body #onboardingDialog button.primary,body #onboardingDialog button.secondary{min-height:46px;margin:8px 0 0;padding:12px}
@media(max-height:650px){body #onboardingDialog .onboarding-art svg{height:58px}body #onboardingDialog h2{font-size:21px}body #onboardingDialog p{margin:8px 0}}

/* Keep the map as the main mobile surface, even for the administrator. */
@media(max-width:700px){
 body header,body.install-available header{min-height:70px;grid-template-columns:minmax(0,1fr) 42px;padding:19px 12px 6px;gap:8px}
 header .brand img.brand-logo{width:min(160px,100%);max-height:34px}
 header .brand small{display:none}
 header .profile-button{width:42px;height:42px}
 #modeLabel.gps-status-label{font-size:9px}
 body .top-pills,body.install-available .top-pills{left:10px;right:10px;display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,.85fr) minmax(0,1fr);gap:6px}
 body .top-pills #mapSharing{grid-column:1;grid-row:1;margin:0;gap:4px;min-width:0}
 body .top-pills #mapSharing strong{font-size:9px}
 body .top-pills #share{min-width:65px;width:65px;height:40px;min-height:40px;font-size:12px}
 body .top-pills #share .toggle-knob{width:25px;height:25px}
 body .top-pills #mapOptions{grid-column:2;grid-row:1;font-size:12px;padding:6px;min-height:40px}
 body .top-pills #gamesOnlineButton{grid-column:3;grid-row:1;justify-content:center;min-width:0;padding:4px;font-size:10px;min-height:40px;gap:4px;border-radius:14px}
 body #gamesOnlineButton .games-orbit{width:20px;height:20px;font-size:18px}
 body #gamesOnlineButton small{font-size:9px;line-height:1.2}
 body .top-pills #zombieTestButton{grid-column:1;grid-row:2}
 body .top-pills #statsButton{grid-column:2;grid-row:2}
 body .top-pills #mapLimit{grid-column:3;grid-row:2}
 body .top-pills #zombieTestButton,body .top-pills #statsButton,body .top-pills #mapLimit{font-size:10px;min-width:0;min-height:36px;padding:6px;white-space:normal;line-height:1.2;border-radius:14px}
 body .top-pills #mapLimit svg{width:20px;height:20px}
 body .map-tools,body.install-available .map-tools{right:10px;padding:2px;border-radius:14px}
 body .map-tools button{width:38px;height:40px}
 body .main-nav{padding:3px;bottom:calc(6px + var(--touchyou-safe-bottom));border-radius:18px}
 body .main-nav button{min-height:49px;padding:2px 0;font-size:10px;gap:2px}
 body .main-nav svg{width:23px;height:23px}
 body .sheet.collapsed{min-height:0;height:auto;border-radius:17px}
 body .sheet.collapsed .sheet-toggle{padding:3px 8px;min-height:48px;border:0}
 body .sheet.collapsed .handle,body .sheet.collapsed .sheet-summary small{display:none}
 body .sheet.collapsed .sheet-summary{flex-wrap:nowrap;gap:8px}
 body .sheet.collapsed .sheet-summary>span:first-child{flex:1;min-width:0}
 body .sheet.collapsed .sheet-summary strong{font-size:13px;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 body .sheet.collapsed .sheet-action{min-height:40px;padding:6px 10px;font-size:12px;border-radius:12px;box-shadow:none}
 body .sheet.collapsed #sheetArrow{font-size:18px}
 body #toast{position:fixed;z-index:8;left:14px;right:14px;bottom:calc(var(--touchyou-sheet-bottom,110px) + 60px);width:auto;margin:0;max-width:none;transform:none}
}

/* Visibility is the first, full-width action; map tools follow underneath. */
body .top-pills #share{width:auto;min-width:110px}
@media(max-width:700px){
 body .top-pills,body.install-available .top-pills{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
 body .top-pills #mapSharing{order:0;flex:0 0 100%;width:100%;margin:0;padding:0}
 body .top-pills #mapSharing>strong{display:none}
 body .top-pills #mapSharing #share,body .top-pills #mapSharing #share[aria-checked=true]{position:relative;width:100%;min-width:0;height:auto;min-height:44px;display:flex;flex-direction:row;justify-content:center;padding:10px 40px;border-radius:14px;font-size:15px;font-weight:800;line-height:1.3;box-shadow:0 3px 12px #23182d22}
 body .top-pills #share .toggle-knob{position:absolute;right:12px;top:50%;transform:translateY(-50%);width:20px;height:20px;opacity:.95}
 body .top-pills #shareLabel{white-space:normal;text-align:center}
 body .top-pills #mapOptions{order:1}
 body .top-pills #gamesOnlineButton{order:2}
 body .top-pills #zombieTestButton{order:3}
 body .top-pills #statsButton{order:4}
 body .top-pills #mapLimit{order:5}
 body .top-pills #mapOptions,body .top-pills #gamesOnlineButton,body .top-pills #zombieTestButton,body .top-pills #statsButton,body .top-pills #mapLimit{flex:1 1 auto;margin:0;min-height:36px;padding:5px;font-size:10px;line-height:1.2}
 body .top-pills #gamesOnlineButton{gap:3px}
 body #gamesOnlineButton .games-orbit{width:17px;height:17px;font-size:16px}
}

/* Purple confirmation badge follows the visible label only. */
body .top-pills #share[aria-checked=true] .toggle-knob{display:none}
body .top-pills #share[aria-checked=true] #shareLabel{display:inline-flex;align-items:center;justify-content:center;gap:9px}
body .top-pills #share[aria-checked=true] #shareLabel::after{content:'✓';display:inline-flex;align-items:center;justify-content:center;flex:none;width:23px;height:23px;border-radius:50%;background:#f3e8ff;color:#792fc1;border:1px solid #d9b9f4;font-family:Arial,sans-serif;font-size:18px;font-weight:900;line-height:1;box-shadow:0 1px 4px #24103825}
