:root{--editor-panel:310px;--ed-bg:#15191d;--ed-surface:#1e2429;--ed-border:#363e45;--ed-text:#edf0f2;--ed-muted:#a8b2ba;--ed-green:#24cc8b;--ed-red:#f25b6c}
body.app-editor{margin:0;background:var(--ed-bg);color:var(--ed-text);font-family:Inter,"Segoe UI",sans-serif;font-size:13px;height:100dvh;display:flex;flex-direction:column;overflow:hidden;letter-spacing:0}
.app-editor *{box-sizing:border-box;min-width:0;letter-spacing:0}.app-editor button,.app-editor input,.app-editor select,.app-editor textarea{font:inherit;color:inherit;border:1px solid var(--ed-border);border-radius:4px;background:#252c32;min-height:34px}.app-editor button{cursor:pointer;padding:7px 10px;display:inline-flex;align-items:center;justify-content:center;gap:7px}.app-editor button:hover{background:#354048;border-color:#697680}.app-editor button:disabled{opacity:.45;cursor:wait}.app-editor button.active{background:#173d34;border-color:var(--ed-green);color:#9df0cc}.app-editor .accent{background:#28bb91;color:#08251d;border-color:#28bb91;font-weight:650}.app-editor input,.app-editor select,.app-editor textarea{padding:7px 9px;width:100%;}.app-editor input[type=checkbox]{width:16px;min-height:16px;accent-color:var(--ed-green);flex-shrink:0}.app-editor input[type=range]{padding:0;accent-color:var(--ed-green)}.app-editor label{display:flex;flex-direction:column;gap:6px;margin:12px 0;color:var(--ed-muted)}.app-editor .inline{flex-direction:row;align-items:center;gap:7px}.app-editor .icon-only{width:34px;padding:7px;flex-shrink:0}.app-editor h1{font-size:20px;line-height:1.2;margin:3px 0}.app-editor h2{font-size:14px;margin:0 0 12px}.editor-eyebrow{font-size:10px;color:var(--ed-muted);font-weight:650}.editor-header{display:flex;align-items:center;gap:18px;padding:12px 16px;border-bottom:1px solid var(--ed-border);flex-shrink:0}.editor-header>select{max-width:285px}.editor-header-actions{margin-left:auto;display:flex;gap:6px}.editor-header #editorSaveState{font-size:12px;color:#a5cfbd}.editor-options{display:flex;gap:14px;align-items:center;flex-shrink:0;padding:8px 14px;border-bottom:1px solid var(--ed-border);background:#20262b}.editor-options label{margin:0;flex-direction:row;align-items:center;white-space:nowrap}.editor-options input[type=number]{width:66px}.editor-options select{width:90px}.option-actions{display:flex;gap:5px;margin-left:auto}.state-picker{display:flex;gap:4px}.state-picker i{width:10px;height:10px;border-radius:50%;background:var(--ed-green)}.state-picker [data-state=blocked] i{background:var(--ed-red);border-radius:2px}.state-picker [data-state=unknown] i{background:repeating-linear-gradient(45deg,#88949d 0 2px,#30373e 2px 4px);border-radius:2px}.redo svg{transform:scaleX(-1)}
.editor-layout{flex:1;min-height:0;display:grid;grid-template-columns:52px minmax(240px,1fr) 6px var(--editor-panel)}.drawing-tools{padding:9px 6px;display:flex;flex-direction:column;gap:5px;border-right:1px solid var(--ed-border);overflow-y:auto}.drawing-tools button{width:38px;height:38px}.drawing-tools hr{width:24px;border:0;border-top:1px solid var(--ed-border)}.editor-map-column{display:flex;flex-direction:column;min-height:0}.editor-map-bar{height:40px;flex-shrink:0;display:flex;align-items:center;justify-content:space-between;padding:4px 10px;color:var(--ed-muted)}.editor-map-bar>div{display:flex;align-items:center;gap:6px}.editor-map-bar output{width:44px;text-align:center}.editor-map-bar button{min-height:28px;height:28px;width:28px}#editorViewport{flex:1;position:relative;min-height:0;overflow:hidden;background:#b6bdc1}#editorViewport canvas{position:absolute;inset:0;width:100%;height:100%;touch-action:none}#editorHover{cursor:crosshair;outline:none}.preview-bar{display:flex;gap:8px;align-items:center;flex-wrap:wrap;padding:8px;border-top:1px solid var(--ed-border);min-height:50px}.preview-bar label{margin:0}.preview-bar output{font-size:12px;color:var(--ed-muted);margin-left:auto}.selection-menu{position:absolute;z-index:4;background:#1f282c;box-shadow:0 6px 20px #0006;border:1px solid #88949d;padding:6px;display:flex;gap:4px;max-width:100%;flex-wrap:wrap}.selection-menu[hidden]{display:none}#editorResize{cursor:col-resize;border-left:1px solid var(--ed-border);background:#292f34}#editorResize:hover{background:var(--ed-green)}#editorPanel{overflow:auto;background:#1a2025}.editor-tabs{display:flex;gap:4px;padding:9px;position:sticky;top:0;background:#1a2025;z-index:3;border-bottom:1px solid var(--ed-border)}.editor-tabs button{flex:1}.app-editor [data-panel]{padding:14px}.panel-heading{display:flex;justify-content:space-between}.area-list{display:flex;flex-direction:column;gap:1px;max-height:260px;overflow:auto;margin:0 -7px 14px}.area-row{display:flex;gap:4px;padding:5px;border-left:3px solid var(--area-color,#888);align-items:center}.area-row.selected{background:#36414a}.area-row>button:first-child{flex:1;justify-content:flex-start;text-align:left;background:none;border:0;overflow:hidden;text-overflow:ellipsis}.area-row>button:first-child span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.area-row .mini{font-size:12px;min-height:27px;width:28px;padding:4px}.area-row small{font-size:10px;color:#e6ba67}#areaProperties{border-top:1px solid var(--ed-border);padding-top:14px}#areaSource{display:block;overflow-wrap:anywhere;color:var(--ed-muted);margin:10px 0}.button-row{display:flex;gap:5px;flex-wrap:wrap}.app-editor details{border-top:1px solid var(--ed-border);padding-top:14px;margin-top:16px}.app-editor summary{cursor:pointer;font-weight:600}.editor-status{min-height:30px;display:flex;justify-content:space-between;gap:12px;padding:6px 12px;background:#11161a;color:#adbfc7;border-top:1px solid var(--ed-border);font-size:12px;flex-shrink:0}#editorStatus{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#editorStatus.error{color:#ff92a0}#editorCoordinates{white-space:nowrap}.editor-link{color:#8be4c1;display:inline-block;margin:14px 0}.issue{display:block!important;width:100%;text-align:left;margin-top:6px;border-left:3px solid #efb84b!important;justify-content:flex-start!important;overflow-wrap:anywhere}.version-row{padding:12px 0;border-bottom:1px solid var(--ed-border)}.version-row strong,.version-row small{display:block;margin-bottom:7px}.version-row small{color:var(--ed-muted)}.app-editor dialog{background:#20282e;color:var(--ed-text);border:1px solid #64727d;border-radius:8px;width:min(440px,94vw);padding:22px}.app-editor dialog::backdrop{background:#0008}.app-editor .ui-icon{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;flex-shrink:0}#suggestionControls{padding:10px 0}#suggestionCount{display:block;margin-bottom:8px}.panel-closed .editor-layout{grid-template-columns:52px minmax(240px,1fr)}.panel-closed #editorResize,.panel-closed #editorPanel{display:none}
@media(max-width:1000px){.editor-header{gap:10px}.editor-header>select{max-width:220px}.editor-header #editorSaveState{display:none}.editor-options{gap:8px}.state-picker button{padding:7px}.editor-layout{grid-template-columns:48px minmax(240px,1fr) 6px min(280px,30vw)}}
@media(max-width:700px){body.app-editor{overflow:auto;height:auto;min-height:100dvh}.editor-header{flex-wrap:wrap;padding:10px}.editor-header>div:first-child{flex:1}.editor-header>select{max-width:none;width:52%}.editor-header-actions{width:100%;margin:0;justify-content:flex-end}.editor-header-actions button:not(.icon-only){flex:1}.editor-options{flex-wrap:wrap;padding:8px}.state-picker{width:100%}.state-picker button{flex:1;min-height:40px}.option-actions{margin-left:auto}#finishPolygon{max-width:108px;font-size:12px}.editor-layout{display:grid;grid-template-columns:46px minmax(0,1fr);min-height:64dvh;flex:none}.drawing-tools{grid-column:1;grid-row:1;padding:6px 3px}.drawing-tools button{width:38px;height:40px;flex-shrink:0}.editor-map-column{grid-column:2;height:64dvh;min-height:430px}.editor-map-bar{height:40px}#editorResize{display:none}#editorPanel{grid-column:1/-1;max-height:65dvh;border-top:1px solid var(--ed-border)}.editor-tabs button{min-height:44px}.preview-bar{gap:5px}.preview-bar button{min-height:40px}.preview-bar output{width:100%;margin-left:0}.editor-status{position:sticky;bottom:0;z-index:4}.panel-closed .editor-layout{grid-template-columns:46px minmax(0,1fr)}#editorCoordinates{font-size:10px}.editor-map-bar strong{font-size:11px}.editor-map-bar .icon-only{width:26px}.app-editor dialog input{font-size:16px}}
.app-editor [hidden]{display:none!important}.app-editor .shell-language{flex-direction:row;margin:0;align-items:center}.app-editor .shell-language select{width:58px}.editor-options label{width:auto;flex:none}.editor-options label>span{flex-shrink:0}#brushWidth{width:66px;flex:0 0 66px}
#editorExportFormat{width:76px;flex-shrink:0}
#editorDownload{color:#77ddca;max-width:40%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex-shrink:0}
.layer-controls{border-bottom:1px solid var(--ed-border);padding-bottom:12px;margin-bottom:10px}.layer-controls label{margin-top:0}.layer-controls .button-row>button:first-child{flex:1}
#layerUp svg{transform:rotate(-90deg)}#layerDown svg{transform:rotate(90deg)}
.editor-map-bar{gap:10px}.editor-map-bar>div{margin-left:auto;flex-shrink:0}.editor-map-bar #activeLayer{width:auto;max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left;border-left:3px solid var(--area-color);padding-left:8px;color:var(--ed-text);font-size:12px}
.pending-layer{padding:10px;border:1px dashed #82929f;border-radius:4px;margin:5px;color:#c8d5db}
#suggestionControls{position:absolute;bottom:12px;left:12px;max-width:calc(100% - 24px);z-index:3;background:#202a30;border:1px solid #597684;border-radius:4px;padding:10px;box-shadow:0 4px 15px #0005}
#suggestionControls button:first-child{background:#234d43;border-color:#3caa84}.selection-menu{border:2px solid #39dcff;max-width:min(100%,350px)}
.selection-menu [data-fill-state=walkable]{border-bottom:3px solid var(--ed-green)}.selection-menu [data-fill-state=blocked]{border-bottom:3px solid var(--ed-red)}
#editorHover[data-panning]{cursor:grabbing!important}#editorHover:focus-visible{outline:2px solid #50caed;outline-offset:-2px}.app-editor .icon-only:focus-visible{outline:2px solid #50caed}
@media(max-width:700px){.editor-map-bar{height:60px;flex-wrap:wrap;gap:2px}.editor-map-bar #activeLayer{font-size:10px;max-width:115px}.editor-map-bar>strong{max-width:95px}.editor-map-bar>div{gap:2px}.selection-menu button{min-height:40px}}
@media(prefers-reduced-motion:no-preference){.app-editor button{transition:background .12s,border-color .12s}}

/* Calibrated base-map library and independent access-map workspaces. */
.editor-header{gap:16px;padding:10px 16px}.editor-context{display:flex;align-items:end;gap:6px;flex:1;max-width:690px}.editor-context label{margin:0;gap:3px;font-size:10px;flex:1}.editor-context label:first-child{max-width:250px}.editor-context select{height:34px}.editor-library-link{width:34px;height:34px;display:inline-flex;align-items:center;justify-content:center;color:var(--ed-text);border:1px solid var(--ed-border);border-radius:4px;background:#252c32;flex-shrink:0}.editor-library-link:hover{background:#354048}.editor-header #editorSaveState{max-width:120px}.editor-workflow{height:34px;display:flex;align-items:center;gap:18px;padding:4px 10px;border-bottom:1px solid var(--ed-border);color:var(--ed-muted);font-size:10px;white-space:nowrap;overflow:hidden;flex-shrink:0}.editor-workflow>span{display:flex;align-items:center;gap:6px}.editor-workflow b{display:grid;place-items:center;width:18px;height:18px;border:1px solid #57717a;border-radius:50%;color:#8ce1c1;font-size:10px}.editor-workflow>span+span::before{content:'›';color:#58717b;margin-right:10px}.layer-controls .danger-action{width:100%;margin-top:7px;color:#ff9aa6;background:#2d2024;border-color:#6b353c}.layer-controls .danger-action:hover{background:#46262d;border-color:#ba5966}.route-ready{display:inline-flex;align-items:center;gap:5px;color:#78dbb5;font-size:10px;margin-bottom:7px}.route-ready .ui-icon{width:14px;height:14px}.dialog-help{color:var(--ed-muted);line-height:1.45}.app-editor dialog .button-row{justify-content:flex-end}
@media(max-width:1150px){.editor-context{max-width:540px}.editor-header{gap:10px}.editor-header #editorSaveState{display:none}}
@media(max-width:700px){.editor-header>select{width:auto}.editor-context{order:3;width:100%;max-width:none}.editor-context label:first-child{max-width:none}.editor-context label{min-width:0}.editor-workflow{display:none}}
/* Short wide Web screens keep the existing desktop tools/panel, but the page
   must scroll instead of shrinking the drawing surface between fixed bands. */
@media (orientation:landscape) and (max-height:560px) and (min-width:701px) {
  body.app-editor { height:auto; min-height:100dvh; overflow:auto; }
  .app-editor > .editor-layout { flex:none; height:max(24rem,75dvh); min-height:24rem; }
  .app-editor #editorViewport { min-height:16rem; }
}
