/* Compact controls reserve the centre for the world. Every secondary tool remains in the menu. */
*{box-sizing:border-box}
#mobile-tools{display:none}
#mobile-menu{display:contents}#mobile-menu>header{display:none}
#round-panel,#district-progress{position:fixed;z-index:14;right:16px;top:72px;width:min(420px,calc(100vw - 32px));max-height:calc(var(--view-height,100dvh) - 90px);overflow:auto;padding:16px;overscroll-behavior:contain;touch-action:pan-y}
#round-panel header,#mobile-menu header{display:flex;align-items:center;justify-content:space-between;gap:12px}
#round-panel h2{margin:0}#round-panel button,#shared-hud button,#district-progress button,#mobile-menu button{min-height:44px;border:1px solid var(--line);border-radius:10px;background:var(--glass-hi);color:var(--ink);padding:8px 12px;cursor:pointer}
.round-choice{display:grid;gap:8px;margin-top:16px}.round-choice button{text-align:left}
#shared-hud{position:fixed;z-index:7;top:72px;left:16px;display:flex;flex-wrap:wrap;gap:6px;padding:10px;max-width:min(380px,calc(100vw - 32px))}
#shared-hud b{width:100%}#shared-hud p{width:100%;margin:4px 0}
body.compact #top{top:calc(6px + env(safe-area-inset-top));left:8px;right:8px;gap:6px;flex-wrap:nowrap;align-items:center}
body.compact .brand{padding:8px;gap:6px;min-width:0;flex:1}body.compact .brand b{font-size:15px}body.compact .brand span{max-width:140px;font-size:11px}
body.compact #top .right{margin:0;gap:4px}body.compact #gear{height:44px;width:44px}body.compact #wanted,body.compact #clock,body.compact #perf,body.compact #me{display:none!important}
body.compact #modes{position:fixed;left:8px;right:8px;width:auto;bottom:calc(6px + env(safe-area-inset-bottom));z-index:8;padding:3px;order:initial}
body.compact #modes button{height:44px;min-width:0;padding:6px 2px;font-size:12px;flex:1}body.compact kbd{display:none!important}
body.compact #mobile-tools{position:fixed;z-index:8;display:flex;gap:4px;left:8px;top:calc(58px + env(safe-area-inset-top));height:44px;pointer-events:auto}
body.compact #mobile-tools button{border:1px solid var(--line);background:var(--glass);border-radius:10px;color:var(--ink);padding:6px 10px;min-height:44px;font-size:12px}
body.compact #mobile-menu{display:grid;position:fixed;z-index:15;inset:auto 8px 62px;top:calc(110px + env(safe-area-inset-top));padding:12px;max-height:calc(var(--view-height,100dvh) - 172px - env(safe-area-inset-top));overflow:auto;touch-action:pan-y}
body.compact #mobile-menu>header{display:flex}body.compact #infobtns{position:static!important;inset:auto!important;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding-top:12px;width:100%;max-width:none;transform:none;flex-wrap:initial}
body.compact #infobtns button{width:100%;height:auto;white-space:normal;font-size:13px}
body.compact #minimap{display:none!important}body.compact #minimap.mobile-expanded{display:grid!important;top:calc(110px + env(safe-area-inset-top));right:8px;max-height:calc(var(--view-height,100dvh) - 185px);overflow:auto;max-width:calc(100vw - 16px)}
body.compact #mm-c{width:150px!important;height:150px!important}body.compact #minimap.big #mm-c{width:220px!important;height:220px!important}
body.compact #panel,body.compact .sheet,body.compact #quarters,body.compact #game-menu,body.compact #round-panel,body.compact #event-board,body.compact #river,body.compact #district-progress{position:fixed!important;inset:auto 8px 62px!important;top:calc(110px + env(safe-area-inset-top))!important;width:auto!important;max-width:none!important;max-height:calc(var(--view-height,100dvh) - 172px - env(safe-area-inset-top))!important;overflow:auto!important;transform:none!important;touch-action:pan-y;overscroll-behavior:contain}
body.compact .modal,body.compact #result{padding:8px;max-height:var(--view-height,100dvh);overflow:auto;align-items:start}body.compact .modal .card,body.compact #result .card{margin:auto;padding:16px;max-height:calc(var(--view-height,100dvh) - 16px);overflow:auto}
body.compact #joy{left:12px;bottom:calc(68px + env(safe-area-inset-bottom));width:100px;height:100px}body.compact #knob{left:26px;top:26px}
body.compact #jumpbtn{right:12px;bottom:calc(68px + env(safe-area-inset-bottom));width:54px;height:54px;font-size:11px}
body.compact #punch{display:none!important}body.compact #lift{right:12px;bottom:calc(68px + env(safe-area-inset-bottom));gap:6px}body.compact #lift button{width:44px;height:44px}
body.compact #ctxwrap{left:auto;right:12px;bottom:calc(128px + env(safe-area-inset-bottom));transform:none;max-width:calc(100vw - 136px)}body.compact #ctx,body.compact #ctx-link{white-space:normal;padding:10px 12px;font-size:12px;min-height:44px;max-width:100%;text-align:center}
body.compact #chat-btn{right:8px;top:calc(58px + env(safe-area-inset-top));bottom:auto!important;width:44px;height:44px}
body.compact #dock{inset:auto 8px 62px;top:calc(110px + env(safe-area-inset-top));width:auto;height:calc(var(--view-height,100dvh) - 172px - env(safe-area-inset-top));max-height:none}
body.compact #chat-in{font-size:16px}body.compact input,body.compact select{font-size:16px;min-height:44px}
body.compact #ghud,body.compact #navhud,body.compact #farmhud,body.compact #shared-hud{top:calc(108px + env(safe-area-inset-top));left:8px;right:8px;max-width:none;min-width:0;transform:none;font-size:11px;padding:8px;max-height:35vh;overflow:auto}
body.compact #shared-hud{pointer-events:auto}body.compact #shared-hud b{width:auto}body.compact #shared-hud p{font-size:12px}body.compact #shared-hud button{font-size:12px;padding:6px 8px}
body.compact #farmhud:has(~ #shared-hud:not([hidden])){display:none}
body.compact #labels .zlabel span,body.compact #pins .pin span{display:none}body.compact #labels .zlabel{padding:5px 7px}body.compact #toast{top:calc(108px + env(safe-area-inset-top));font-size:12px;max-width:calc(100vw - 16px)}
body.compact.drawer-open #joy,body.compact.drawer-open #jumpbtn,body.compact.drawer-open #lift,body.compact.drawer-open #ctxwrap,body.compact.drawer-open #shared-hud{visibility:hidden}
@media(max-height:480px) and (orientation:landscape){
 body.compact #modes{left:calc(50% - 170px);right:auto;width:340px}
 body.compact #mobile-tools{left:auto;right:60px;top:calc(6px + env(safe-area-inset-top))}
 body.compact #chat-btn{right:8px;top:calc(58px + env(safe-area-inset-top))}
 body.compact #mobile-menu,body.compact #panel,body.compact .sheet,body.compact #quarters,body.compact #game-menu,body.compact #round-panel,body.compact #event-board,body.compact #river,body.compact #district-progress{top:calc(58px + env(safe-area-inset-top))!important;left:auto!important;width:min(400px,calc(100vw - 16px))!important;max-height:calc(var(--view-height,100dvh) - 120px)!important}
 body.compact #minimap.mobile-expanded{top:calc(58px + env(safe-area-inset-top))}
 body.compact #joy{bottom:calc(14px + env(safe-area-inset-bottom));width:94px;height:94px}body.compact #knob{left:23px;top:23px}
 body.compact #jumpbtn,body.compact #lift{bottom:calc(14px + env(safe-area-inset-bottom))}
 body.compact #ctxwrap{bottom:calc(78px + env(safe-area-inset-bottom));max-width:240px}
 body.compact #shared-hud,body.compact #ghud,body.compact #navhud,body.compact #farmhud{top:58px;right:auto;width:min(380px,calc(100vw - 140px));max-height:35vh}
}

