:root{color-scheme:dark;--bg:#000;--panel:#080b0a;--line:#202725;--fg:#e9f1ed;--muted:#7e8b85;--green:#66e5a1;--button:#121916}
*{box-sizing:border-box}html,body{width:100%;height:100%;margin:0;overflow:hidden;overscroll-behavior:none}
body{font:13px/1.35 "Segoe UI",system-ui,-apple-system,sans-serif;color:var(--fg);background:#000}
button,input{font:inherit}button{cursor:pointer;color:inherit;touch-action:manipulation}
button:disabled{opacity:.3;cursor:default}button:focus-visible,input:focus-visible{outline:2px solid var(--green);outline-offset:2px}
#app{position:relative;display:flex;flex-direction:column;width:100%;height:100vh;height:100dvh;overflow:hidden;isolation:isolate}
.topbar{display:flex;align-items:center;justify-content:space-between;gap:8px;flex:0 0 48px;padding:0 max(10px,env(safe-area-inset-right)) 0 max(12px,env(safe-area-inset-left));background:#000;border-bottom:1px solid #151b18}
.brand{white-space:nowrap;font-variant:small-caps;letter-spacing:.105em;font-size:15px;font-weight:600;display:flex;align-items:center;gap:8px}
.brand b{font-weight:350;color:#a9b8b0}.brand-mark{font-size:20px;color:var(--green)}
.head-actions{display:flex;align-items:center;gap:5px;min-width:0}
.btn{min-height:34px;border:1px solid #28332c;border-radius:10px;padding:0 11px;background:#111613;color:#dce9e1;white-space:nowrap}
.btn:hover{background:#1a2420}.btn.primary{background:#16482f;border-color:#236d46;color:#d8ffea}
.btn.primary:hover{background:#206641}.btn.square{width:34px;padding:0;font-size:20px;line-height:1}
.btn[aria-pressed=true]{color:var(--green);border-color:#39734f}
.tabs{display:flex;align-items:stretch;flex:0 0 37px;gap:3px;padding:4px 7px;background:#070807;border-bottom:1px solid #1b231e;overflow-x:auto;overflow-y:hidden;scrollbar-width:none}
.tabs::-webkit-scrollbar,.layer-list::-webkit-scrollbar{display:none}
.tab{display:flex;align-items:center;gap:4px;flex:0 0 auto;max-width:170px;min-width:65px;padding:0 5px 0 12px;background:transparent;border:1px solid transparent;border-radius:8px;color:#89948f}
.tab.active{background:#15241b;border-color:#2a4e38;color:#e6fff0}
.tab-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:125px;font-size:12px}
.tab-close{flex:0 0 24px;height:23px;padding:0;border:0;background:none;border-radius:6px;color:inherit;font-size:17px}
.tab-close:hover{background:#34553f}
.tools{display:grid;grid-template-columns:repeat(11,minmax(0,1fr));align-items:stretch;gap:4px;flex:0 0 57px;padding:5px max(8px,env(safe-area-inset-right)) 5px max(8px,env(safe-area-inset-left));border-bottom:1px solid #18211b;background:#070b08}
.tool{min-width:0;min-height:46px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;border:1px solid transparent;border-radius:9px;background:transparent;color:#92a79b}
.tool:hover{background:#151f19}.tool.active{background:#133321;color:#74efaa;border-color:#2b6445}
.tool span{height:23px;font:23px/23px "Segoe UI Symbol","Segoe UI",system-ui,sans-serif}
.tool small{font-size:10px;line-height:12px;font-variant:small-caps;letter-spacing:.045em}
.workspace{position:relative;min-height:0;flex:1;overflow:hidden;background:#000;touch-action:none}
#canvas{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none;user-select:none;-webkit-user-select:none}
.empty{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;pointer-events:none;color:#899c90;text-align:center;user-select:none}
.empty[hidden]{display:none}
.empty strong{font-size:16px;color:#cfe6d7;font-weight:550;letter-spacing:.03em}.empty span{font-size:12px}
.empty-icon{display:grid;place-items:center;width:54px;height:54px;border:1px solid #25513b;border-radius:17px;color:var(--green);font-size:32px}
.empty button{pointer-events:auto}
.view-controls{position:absolute;bottom:10px;left:50%;transform:translateX(-50%);display:flex;gap:4px;align-items:center;background:rgba(2,9,5,.84);padding:4px;border:1px solid #1b2c21;border-radius:12px;backdrop-filter:blur(10px)}
.view-controls .btn{height:32px;min-height:32px}.zoom-readout{min-width:65px;font-size:11px;font-variant:small-caps;letter-spacing:.08em}
.gesture-hint{position:absolute;left:12px;top:10px;font-size:10px;color:#78887d;pointer-events:none}
.properties{flex:0 0 auto;padding:6px max(11px,env(safe-area-inset-right)) max(9px,env(safe-area-inset-bottom)) max(11px,env(safe-area-inset-left));background:#080b09;border-top:1px solid #243028;max-height:190px}
.property-top{display:flex;align-items:center;justify-content:space-between;margin-bottom:4px;min-height:19px}
.selection-label{font-variant:small-caps;letter-spacing:.14em;font-size:11px;color:#b4cbbd;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.text-button{border:0;padding:1px 3px;background:none;color:#c69a9a;font-size:11px}
.text-row{display:flex;align-items:center;gap:8px;margin:3px 0 7px}.text-row[hidden]{display:none}
.text-row label{white-space:nowrap;color:var(--muted);font-size:11px}.text-row input{width:100%;min-width:0;height:30px;border:1px solid #304036;border-radius:7px;background:#030705;padding:0 9px;color:var(--fg)}
.property-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px 14px}
.range-field{display:flex;flex-direction:column;gap:4px;min-width:0}
.range-field>span{display:flex;justify-content:space-between;gap:4px;color:#98a9a0;font-size:11px;white-space:nowrap}
.range-field output{color:#c2e9cf;font-variant-numeric:tabular-nums}
.range-field input[type=range]{display:block;width:100%;height:19px;margin:0;appearance:none;-webkit-appearance:none;background:transparent;cursor:pointer;touch-action:pan-y}
.range-field input[type=range]::-webkit-slider-runnable-track{height:7px;border-radius:20px;background:#334239}
.range-field input[type=range]::-moz-range-track{height:7px;border-radius:20px;background:#334239}
.range-field input[type=range]::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;width:13px;height:13px;border-radius:8px;margin-top:-3px;background:#94edb7;border:2px solid #143524}
.range-field input[type=range]::-moz-range-thumb{width:11px;height:11px;border-radius:8px;background:#94edb7;border:2px solid #143524}
.range-field input[type=range]:disabled{opacity:.28}
.hue-field input[type=range]::-webkit-slider-runnable-track{background:linear-gradient(90deg,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}
.hue-field input[type=range]::-moz-range-track{background:linear-gradient(90deg,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}
.layers-panel{position:absolute;z-index:5;top:142px;right:0;bottom:0;width:min(340px,88vw);display:flex;flex-direction:column;background:rgba(6,11,8,.97);border-left:1px solid #26392d;box-shadow:-15px 0 40px #000b;transform:translateX(105%);transition:transform .18s ease;visibility:hidden;overflow:hidden;backdrop-filter:blur(18px)}
.layers-panel.open{transform:translateX(0);visibility:visible}
.panel-head{display:flex;align-items:center;gap:9px;min-height:48px;padding:7px 10px 7px 15px;border-bottom:1px solid var(--line)}
.panel-head strong{letter-spacing:.13em;font-variant:small-caps}.panel-head span{color:var(--muted);font-size:11px}.panel-head button{margin-left:auto}
.layer-list{flex:1;overflow:auto;overscroll-behavior:contain;scrollbar-width:none;padding:7px;min-height:0}
.layer-row{display:flex;align-items:center;gap:4px;min-height:46px;margin-bottom:5px;border:1px solid #18271d;border-radius:9px;background:#0d140f}
.layer-row.selected{background:#132b1a;border-color:#337c4b}
.layer-row.dragging{opacity:.6;border-color:#78e7a5}.layer-row.drop-target{box-shadow:0 -2px var(--green)}
.layer-grip{display:grid;place-items:center;width:26px;align-self:stretch;flex-shrink:0;cursor:grab;touch-action:none;font-size:18px;color:#70927b;user-select:none}
.layer-name{flex:1;display:flex;flex-direction:column;justify-content:center;min-width:0;align-self:stretch;padding:3px 0;border:0;background:none;text-align:left}
.layer-name strong{font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:500}
.layer-name span{font-size:10px;color:var(--muted)}
.layer-action{display:grid;place-items:center;flex:0 0 29px;width:29px;height:32px;border:0;border-radius:6px;background:none;font-size:16px;color:#9faf9f}
.layer-action:hover{background:#26392d}.layer-action.delete{color:#bd8b90}
.layer-row.muted .layer-name{opacity:.43}.panel-foot{flex:0 0 auto;padding:12px;color:#7f9486;font-size:11px;border-top:1px solid var(--line);text-align:center}
dialog{width:min(360px,calc(100vw - 28px));max-height:calc(100dvh - 30px);overflow:hidden;padding:0;border:1px solid #365140;border-radius:16px;background:#090e0b;color:var(--fg);box-shadow:0 20px 100px #000}
dialog::backdrop{background:#000b;backdrop-filter:blur(7px)}
.dialog-body{display:flex;flex-direction:column;gap:17px;padding:18px}.dialog-head{display:flex;align-items:center;justify-content:space-between}
.dialog-head strong{font-variant:small-caps;font-size:16px;letter-spacing:.12em}
.format-row{display:flex;background:#131e16;border:1px solid #2a3d31;border-radius:10px;padding:3px}
.format-row label{flex:1;cursor:pointer}.format-row input{position:absolute;opacity:0}.format-row span{display:grid;place-items:center;min-height:33px;border-radius:8px;color:#a3b2a7}
.format-row input:checked+span{background:#255335;color:#d4ffe3}
.export-info{font-size:12px;text-align:right;color:#98c4a5;margin-top:-12px}
.dialog-actions{display:flex;justify-content:flex-end;gap:9px;margin-top:6px}
#toast{position:fixed;z-index:20;bottom:calc(16px + env(safe-area-inset-bottom));left:50%;transform:translate(-50%,14px);opacity:0;pointer-events:none;max-width:90vw;padding:10px 15px;border-radius:10px;background:#20432e;border:1px solid #3d8053;color:#e4ffeb;transition:opacity .2s,transform .2s;text-align:center;font-size:12px}
#toast.visible{opacity:1;transform:translate(-50%,0)}
@media(max-width:690px){
 .brand{font-size:12px;letter-spacing:.055em}.brand-mark{font-size:17px}.head-actions{gap:4px}.head-actions .btn{padding:0 9px;font-size:12px}.head-actions .btn.square{width:31px;padding:0;font-size:18px}.desktop-label{display:none}
 .tools{grid-template-columns:repeat(6,minmax(0,1fr));flex-basis:98px;gap:3px;padding:4px 7px}
 .tool{min-height:42px}.tool span{height:20px;font-size:21px;line-height:20px}.tool small{font-size:9px}
 .property-grid{grid-template-columns:repeat(2,minmax(0,1fr));column-gap:15px;row-gap:4px}
 .properties{padding-top:6px}.range-field{gap:2px}.range-field input[type=range]{height:16px}
 .layers-panel{top:183px}
}
@media(max-width:360px){.brand{font-size:11px}.brand-mark{display:none}.head-actions .btn{padding:0 7px}.tools{gap:1px}}
@media(max-height:520px) and (orientation:landscape){
 #app{display:grid;grid-template-columns:minmax(0,1fr) 230px;grid-template-rows:43px 32px 55px minmax(0,1fr)}
 .topbar,.tabs,.tools{grid-column:1/-1;min-height:0}.topbar{grid-row:1}.tabs{grid-row:2}.tools{grid-row:3;grid-template-columns:repeat(11,minmax(0,1fr));padding:3px 8px}
 .workspace{grid-row:4;grid-column:1}.properties{grid-row:4;grid-column:2;max-height:none;overflow-y:auto;scrollbar-width:none;border-top:0;border-left:1px solid var(--line);padding:7px}
 .property-grid{grid-template-columns:1fr}.layers-panel{top:130px;width:min(320px,60vw)}
}
@media(prefers-reduced-motion:reduce){.layers-panel,#toast{transition:none}}

/* Touch-first editor: a full-width single icon row at the thumb edge. */
#app{display:flex;flex-direction:column}
.topbar{order:0}.tabs{order:1}.workspace{order:2;flex:1;min-height:0}
.properties{order:3;padding:9px 11px max(11px,env(safe-area-inset-bottom));max-height:none;flex:0 0 auto}
.tools{order:4;display:grid;grid-template-columns:repeat(11,minmax(0,1fr));gap:0;flex:0 0 55px;padding:3px max(4px,env(safe-area-inset-right)) 3px max(4px,env(safe-area-inset-left));background:#090d0a;border-top:1px solid #1c2c22;border-bottom:0}
.tool{height:48px;min-height:48px;min-width:0;padding:0;display:flex;align-items:center;justify-content:center;border-radius:9px;touch-action:manipulation}
.tool span{height:auto;font:25px/1 "Segoe UI Symbol","Segoe UI",system-ui,sans-serif}
.tool small{display:none}
.range-field{gap:5px}
.range-field>span{font-size:12px;color:#b0c8b7;letter-spacing:.02em}
.range-field output{display:none}
.range-field input[type=range]{height:31px;touch-action:pan-y}
.range-field input[type=range]::-webkit-slider-runnable-track{height:12px;border-radius:12px;background:#2b4133}
.range-field input[type=range]::-moz-range-track{height:12px;border-radius:12px;background:#2b4133}
.range-field input[type=range]::-webkit-slider-thumb{width:21px;height:21px;border-radius:12px;margin-top:-4.5px;background:#7ff0ad;border:2px solid #183925}
.range-field input[type=range]::-moz-range-thumb{width:19px;height:19px;border-radius:12px;background:#7ff0ad;border:2px solid #183925}
.hue-field input[type=range]::-webkit-slider-runnable-track{background:linear-gradient(90deg,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}
.hue-field input[type=range]::-moz-range-track{background:linear-gradient(90deg,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}
.property-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px 20px}
.property-top{margin-bottom:6px}
.text-row{margin:3px 0 8px}
.text-row input{min-height:40px;font-size:15px}
.range-field[hidden],#rotateField[hidden]{display:none}
#smoothingField[hidden]{display:none}
.layers-panel{top:85px;bottom:55px;right:0;width:min(var(--panel-width,300px),calc(100vw - 10px));max-height:none}
.panel-resize{position:absolute;left:0;top:0;bottom:0;width:13px;z-index:2;cursor:ew-resize;touch-action:none;background:linear-gradient(90deg,#426b4d 0 2px,transparent 2px)}
.panel-resize:after{content:"";position:absolute;top:48%;left:3px;height:40px;width:3px;background:#4b8260;border-radius:3px}
.panel-head{height:48px;padding:5px 8px 5px 18px}
.layer-list{padding:6px 8px 6px 16px}
.layer-row{min-height:41px;max-height:43px;gap:3px;margin-bottom:3px}
.layer-grip{width:23px}
.layer-name{padding:0 3px}
.layer-name strong{font-size:13px}
.layer-name span{display:none}
.layer-action{flex:0 0 33px;width:33px;height:36px;font-size:19px}
.layer-action.lock{font-size:17px}
.layer-action.delete{color:#df9fa1}
.panel-foot{display:none}
.btn.danger{border-color:#713638;background:#64282d;color:#ffe2e3}
.close-dialog p{margin:0;color:#a5b4aa;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.selection-label{font-size:12px}
.text-button{font-size:13px}
@media(max-width:690px){
 .tools{grid-template-columns:repeat(11,minmax(0,1fr));flex-basis:55px;gap:0;padding:3px 4px}
 .tool{min-height:48px;height:48px}
 .tool span{height:auto;font-size:24px;line-height:1}
 .properties{padding:7px 10px max(8px,env(safe-area-inset-bottom))}
 .property-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 14px}
 .range-field{gap:3px}
 .range-field input[type=range]{height:29px}
 .layers-panel{top:85px;bottom:55px}
}
@media(max-width:360px){.tool span{font-size:22px}}
@media(max-height:520px) and (orientation:landscape){
 #app{display:flex;flex-direction:column}
 .topbar,.tabs,.workspace,.properties,.tools{grid-row:auto;grid-column:auto}
 .topbar{flex:0 0 43px}.tabs{flex:0 0 32px}
 .workspace{flex:1;min-height:0}
 .properties{overflow:visible;max-height:125px;border-top:1px solid #243028;border-left:0}
 .property-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
 .tools{flex:0 0 50px}
 .tool{height:43px;min-height:43px}
 .layers-panel{top:75px;bottom:50px;width:min(var(--panel-width,300px),calc(100vw - 10px))}
}

/* Actual export dimensions and encoded file size. */
#exportDialog .export-info{display:flex;justify-content:space-between;align-items:center;gap:9px;text-align:left;margin-top:-8px;font-variant-numeric:tabular-nums}
#exportFileSize{white-space:nowrap;color:#d7e8da}

/* Compact photo editor layout */
.topbar{order:0;flex:0 0 46px;min-height:46px;padding:4px 6px;gap:5px;overflow:hidden}
.brand{flex:0 0 30px;display:grid;place-items:center;min-width:0;margin:0}
.brand-mark{font-size:24px;line-height:1;color:var(--green)}
.tabs{order:initial;flex:1 1 auto;min-width:0;min-height:37px;max-height:37px;border:0;background:none;padding:2px;gap:3px}
.tab{min-width:0;max-width:170px;flex:0 0 auto;height:32px;gap:2px;padding:0 4px 0 9px}
.tab-title{font-size:12px;max-width:123px;min-width:0;flex:0 1 auto;display:block;appearance:none;-webkit-appearance:none;background:transparent;border:0;border-radius:0;box-shadow:none;margin:0;padding:0;color:inherit;font-family:inherit;font-weight:inherit;line-height:inherit;text-align:left;text-decoration:none}
.tab:not(.active) .tab-close{display:none}
.tab.active .tab-close{display:grid;place-items:center;font-size:20px;flex-basis:23px}
.head-actions{flex:0 0 auto;gap:3px}
.head-actions .btn.square{min-height:34px;width:34px;padding:0;font-size:21px;display:grid;place-items:center;border-radius:9px}
.btn svg,.tool svg,.control-icon svg,.option-button svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.tools{order:4;display:grid;grid-template-columns:repeat(12,minmax(0,1fr));flex:0 0 54px;padding:4px 3px max(4px,env(safe-area-inset-bottom));gap:0;min-height:52px}
.tool{min-width:0;height:43px;min-height:43px;border:0;border-radius:8px;font-size:24px;display:grid;place-items:center;padding:0}
.tool svg{width:23px;height:23px}
.properties{order:3;flex:0 0 auto;padding:8px 9px;max-height:none;min-height:0}
.property-top,.text-row{display:none!important}
.property-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 12px;align-items:center}
.range-field{display:flex;flex-direction:row;align-items:center;gap:8px;min-width:0;height:34px;padding:0}
.range-field>span,.range-field .control-icon{display:grid;place-items:center;width:26px;min-width:26px;height:32px;color:#9ac8a8}
.range-field input[type=range]{flex:1;min-width:0;width:auto;height:32px;margin:0;appearance:none;-webkit-appearance:none;touch-action:pan-y;background:transparent}
.range-field input[type=range]::-webkit-slider-runnable-track{height:16px;background:#31433a;border-radius:7px}
.range-field input[type=range]::-moz-range-track{height:16px;background:#31433a;border-radius:7px}
.range-field input[type=range]::-webkit-slider-thumb{width:25px;height:26px;margin-top:-5px;border-radius:8px;background:#8aebb0;border:2px solid #315940;box-shadow:none}
.range-field input[type=range]::-moz-range-thumb{width:23px;height:24px;border-radius:8px;background:#8aebb0;border:2px solid #315940;box-shadow:none}
.hue-field input[type=range]::-webkit-slider-runnable-track,#outlineField.color-mode input[type=range]::-webkit-slider-runnable-track{background:linear-gradient(90deg,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}
.hue-field input[type=range]::-moz-range-track,#outlineField.color-mode input[type=range]::-moz-range-track{background:linear-gradient(90deg,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}
.range-field[hidden],.option-field[hidden],.pen-options[hidden],#rotateField[hidden],#outlineField[hidden],#smoothField[hidden]{display:none!important}
.control-button{appearance:none;background:none;border:0;border-radius:7px;padding:2px;color:#d6eddb;touch-action:manipulation}
#outlineField.color-mode .control-icon{color:#f0d17d}
.option-field{display:flex;align-items:center;height:34px}
.option-button{width:42px;height:33px;border:1px solid #2b4030;border-radius:9px;background:#101b13;color:#819587;display:grid;place-items:center}
.option-button[aria-pressed=true]{background:#1d5631;color:#9cfdbe}
#canvasEditor{position:absolute;z-index:4;top:0;left:0;min-height:1.25em;min-width:40px;width:220px;height:auto;padding:0;margin:0;resize:none;overflow:hidden;white-space:pre;outline:1px dashed #69e8a0;outline-offset:3px;border:0;background:transparent;font-family:"Segoe UI",system-ui,sans-serif;font-weight:600;line-height:1.24;transform-origin:0 0;color:#eaf4ed;box-sizing:border-box;touch-action:manipulation}
#canvasEditor[hidden]{display:none!important}
.layers-panel{top:46px;bottom:54px;display:flex;flex-direction:column}
.layers-panel.left{right:auto;left:0;transform:translateX(-105%);border-left:0;border-right:1px solid #26392d;box-shadow:15px 0 40px #000b}
.layers-panel.left.open{transform:translateX(0)}
.layers-panel.left .panel-resize{left:auto;right:0;cursor:ew-resize;background:linear-gradient(270deg,#426b4d 0 2px,transparent 2px)}
.layers-panel.left .panel-resize:after{left:auto;right:3px}
.panel-head{order:2;flex:0 0 45px;height:45px;border-top:1px solid #24332a;border-bottom:0}
.layer-list{order:1;flex:1;min-height:0}
@media(max-width:690px){
 .topbar{min-height:46px;height:46px;flex-basis:46px}
 .brand{font-size:22px;flex-basis:25px}
 .head-actions{gap:2px}.head-actions .btn.square{width:32px;min-height:33px}
 .tabs{flex:1 1 auto;min-width:0}
 .tools{grid-template-columns:repeat(12,minmax(0,1fr));gap:0;flex:0 0 54px;padding:4px 2px}
 .tool{height:44px;min-height:44px;font-size:22px}
 .tool svg{width:21px;height:21px}
 .properties{padding:7px 8px}
 .property-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px 10px}
 .range-field{height:35px}
 .range-field input[type=range]{height:33px}
 .layers-panel{top:46px;bottom:54px}
}
@media(max-width:360px){
 .topbar{gap:2px;padding:3px 3px}
 .brand{flex-basis:21px}.brand-mark{display:block;font-size:21px}
 .tab{padding:0 2px 0 6px}
 .head-actions .btn.square{width:29px;padding:0}
 .tool{font-size:20px}.tool svg{width:20px;height:20px}
 .property-grid{gap:6px}
 .range-field{gap:4px}.range-field>span,.range-field .control-icon{width:24px;min-width:24px}
}
@media(max-height:520px) and (orientation:landscape){
 .topbar{flex:0 0 42px}
 .workspace{flex:1}
 .properties{max-height:130px;padding:5px 8px}
 .property-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:4px 10px}
 .tools{flex:0 0 47px}.tool{height:40px;min-height:40px}
 .layers-panel{top:42px;bottom:47px}
}

.properties[hidden]{display:none!important}
.layer-action svg{width:19px;height:19px;display:block;margin:auto;fill:none;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round}
.layer-row .layer-action.lock{color:#96baa2}
.layer-row .layer-action.toggle{color:#b9d1c0}
.layer-row.muted .layer-action.toggle{color:#6d8272}
.tab-rename{flex:1;min-width:0;width:90px;height:27px;padding:0 4px;border:1px solid #64a87b;background:#0d1b13;border-radius:5px;color:#e6fff0;font:12px "Segoe UI",sans-serif}

/* Reorder by dragging names; actions give way to the full layer name. */
.layer-list{position:relative}
.layer-row{min-width:0}
.layer-name{flex:1 1 auto;min-width:0;display:flex;flex-direction:row;align-items:center;padding:0 8px;touch-action:none;cursor:grab;user-select:none;-webkit-user-select:none}
.layer-name:active{cursor:grabbing}
.layer-name strong{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1 1 auto}
.layer-row.hide-lock .layer-action.lock,
.layer-row.hide-visible .layer-action.toggle,
.layer-row.hide-delete .layer-action.delete{display:none!important}
.layer-row.dragging{opacity:.5;border-color:var(--green)}
.layer-drop-indicator{position:absolute;z-index:4;left:16px;right:8px;height:3px;margin-top:-1.5px;border-radius:3px;background:var(--green);pointer-events:none;box-shadow:0 0 0 1px #07130d}
.layer-drop-indicator[hidden]{display:none}
.tools{grid-template-columns:repeat(13,minmax(0,1fr))}
@media(max-width:690px){.tools{grid-template-columns:repeat(13,minmax(0,1fr))}}
@media(max-width:360px){.tool{font-size:18px}.tool svg{width:19px;height:19px}}

/* Keep the canvas coordinate system fixed while tool properties open or close. */
#app>.workspace{flex:1 1 auto;min-height:0}
#app>.properties{position:absolute;z-index:4;left:0;right:0;bottom:54px;width:100%;flex:none;margin:0;background:#080e0bdc;backdrop-filter:blur(10px)}
#app>.properties[hidden]{display:none!important}
@media(max-height:520px) and (orientation:landscape){
 #app>.properties{bottom:47px}
}

/* Identifiable slider labels instead of cryptic glyphs. */
.range-field>span.control-name,
.range-field>button.control-name{
  display:flex;align-items:center;justify-content:flex-start;
  flex:0 0 57px;width:57px;min-width:57px;height:33px;
  margin:0;padding:0;font:500 11px/1.2 "Segoe UI",system-ui,sans-serif;
  letter-spacing:.005em;white-space:nowrap;color:#bfd7c7;
}
.range-field>button.control-name{appearance:none;-webkit-appearance:none;border:0;background:none;text-align:left;touch-action:manipulation}
#outlineField.color-mode>button.control-name{color:#f0d17d}
.option-button{min-width:57px;width:57px;font-size:12px;font-weight:550;letter-spacing:.01em}
/* Pen choices are a touch-hold palette above the tool bar. */
.tool[data-tool="pen"]{touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
.pen-picker{
  position:fixed;z-index:12;display:flex;align-items:stretch;gap:5px;
  max-width:calc(100vw - 14px);padding:7px;border:1px solid #355b43;
  border-radius:14px;background:#101a14;box-shadow:0 6px 25px #000c;
}
.pen-picker[hidden]{display:none!important}
.pen-picker button{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:4px;width:69px;min-width:0;height:69px;padding:3px 2px;
  border:1px solid transparent;border-radius:9px;background:transparent;color:#b5d7c1;
  touch-action:manipulation;
}
.pen-picker button svg{width:34px;height:34px;display:block;flex:0 0 34px}
.pen-picker button span{font:500 10px/1.2 "Segoe UI",system-ui,sans-serif;white-space:nowrap}
.pen-picker button[aria-pressed="true"]{background:#17432b;border-color:#427f59;color:#a7ffd0}
.pen-picker button:focus-visible{outline:2px solid #78eba8;outline-offset:0}
@media(max-width:360px){
 .range-field>span.control-name,.range-field>button.control-name{flex-basis:50px;width:50px;min-width:50px;font-size:10.5px}
 .pen-picker{gap:3px;padding:5px}
 .pen-picker button{width:calc((100vw - 39px)/4)}
}

/* The clear strip immediately to the right of each layer name scrolls the list.
   Pointer capture for reordering remains on the name, never on this strip. */
.layer-row .layer-scroll-zone{
  display:block;flex:0 0 28px;align-self:stretch;min-width:28px;
  cursor:ns-resize;touch-action:pan-y;overscroll-behavior:contain;
}
@media(max-width:360px){.layer-row .layer-scroll-zone{flex-basis:25px;min-width:25px}}

/* Export controls use labels and live numeric values, not ambiguous icons. */
#exportDialog .export-range{display:flex;flex-direction:row;align-items:center;gap:9px;min-width:0;width:100%;height:36px}
#exportDialog .export-range>span.export-range-label{
  display:block;flex:0 0 77px;width:77px;min-width:77px;height:auto;
  font:500 12px/1.25 "Segoe UI",system-ui,sans-serif;
  color:#d1e5d7;white-space:nowrap;text-align:left;
}
#exportDialog .export-range input[type=range]{flex:1 1 auto;width:100%;min-width:0}
#exportDialog .export-range output{
  display:block;flex:0 0 38px;min-width:38px;width:38px;
  color:#b5dbc2;text-align:right;font-size:12px;
  font-variant-numeric:tabular-nums;
}

/* Main sliders: recognizable icons only, no visible labels or values. */
#app>.properties{
  background:#080e0b;backdrop-filter:none;
  padding:7px max(9px,env(safe-area-inset-right)) 7px max(9px,env(safe-area-inset-left));
}
#app>.properties .property-grid{
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
  gap:6px 11px;align-items:center;
}
#app>.properties .range-field{
  display:flex;flex-direction:row;align-items:center;gap:6px;
  height:36px;min-width:0;padding:0;
}
#app>.properties .range-field>.control-icon{
  display:flex;justify-content:center;align-items:center;
  flex:0 0 27px;width:27px;min-width:27px;height:34px;
  padding:0;margin:0;color:#b0d0ba;
}
#app>.properties .range-field>.control-icon svg,
#app>.properties .option-button svg{display:block;width:23px;height:23px;flex-shrink:0}
#app>.properties .range-field>button.control-icon{
  appearance:none;-webkit-appearance:none;
  border:0;background:transparent;border-radius:7px;
  touch-action:manipulation;
}
#app>.properties .range-field input[type=range]{
  display:block;flex:1 1 auto;width:100%;min-width:0;height:33px;margin:0;
}
#app>.properties .outline-width-icon,
#app>.properties .outline-color-icon{display:flex;align-items:center;justify-content:center}
#app>.properties .outline-color-icon,
#app>.properties #outlineField.color-mode .outline-width-icon{display:none}
#app>.properties #outlineField.color-mode .outline-color-icon{display:flex}
#app>.properties #outlineField.color-mode>.control-icon{color:#f0d17d}
#app>.properties .option-field{display:flex;align-items:center;height:36px}
#app>.properties .option-button{
  display:grid;place-items:center;width:36px;min-width:36px;height:34px;padding:0;
}
@media(max-width:360px){
  #app>.properties .property-grid{column-gap:8px;row-gap:5px}
  #app>.properties .range-field{gap:4px}
  #app>.properties .range-field>.control-icon{flex-basis:25px;width:25px;min-width:25px}
  #app>.properties .range-field>.control-icon svg{width:21px;height:21px}
}

/* Keep every tab title and its close control on the same line at any width. */
.topbar .tab{display:inline-flex;flex-direction:row;flex-wrap:nowrap;align-items:center;white-space:nowrap;max-width:100%;min-width:0}
.topbar .tab-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:0 1 auto}
.topbar .tab.active .tab-close{
  display:flex;align-items:center;justify-content:center;
  flex:0 0 23px;width:23px;min-width:23px;max-width:23px;
  height:25px;line-height:1;padding:0;margin:0;white-space:nowrap;
}

/* The text input is clipped to the visible image and uses only a caret.
   Glyphs come from the same canvas renderer before and after Enter. */
.canvas-editor-clip{position:absolute;z-index:4;overflow:hidden;pointer-events:none}
#canvasEditor{pointer-events:auto;outline:none;outline-offset:0;color:transparent!important;-webkit-text-fill-color:transparent!important;caret-color:#b0ffd1}
#canvasEditor::selection{background:rgba(102,229,161,.3);-webkit-text-fill-color:transparent}

/* Export dialog close icon and concise slider names. */
#exportDialog .dialog-head>.btn.square{
  display:grid;place-items:center;flex:0 0 34px;width:34px;
  min-width:34px;height:34px;padding:0;line-height:1;
}
#exportDialog .dialog-head>.btn.square svg{display:block;width:17px;height:17px;stroke-width:2.2}
#exportDialog .export-range>span.export-range-label{flex-basis:54px;width:54px;min-width:54px}

/* Mobile layer stacks sit directly above the footer and grow upward. */
@media(max-width:690px){
  #layerList{display:flex;flex-direction:column;align-items:stretch}
  #layerList::before{content:"";display:block;margin-top:auto;flex:0 0 0}
  #layerList .layer-row{flex:0 0 auto}
}

/* Black → gray → white → continuous hue wheel (ending in red). */
#app>.properties .hue-field input[type=range]::-webkit-slider-runnable-track,
#app>.properties #outlineField.color-mode input[type=range]::-webkit-slider-runnable-track{background:linear-gradient(90deg,hsl(0 0% 0.00%) 0.00%,hsl(0 0% 2.38%) 0.30%,hsl(0 0% 4.76%) 0.60%,hsl(0 0% 7.14%) 0.90%,hsl(0 0% 9.52%) 1.20%,hsl(0 0% 11.90%) 1.50%,hsl(0 0% 14.29%) 1.80%,hsl(0 0% 16.67%) 2.10%,hsl(0 0% 19.05%) 2.40%,hsl(0 0% 21.43%) 2.70%,hsl(0 0% 23.81%) 3.00%,hsl(0 0% 26.19%) 3.30%,hsl(0 0% 28.57%) 3.60%,hsl(0 0% 30.95%) 3.90%,hsl(0 0% 33.33%) 4.20%,hsl(0 0% 35.71%) 4.50%,hsl(0 0% 38.10%) 4.80%,hsl(0 0% 40.48%) 5.10%,hsl(0 0% 42.86%) 5.40%,hsl(0 0% 45.24%) 5.70%,hsl(0 0% 47.62%) 6.00%,hsl(0 0% 50.00%) 6.30%,hsl(0 0% 52.38%) 6.60%,hsl(0 0% 54.76%) 6.90%,hsl(0 0% 57.14%) 7.20%,hsl(0 0% 59.52%) 7.50%,hsl(0 0% 61.90%) 7.80%,hsl(0 0% 64.29%) 8.10%,hsl(0 0% 66.67%) 8.40%,hsl(0 0% 69.05%) 8.70%,hsl(0 0% 71.43%) 9.00%,hsl(0 0% 73.81%) 9.30%,hsl(0 0% 76.19%) 9.60%,hsl(0 0% 78.57%) 9.90%,hsl(0 0% 80.95%) 10.20%,hsl(0 0% 83.33%) 10.50%,hsl(0 0% 85.71%) 10.80%,hsl(0 0% 88.10%) 11.10%,hsl(0 0% 90.48%) 11.40%,hsl(0 0% 92.86%) 11.70%,hsl(0 0% 95.24%) 12.00%,hsl(0 0% 97.62%) 12.30%,hsl(0 0% 100.00%) 12.60%,hsl(0 5.56% 97.56%) 12.90%,hsl(0 11.11% 95.11%) 13.20%,hsl(0 16.67% 92.67%) 13.50%,hsl(0 22.22% 90.22%) 13.80%,hsl(0 27.78% 87.78%) 14.10%,hsl(0 33.33% 85.33%) 14.40%,hsl(0 38.89% 82.89%) 14.70%,hsl(0 44.44% 80.44%) 15.00%,hsl(0 50.00% 78.00%) 15.30%,hsl(0 55.56% 75.56%) 15.60%,hsl(0 61.11% 73.11%) 15.90%,hsl(0 66.67% 70.67%) 16.20%,hsl(0 72.22% 68.22%) 16.50%,hsl(0 77.78% 65.78%) 16.80%,hsl(0 83.33% 63.33%) 17.10%,hsl(0 88.89% 60.89%) 17.40%,hsl(0 94.44% 58.44%) 17.70%,hsl(0 100.00% 56.00%) 18.00%,hsl(10 100% 56%) 20.32%,hsl(20 100% 56%) 22.65%,hsl(30 100% 56%) 24.97%,hsl(40 100% 56%) 27.29%,hsl(50 100% 56%) 29.62%,hsl(60 100% 56%) 31.94%,hsl(70 100% 56%) 33.09%,hsl(80 100% 56%) 34.24%,hsl(90 100% 56%) 35.11%,hsl(100 100% 56%) 35.71%,hsl(110 100% 56%) 36.31%,hsl(120 100% 56%) 36.91%,hsl(130 100% 56%) 37.52%,hsl(140 100% 56%) 38.12%,hsl(150 100% 56%) 38.72%,hsl(160 100% 56%) 39.32%,hsl(170 100% 56%) 40.75%,hsl(180 100% 56%) 42.19%,hsl(190 100% 56%) 44.65%,hsl(200 100% 56%) 47.11%,hsl(210 100% 56%) 49.57%,hsl(220 100% 56%) 52.77%,hsl(230 100% 56%) 55.97%,hsl(240 100% 56%) 59.16%,hsl(250 100% 56%) 62.36%,hsl(260 100% 56%) 65.56%,hsl(270 100% 56%) 68.59%,hsl(280 100% 56%) 71.63%,hsl(290 100% 56%) 74.66%,hsl(300 100% 56%) 77.70%,hsl(310 100% 56%) 80.73%,hsl(320 100% 56%) 84.58%,hsl(330 100% 56%) 88.44%,hsl(340 100% 56%) 92.29%,hsl(350 100% 56%) 96.15%,hsl(360 100% 56%) 100.00%)}
#app>.properties .hue-field input[type=range]::-moz-range-track,
#app>.properties #outlineField.color-mode input[type=range]::-moz-range-track{background:linear-gradient(90deg,hsl(0 0% 0.00%) 0.00%,hsl(0 0% 2.38%) 0.30%,hsl(0 0% 4.76%) 0.60%,hsl(0 0% 7.14%) 0.90%,hsl(0 0% 9.52%) 1.20%,hsl(0 0% 11.90%) 1.50%,hsl(0 0% 14.29%) 1.80%,hsl(0 0% 16.67%) 2.10%,hsl(0 0% 19.05%) 2.40%,hsl(0 0% 21.43%) 2.70%,hsl(0 0% 23.81%) 3.00%,hsl(0 0% 26.19%) 3.30%,hsl(0 0% 28.57%) 3.60%,hsl(0 0% 30.95%) 3.90%,hsl(0 0% 33.33%) 4.20%,hsl(0 0% 35.71%) 4.50%,hsl(0 0% 38.10%) 4.80%,hsl(0 0% 40.48%) 5.10%,hsl(0 0% 42.86%) 5.40%,hsl(0 0% 45.24%) 5.70%,hsl(0 0% 47.62%) 6.00%,hsl(0 0% 50.00%) 6.30%,hsl(0 0% 52.38%) 6.60%,hsl(0 0% 54.76%) 6.90%,hsl(0 0% 57.14%) 7.20%,hsl(0 0% 59.52%) 7.50%,hsl(0 0% 61.90%) 7.80%,hsl(0 0% 64.29%) 8.10%,hsl(0 0% 66.67%) 8.40%,hsl(0 0% 69.05%) 8.70%,hsl(0 0% 71.43%) 9.00%,hsl(0 0% 73.81%) 9.30%,hsl(0 0% 76.19%) 9.60%,hsl(0 0% 78.57%) 9.90%,hsl(0 0% 80.95%) 10.20%,hsl(0 0% 83.33%) 10.50%,hsl(0 0% 85.71%) 10.80%,hsl(0 0% 88.10%) 11.10%,hsl(0 0% 90.48%) 11.40%,hsl(0 0% 92.86%) 11.70%,hsl(0 0% 95.24%) 12.00%,hsl(0 0% 97.62%) 12.30%,hsl(0 0% 100.00%) 12.60%,hsl(0 5.56% 97.56%) 12.90%,hsl(0 11.11% 95.11%) 13.20%,hsl(0 16.67% 92.67%) 13.50%,hsl(0 22.22% 90.22%) 13.80%,hsl(0 27.78% 87.78%) 14.10%,hsl(0 33.33% 85.33%) 14.40%,hsl(0 38.89% 82.89%) 14.70%,hsl(0 44.44% 80.44%) 15.00%,hsl(0 50.00% 78.00%) 15.30%,hsl(0 55.56% 75.56%) 15.60%,hsl(0 61.11% 73.11%) 15.90%,hsl(0 66.67% 70.67%) 16.20%,hsl(0 72.22% 68.22%) 16.50%,hsl(0 77.78% 65.78%) 16.80%,hsl(0 83.33% 63.33%) 17.10%,hsl(0 88.89% 60.89%) 17.40%,hsl(0 94.44% 58.44%) 17.70%,hsl(0 100.00% 56.00%) 18.00%,hsl(10 100% 56%) 20.32%,hsl(20 100% 56%) 22.65%,hsl(30 100% 56%) 24.97%,hsl(40 100% 56%) 27.29%,hsl(50 100% 56%) 29.62%,hsl(60 100% 56%) 31.94%,hsl(70 100% 56%) 33.09%,hsl(80 100% 56%) 34.24%,hsl(90 100% 56%) 35.11%,hsl(100 100% 56%) 35.71%,hsl(110 100% 56%) 36.31%,hsl(120 100% 56%) 36.91%,hsl(130 100% 56%) 37.52%,hsl(140 100% 56%) 38.12%,hsl(150 100% 56%) 38.72%,hsl(160 100% 56%) 39.32%,hsl(170 100% 56%) 40.75%,hsl(180 100% 56%) 42.19%,hsl(190 100% 56%) 44.65%,hsl(200 100% 56%) 47.11%,hsl(210 100% 56%) 49.57%,hsl(220 100% 56%) 52.77%,hsl(230 100% 56%) 55.97%,hsl(240 100% 56%) 59.16%,hsl(250 100% 56%) 62.36%,hsl(260 100% 56%) 65.56%,hsl(270 100% 56%) 68.59%,hsl(280 100% 56%) 71.63%,hsl(290 100% 56%) 74.66%,hsl(300 100% 56%) 77.70%,hsl(310 100% 56%) 80.73%,hsl(320 100% 56%) 84.58%,hsl(330 100% 56%) 88.44%,hsl(340 100% 56%) 92.29%,hsl(350 100% 56%) 96.15%,hsl(360 100% 56%) 100.00%)}

/* The color row spans both columns, keeping hue wide on small screens. */
#app>.properties .color-actions-row{display:flex;align-items:center;gap:7px;grid-column:1/-1;min-width:0;height:36px}
#app>.properties .color-actions-row #hueField{flex:1 1 auto;width:0;min-width:0}
#app>.properties .color-actions-row #hueField input[type=range]{min-width:0}
#app>.properties .color-actions-row #fillField{flex:0 0 36px;width:36px;height:36px}
#app>.properties .color-actions-row #fillField[hidden]{display:none!important}
#app>.properties .color-actions-row .option-button{width:36px;min-width:36px;height:34px}
#app>.properties .color-actions-row .snap-toggle{position:static;flex:0 0 36px;width:36px;height:34px;display:grid;place-items:center;padding:0;border:1px solid #40534a;border-radius:9px;background:#131b16;color:#aab9af}
#app>.properties .color-actions-row .snap-toggle svg{width:21px;height:21px;display:block}
#app>.properties .color-actions-row .snap-toggle .snap-disabled{display:none}
#app>.properties .color-actions-row .snap-toggle[aria-pressed=false] .snap-disabled{display:block}
#app>.properties .color-actions-row .snap-toggle[aria-pressed=true]{background:#143322;border-color:#316f49;color:#b8f4ce}

/* Hue and outline-color thumbs reflect the selected actual drawing color. */
#app>.properties .hue-field input[type=range]::-webkit-slider-thumb,
#app>.properties #outlineField.color-mode input[type=range]::-webkit-slider-thumb{
  background:var(--handle-color,#8aebb0);border:2px solid #77857e;
}
#app>.properties .hue-field input[type=range]::-moz-range-thumb,
#app>.properties #outlineField.color-mode input[type=range]::-moz-range-thumb{
  background:var(--handle-color,#8aebb0);border:2px solid #77857e;
}
/* Task-focused help: four quick actions and optional detail sections. */
.head-actions .help-button{font:600 20px/1 "Segoe UI",system-ui,sans-serif}
#helpDialog{width:min(540px,calc(100vw - 20px));max-height:min(78dvh,630px);overflow:hidden}
#helpDialog::backdrop{background:#0008;backdrop-filter:blur(2px)}
#helpDialog .help-panel{display:flex;flex-direction:column;min-height:0;max-height:min(78dvh,630px)}
#helpDialog .help-head{flex:0 0 50px;min-height:50px;padding:8px 14px;border-bottom:1px solid #26392c}
#helpDialog .help-head strong{font-size:15px;letter-spacing:.04em;font-variant:normal}
#helpDialog .help-head .btn{display:grid;place-items:center;width:32px;min-height:32px;font:24px/1 "Segoe UI",system-ui,sans-serif}
#helpDialog .help-content{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:12px 13px 14px;scrollbar-width:thin}
#helpDialog .help-quick{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;margin-bottom:13px}
#helpDialog .help-quick-item{display:flex;flex-direction:column;justify-content:center;gap:4px;min-height:59px;padding:10px 11px;border:1px solid #283a2e;border-radius:9px;background:#111b15}
#helpDialog .help-quick-item span:first-child{font-size:12px;font-weight:650;color:#c5efd1}
#helpDialog .help-quick-item span:last-child{font-size:11px;line-height:1.35;color:#9eafa4}
#helpDialog .help-topics{border-top:1px solid #27392d}
#helpDialog details{border-bottom:1px solid #27392d}
#helpDialog summary{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:45px;padding:9px 5px;color:#d9e7dd;font-size:12.5px;font-weight:550;cursor:pointer;list-style:none}
#helpDialog summary::-webkit-details-marker{display:none}
#helpDialog summary::after{content:"";flex:0 0 7px;width:7px;height:7px;border-right:1.5px solid #8da994;border-bottom:1.5px solid #8da994;transform:rotate(45deg);transition:transform .15s ease}
#helpDialog details[open] summary::after{transform:rotate(225deg)}
#helpDialog summary:hover{color:#b8f5cb}
#helpDialog summary:focus-visible{outline:2px solid #66e5a1;outline-offset:-2px}
#helpDialog dl{margin:0 0 10px}
#helpDialog dl>div{display:grid;grid-template-columns:minmax(98px,37%) minmax(0,1fr);gap:12px;align-items:start;padding:8px 6px;border-top:1px solid #1b2a20}
#helpDialog dt{font-size:11.5px;font-weight:550;color:#b4dcc0}
#helpDialog dd{margin:0;font-size:11.5px;line-height:1.45;color:#afc0b3}
#helpDialog kbd{display:inline-block;padding:1px 4px;margin:1px 0;font:inherit;font-size:10.5px;line-height:1.4;color:#d5e5da;background:#1b2a20;border:1px solid #344639;border-radius:4px}
@media(max-width:380px){#helpDialog .help-content{padding:10px}#helpDialog .help-quick{gap:6px}#helpDialog .help-quick-item{padding:9px;min-height:61px}#helpDialog dl>div{grid-template-columns:minmax(89px,37%) minmax(0,1fr);gap:8px}}
@media(prefers-reduced-motion:reduce){#helpDialog summary::after{transition:none}}

/* Thin inset border around every slider groove, including hue and export. */
.range-field input[type=range]::-webkit-slider-runnable-track{
  border:1px solid #607166;box-sizing:border-box;
}
.range-field input[type=range]::-moz-range-track{
  border:1px solid #607166;box-sizing:border-box;
}

/* All bottom toolbar icons use the same size, outline weight and alignment. */
#app>.tools .tool{display:grid;place-items:center;line-height:1}
#app>.tools .tool svg{
  display:block;flex:none;width:22px;height:22px;
  fill:none;stroke:currentColor;stroke-width:1.85;
  stroke-linecap:round;stroke-linejoin:round;
}
@media(max-width:360px){#app>.tools .tool svg{width:20px;height:20px}}


/* Desktop editor: docked tools, unobstructed canvas, contextual inspector. */
#app>.properties .inspector-header,#app>.properties .inspector-placeholder{display:none}
@media(min-width:900px){
  #app{
    --desktop-panel-width:clamp(260px,var(--panel-width,300px),min(48vw,760px));
    display:grid;
    grid-template-columns:58px minmax(0,1fr) var(--desktop-panel-width);
    grid-template-rows:50px minmax(0,1fr);
    gap:0;
  }
  #app>.topbar{
    grid-column:1/-1;grid-row:1;order:initial;
    height:50px;min-height:0;flex:none;
    padding:0 10px;gap:12px;
    border-bottom:1px solid #213128;
  }
  #app>.topbar .brand{flex:0 0 32px}
  #app>.topbar .tabs{height:44px;min-height:0;max-height:44px;align-items:center;gap:4px}
  #app>.topbar .tab{height:36px;max-width:210px}
  #app>.topbar .tab-title{font-size:13px;max-width:169px}
  #app>.topbar .head-actions{gap:5px}
  #app>.topbar .head-actions .btn.square{width:35px;height:35px}
  #app>.tools{
    position:relative;grid-column:1;grid-row:2;order:initial;
    display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;
    width:58px;height:100%;min-height:0;max-height:none;flex:none;
    gap:4px;padding:8px 7px;
    border:0;border-right:1px solid #26382d;
    overflow-x:hidden;overflow-y:auto;scrollbar-width:none;
    background:#090e0b;
  }
  #app>.tools::-webkit-scrollbar{display:none}
  #app>.tools .tool{
    flex:0 0 43px;display:grid;place-items:center;
    width:43px;height:43px;min-height:43px;
    border-radius:9px;
  }
  #app>.tools #undoBtn{margin-top:auto}
  #app>.tools .tool svg{width:22px;height:22px}
  #app>.workspace{
    grid-column:2;grid-row:2;order:initial;
    position:relative;min-height:0;min-width:0;
    width:100%;height:100%;flex:none;
  }
  #app>.properties{
    grid-column:3;grid-row:2;order:initial;
    position:relative;inset:auto;bottom:auto;left:auto;right:auto;
    display:flex;flex-direction:column;
    width:100%;height:100%;min-height:0;max-height:none;
    padding:0 15px 20px;flex:none;margin:0;
    overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;
    border:0;border-left:1px solid #26382d;
    background:#0b100d;backdrop-filter:none;scrollbar-width:thin;
  }
  #app>.properties .inspector-header{
    display:flex;align-items:center;justify-content:space-between;
    flex:0 0 52px;min-height:52px;margin:0 -15px 15px;padding:0 16px;
    border-bottom:1px solid #24362a;
    color:#d7e9db;font-size:14px;font-weight:600;
    font-variant:small-caps;letter-spacing:.09em;
  }
  #app>.properties .inspector-subtitle{
    color:#6f8777;font-size:10px;font-weight:400;
    text-transform:uppercase;letter-spacing:.09em;
  }
  #app>.properties .inspector-placeholder{
    display:none;padding:8px 2px;
    font-size:12px;line-height:1.65;color:#8da393;
  }
  #app>.properties.inspector-empty .inspector-placeholder{display:block}
  #app>.properties.inspector-empty .property-grid{display:none}
  #app>.properties .property-grid{
    display:grid;grid-template-columns:minmax(0,1fr);
    align-content:start;align-items:stretch;gap:13px;
  }
  #app>.properties .range-field{
    display:grid;grid-template-columns:27px minmax(0,1fr);
    grid-template-rows:24px 32px;align-items:center;
    column-gap:8px;row-gap:4px;
    min-height:0;height:auto;padding:0 0 7px;
    border-bottom:1px solid #1c2a20;
  }
  #app>.properties .range-field::before{
    grid-column:2;grid-row:1;
    font-size:12px;color:#a8c5b0;
    font-weight:500;letter-spacing:.01em;
  }
  #app>.properties #sizeField::before{content:"Size"}
  #app>.properties #opacityField::before{content:"Opacity"}
  #app>.properties #smoothField::before{content:"Smoothing"}
  #app>.properties #outlineField::before{content:"Outline width"}
  #app>.properties #outlineField.color-mode::before{content:"Outline color"}
  #app>.properties #rotateField::before{content:"Rotation"}
  #app>.properties #hueField::before{content:"Color"}
  #app>.properties .range-field>.control-icon{
    grid-column:1;grid-row:1;
    width:27px;height:24px;flex:none;
  }
  #app>.properties .range-field input[type=range]{
    grid-column:1/-1;grid-row:2;
    display:block;width:100%;min-width:0;height:32px;
    margin:0;flex:none;
  }
  #app>.properties .color-actions-row{
    display:flex;flex-wrap:wrap;align-items:center;
    width:100%;height:auto;min-height:0;gap:8px;grid-column:auto;
    padding-top:2px;
  }
  #app>.properties .color-actions-row #hueField{
    flex:1 0 100%;min-width:0;width:100%;
  }
  #app>.properties .color-actions-row #fillField{
    flex:0 0 36px;width:36px;height:36px;
  }
  #app>.properties .color-actions-row .snap-toggle{
    position:static;width:36px;height:36px;flex:0 0 36px;margin-left:auto;
  }
  #app>.layers-panel{
    position:absolute;z-index:7;top:50px;bottom:0;right:0;left:auto;
    height:auto;width:var(--desktop-panel-width);max-width:none;
    border:0;border-left:1px solid #26382d;
    background:#0b100d;box-shadow:none;backdrop-filter:none;
    transform:translateX(102%);
  }
  #app>.layers-panel.open{transform:translateX(0)}
  #app>.layers-panel.left{
    left:58px;right:auto;transform:translateX(-105%);
    border-left:0;border-right:1px solid #26382d;
  }
  #app>.layers-panel.left.open{transform:translateX(0)}
  #app>.layers-panel .panel-head{
    order:0;flex:0 0 52px;height:52px;min-height:52px;
    border-top:0;border-bottom:1px solid #24362a;
  }
  #app>.layers-panel .layer-list{order:1}
  #app>.layers-panel .layer-name{touch-action:none}
}


/* Crop preview lives over the canvas; no changes until Apply. */
#app>.workspace .crop-controls{
  position:absolute;z-index:5;left:50%;top:12px;transform:translateX(-50%);
  display:flex;align-items:center;gap:6px;
  max-width:calc(100% - 14px);width:max-content;
  padding:6px;border:1px solid #385744;border-radius:10px;
  background:#0c1510;color:#d0ebd8;
}
#app>.workspace .crop-controls[hidden]{display:none!important}
#app>.workspace .crop-info{
  flex:0 0 auto;min-width:92px;padding:0 9px;
  font-size:12px;font-variant-numeric:tabular-nums;
  white-space:nowrap;text-align:center;
}
#app>.workspace .crop-controls .btn{
  min-height:33px;padding:0 10px;font-size:12px;border-radius:7px;
}
#app>.workspace .crop-controls .btn.primary{font-weight:600}
@media(max-width:520px){
  #app>.workspace .crop-controls{top:8px;gap:4px;padding:5px}
  #app>.workspace .crop-info{min-width:0;padding:0 3px;font-size:11px}
  #app>.workspace .crop-controls .btn{padding:0 7px;font-size:11px;min-height:32px}
}

/* Confirm tab closing in a small anchored popover by its X control. */
#closeDialog{
  position:fixed;inset:auto;margin:0;
  z-index:30;width:min(260px,calc(100vw - 16px));
  max-height:calc(100dvh - 16px);
  border:1px solid #375642;border-radius:11px;
  background:#0d1610;box-shadow:0 6px 20px #0009;
}
#closeDialog .dialog-body{gap:9px;padding:12px}
#closeDialog .dialog-body>strong{
  font-size:13px;font-weight:600;color:#e4f5e9;
}
#closeDialog .dialog-body>p{
  font-size:11px;color:#9fb7a5;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
#closeDialog .dialog-actions{gap:7px;margin-top:3px}
#closeDialog .dialog-actions .btn{
  flex:1;min-width:0;min-height:33px;
  padding:0 8px;font-size:12px;
}
