.touch-controls [data-mobile-custom]{position:fixed!important;left:var(--mobile-left)!important;top:var(--mobile-top)!important;right:auto!important;bottom:auto!important;width:var(--mobile-width)!important;height:var(--mobile-height)!important;transform:none!important}
body.layout-measuring #touch{display:block!important}body.layout-measuring #touch .touch-actions button{display:flex!important}
#edit-mobile-layout{width:100%;min-height:48px;margin:0 0 18px;border:1px solid #a9bdcc;background:#294258;color:white;font:bold 15px Arial}
#layout-editor{position:fixed;inset:0;width:100vw;max-width:none;height:100dvh;max-height:none;padding:0;margin:0;border:0;border-radius:0;background:#10223242;color:white;overflow:hidden;touch-action:none;font-family:Arial,sans-serif}
#layout-editor::backdrop{background:#0b172333}.layout-editing #touch,.layout-editing #menu{visibility:hidden}
.layout-stage{position:absolute;inset:0;touch-action:none}
#layout-editor .layout-handle{position:absolute;display:flex;align-items:center;justify-content:center;border:2px solid #e3edf4a6;border-radius:50%;background:#183238c9;color:white;padding:12px;min-width:0;min-height:0;touch-action:none;cursor:grab;user-select:none}
#layout-editor .layout-handle[aria-pressed=true]{border-color:#eefe7c;box-shadow:0 0 0 3px #eefe7c60;background:#415d52df}
.layout-handle svg{width:100%;height:100%;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}.layout-handle>span{position:absolute;top:calc(100% + 3px);font-size:11px;font-weight:bold;white-space:nowrap;text-shadow:0 1px 3px #000;pointer-events:none}
#layout-editor .layout-joystick{background:#ffffff18}.layout-joystick i{position:absolute;width:40%;height:40%;border-radius:50%;background:#25404caa;border:1px solid #ffffff80;pointer-events:none}
.layout-tools{position:absolute;z-index:2;top:52px;left:50%;transform:translateX(-50%);width:min(430px,calc(100% - 24px));background:#182737f5;border:1px solid #829aaa;padding:10px;box-sizing:border-box}
.layout-tools h2{font-size:16px;margin:0 0 5px}.layout-tools p{font-size:12px;color:#cedbe5;margin:4px 0 8px;line-height:1.35}.layout-size-row{display:flex;gap:6px;align-items:center}.layout-size-row label{font-size:13px}.layout-size-row select{min-width:0;flex:1}.layout-size-row output{min-width:46px;font-size:13px}.layout-tools input{width:100%;height:32px;accent-color:#eefe7c;touch-action:none}
#layout-editor button:not(.layout-handle),#layout-editor select{min-height:44px;border:1px solid #89a1b2;background:#2c4155;color:white;font:bold 13px Arial;padding:6px 10px;border-radius:0}.layout-size-row button{min-width:44px}.layout-tool-actions{display:flex;gap:6px}.layout-tool-actions button{flex:1}#layout-editor #layout-save{background:#eefe7c;color:#182737;border-color:#eefe7c}
#layout-tools-toggle{position:absolute;z-index:3;top:4px;left:50%;transform:translateX(-50%)}.tools-hidden .layout-tools{display:none}
@media(orientation:landscape){.layout-tools{top:8px;width:min(420px,calc(100% - 330px));min-width:280px}.layout-tools h2{font-size:14px}.layout-tools p{font-size:11px}.layout-tools input{height:26px}#layout-tools-toggle{top:auto;bottom:6px}.layout-tool-actions button{padding:5px!important}.layout-size-row label{display:none}}

.touch-controls #touch-down{right:0;bottom:82px}
#layout-editor .layout-handle[data-control="touch-down"][aria-pressed="false"]{display:none}
#layout-editor .layout-stage:has([data-control="touch-down"][aria-pressed="true"]) .layout-handle:not([data-control="touch-down"]):not([data-control="touch-jump"]):not([data-control="joystick"]):not([data-control="touch-sprint"]){display:none}