#arena-status{position:fixed;z-index:22;top:110px;right:16px;width:min(390px,calc(100vw - 32px));max-height:calc(var(--view-height,100dvh) - 180px);overflow:auto;padding:16px}#arena-status button{min-height:44px;margin:5px}body.compact #arena-status{left:12px;right:12px;width:auto;top:105px;bottom:68px;max-height:none}

body.compact #realms-panel{bottom:130px;max-height:calc(var(--view-height,100dvh) - 245px);width:min(320px,calc(100vw - 24px))}

#arena-status{font:14px/1.45 var(--f-ui);border-radius:16px;scrollbar-width:thin}#arena-status h2{font-size:19px;margin:0 0 10px}#arena-status>p{color:var(--muted);font-size:13px}#arena-status .round-choice{padding:12px 0;border-top:1px solid var(--line)}#arena-status .round-choice p{margin:6px 0 10px;color:var(--muted)}#arena-status button{font:inherit;min-height:44px;padding:10px 12px;background:rgba(54,214,195,.09);border:1px solid rgba(54,214,195,.3);border-radius:10px;color:var(--ink);cursor:pointer;margin:3px 0}#arena-status .round-choice button{width:100%;text-align:left}#arena-status button:hover{background:rgba(54,214,195,.19)}#arena-status button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}

