/* Direct, on-object handles. Explicit light colours also apply inside Android. */
.direct-options{display:flex;align-items:center;flex-wrap:wrap;gap:10px 18px;padding:8px 14px;background:#fff;color:#203550;border:1px solid #d5e1ee;border-top:0;font:500 12px/1.4 Poppins,Arial,sans-serif}
.direct-options label{display:inline-flex;gap:7px;align-items:center;white-space:nowrap;cursor:pointer}
.direct-options input{accent-color:#087be8;width:16px;height:16px;margin:0}
.direct-options select{background:#fff;border:1px solid #bfd0e2;border-radius:6px;padding:5px;color:#1c3047;font:inherit}
.direct-options-help{color:#556e89;font-size:11px}
.direct-key{font-size:10px;border:1px solid #d3dce6;border-radius:4px;background:#f5f8fb;padding:1px 4px;color:#5a6f85}
#editor-canvas>.direct-controls{position:absolute;inset:0;z-index:2;pointer-events:none;user-select:none;-webkit-user-select:none;color-scheme:only light;font:12px/1.35 Poppins,Arial,sans-serif;overflow:hidden}
.direct-controls[hidden],.direct-controls [hidden]{display:none!important}
.direct-wire{position:absolute;inset:0;overflow:visible;pointer-events:none}
.direct-box{fill:none;stroke:#08a9d8;stroke-width:1.6;stroke-dasharray:5 3;vector-effect:non-scaling-stroke}
.direct-guide{fill:none;stroke:#8da5b8;stroke-width:1;stroke-dasharray:3 3}
/* A single annulus projected onto the chosen local face. Its centre is
 * transparent and click-through: hovering a wheel never moves the model. */
.direct-dial{pointer-events:none}
.direct-wheel-band{fill:rgba(32,179,223,.23);stroke:none;pointer-events:none}
.direct-wheel-rim{fill:none;stroke:#189bc6;stroke-width:1.25;vector-effect:non-scaling-stroke;pointer-events:none}
.direct-wheel-ticks{fill:none;stroke:#2289b0;stroke-width:1;vector-effect:non-scaling-stroke;pointer-events:none}
.direct-dial .direct-needle{fill:none;stroke:#e66f54;stroke-width:1.8;vector-effect:non-scaling-stroke;stroke-linejoin:round;pointer-events:none}
.direct-dial .direct-wheel-hit{fill:transparent;stroke:transparent;stroke-width:12;pointer-events:all;cursor:grab;touch-action:none}
.direct-controls.is-dragging .direct-wheel-hit{cursor:grabbing}
.direct-wheel-label{position:absolute;transform:translateX(-50%);padding:4px 8px;background:rgba(255,255,255,.97);border:1px solid #b8d9e9;border-radius:5px;color:#174b68;font:600 12px/1.35 Poppins,Arial,sans-serif;pointer-events:none;white-space:nowrap;box-shadow:0 1px 5px #39647f1a}
#editor-canvas .direct-handle{position:absolute;width:32px;height:32px;min-width:0;min-height:0;margin:0;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;transform:translate(-50%,-50%);pointer-events:auto;display:flex;align-items:center;justify-content:center;cursor:grab;touch-action:none;outline-offset:-3px;color:#223440;line-height:1}
#editor-canvas .direct-handle:hover{background:rgba(255,255,255,.35);border-radius:8px}
#editor-canvas .direct-handle:focus-visible{outline:2px solid #076de0;border-radius:5px}
#editor-canvas .direct-size>span{display:block;box-sizing:border-box;width:11px;height:11px;background:#fff;border:2px solid #253d50;border-radius:1px;box-shadow:0 1px 2px #ffffffa6}
#editor-canvas .direct-size.is-side>span{width:8px;height:8px;background:#253d50}
#editor-canvas .direct-size.is-height>span{width:12px;height:12px;box-shadow:0 0 0 3px #ffffff9c}
#editor-canvas .direct-lift{width:34px;height:34px;background:rgba(255,255,255,.9);border:1px solid #bed0df;border-radius:50%;box-shadow:0 2px 4px #31475924}
#editor-canvas .direct-lift>span{font:23px/1 Arial,sans-serif;color:#202c37;transform:scaleX(.8)}
#editor-canvas .direct-rotate{width:37px;height:37px;border-radius:50%;background:rgba(255,255,255,.92);border:1px solid #b4c9db;box-shadow:0 2px 4px #31475924}
#editor-canvas .direct-rotate.is-preview{background:#e7f7ff;border-color:#139dc8;box-shadow:0 0 0 2px #40b9da30}
#editor-canvas .direct-rotate>svg{width:25px;height:25px;fill:none;stroke:#2d4b63;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
#editor-canvas .direct-rotate>small{position:absolute;bottom:-5px;right:-3px;background:#fff;border:1px solid #c3d3e0;color:#203954;border-radius:4px;padding:1px 3px;font:700 10px/1.1 Arial,sans-serif}
#editor-canvas .direct-handle.is-active,#editor-canvas .direct-handle:active{cursor:grabbing;background:#e5f3ff;border-radius:6px}
#editor-canvas .direct-size.is-active>span{background:#0b88ec;border-color:#0764b2}
.direct-controls.is-dragging{cursor:grabbing}
.direct-controls .direct-measure{position:absolute;bottom:42px;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:2px;padding:3px;background:rgba(255,255,255,.95);border:1px solid #c4d4e2;border-radius:8px;box-shadow:0 2px 8px #3958751f;max-width:calc(100% - 16px);pointer-events:auto;white-space:nowrap}
#editor-canvas .direct-measure-value{font:600 11px/1.3 Poppins,Arial,sans-serif;padding:5px 8px;min-height:28px;min-width:0;margin:0;color:#223e59;background:transparent;border:0;border-radius:4px;cursor:pointer;white-space:nowrap}
#editor-canvas .direct-measure-value:disabled{opacity:1;color:#536980;cursor:default}
#editor-canvas .direct-measure-value:not(:disabled):hover{background:#e3f1ff;color:#0766ca}
.direct-measure::after{content:'mm';font-size:10px;color:#59758d;padding:0 4px}
.direct-readout{position:absolute;left:50%;bottom:86px!important;top:auto!important;transform:translateX(-50%);padding:6px 10px;border:1px solid #b5cee1;border-radius:7px;background:#fff;color:#143957;box-shadow:0 2px 7px #39587529;text-align:center;max-width:calc(100% - 22px);width:max-content;font:600 12px/1.4 Poppins,Arial,sans-serif;pointer-events:none}
.direct-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);clip-path:inset(50%);white-space:nowrap}
.editor-shell.is-readonly .direct-options{display:none}
@media(pointer:coarse){.direct-dial .direct-wheel-hit{stroke-width:22}#editor-canvas .direct-handle{width:42px;height:42px}#editor-canvas .direct-size>span{width:14px;height:14px}#editor-canvas .direct-size.is-side>span{width:10px;height:10px}#editor-canvas .direct-lift,#editor-canvas .direct-rotate{width:40px;height:40px}#editor-canvas .direct-measure-value{min-height:34px}}
@media(max-width:820px){.direct-options{padding:8px 10px;gap:7px 12px;font-size:11px}.direct-key{display:none}.direct-options-help{font-size:10px;flex-basis:100%}.direct-readout{font-size:11px}.direct-controls .direct-measure{bottom:42px}.direct-controls .direct-measure-value{font-size:10px;padding:5px 6px}}
/* Only the overlay belongs to the WebGL canvas; the APK keeps native menus. */
.direct-controls.is-native .direct-measure{bottom:9px}
/* X/Y/Z stay above the bottom grid toolbar in web and Android. */
#editor-canvas .direct-controls .direct-measure{bottom:70px}

/* Object actions: right-click or stationary long press. Always light, including
 * browsers configured in dark mode. It lives outside the clipped 3D stage. */
.editor-context-menu{position:fixed;z-index:2147483630;box-sizing:border-box;width:244px;max-width:calc(100vw - 16px);padding:6px;background:#fff;color:#1b3048;border:1px solid #c4d4e5;border-radius:12px;box-shadow:0 8px 30px #19385633;color-scheme:only light;font:500 13px/1.4 Poppins,Arial,sans-serif;overflow:auto;overscroll-behavior:contain;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
.editor-context-menu[hidden]{display:none!important}
.editor-context-title{padding:7px 9px 9px;border-bottom:1px solid #e0e8f0;font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.editor-context-menu button{display:flex;align-items:center;justify-content:space-between;gap:15px;width:100%;min-height:44px;padding:10px;margin:2px 0;border:0;border-radius:6px;background:#fff;color:#1b3048;box-shadow:none;font:inherit;cursor:pointer;text-align:left;touch-action:manipulation}
.editor-context-menu button:not(:disabled):hover,.editor-context-menu button:not(:disabled):focus-visible{background:#eaf4ff;color:#0755aa;outline:2px solid #1478e0;outline-offset:-2px}
.editor-context-menu button:disabled{opacity:1;color:#8493a4;background:#fff;cursor:default}
.editor-context-menu kbd{white-space:nowrap;border:0;background:transparent;color:#60748a;font:500 11px/1.2 Poppins,Arial,sans-serif}
.editor-context-menu button:disabled kbd{color:#8493a4}
.editor-context-hint{padding:9px 9px 3px;margin:2px 0 0;border-top:1px solid #e0e8f0;color:#62768c;font-size:11px}
.editor-context-menu.is-touch button{min-height:48px;font-size:14px}
.editor-context-menu.is-touch kbd{display:none}
#editor-canvas{user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}

/* Hold/slide/release palette: part of the canvas overlay, never a modal dialog.
 * The explicit display also overrides canvas-only APK body hiding rules. */
body>.editor-context-menu:not([hidden]),.editor-shell>.editor-context-menu:not([hidden]){display:block!important}
.editor-context-actions{display:block}
.editor-context-icon{display:none;flex:none;width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.editor-context-menu.is-held{width:304px;padding:7px;touch-action:none;overflow:hidden;box-shadow:0 7px 28px #173d6040;border-color:#b7cee4}
.editor-context-menu.is-held .editor-context-title{padding:5px 7px 7px;font-size:12px;line-height:1.5}
.editor-context-menu.is-held .editor-context-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;padding-top:6px}
.editor-context-menu.is-held button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;min-width:0;min-height:65px;margin:0;padding:7px 2px;border:1px solid #d5e2ef;border-radius:8px;background:#f6f9fd;color:#22435f;font-size:13px;font-weight:600;touch-action:none;outline:none}
.editor-context-menu.is-held .editor-context-icon{display:block}
.editor-context-menu.is-held button:not(:disabled):hover,.editor-context-menu.is-held button:not(:disabled):focus-visible{outline:none;background:#f6f9fd;color:#22435f}
.editor-context-menu.is-held button.is-active:not(:disabled){background:#dcefff;color:#064c96;border-color:#147bdb;box-shadow:inset 0 0 0 1px #147bdb;outline:none}
.editor-context-menu.is-held button:disabled{background:#fafbfd;color:#96a4b3;border-color:#e5ecf3}
.editor-context-menu.is-held .editor-context-hint{border:0;padding:6px 3px 1px;margin:0;font-size:10px;line-height:1.5;text-align:center;min-height:16px;color:#526c82}

/* Mobile hold dial ------------------------------------------------------- */
.editor-context-menu.is-dial{padding:0!important;background:transparent!important;border:0!important;border-radius:50%!important;box-shadow:none!important;overflow:visible!important;touch-action:none!important;pointer-events:none!important}
.editor-context-menu.is-dial::before{content:"";position:absolute;inset:18%;border:1px solid rgba(107,139,169,.52);border-radius:50%;background:rgba(245,250,255,.42);box-shadow:0 10px 30px rgba(16,51,82,.18);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);pointer-events:none}
.editor-context-menu.is-dial .editor-context-title{display:none!important}
.editor-context-menu.is-dial .editor-context-actions{position:absolute!important;inset:0!important;display:block!important;padding:0!important;pointer-events:none!important}
.editor-context-menu.is-dial .editor-context-actions button{position:absolute!important;transform:translate(-50%,-50%)!important;width:70px!important;height:70px!important;min-width:70px!important;min-height:70px!important;margin:0!important;padding:6px 4px!important;display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;gap:3px!important;border:1px solid rgba(169,195,219,.94)!important;border-radius:50%!important;background:rgba(250,253,255,.91)!important;color:#1f4769!important;box-shadow:0 5px 16px rgba(17,58,91,.20)!important;font-size:10px!important;font-weight:700!important;line-height:1.05!important;text-align:center!important;white-space:normal!important;touch-action:none!important;pointer-events:none!important;backdrop-filter:blur(7px);-webkit-backdrop-filter:blur(7px)}
.editor-context-menu.is-dial .editor-context-actions button span{display:block;max-width:60px;overflow:hidden;text-overflow:ellipsis}
.editor-context-menu.is-dial .editor-context-icon{display:block!important;width:24px!important;height:24px!important;stroke-width:1.8!important}
.editor-context-menu.is-dial kbd{display:none!important}
.editor-context-menu.is-dial .editor-context-actions button:disabled{opacity:.42!important;background:rgba(239,244,248,.76)!important;color:#718396!important;border-color:rgba(193,207,220,.78)!important;box-shadow:none!important}
.editor-context-menu.is-dial .editor-context-actions button.is-active:not(:disabled){background:rgba(214,238,255,.97)!important;color:#075aa7!important;border-color:#0b7fe0!important;box-shadow:0 0 0 3px rgba(19,131,226,.18),0 7px 18px rgba(15,86,145,.25)!important;transform:translate(-50%,-50%) scale(1.12)!important}
.editor-context-menu.is-dial .editor-context-hint{position:absolute!important;left:50%!important;top:50%!important;transform:translate(-50%,-50%)!important;width:78px!important;height:78px!important;box-sizing:border-box!important;margin:0!important;padding:14px 7px!important;display:flex!important;align-items:center!important;justify-content:center!important;border:1px solid rgba(169,195,219,.86)!important;border-radius:50%!important;background:rgba(255,255,255,.88)!important;color:#365c7b!important;box-shadow:0 4px 14px rgba(17,58,91,.14)!important;font-size:9px!important;font-weight:600!important;line-height:1.25!important;text-align:center!important;pointer-events:none!important;backdrop-filter:blur(7px);-webkit-backdrop-filter:blur(7px)}
.editor-context-dial-center{display:none}
.editor-context-menu.is-dial .editor-context-dial-center{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:flex;align-items:center;justify-content:center;width:58px;height:58px;border-radius:50%;pointer-events:none;color:#123f65;font-size:10px;font-weight:800;text-align:center;z-index:2}
.editor-context-menu.is-dial .editor-context-dial-center span{max-width:50px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media (max-width:420px){.editor-context-menu.is-dial .editor-context-actions button{width:64px!important;height:64px!important;min-width:64px!important;min-height:64px!important;font-size:9px!important}.editor-context-menu.is-dial .editor-context-icon{width:22px!important;height:22px!important}.editor-context-menu.is-dial .editor-context-hint{width:72px!important;height:72px!important}.editor-context-menu.is-dial .editor-context-dial-center{width:52px;height:52px}}
.editor-context-menu.is-dial .editor-context-hint{display:none!important}


/* Shift + left-drag marquee selection (desktop). */
#editor-canvas>.direct-selection-box{position:absolute;z-index:30;box-sizing:border-box;pointer-events:none;border:1.5px solid #087be8;background:rgba(8,123,232,.12);box-shadow:inset 0 0 0 1px rgba(255,255,255,.7);border-radius:2px}
#editor-canvas>.direct-selection-box[data-direction="left"]{border-style:dashed;background:rgba(8,123,232,.075)}
#editor-canvas.is-box-selecting{cursor:crosshair!important}
#editor-canvas.is-box-selecting canvas{cursor:crosshair!important}
