/* V507 · iPhone: toque duplo nos botões não dá zoom na página nem seleciona texto. */
html,body,#root,#stage,#stage canvas{touch-action:manipulation}
#root #stage #touch,#root #stage #touch button{touch-action:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent}
/* Custom touch layout: saved buttons leave the grid, stay inside the safe area and keep 44px targets. */
#root #stage #touch button[data-touch-id][data-touch-placed]{
 --tw:max(44px,calc(var(--button-size,calc(48px * var(--touch-scale,1))) * var(--ts,1)));
 position:absolute;margin:0;width:var(--tw);height:var(--tw);min-width:0;min-height:0;max-width:none;
 left:clamp(max(8px,env(safe-area-inset-left)),calc(var(--tx) * 100% - var(--tw) / 2),calc(100% - max(8px,env(safe-area-inset-right)) - var(--tw)));
 top:clamp(max(8px,env(safe-area-inset-top)),calc(var(--ty) * 100% - var(--tw) / 2),calc(100% - max(6px,env(safe-area-inset-bottom)) - var(--tw)));
 font-size:calc(24px * var(--ts,1));pointer-events:auto
}
#root #stage #touch button[data-touch-id=jump][data-touch-placed]{font-size:calc(32px * var(--ts,1))}
#root #stage #touch button[data-touch-placed] svg{width:calc(25px * var(--ts,1));height:calc(25px * var(--ts,1))}
#root #stage #touch button[data-touch-placed] small{font-size:clamp(10px,calc(11px * var(--ts,1)),16px)}
#root #stage #touch button[data-touch-essential]{z-index:2}
#root #stage #touch button[data-touch-id][data-touch-off]{display:none!important}

/* Editor: every available button shows, including hidden ones (dimmed) and mode-only ones. */
#root #stage #touch.touch-editing{display:flex!important;z-index:40;pointer-events:auto;touch-action:none;background:#080e22c7}
#root #stage #touch.touch-editing button[data-touch-id]:not([data-touch-preview]){display:none!important}
#root #stage #touch.touch-editing button[data-touch-id][data-touch-preview]{display:flex!important;pointer-events:auto;cursor:grab;opacity:1;outline:2px dashed #ffe08799;outline-offset:2px;transition:none}
#root #stage #touch.touch-editing button[data-touch-id][data-touch-preview][data-touch-off]{opacity:.38;filter:grayscale(1);outline-color:#9aa9b799}
#root #stage #touch.touch-editing button[data-touch-id].touch-selected{outline:3px solid #ffe087;outline-offset:3px;z-index:3}
#root #stage.touch-layout-open #utilities,#root #stage.touch-layout-open #interact{pointer-events:none;opacity:.45}

.touch-layout-editor{position:absolute;z-index:41;left:max(8px,env(safe-area-inset-left));right:calc(max(8px,env(safe-area-inset-right)) + 104px);top:max(6px,env(safe-area-inset-top));box-sizing:border-box;max-width:700px;margin:0 auto;display:flex;flex-direction:column;gap:4px;padding:6px 8px;border:2px solid #9fddcb;background:#172439f2;box-shadow:4px 4px #080e22;color:#e9f6ec;font:18px/1.15 'VT323',monospace;text-align:left}
.touch-layout-editor[data-dock=bottom]{top:auto;bottom:max(6px,env(safe-area-inset-bottom))}
.touch-layout-editor[hidden]{display:none}
.touch-layout-editor *{box-sizing:border-box}
.touch-layout-row{display:flex;align-items:center;gap:8px;min-width:0}
.touch-layout-editor h2{margin:0;font:10px/1.4 'Brasil Arcade',monospace;color:#ffe083;white-space:nowrap}
.touch-layout-editor h2:focus{outline:none}
.touch-layout-modes{display:flex;gap:0}
.touch-layout-modes button[aria-pressed=true]{background:#5b4626;border-color:#ffe087;color:#fff2b3}
.touch-layout-actions{display:flex;gap:6px;align-items:center;margin-left:auto}
.touch-layout-tools strong{flex:0 1 190px;min-width:0;font-weight:normal;color:#fff0bd;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.touch-layout-tools label{display:flex;align-items:center;gap:6px;flex:1 1 160px;min-width:0;color:#a8c4cc}
.touch-layout-tools input[type=range]{flex:1 1 auto;width:0;min-width:50px;height:32px;margin:0;accent-color:#ffe087;touch-action:pan-x}
.touch-layout-tools output{flex:none;min-width:44px;text-align:right;color:#ffe087}
.touch-layout-tools [data-touch-visibility]{flex:none}
.touch-layout-editor [data-touch-status]{margin:0;min-height:18px;color:#bcd1d7;font-size:16px;line-height:1.1}
.touch-layout-editor button{min-height:38px;padding:4px 8px;border:2px solid #648eaa;background:#21394d;color:#e9f8ff;font:18px/1.05 'VT323',monospace;cursor:pointer;white-space:nowrap}
.touch-layout-editor button:disabled{opacity:.55;cursor:default}
.touch-layout-editor button:focus-visible{outline:3px solid #ffe087;outline-offset:2px}
.touch-layout-editor [data-touch-save]{background:#1d604f;border-color:#95dec0;min-width:70px}
.touch-layout-reserved{position:absolute;z-index:40;left:50%;transform:translateX(-50%);bottom:max(10px,env(safe-area-inset-bottom));width:min(180px,40%);height:48px;display:flex;align-items:center;justify-content:center;border:2px dashed #9aa9b7aa;color:#c9d6df;font:16px/1 'VT323',monospace;pointer-events:none}
.touch-layout-reserved[hidden]{display:none}
.touch-preferences .touch-layout-open{flex:1 1 100%;min-height:44px;padding:7px 10px;border:2px solid #95dec0;background:#1d604f;color:#e9f8ff;font:20px/1.1 'VT323',monospace;cursor:pointer}
@media(max-width:620px){
 .touch-layout-editor{right:max(8px,env(safe-area-inset-right))}
 .touch-layout-editor h2{display:none}
}