/* v18 ability panels remain reachable above the game action strip. */
body.compact #rift-bar{max-width:calc(100vw - 20px)!important;flex-wrap:wrap!important;bottom:calc(140px + env(safe-area-inset-bottom))!important;gap:4px!important}
body.compact #rift-bar button{min-width:0!important;flex:1 1 70px!important;min-height:44px!important;font-size:11px!important}
body.compact #strike-feed{display:none!important}
body.compact #realms-panel{max-width:calc(100vw - 20px)!important;overflow:auto!important}
@media(max-height:500px){body.compact #rift-bar{left:auto!important;right:8px!important;transform:none!important;width:220px!important;bottom:58px!important}body.compact #realms-panel{left:auto!important;right:8px!important;bottom:58px!important;max-height:calc(100dvh - 120px)!important}}

@media(max-width:600px){#city-offer{top:64px!important;width:calc(100vw - 20px);font-size:12px!important;padding:8px!important;box-sizing:border-box}#city-offer button{min-height:44px;flex-shrink:0}}
@media(max-height:500px){#city-offer{top:52px!important;max-width:60vw!important}}

/* v24 city window: one modal, safe areas and touch targets in both orientations. */
#hub[hidden],#hub-ord[hidden]{display:none!important}
#hub{max-height:calc(var(--view-height,100dvh) - 100px);max-width:calc(100vw - 24px);padding-bottom:env(safe-area-inset-bottom);}
#hub button{min-height:44px}#hub .hb-qty button{min-width:44px;height:44px}#hub .hb-note{overflow-wrap:anywhere}
#hub-ord{max-width:calc(100vw - 24px);white-space:normal;text-align:center;pointer-events:auto}
body.compact #hub{inset:calc(env(safe-area-inset-top) + 10px) 8px calc(env(safe-area-inset-bottom) + 64px);width:auto;max-width:none;max-height:none;z-index:60}
body.compact #hub-ord{top:calc(env(safe-area-inset-top) + 52px);font-size:12px;width:calc(100vw - 32px)}
@media(max-height:480px){body.compact #hub .hb-grid{grid-template-columns:repeat(6,minmax(0,1fr))}body.compact #hub .hb-app{padding:5px 2px;min-height:50px}}

body.compact #hub{height:auto}#hub .hb-back,#hub .hb-x{min-width:44px}body.compact #hub-ord{top:calc(env(safe-area-inset-top) + 108px);white-space:normal}body.compact #mobile-tools{max-width:calc(100vw - 60px)}

/* Location choice precedes GPU/model loading and remains usable in both orientations. */
#district-backdrop{position:fixed;inset:0;z-index:30;background:rgba(5,9,18,.65);backdrop-filter:blur(4px)}
body.district-selecting #district-progress{position:fixed!important;z-index:31;left:50%!important;right:auto!important;top:50%!important;bottom:auto!important;width:min(440px,calc(100vw - 32px))!important;transform:translate(-50%,-50%)!important;max-height:calc(var(--view-height,100dvh) - 48px - env(safe-area-inset-top) - env(safe-area-inset-bottom))!important;display:grid;gap:12px;padding:20px;overflow:auto;box-sizing:border-box}
#district-progress h2{margin:0;font-size:25px}#district-progress p{margin:0;line-height:1.5;color:var(--muted)}#district-progress button{min-height:48px;text-align:center;font:600 15px var(--f)}#district-progress select{width:100%;min-height:48px;background:var(--glass-hi);color:var(--ink);border:1px solid var(--line);border-radius:10px;padding:10px}
