/* Touch-only layout. Desktop controls and construction layout stay unchanged. */
#world{touch-action:none;overscroll-behavior:none}
#mobile-tool-dock{display:contents}
#mobile-tool-dock>.mobile-dock-toggle{display:none}
#mobile-touch-dock,#mobile-history-dock,#mobile-layout-editor,#mobile-layout-settings{display:none}
@media(pointer:coarse),(max-width:750px){
 #nl-badge-frame{display:none!important}
 body{overscroll-behavior:none;-webkit-text-size-adjust:100%}
 button,select,input{font:inherit}
 input,select,textarea{font-size:16px}
 button{touch-action:manipulation}
 body:not(.at-home)>header{padding-left:max(8px,env(safe-area-inset-left));padding-right:max(8px,env(safe-area-inset-right))}
 body:not(.at-home)>footer{left:0;right:0;bottom:0;width:auto;padding:4px 8px env(safe-area-inset-bottom);height:0;gap:4px}
 #mobile-layout-settings{display:block;border-top:1px solid #34454b;margin-top:18px;padding-top:14px}
 .at-home #mobile-layout-settings{display:none!important}
 #mobile-layout-settings strong{font-size:14px}
 #mobile-layout-settings p{font-size:11px;margin:6px 0;color:#a6b4b3}
 #mobile-layout-settings button{min-height:42px;margin:0}
 body:not(.at-home) .mobile-control-dock{display:block;position:fixed;z-index:22;left:0;top:0;transform:translate(-50%,-50%) scale(var(--mobile-layout-scale,.84)) rotate(var(--mobile-layout-rotation,0deg));transform-origin:center;touch-action:none}
 body:not(.at-home) #mobile-tool-dock{display:block}
 .mobile-control-dock>.mobile-dock-toggle{display:flex;align-items:center;justify-content:center;width:36px;height:48px;padding:0;background:#13272df5;border:1px solid #789295;border-left:0;border-radius:0 10px 10px 0;color:#f1c673;font-size:20px;box-shadow:0 3px 14px #0005}
 #mobile-tool-dock>.mobile-dock-toggle{display:flex}
 .mobile-control-dock>.mobile-dock-toggle:focus-visible{outline:2px solid #eabb68;outline-offset:2px}
 #mobile-tool-dock .toolbar{display:none;position:absolute;left:calc(100% + 5px);top:50%;transform:translateY(-50%);width:60px;height:198px;min-width:60px;box-sizing:border-box;padding:3px;background:#111c26f5;border:1px solid #789295;border-radius:8px;box-shadow:0 4px 16px #0006}
 #mobile-tool-dock.expanded .toolbar{display:flex}
 #mobile-tool-dock .toolbar button{position:absolute;left:50%;top:50%;width:52px;height:44px;min-height:44px;min-width:52px;padding:3px;font-size:9px;color:#dce8e4;transform:translate(-50%,-50%) rotate(var(--mobile-item-rotation,0deg)) scale(var(--mobile-item-scale,1))}
 #mobile-tool-dock .toolbar button>span{font-size:18px;margin:0 0 1px}
 #mobile-tool-dock .toolbar kbd{display:none}
 #mobile-tool-dock .toolbar .active{border-color:#eabb68;color:#f1c673;background:#eabb6818}
 body:not(.at-home) #mobile-touch-dock{display:block}
 #mobile-touch-dock>.mobile-dock-toggle{color:#a9d8ed;font-size:21px}
 #touch-controls{display:none;position:absolute;left:calc(100% + 6px);top:50%;transform:translateY(-50%);width:min(220px,calc(100vw - 54px));height:234px;box-sizing:border-box;overflow:hidden;overscroll-behavior:contain;display:none;padding:6px;background:#111c26f7;border:1px solid #53656b;border-radius:9px;box-shadow:0 5px 18px #0006}
 #mobile-touch-dock.expanded #touch-controls{display:grid}
 #touch-controls button[data-layout-space="panel"]{position:absolute;left:50%;top:50%;width:96px;min-width:0;min-height:42px;height:42px;padding:5px;background:#1d2c38;border:1px solid #41515d;border-radius:5px;color:#dfebef;font-size:11px;transform:translate(-50%,-50%) rotate(var(--mobile-item-rotation,0deg)) scale(var(--mobile-item-scale,1))}
 #touch-controls button[aria-pressed=true]{background:#654b29;border-color:#e5a04e;color:#ffe2ad}
 #touch-hint{position:absolute;left:50%;bottom:3px;transform:translateX(-50%);width:calc(100% - 14px);color:#a5b6c5;font-size:9px;line-height:1.3;padding:2px 3px;text-align:center}
 body:not(.at-home) #mobile-history-dock{display:block;position:fixed;z-index:23;left:0;top:0;transform:translate(-50%,-50%) scale(var(--mobile-layout-scale,.82));transform-origin:center;touch-action:none}
 #mobile-history-dock #history-controls{display:flex;position:relative;flex-direction:column;gap:0;width:36px;height:68px;padding:3px;background:#13272df5;border:1px solid #789295;border-right:0;border-radius:9px 0 0 9px;box-shadow:0 3px 14px #0005}
 #history-controls button[data-layout-space="panel"]{position:absolute;left:50%;top:50%;display:flex;align-items:center;justify-content:center;width:32px;min-width:32px;height:32px;min-height:32px;padding:0;font-size:21px;line-height:1;color:#e1e9e6;background:transparent;border:0;border-radius:4px;transform:translate(-50%,-50%) rotate(var(--mobile-item-rotation,0deg)) scale(var(--mobile-item-scale,1))}
 #history-controls button:hover{background:#304148}
 body.mobile-layout-editing #mobile-tool-dock .toolbar,body.mobile-layout-editing #mobile-touch-dock #touch-controls{display:block!important}
 body.mobile-layout-editing #mobile-tool-dock .toolbar button[data-layout-space="panel"]{top:var(--mobile-layout-top,50%)}
 body.mobile-layout-editing .mobile-control-dock.layout-editing{outline:1px dashed #f1c673;outline-offset:4px;cursor:move}
 body.mobile-layout-editing [data-mobile-layout].layout-selected{outline:2px solid #72d4ef!important;outline-offset:3px!important;z-index:2}
 body.mobile-layout-editing [data-mobile-layout-space="panel"]{cursor:move;touch-action:none}
 body.mobile-layout-editing #touch-hint{display:none}
 #mobile-layout-editor{display:none;position:fixed;z-index:80;left:50%;bottom:calc(12px + env(safe-area-inset-bottom));transform:translateX(-50%);width:max-content;max-width:calc(100vw - 16px);align-items:center;justify-content:center;gap:4px;padding:6px;background:#101c22f5;border:1px solid #60777d;border-radius:10px;box-shadow:0 6px 24px #0008}
 #mobile-layout-editor.visible{display:flex}
 #mobile-layout-selected{max-width:78px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0 4px;font-size:10px;color:#d8e5e1}
 #mobile-layout-editor button{min-width:34px;min-height:38px;padding:4px 7px;font-size:12px}
 #mobile-layout-editor button[aria-label="Finish mobile layout setup"]{color:#f1c673}
 #pinned-quest{display:none!important}
 .view-controls{display:none!important}
 .help{display:none}
 #inspector{z-index:32;max-height:calc(100dvh - 200px);overflow:auto;overscroll-behavior:contain}
 #build{max-height:calc(100dvh - 200px);overflow:hidden}
 #catalog{overflow-y:auto;overscroll-behavior:contain}
 #build .panel-foot{display:none}
 dialog{max-height:calc(100dvh - 20px);max-width:calc(100vw - 16px);overflow:auto;overscroll-behavior:contain}
 dialog button{min-height:40px}
 #recipe-book .recipe-items{flex-wrap:wrap}
 #activity-feed{bottom:calc(12px + env(safe-area-inset-bottom))}
 .space-ops-dialog{height:100dvh;max-height:100dvh}
 .space-ops-bottom{height:125px;min-height:100px}
 .space-ops-dialog .space-ops-layout{min-height:0}
 .space-ops-detail{max-height:180px}
 .space-map-controls button{min-width:40px;min-height:40px}
}
@media(max-width:520px){
 body:not(.at-home)>header .brand{display:none}
 body:not(.at-home)>header .balances{flex:0 1 auto;min-width:0;gap:7px}
 body:not(.at-home)>header .session-context{flex:1 1 90px;min-width:75px;max-width:140px}
 .session-context select{max-width:100%;font-size:12px}
 .top-navigation{overflow-x:auto;scrollbar-width:none}
 .top-navigation button{min-height:40px;font-size:10px;padding:5px 7px}
 #save-status{max-width:72px}
 body:not(.at-home)>header .save-tools button{padding:5px;min-width:30px;font-size:10px}
 #settings{min-width:38px;min-height:38px}
 #build{left:8px;width:min(320px,calc(100vw - 16px));top:80px}
 #inspector{left:8px;right:8px;width:auto;top:80px;max-height:calc(100dvh - 200px)}
 #selection{max-width:calc(100vw - 16px);left:8px;bottom:calc(76px + env(safe-area-inset-bottom));pointer-events:none;transform:none}
 #welcome{max-width:calc(100vw - 35px);left:18px;top:155px;pointer-events:none}
 #welcome h2{font-size:26px}
 #toast{max-width:calc(100vw - 30px);top:auto;height:auto;bottom:calc(76px + env(safe-area-inset-bottom))}
 #selection{left:50%;right:auto;bottom:calc(12px + env(safe-area-inset-bottom));width:max-content;max-width:calc(100vw - 82px);gap:6px;padding:5px 8px;border-radius:7px;transform:translateX(-50%)}
 #selection-icon{font-size:17px}
 #selection strong{font-size:11px}
 #selection small{font-size:9px;line-height:1.25;max-width:170px;margin-top:2px}
 #selection b{font-size:10px;margin-left:4px}
 #selection b:empty{display:none}
 .menu-tooltip{display:none!important}
 .world-meta{display:none}
 .home-layout{padding:18px}.home-copy h1{font-size:48px}.home-art{min-width:0}
 .world-menu-layout{display:flex;flex-direction:column}.world-library{max-height:45dvh;overflow-y:auto}.world-create{padding:18px}
 .space-ops-detail{max-height:160px}.space-ops-bottom{height:100px;min-height:90px}
 .space-center{min-height:150px}.space-ops-layout{grid-template-rows:minmax(150px,1fr) auto}
 .controls-help-grid{grid-template-columns:1fr}
}
@media(max-height:500px) and (pointer:coarse){
 body:not(.at-home)>header{height:64px}
 #build,#inspector{top:70px;max-height:calc(100dvh - 165px)}
 .space-ops-bottom{display:none}
 #mobile-layout-editor{bottom:calc(4px + env(safe-area-inset-bottom));padding:3px}
 #mobile-layout-editor button{min-height:34px}
}
