/* Created by Yanjunhui */
.custom-module-editor{
 width:min(1480px,calc(100vw - 40px));height:min(940px,calc(100dvh - 32px));
 max-width:none;max-height:none;margin:auto;padding:0;border:1px solid #dce5d8;border-radius:20px;
 background:var(--bg,#f4f6f0);color:var(--ink,#273a30);box-shadow:0 28px 100px #19352340;overflow:hidden;
}
.custom-module-editor[open]{display:grid;grid-template-rows:auto auto minmax(0,1fr) auto}
.custom-module-editor::backdrop{background:#1b302e80;backdrop-filter:blur(4px)}
.custom-module-editor *{box-sizing:border-box}
.custom-module-editor .button,.custom-module-editor .text-button{min-height:34px;white-space:nowrap}
.custom-module-editor .button{padding:7px 11px}
.custom-module-editor input,.custom-module-editor select,.custom-module-editor textarea{min-width:0;max-width:100%;font:inherit}
.custom-module-editor input:not([type=checkbox]):not([type=color]),.custom-module-editor textarea,.custom-module-editor select{width:100%;padding:8px 9px;border:1px solid #d7e1d2;border-radius:8px;background:#fff;color:var(--ink)}
.custom-module-editor input[type=color]{width:100%;height:34px;padding:3px;border:1px solid #d7e1d2;border-radius:8px;background:#fff}
.custom-module-editor input[aria-invalid=true]{border-color:#bf6048;background:#fff4ef;box-shadow:0 0 0 1px #bf60483d}
.custom-module-editor :focus-visible{outline:2px solid #4e8564;outline-offset:2px}
.custom-module-editor h2,.custom-module-editor h3,.custom-module-editor h4,.custom-module-editor p{margin:0}
.custom-module-editor h2{font-size:20px;line-height:1.4}
.custom-module-editor h3{font-size:14px}
.custom-module-editor h4{font-size:12px;font-weight:700;margin:13px 0 7px}
.custom-module-editor .muted{font-size:12px;line-height:1.6;color:var(--muted,#72806f)}
.ce-header{display:flex;align-items:center;justify-content:space-between;gap:20px;background:#fff;padding:16px 22px 12px}
.ce-eyebrow{font-size:10px;letter-spacing:.16em;color:#6f806d;margin-bottom:4px!important}
.ce-close{flex:none;width:38px;height:38px;font-size:25px;border:1px solid #dce5d8;border-radius:50%;background:#f7f9f4}
.ce-tabs{display:flex;gap:6px;padding:0 22px 10px;background:#fff;border-bottom:1px solid var(--line,#e7ebe4)}
.ce-tabs .button{background:transparent;border:1px solid transparent;color:#63715d}
.ce-tabs .button.active{background:#e8f0e7;border-color:#d5e2d1;color:#245b43;font-weight:700}
.ce-body{min-height:0;overflow:hidden}
.ce-editor-panel{height:100%;min-height:0;display:flex;flex-direction:column}
.ce-tools{flex:none;display:flex;gap:6px;align-items:center;padding:10px 14px;flex-wrap:wrap;border-bottom:1px solid #e0e8dc}
.ce-tools select{width:auto;max-width:170px}
.ce-tools .text-button{font-size:12px;padding:5px}
.ce-workspace{display:grid;grid-template-columns:184px minmax(260px,1fr) 284px;flex:1;min-height:0}
.ce-steps,.ce-properties{min-height:0;overflow:auto;background:#fff;padding:15px}
.ce-steps{border-right:1px solid #e0e8dc}
.ce-properties{border-left:1px solid #e0e8dc}
.ce-help{margin:7px 0 11px!important}
.ce-step-list{display:flex;flex-direction:column;gap:7px}
.ce-step{width:100%;text-align:left;border:1px solid #e3e9df;border-radius:10px;padding:10px;background:#fbfcf9;color:#41503e;font-size:12px;cursor:pointer;line-height:1.45}
.ce-step small{display:block;color:#7b8875;font-size:10px;margin-top:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-variant-numeric:tabular-nums}
.ce-step.active{border-color:#639172;background:#edf4e9;box-shadow:inset 3px 0 #386d4c;font-weight:700}
.ce-step-actions{display:grid;grid-template-columns:1fr 1fr;gap:5px;margin-top:14px}
.ce-step-actions .button{font-size:11px;padding:5px 3px}
.ce-stage{min-width:0;min-height:0;padding:12px;display:flex;flex-direction:column;gap:8px;background:#f2f5ef}
.ce-view-bar,.ce-gesture-tools,.ce-solid-tools{display:flex;flex-wrap:wrap;align-items:center;gap:5px;flex:none}
.ce-view-bar .button,.ce-gesture-tools .button,.ce-solid-tools .button{font-size:11px}
.ce-view-bar .button.active,.ce-gesture-tools .button.active,.ce-solid-tools .button.active{background:#245b43;color:#fff;border-color:#245b43}
.ce-view-bar select{width:auto;flex:1;min-width:100px;max-width:160px;font-size:11px}
.ce-gesture-tools select{width:auto;font-size:11px;padding:5px}
.ce-sketch-host,.ce-scene-host{position:relative;flex:1;min-height:240px;border:1px solid #d9e4d2;border-radius:13px;background:#f8faf5;overflow:hidden}
.ce-sketch,.ce-scene-host canvas{display:block;width:100%;height:100%;min-height:240px}
.ce-sketch{cursor:crosshair;touch-action:none}
.ce-sketch[data-tool=pan]{cursor:grab}
.ce-sketch[aria-disabled=true]{opacity:.75}
.ce-sketch circle[data-vertex]{cursor:move}
.ce-sketch path[data-step]{cursor:pointer}
.ce-render-error{padding:20px;font-size:13px;color:#966441}
.ce-canvas-help{font-size:10px!important}
.ce-dimension-status{font-size:11px;color:#58714d;flex:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-variant-numeric:tabular-nums}
.ce-property-group+ .ce-property-group{border-top:1px solid #e2e9de;margin-top:16px;padding-top:14px}
.ce-property-group summary{cursor:pointer;font-size:13px;font-weight:700;margin-bottom:12px}
.ce-field{display:flex;flex-direction:column;gap:5px;margin:8px 0;font-size:11px;line-height:1.5;min-width:0}
.ce-field-label{font-weight:600;color:#53664d}
.ce-field small{font-size:10px!important}
.ce-field-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 8px}
.ce-field-grid.thirds{grid-template-columns:repeat(3,minmax(0,1fr))}
.ce-wide{width:100%;font-size:11px}
.ce-inline{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.ce-inline h4{margin:8px 0}
.ce-points{display:flex;flex-direction:column;gap:5px;max-height:300px;overflow:auto;margin:10px -3px;padding:3px}
.ce-point{display:grid;grid-template-columns:25px minmax(0,1fr) minmax(0,1fr) 25px 25px;gap:3px;align-items:center;border-radius:8px;padding:3px}
.ce-point.is-selected{background:#e4efdf}
.ce-point input{padding:6px 5px!important;font-size:11px!important}
.ce-point-index,.ce-point-action{font:inherit;border:1px solid #dce5d7;border-radius:6px;background:#fff;min-height:30px;color:#45633d;cursor:pointer;padding:2px}
.ce-point-index{font-size:10px}
.ce-point-action.danger{color:#a65f49}
.ce-checks{border:0;padding:0;margin:12px 0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 8px}
.ce-checks legend{font-size:11px;font-weight:600;color:#53664d;margin-bottom:6px}
.ce-checks .ce-field{flex-direction:row-reverse;justify-content:flex-end;align-items:center;margin:0;font-size:10px}
.ce-checks input{flex:none;accent-color:#346749;width:15px;height:15px}
.ce-footer{background:#fff;border-top:1px solid #dbe5d6;padding:12px 18px;display:flex;align-items:center;justify-content:space-between;gap:20px;flex:none}
.ce-footer-info{min-width:160px;flex:1;overflow:hidden}
.ce-validation{height:56px;min-height:56px;max-height:56px;overflow:auto;scrollbar-gutter:stable;font-size:12px;line-height:1.55;color:#5b6e50;white-space:pre-line}
.ce-validation[data-status=error],.ce-validation[data-status=invalid],.ce-error{color:#a1563f}
.ce-validation[data-status=working],.ce-validation[data-status=waiting]{color:#806f42}
.ce-warning{color:#93713f;margin-top:4px!important}
.ce-save-status{font-size:10px;color:#85917c;display:block;margin-top:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ce-footer-actions{display:flex;align-items:center;justify-content:flex-end;gap:7px;flex-wrap:wrap;flex:none;max-width:68%}
/* Reserve the cancellation slot while an async geometry request starts/stops. */
.custom-module-editor .ce-footer-actions [data-ce=cancel][hidden]{display:inline-flex!important;visibility:hidden;pointer-events:none}
.ce-install-face{display:flex;align-items:center;gap:5px;font-size:10px}
.ce-install-face select{width:auto;max-width:120px;font-size:11px}
.ce-mount-label{white-space:nowrap;color:#75866b}
.ce-library-panel{height:100%;padding:24px;overflow:auto}
.ce-library-heading{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}
.ce-library-panel>h3{margin-top:25px;margin-bottom:12px}
.ce-library-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:12px;margin:15px 0}
.ce-library-card{border:1px solid #dbe5d5;border-radius:13px;background:#fff;padding:15px;min-width:0}
.ce-library-card h4{font-size:13px;margin:0}
.ce-library-card>p{margin:9px 0}
.ce-library-card .text-button{font-size:11px}
.ce-swatch{width:18px;height:18px;border-radius:6px;flex:none;border:1px solid #0001}
.ce-version{font-size:10px;color:#85927a;border-radius:5px;padding:2px 5px;background:#f0f4ec;margin-left:auto}
.ce-dimensions{font-size:11px;color:#627455}
.ce-trash{margin:24px 0 10px;border-top:1px solid #dbe5d5;padding-top:15px}
.ce-trash summary{cursor:pointer;font-size:12px;color:#7c8775}
.ce-trash-row{display:flex;justify-content:space-between;gap:15px;align-items:center;font-size:12px;padding:8px 0}
.custom-module-editor[data-tab=library] .ce-install-face,.custom-module-editor[data-tab=library] [data-ce=save],.custom-module-editor[data-tab=library] [data-ce=install],.custom-module-editor[data-tab=library] [data-ce=update]{display:none}
.custom-module-editor[data-busy=true] .ce-step-list,.custom-module-editor[data-busy=true] .ce-module-fields,.custom-module-editor[data-busy=true] .ce-step-fields{opacity:.68}
@media(max-width:1100px){
 .ce-workspace{grid-template-columns:155px minmax(240px,1fr) 250px}
 .ce-steps,.ce-properties{padding:11px}
 .ce-footer{gap:12px}.ce-footer-actions{max-width:65%}
}
@media(max-width:900px){
 .custom-module-editor{width:100vw;height:100dvh;max-height:100dvh;border-radius:0;border:0}
 .ce-header{padding:11px 14px 7px}.custom-module-editor h2{font-size:17px}.ce-eyebrow{font-size:9px}
 .ce-tabs{padding:0 14px 8px}.ce-tabs .button{min-height:32px}
 .ce-body{overflow:auto;overscroll-behavior:contain}
 .ce-editor-panel{height:auto;min-height:100%}
 .ce-tools{padding:8px;gap:5px}.ce-tools .button{padding:6px 9px;font-size:11px}
 .ce-tools select{font-size:11px;max-width:160px}
 .ce-workspace{display:flex;flex-direction:column;overflow:visible}
 .ce-stage{order:0;min-height:420px;padding:9px}
 .ce-sketch-host,.ce-scene-host{height:clamp(280px,41dvh,410px);flex:none;min-height:280px}
 .ce-sketch,.ce-scene-host canvas{min-height:280px}
 .ce-steps{order:1;border:1px solid #e0e8dc;border-radius:12px;margin:0 9px 9px;overflow:visible}
 .ce-step-list{flex-direction:row;overflow-x:auto;padding-bottom:3px}
 .ce-step{min-width:155px;max-width:190px;flex:none}
 .ce-step-actions{display:flex;flex-wrap:wrap;margin-top:8px}.ce-step-actions .button{padding:7px 12px}
 .ce-properties{order:2;border:1px solid #e0e8dc;border-radius:12px;margin:0 9px 12px;overflow:visible}
 .ce-field input,.ce-field select{min-height:40px}
 .ce-field-grid.thirds{grid-template-columns:repeat(3,minmax(0,1fr))}
 .ce-point{grid-template-columns:35px minmax(0,1fr) minmax(0,1fr) 35px 35px;gap:5px}
 .ce-point input,.ce-point-action,.ce-point-index{min-height:40px}
 .ce-checks input{width:20px;height:20px}
 .ce-checks .ce-field{min-height:36px;font-size:12px}
 .ce-checks .ce-field-label{font-size:12px}
 .ce-footer{padding:9px 12px calc(9px + env(safe-area-inset-bottom));flex-direction:column;gap:6px;align-items:stretch}
 .ce-footer-info{min-width:0}.ce-validation{font-size:11px;max-height:56px}.ce-save-status{font-size:9px}
 .ce-footer-actions{max-width:none;gap:5px}.ce-footer-actions .button{font-size:11px;min-height:36px;padding:6px 9px}
 .ce-install-face{margin-right:auto}.ce-mount-label{display:none}.ce-install-face select{max-width:102px;font-size:10px;padding:6px}
 .ce-library-panel{height:auto;min-height:100%;padding:16px}
 .ce-library-cards{grid-template-columns:repeat(auto-fill,minmax(230px,1fr))}
 #custom-module-open,#custom-library-open{width:auto;padding:4px 5px;font-size:10px;white-space:nowrap}
}
/* Each mobile library action has its own row; cards cannot cover wrapped tools. */
@media(max-width:760px){
 .workspace{grid-template-rows:minmax(0,1fr) 198px}
 .library{grid-template-rows:28px 36px minmax(0,1fr)}
 .library-bottom{grid-column:1/-1;grid-row:2;margin:0;min-width:0;gap:8px;flex-wrap:nowrap}
 .library-bottom .button{height:34px;flex:none}
 .library-bottom #custom-module-open,.library-bottom #custom-library-open{padding:6px 9px;font-size:11px}
 .library .component-library{grid-row:3}
}
@media(max-width:420px){
 .ce-tools .button{font-size:10px;padding:5px 7px}
 .ce-tools .text-button{font-size:10px}
 .ce-view-bar .button,.ce-gesture-tools .button{padding:6px 8px;font-size:10px}
 .ce-gesture-tools{gap:4px}.ce-gesture-tools select{max-width:78px;font-size:10px}
 .ce-footer-actions .button{font-size:10px;padding:6px 8px}
 .ce-library-cards{grid-template-columns:1fr}
}
/* Direct solid editing: world-space handles share one 3D canvas. */
.ce-solid-tools .ce-field{margin:0 0 0 auto;display:flex;flex-direction:row;align-items:center;gap:6px}
.ce-solid-tools .ce-field-label{font-size:10px}
.ce-solid-tools select{width:96px!important;font-size:11px;padding:6px!important}
.ce-scene-host{isolation:isolate}
.ce-scene-host canvas{touch-action:none;outline-offset:-3px}
.ce-solid-overlay{position:absolute;inset:0;z-index:2;pointer-events:none}
.ce-solid-overlay>svg{display:block;position:absolute;inset:0;width:100%;height:100%;overflow:hidden;pointer-events:none}
.ce-solid-edge{fill:none;stroke:#318366;stroke-width:1.4;opacity:.6;vector-effect:non-scaling-stroke}
.ce-solid-edge.is-hovered{stroke:#efab3c;stroke-width:3;opacity:1}
.ce-solid-handle{fill:#fff;stroke:#267659;stroke-width:2;vector-effect:non-scaling-stroke}
.ce-solid-handle.is-hovered{fill:#fff3ce;stroke:#d78b1c;stroke-width:2.5}
.ce-solid-handle-label{font:600 12px system-ui,sans-serif;fill:#374c38;paint-order:stroke;stroke:#fffffff2;stroke-width:4;stroke-linejoin:round}
.ce-solid-cut-edge{fill:none;stroke:#c77954;stroke-width:1.5;stroke-dasharray:5 4;vector-effect:non-scaling-stroke}
.ce-solid-status{position:absolute;z-index:3;top:10px;left:10px;max-width:calc(100% - 20px);max-height:68px;overflow:hidden;
 padding:6px 9px;border:1px solid #d6e5d3;border-radius:8px;background:#f7fbf4ed;color:#56724d;font-size:11px;line-height:1.45;pointer-events:none}
.ce-solid-status[data-phase=editing],.ce-solid-status[data-phase=computing]{background:#fff8e9ed;border-color:#eadab5;color:#856530}
.ce-solid-status[data-phase=invalid]{background:#fff2eced;border-color:#ebc7b6;color:#9b533b}
.ce-solid-drag-tools{position:absolute;z-index:4;left:10px;right:10px;bottom:10px;display:flex;flex-direction:column;align-items:flex-start;gap:5px;pointer-events:none}
.ce-solid-handle-buttons{display:flex;gap:4px;width:100%;max-width:100%;overflow-x:auto;padding:3px;scrollbar-width:thin;pointer-events:auto;
 border:1px solid #dae5d5;border-radius:10px;background:#fffffff0}
.ce-solid-dimension-button{font-size:10px!important;flex:none;width:124px;min-height:32px!important;padding:5px 7px!important;overflow:hidden;text-overflow:ellipsis;font-variant-numeric:tabular-nums}
.ce-solid-dimension-button[aria-pressed=true]{background:#28634b;color:white;border-color:#28634b}
.ce-solid-dimension{display:flex;align-items:center;gap:6px;max-width:100%;padding:5px 7px;border:1px solid #dae5d5;border-radius:10px;background:#fffffff5;pointer-events:auto;font-size:11px}
.ce-solid-dimension input{width:76px!important;padding:5px 7px!important;font-variant-numeric:tabular-nums}
.ce-solid-dimension .button{font-size:10px;min-height:30px;padding:4px 8px}
.ce-solid-drag-tools :disabled{opacity:.55;cursor:default}
@media(max-width:900px){
 .ce-stage{min-height:460px}
 .ce-scene-host{height:clamp(360px,44dvh,480px);min-height:360px}
 .ce-solid-status{font-size:10px;top:8px;left:8px;max-width:calc(100% - 16px)}
 .ce-solid-drag-tools{left:8px;right:8px;bottom:8px}
 .ce-solid-dimension-button{min-height:44px!important;padding:8px!important}
 .ce-solid-dimension input,.ce-solid-dimension .button{min-height:44px}
 .custom-module-editor .button,.custom-module-editor .text-button,
 .custom-module-editor .ce-close{min-width:44px;min-height:44px}
 .ce-solid-tools .ce-field{margin-left:0}
 .ce-solid-dimension{font-size:10px;gap:5px}
 .ce-field input,.ce-field select{min-height:44px}
}
