:root{
  --bg:#171717; --panel:#232323; --ink:#F2F2F2; --muted:#8C8C8C; --line:#333333;
  --accent:#2B3FEE; --accent-ink:#4053FF; --soft:#1A1A1A; --danger:#E0483F;
  --field:#1A1A1A; --field-bd:#3D3D3D; --hover:#303030; --dim:#B3B3B3; --bdh:#4D4D4D; --dots:#6E6E6E;
  --radius:11px; --card-radius:18px; --shadow:0 6px 24px rgba(0,0,0,.35), 0 1px 2px rgba(0,0,0,.25); --canvas:#5E5E5E;
  font-family:'Schibsted Grotesk','Inter',system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
}
*{ margin:0; padding:0; box-sizing:border-box; }
body{ background:var(--bg); color:var(--ink); -webkit-font-smoothing:antialiased; }
.hidden{ display:none !important; }
button{ font-family:inherit; cursor:pointer; }

/* ---------- EDITOR (dark warm theme) ---------- */
.editor{ height:100vh; display:flex; flex-direction:column; background:var(--bg); color:var(--ink); color-scheme:dark; accent-color:var(--accent); }
.ed-top{ display:flex; align-items:center; gap:14px; padding:8px 14px; background:var(--panel); border-bottom:1px solid var(--line); position:relative; }
.ed-title{ position:absolute; left:50%; transform:translateX(-50%); font-weight:700; font-size:13.5px; color:var(--ink); background:none; border:none; padding:7px 14px; display:flex; align-items:center; gap:8px; max-width:40%; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ed-title::before{ content:""; width:6px; height:6px; border-radius:50%; background:#5FBF6E; }
.ed-actions{ display:flex; align-items:center; gap:8px; }
.sep{ width:1px; height:22px; background:var(--line); margin:0 4px; }
.ghost{ background:transparent; border:1px solid var(--field-bd); color:var(--dim); padding:8px 13px; border-radius:9px; font-size:13px; font-weight:600; }
.ghost:hover{ background:var(--hover); color:var(--ink); }
.primary{ background:var(--accent); color:#fff; border:none; padding:9px 15px; border-radius:9px; font-size:13px; font-weight:700; }
.primary:hover{ background:var(--accent-ink); }

.ed-body{ flex:1; display:flex; gap:0; padding:0 0 0 58px; min-height:0; background:var(--canvas); position:relative; }
.toolbar{ position:absolute; left:0; top:0; bottom:0; z-index:40; width:58px; background:var(--panel); border:none; border-right:1px solid var(--line); border-radius:0; box-shadow:none; display:flex; flex-direction:column; align-items:stretch; gap:3px; padding:10px 8px; overflow-x:hidden; overflow-y:auto; transition:width .16s ease, box-shadow .16s ease; flex:none; max-height:none; }
.toolbar:hover,.toolbar.expanded{ width:186px; box-shadow:12px 0 30px -18px rgba(0,0,0,.6); }
.rail-toggle{ display:none; }
.tlabel{ white-space:nowrap; font-size:13px; font-weight:600; opacity:0; transition:opacity .12s; pointer-events:none; }
.toolbar:hover .tlabel,.toolbar.expanded .tlabel{ opacity:1; }
.tool-div{ width:100%; height:1px; background:var(--line); margin:5px 0; flex:none; }
.tool.stub{ opacity:.38; }
.tool.stub:hover{ opacity:.6; background:transparent; color:var(--muted); }
.swatches{ display:flex; flex-direction:column; align-items:stretch; gap:2px; margin-top:2px; }
.sw-row{ display:flex; align-items:center; gap:12px; height:38px; padding:0 0 0 12px; border:none; background:transparent; border-radius:9px; cursor:pointer; color:var(--muted); }
.sw-row:hover{ background:var(--hover); color:var(--ink); }
.sw-box{ width:26px; height:26px; border-radius:7px; overflow:hidden; border:1px solid var(--field-bd); flex:none; box-shadow:0 1px 2px rgba(0,0,0,.3); }
.sw-box input[type=color]{ width:150%; height:150%; margin:-25%; padding:0; border:none; cursor:pointer; }
.sw-ic{ width:26px; display:flex; align-items:center; justify-content:center; flex:none; }
.range-row{ display:flex; align-items:center; gap:8px; }
.range-row input[type=range]{ flex:1; }
.range-row .val{ font-size:11.5px; color:var(--ink); font-family:'JetBrains Mono',ui-monospace,monospace; width:38px; text-align:right; }
.sec-title{ font-size:10.5px; font-weight:700; text-transform:uppercase; letter-spacing:.12em; color:var(--muted); margin:16px 0 8px; padding-top:12px; border-top:1px solid var(--line); }
.chk-row{ display:flex; align-items:center; gap:8px; font-size:13px; margin-bottom:8px; }
.tool{ height:40px; border-radius:10px; border:none; background:transparent; color:var(--muted); display:flex; align-items:center; gap:12px; padding:0 0 0 14px; justify-content:flex-start; flex:none; }
.tool svg{ flex:none; }
.tool:hover{ background:var(--hover); color:var(--ink); }
.tool.active{ background:var(--accent); color:#fff; }
.ed-mid{ display:flex; align-items:center; gap:6px; margin-left:auto; }
.hgroup{ display:inline-flex; align-items:center; gap:2px; }
.ed-bottom{ flex:none; position:relative; z-index:140; display:flex; align-items:center; justify-content:flex-end; gap:12px; padding:6px 16px; background:var(--panel); border-top:1px solid var(--line); }
.zoombar{ display:flex; align-items:center; gap:8px; }
.zoombar input[type="range"]{ width:150px; accent-color:var(--accent,#2b3fee); cursor:pointer; }
.zoombar .zoom-val{ min-width:48px; text-align:center; }
.icon-btn{ width:32px; height:32px; border:none; background:transparent; border-radius:8px; font-size:16px; line-height:1; color:var(--dim); display:inline-flex; align-items:center; justify-content:center; }
.icon-btn:hover{ background:var(--hover); color:var(--ink); }
.icon-btn:disabled{ opacity:.4; cursor:default; }
.zoom-val{ min-width:52px; height:32px; border:1px solid var(--field-bd); background:var(--field); border-radius:8px; font-size:12px; font-weight:600; color:var(--ink); font-family:'JetBrains Mono',ui-monospace,monospace; }
.zoom-val:hover{ background:var(--hover); }

.stage-wrap{ flex:1; overflow:hidden; background:var(--canvas); background-image:radial-gradient(var(--dots) 1px,transparent 1px); background-size:22px 22px; display:block; padding:0; position:relative; }
.stage-outer{ position:relative; transform-origin:top left; will-change:transform; display:flex; flex-direction:column; align-items:center; }
.stage-outer.anim{ transition:transform .22s cubic-bezier(.2,.8,.3,1); }
.stage{ position:relative; overflow:hidden; background:#fff; box-shadow:0 30px 60px -20px rgba(0,0,0,.6); flex:none; }
.stage.inactive{ cursor:pointer; }
.stage.inactive:hover{ outline:2px solid rgba(43,63,238,.45); }
.sel-overlay{ position:absolute; left:0; top:0; pointer-events:none; overflow:visible; z-index:60; }
/* page furniture is screen-constant: sizes counter-scaled by --pinv (1/zoom), like Figma/Canva chrome */
.page-head{ display:flex; align-items:center; margin:0 0 calc(10px*var(--pinv,1)); flex:none; }
.page-name{ font-size:calc(16px*var(--pinv,1)); font-weight:600; color:var(--muted); padding:calc(4px*var(--pinv,1)) calc(8px*var(--pinv,1)); border-radius:calc(7px*var(--pinv,1)); outline:none; cursor:text; min-width:calc(40px*var(--pinv,1)); transition:color .12s, background .12s; }
.page-name.cur{ color:var(--ink); }
.page-name:hover{ background:rgba(128,128,128,.12); }
.page-name:focus{ background:rgba(43,63,238,.14); color:var(--ink); }
.page-head:has(.page-name:not(.cur)) .page-name{ cursor:pointer; }
.page-bar{ display:flex; align-items:center; gap:calc(10px*var(--pinv,1)); margin:calc(14px*var(--pinv,1)) 0 calc(52px*var(--pinv,1)); flex:none; justify-content:center; }
.pb-add{ flex:1; max-width:70%; height:calc(30px*var(--pinv,1)); border:calc(1.5px*var(--pinv,1)) solid var(--field-bd); background:var(--panel); border-radius:calc(9px*var(--pinv,1)); color:var(--dim); font-size:calc(13px*var(--pinv,1)); font-weight:600; transition:background .12s,color .12s; }
.pb-add:hover{ background:var(--hover); color:var(--ink); border-color:var(--bdh); }
.pb-dup{ width:calc(30px*var(--pinv,1)); height:calc(30px*var(--pinv,1)); border:calc(1.5px*var(--pinv,1)) solid var(--field-bd); background:var(--panel); border-radius:calc(9px*var(--pinv,1)); color:var(--dim); display:grid; place-items:center; transition:background .12s,color .12s; }
.pb-dup:hover{ background:var(--hover); color:var(--ink); border-color:var(--bdh); }
.pb-dup svg{ width:calc(15px*var(--pinv,1)); height:calc(15px*var(--pinv,1)); }
.ctx-menu{ position:fixed; z-index:130; min-width:200px; background:var(--panel); border:1px solid var(--line); border-radius:12px; box-shadow:0 18px 50px -12px rgba(0,0,0,.6); padding:6px; display:flex; flex-direction:column; gap:1px; }
.ctx-menu button{ display:flex; align-items:center; gap:11px; padding:8px 10px; background:transparent; border:none; border-radius:8px; font-size:13px; font-weight:500; color:var(--dim); text-align:left; transition:background .1s,color .1s; }
.ctx-menu button:hover:not(:disabled){ background:var(--hover); color:var(--ink); }
.ctx-menu button:disabled{ opacity:.38; cursor:default; }
.ctx-menu button[hidden]{ display:none; }
.ctx-menu button kbd{ margin-left:auto; font-family:'JetBrains Mono',ui-monospace,monospace; font-size:10.5px; color:var(--muted); background:var(--field); border:1px solid var(--field-bd); border-radius:5px; padding:2px 6px; }
.ctx-menu button.danger{ color:#F08A82; }
.ctx-menu button.danger:hover:not(:disabled){ background:rgba(224,72,63,.15); color:#FF9B93; }
.ctx-sep{ height:1px; background:var(--line); margin:4px 6px; }
.page-menu{ position:fixed; z-index:95; width:720px; max-width:92vw; background:var(--panel); border:1px solid var(--line); border-radius:16px; box-shadow:0 34px 80px -20px rgba(0,0,0,.75); display:flex; flex-direction:column; overflow:hidden; }
.pm-top{ border-bottom:1px solid var(--line); padding:8px; }
.pm-samebar{ width:100%; display:flex; align-items:center; gap:12px; padding:9px 12px; background:transparent; border:none; border-radius:10px; font-size:13.5px; font-weight:600; color:var(--ink); text-align:left; transition:background .12s; }
.pm-samebar:hover{ background:var(--hover); }
.pm-samebar .csm-ic{ width:32px; height:32px; }
.pm-samelabel{ flex:1; }
.pm-dims{ font-family:'JetBrains Mono',ui-monospace,monospace; font-size:11.5px; color:var(--muted); }
.pm-body{ display:grid; grid-template-columns:186px 1fr; min-height:0; }
.pm-body .csm-main{ max-height:400px; }
.shape-menu{ position:fixed; z-index:90; background:var(--panel); border:1px solid var(--line); border-radius:0 12px 12px 0; box-shadow:12px 0 30px -18px rgba(0,0,0,.6); padding:10px 9px; display:grid; grid-template-columns:repeat(3,58px); gap:4px; }
.shape-menu button{ width:58px; height:58px; display:grid; place-items:center; padding:0; background:transparent; border:none; border-radius:12px; color:#8a8d92; transition:background .12s,color .12s; }
.shape-menu button svg{ width:40px; height:40px; }
.shape-menu button:hover{ background:var(--hover); color:var(--ink); }
.shape-menu button.active{ background:var(--accent); color:#fff; }
.stage-wrap.tool-pan{ cursor:grab; }
.stage-wrap.tool-pan.panning{ cursor:grabbing; }
.stage-wrap.tool-draw{ cursor:crosshair; }
.stage-wrap.tool-paint,.stage-wrap.tool-paint .layer{ cursor:crosshair; }
.brush-bar{ display:flex; align-items:center; gap:10px; padding:0 6px; }
.brush-bar label{ font-size:10.5px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; color:var(--muted); }
.brush-bar input[type=range]{ width:110px; }
.bb-dot{ width:18px; height:18px; border-radius:50%; border:2px solid var(--field-bd); background:#15171c; flex:none; }
.bb-val{ font-family:'JetBrains Mono',ui-monospace,monospace; font-size:11.5px; color:var(--ink); min-width:34px; }
.stage-wrap.tool-select{ cursor:default; }
.stage-wrap.tool-select .layer{ cursor:move; }
.stage-wrap.tool-select .layer.locked{ cursor:default; }
.stage-wrap.tool-crop{ cursor:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g stroke="white" stroke-width="4.6" fill="none"><path d="M6 1v15a2 2 0 0 0 2 2h15M1 6h15a2 2 0 0 1 2 2v15M23 1l-8.5 8.5M9.5 14.5 1 23"/></g><g stroke="black" stroke-width="2.2" fill="none"><path d="M6 1v15a2 2 0 0 0 2 2h15M1 6h15a2 2 0 0 1 2 2v15M23 1l-8.5 8.5M9.5 14.5 1 23"/></g></svg>') 12 12, crosshair; }
.stage-wrap.tool-text,.stage-wrap.tool-text .layer{ cursor:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g stroke="white" stroke-width="4.4" fill="none" stroke-linecap="round"><path d="M7 3c3 0 5 .8 5 3v12c0 2.2 2 3 5 3M17 3c-3 0-5 .8-5 3M7 21c3 0 5-.8 5-3"/></g><g stroke="black" stroke-width="2" fill="none" stroke-linecap="round"><path d="M7 3c3 0 5 .8 5 3v12c0 2.2 2 3 5 3M17 3c-3 0-5 .8-5 3M7 21c3 0 5-.8 5-3"/></g></svg>') 12 12, text; }
.layer[contenteditable="true"]{ cursor:text !important; }
.stage-wrap.tool-eyedropper{ cursor:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24"><path d="m2 22 1-4 9-9 3 3-9 9z" fill="white" stroke="black" stroke-width="1.4" stroke-linejoin="round"/><path d="m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.9.9a2.1 2.1 0 1 1-3 3l-6-6a2.1 2.1 0 1 1 3-3l.9.9Z" fill="black" stroke="white" stroke-width="1.2" stroke-linejoin="round"/></svg>') 2 20, crosshair; }
.stage-wrap.tool-pan .layer,.stage-wrap.tool-draw .layer,.stage-wrap.tool-crop .layer,.stage-wrap.tool-eyedropper .layer{ cursor:inherit; }
.crop-marquee{ position:absolute; border:1.5px dashed var(--accent); background:rgba(43,63,238,.12); z-index:70; pointer-events:none; }
.text-marquee{ position:absolute; border:1.5px solid #4A9DF8; background:rgba(74,157,248,.06); z-index:70; pointer-events:none; }

.layer{ position:absolute; box-sizing:border-box; user-select:none; -webkit-user-select:none; }
.layer[contenteditable="true"]{ user-select:text; -webkit-user-select:text; }
.layer.text{ white-space:pre-wrap; overflow:visible; }
.sel-box{ position:absolute; box-sizing:border-box; pointer-events:none; border:calc(1.5px*var(--inv,1)) solid var(--accent); }
.marquee{ position:absolute; box-sizing:border-box; pointer-events:none; z-index:65; background:rgba(43,63,238,.10); border:calc(1px*var(--inv,1)) solid var(--accent); }
.smart-guide{ position:absolute; pointer-events:none; z-index:59; background:#ff2d78; }
.smart-guide.v{ top:0; height:100%; width:calc(1px*var(--inv,1)); }
.smart-guide.h{ left:0; width:100%; height:calc(1px*var(--inv,1)); }
/* Canva-style floating text island */
.text-island{ position:fixed; z-index:120; display:flex; align-items:center; gap:2px; background:#fff; border:1px solid #ececf2; border-radius:13px; box-shadow:0 14px 40px rgba(20,28,60,.20); padding:6px; color:#14161c; }
.text-island.hidden{ display:none; }
.text-island .ti-font{ height:34px; border:1px solid #e4e4ec; border-radius:9px; background:#fff; padding:0 10px; font-size:13.5px; max-width:158px; color:#14161c; cursor:pointer; }
.ti-size{ display:flex; align-items:center; border:1px solid #e4e4ec; border-radius:9px; height:34px; overflow:hidden; }
.ti-size button{ width:28px; height:32px; border:none; background:transparent; font-size:17px; line-height:1; cursor:pointer; color:#14161c; }
.ti-size button:hover{ background:#f1f1f6; }
.ti-size .ti-szval{ width:38px; text-align:center; border:none; font-size:13.5px; background:transparent; -moz-appearance:textfield; }
.ti-size .ti-szval::-webkit-outer-spin-button,.ti-size .ti-szval::-webkit-inner-spin-button{ -webkit-appearance:none; margin:0; }
.ti-btn{ min-width:34px; height:34px; padding:0 8px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:1px; border:none; background:transparent; border-radius:9px; cursor:pointer; color:#14161c; font-size:15px; }
.ti-btn:hover{ background:#f1f1f6; }
.ti-btn.on{ background:#ece9ff; color:#5b5bf5; }
.ti-btn i{ font-family:Georgia,serif; }
.ti-A{ font-weight:800; line-height:1; }
.ti-cbar{ display:block; width:17px; height:3px; border-radius:2px; }
.ti-text{ height:34px; padding:0 13px; border:none; background:transparent; border-radius:9px; font-weight:600; font-size:13.5px; cursor:pointer; color:#14161c; }
.ti-text:hover{ background:#f1f1f6; }
.ti-sep{ width:1px; height:22px; background:#e9e9f0; margin:0 3px; flex:none; }
.ti-pop{ position:absolute; background:#fff; border:1px solid #ececf2; border-radius:13px; box-shadow:0 14px 36px rgba(20,28,60,.20); padding:14px; min-width:220px; }
.ti-pop.hidden{ display:none; }
.ti-pop-h{ font-size:13px; font-weight:600; margin-bottom:8px; color:#3a3a46; }
.ti-pop input[type=range]{ width:100%; margin-bottom:14px; accent-color:#5b5bf5; }
.ti-pop-row{ display:flex; gap:8px; align-items:center; }
.ti-pop-row input[type=color]{ width:36px; height:32px; border:none; background:none; padding:0; cursor:pointer; }
.ti-pop-row input[type=text]{ flex:1; height:32px; border:1px solid #e4e4ec; border-radius:8px; padding:0 9px; font-size:13px; }
/* File menu */
.file-wrap{ position:relative; }
.file-btn{ display:inline-flex; align-items:center; gap:5px; }
.file-menu{ position:absolute; top:calc(100% + 6px); left:0; z-index:130; min-width:212px; background:var(--panel,#fff); border:1px solid var(--line,#ececf2); border-radius:12px; box-shadow:0 16px 42px rgba(20,28,60,.22); padding:6px; }
.file-menu.hidden{ display:none; }
.fm-item{ display:flex; align-items:center; width:100%; gap:10px; padding:8px 11px; background:transparent; border:none; border-radius:8px; font-size:13px; font-weight:500; color:var(--ink,#14161c); text-align:left; cursor:pointer; }
.fm-item:hover{ background:var(--hover,#f1f1f6); }
.fm-item.danger{ color:#e0483f; }
.fm-item .fm-ck{ margin-left:auto; opacity:0; color:var(--accent,#2b3fee); font-weight:700; }
.fm-item.on .fm-ck{ opacity:1; }
.fm-sep{ height:1px; background:var(--line,#ececf2); margin:6px 4px; }
.file-menu .fm-item[hidden], .file-menu .fm-sep[hidden]{ display:none; }
.fm-email{ margin-left:auto; font-size:11px; color:var(--muted,#9aa0a6); font-weight:500; max-width:130px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
/* Rulers */
.ruler{ position:absolute; z-index:58; display:block; background:#f6f7f9; }
.ruler.hidden{ display:none; }
.ruler-top{ border-bottom:1px solid #e3e5ea; cursor:ns-resize; }
.ruler-left{ border-right:1px solid #e3e5ea; cursor:ew-resize; }
.ruler-corner{ position:absolute; z-index:59; background:#f6f7f9; border-right:1px solid #e3e5ea; border-bottom:1px solid #e3e5ea; }
.ruler-corner.hidden{ display:none; }
/* live cursor position indicator on the rulers */
.rcur{ position:absolute; z-index:60; pointer-events:none; display:none; }
.rcur-t{ width:1px; background:var(--accent,#2b3fee); }
.rcur-l{ height:1px; background:var(--accent,#2b3fee); }
.rcur-badge{ position:absolute; font:10px/1.4 ui-monospace,SFMono-Regular,monospace; color:#fff; background:var(--accent,#2b3fee); border-radius:4px; padding:1px 4px; white-space:nowrap; }
.rcur-t .rcur-badge{ left:2px; top:1px; }
.rcur-l .rcur-badge{ left:1px; top:2px; }
/* Guides / margins / bleed */
.guide-layer{ position:absolute; z-index:57; pointer-events:none; overflow:visible; }
.ov-margin{ position:absolute; border:1px dashed rgba(91,91,245,.65); pointer-events:none; }
.ov-bleed{ position:absolute; border:1px dashed rgba(224,72,63,.65); pointer-events:none; }
.ov-guide{ position:absolute; pointer-events:auto; }
.ov-guide.gv{ top:0; height:100%; width:1px; background:#12b2a6; cursor:ew-resize; }
.ov-guide.gh{ left:0; width:100%; height:1px; background:#12b2a6; cursor:ns-resize; }
.ov-guide.gv::before{ content:""; position:absolute; left:-4px; top:0; width:9px; height:100%; }
.ov-guide.gh::before{ content:""; position:absolute; top:-4px; left:0; height:9px; width:100%; }
.imgslot{ display:flex; align-items:center; justify-content:center; background:#eef1f6; border:1.5px solid #d6dce6; color:#9aa6b8; font-size:12px; }
.handle{ position:absolute; width:calc(10px*var(--inv,1)); height:calc(10px*var(--inv,1)); background:#fff; border:calc(1.5px*var(--inv,1)) solid var(--accent); border-radius:calc(2px*var(--inv,1)); z-index:50; box-shadow:0 1px 3px rgba(0,0,0,.35); pointer-events:auto; }
.handle.tl{left:calc(-6px*var(--inv,1));top:calc(-6px*var(--inv,1));cursor:nwse-resize} .handle.tr{right:calc(-6px*var(--inv,1));top:calc(-6px*var(--inv,1));cursor:nesw-resize}
.handle.bl{left:calc(-6px*var(--inv,1));bottom:calc(-6px*var(--inv,1));cursor:nesw-resize} .handle.br{right:calc(-6px*var(--inv,1));bottom:calc(-6px*var(--inv,1));cursor:nwse-resize}
.handle.t{left:calc(50% - 5px*var(--inv,1));top:calc(-6px*var(--inv,1));cursor:ns-resize} .handle.b{left:calc(50% - 5px*var(--inv,1));bottom:calc(-6px*var(--inv,1));cursor:ns-resize}
.handle.l{top:calc(50% - 5px*var(--inv,1));left:calc(-6px*var(--inv,1));cursor:ew-resize} .handle.r{top:calc(50% - 5px*var(--inv,1));right:calc(-6px*var(--inv,1));cursor:ew-resize}
.handle.rot{ left:calc(50% - 12px*var(--inv,1)); top:calc(-34px*var(--inv,1)); width:calc(24px*var(--inv,1)); height:calc(24px*var(--inv,1)); border-radius:50%;
  background:var(--accent) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g stroke="white" stroke-width="2.6" fill="none" stroke-linecap="round" stroke-linejoin="round"><path d="M4 12a8 8 0 1 0 8-8 8.6 8.6 0 0 0-6 2.5L4 8.5"/><path d="M4 4v4.5h4.5"/></g></svg>') center/60% no-repeat;
  border:calc(1.5px*var(--inv,1)) solid #fff; box-shadow:0 2px 8px rgba(0,0,0,.4);
  cursor:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24"><g stroke="white" stroke-width="5" fill="none" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12a9 9 0 1 0 9-9 9.7 9.7 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></g><g stroke="black" stroke-width="2.2" fill="none" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12a9 9 0 1 0 9-9 9.7 9.7 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></g></svg>') 11 11, grab; }
.handle.rot::after{ content:""; position:absolute; left:calc(50% - 0.75px*var(--inv,1)); top:calc(23px*var(--inv,1)); width:calc(1.5px*var(--inv,1)); height:calc(12px*var(--inv,1)); background:var(--accent); }

.panel{ width:300px; background:var(--panel); border:none; border-left:1px solid var(--line); border-radius:0; box-shadow:none; display:flex; flex-direction:column; align-self:stretch; overflow:hidden; }
.panel-section{ flex:1; overflow:auto; padding:16px; }
.ptabs{ display:flex; border-bottom:1px solid var(--line); flex:none; }
.ptab{ flex:1; padding:12px 8px; background:transparent; border:none; font-size:11px; font-weight:700; color:var(--muted); border-bottom:2px solid transparent; letter-spacing:.12em; text-transform:uppercase; }
.ptab:hover{ color:var(--ink); }
.ptab.active{ color:var(--ink); border-bottom-color:var(--accent); }
.ppane{ display:none; flex:1; min-height:0; }
.ppane.active{ display:flex; flex-direction:column; }
.panel-inner{ flex:1; overflow:auto; padding:14px; }
/* Floating, draggable panels (Photoshop / Illustrator style) */
.fpanel{ position:fixed; width:298px; max-height:calc(100vh - 150px); background:var(--panel); border:1px solid var(--line); border-radius:12px; box-shadow:0 22px 56px -14px rgba(0,0,0,.42); display:flex; flex-direction:column; overflow:hidden; z-index:72; }
.fpanel-head{ flex:none; display:flex; align-items:center; gap:8px; padding:9px 12px; cursor:move; font-size:11px; font-weight:700; letter-spacing:.12em; text-transform:uppercase; color:var(--muted); border-bottom:1px solid var(--line); user-select:none; touch-action:none; }
.fpanel-head svg{ opacity:.6; }
.fpanel-head:hover{ color:var(--ink); }
.fpanel-close{ margin-left:auto; width:22px; height:22px; display:grid; place-items:center; background:transparent; border:none; border-radius:6px; color:var(--muted); cursor:pointer; }
.fpanel-close:hover{ background:var(--hover); color:var(--ink); }
.fpanel-close svg{ opacity:1; transition:transform .16s ease; }
.fpanel.collapsed{ max-height:none !important; }
.fpanel.collapsed .ppane{ display:none; }
.fpanel.collapsed .fpanel-head{ border-bottom:none; }
.fpanel.collapsed .fpanel-close svg{ transform:rotate(180deg); }
.fpanel-resize{ flex:none; height:11px; cursor:ns-resize; display:flex; align-items:center; justify-content:center; border-top:1px solid var(--line); }
.fpanel-resize::after{ content:""; width:34px; height:3px; border-radius:2px; background:var(--line); }
.fpanel-resize:hover::after{ background:var(--muted); }
.fpanel.collapsed .fpanel-resize{ display:none; }
#panelProps{ right:172px; top:64px; max-height:58vh; }
#panelLayers{ right:172px; bottom:56px; max-height:40vh; }
/* Pages panel (right) */
.pages-panel{ flex:none; width:156px; background:var(--panel); border-left:1px solid var(--line); display:flex; flex-direction:column; min-height:0; }
.pages-panel.collapsed{ display:none; }
.pp-head{ flex:none; display:flex; align-items:center; justify-content:space-between; padding:10px 12px; font-size:11px; font-weight:700; letter-spacing:.12em; text-transform:uppercase; color:var(--muted); border-bottom:1px solid var(--line); }
.pp-collapse{ background:transparent; border:none; color:var(--muted); cursor:pointer; display:grid; place-items:center; width:22px; height:22px; border-radius:6px; }
.pp-collapse:hover{ background:var(--hover); color:var(--ink); }
.pp-list{ flex:1; overflow:auto; padding:12px 10px; display:flex; flex-direction:column; gap:12px; }
.pp-list.grid{ display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.pp-item{ cursor:pointer; }
.pp-thumbwrap{ border:2px solid var(--line); border-radius:8px; overflow:hidden; background:#fff; box-shadow:0 2px 10px rgba(0,0,0,.12); transition:border-color .12s; }
.pp-item:hover .pp-thumbwrap{ border-color:var(--muted); }
.pp-item.active .pp-thumbwrap{ border-color:var(--accent); box-shadow:0 0 0 2px color-mix(in srgb,var(--accent) 30%,transparent),0 2px 10px rgba(0,0,0,.14); }
.pp-thumb{ position:relative; width:100%; }
.pp-num{ display:block; text-align:center; font-size:11px; font-weight:600; color:var(--muted); margin-top:4px; }
.pp-item.active .pp-num{ color:var(--accent); }
.pp-add{ flex:none; margin:0 10px 10px; padding:9px; border:1px dashed var(--field-bd); border-radius:9px; background:transparent; color:var(--ink); font-size:12.5px; font-weight:600; cursor:pointer; display:flex; align-items:center; justify-content:center; gap:6px; }
.pp-add:hover{ background:var(--hover); border-color:var(--accent); }
.pp-foot{ flex:none; display:flex; gap:4px; justify-content:center; padding:8px; border-top:1px solid var(--line); }
.pp-foot button{ width:30px; height:26px; display:grid; place-items:center; background:transparent; border:none; border-radius:7px; color:var(--muted); cursor:pointer; }
.pp-foot button:hover{ background:var(--hover); color:var(--ink); }
.pp-foot button.on{ background:var(--accent); color:#fff; }
.pp-reopen{ position:fixed; right:0; top:50%; transform:translateY(-50%); z-index:100; width:24px; height:44px; border:1px solid var(--line); border-right:none; background:var(--panel); border-radius:8px 0 0 8px; display:none; place-items:center; cursor:pointer; color:var(--muted); box-shadow:-4px 0 12px -6px rgba(0,0,0,.3); }
.pp-reopen.show{ display:grid; }
.pp-reopen:hover{ color:var(--ink); }
.page-ctx{ position:fixed; }
/* My Projects page */
.projects{ min-height:100vh; background:var(--bg,#fff); color:var(--ink,#14161c); }
.projects.hidden{ display:none; }
.pj-bar{ display:flex; align-items:center; justify-content:space-between; padding:14px 26px; border-bottom:1px solid var(--line,#ececf2); position:sticky; top:0; background:var(--panel,#fff); z-index:10; }
.pj-logo{ display:flex; align-items:center; gap:9px; font-weight:800; font-size:18px; color:var(--ink,#14161c); cursor:pointer; }
.pj-new{ display:inline-flex; align-items:center; gap:7px; background:var(--accent,#2b3fee); color:#fff; border:none; border-radius:10px; padding:10px 16px; font-size:14px; font-weight:700; cursor:pointer; }
.pj-new:hover{ background:#2233d8; }
.pj-wrap{ max-width:1200px; margin:0 auto; padding:26px 26px 80px; }
.pj-title{ font-size:26px; font-weight:800; margin:6px 0 18px; }
.pj-search{ display:flex; align-items:center; gap:10px; border:1px solid var(--field-bd,#e2e2ea); border-radius:12px; padding:12px 16px; background:var(--field,#f6f6f9); color:var(--muted,#6e7280); }
.pj-search input{ flex:1; border:none; background:transparent; outline:none; font-size:15px; color:var(--ink,#14161c); }
.pj-controls{ display:flex; gap:10px; margin:14px 0 6px; }
.pj-controls select{ height:38px; border:1px solid var(--field-bd,#e2e2ea); border-radius:9px; background:var(--field,#fff); padding:0 12px; font-size:13.5px; color:var(--ink,#14161c); cursor:pointer; }
.pj-h{ font-size:16px; font-weight:700; margin:26px 0 12px; }
.pj-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:16px; }
.pj-card{ position:relative; border-radius:12px; cursor:pointer; }
.pj-thumb{ position:relative; aspect-ratio:4/3; border-radius:10px; overflow:hidden; background:var(--field,#eceef3); border:1px solid var(--line,#ececf2); display:flex; align-items:center; justify-content:center; }
.pj-mini{ position:absolute; inset:0; overflow:hidden; }
.pj-thumb img{ width:100%; height:100%; object-fit:contain; }
.pj-card.img .pj-thumb img{ object-fit:cover; }
.pj-card:hover .pj-thumb{ border-color:var(--accent,#2b3fee); }
.pj-meta{ padding:8px 2px 0; }
.pj-name{ font-size:13.5px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pj-sub{ font-size:12px; color:var(--muted,#8a9099); margin-top:2px; }
.pj-more{ position:absolute; top:8px; right:8px; width:28px; height:28px; border:none; border-radius:8px; background:rgba(255,255,255,.92); color:#333; font-size:18px; line-height:1; cursor:pointer; opacity:0; transition:opacity .12s; box-shadow:0 1px 4px rgba(0,0,0,.2); }
.pj-card:hover .pj-more{ opacity:1; }
.pj-empty{ grid-column:1/-1; color:var(--muted,#8a9099); font-size:14px; padding:14px 2px; }
.pj-ctx{ position:fixed; z-index:2100; background:var(--panel,#fff); border:1px solid var(--line,#ececf2); border-radius:10px; box-shadow:0 14px 36px rgba(20,28,60,.22); padding:5px; min-width:130px; }
.pj-ctx button{ display:block; width:100%; text-align:left; padding:8px 11px; background:transparent; border:none; border-radius:7px; font-size:13px; color:var(--ink,#14161c); cursor:pointer; }
.pj-ctx button:hover{ background:var(--hover,#f1f1f6); }
.pj-ctx button.danger{ color:#e0483f; }
.pj-badge{ position:absolute; top:8px; left:8px; font-size:10.5px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; padding:3px 8px; border-radius:6px; }
.pj-badge.pub{ background:#0f9d58; color:#fff; }
.pj-badge.draft{ background:rgba(0,0,0,.6); color:#fff; }
.pj-adminbadge{ font-size:10.5px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--accent,#2b3fee); background:color-mix(in srgb,var(--accent,#2b3fee) 12%,transparent); padding:2px 8px; border-radius:6px; vertical-align:middle; margin-left:6px; }
/* Login gate */
body.locked{ overflow:hidden; }
#authGate{ position:fixed; inset:0; z-index:2000; display:flex; align-items:center; justify-content:center; background:linear-gradient(135deg,#eef0f7,#e7eaf3); }
#authGate .ag-card{ width:340px; max-width:92vw; background:#fff; border:1px solid #e7e7ee; border-radius:18px; box-shadow:0 30px 80px -24px rgba(20,28,60,.4); padding:30px 28px; display:flex; flex-direction:column; gap:10px; font-family:'Inter',system-ui,sans-serif; }
#authGate .ag-brand{ font-size:22px; font-weight:800; color:#14161c; text-align:center; }
#authGate .ag-sub{ font-size:13.5px; color:#6e7280; text-align:center; margin-bottom:12px; }
#authGate .ag-google{ display:flex; align-items:center; justify-content:center; gap:10px; height:44px; border:1px solid #dcdce6; border-radius:10px; background:#fff; font-size:14px; font-weight:600; color:#14161c; cursor:pointer; }
#authGate .ag-google:hover{ background:#f6f7fb; }
#authGate .ag-or{ display:flex; align-items:center; gap:10px; color:#9aa0a6; font-size:12px; margin:6px 0; }
#authGate .ag-or::before,#authGate .ag-or::after{ content:""; flex:1; height:1px; background:#ececf2; }
#authGate .ag-input{ height:44px; border:1px solid #dcdce6; border-radius:10px; padding:0 12px; font-size:14px; color:#14161c; outline:none; }
#authGate .ag-input:focus{ border-color:#5b5bf5; }
#authGate .ag-primary{ height:44px; border:none; border-radius:10px; background:#2b3fee; color:#fff; font-size:14px; font-weight:700; cursor:pointer; margin-top:4px; }
#authGate .ag-primary:hover{ background:#2233d8; }
#authGate .ag-ghost{ height:40px; border:none; background:transparent; color:#4338CA; font-size:13.5px; font-weight:600; cursor:pointer; }
#authGate .ag-ghost:hover{ text-decoration:underline; }
#authGate .ag-msg{ min-height:18px; font-size:12.5px; color:#6e7280; text-align:center; }
#authGate .ag-msg.err{ color:#d23f31; }
/* layers */
.layers-top{ display:flex; gap:8px; padding:12px 14px; border-bottom:1px solid var(--line); flex:none; }
.layers-top label{ display:block; font-size:10.5px; font-weight:700; text-transform:uppercase; letter-spacing:.12em; color:var(--muted); margin-bottom:6px; }
.layers-top .lt-field{ flex:1; min-width:0; }
.layers-top .lt-op{ flex:0 0 84px; }
.layers-top select,.layers-top input{ width:100%; height:34px; border:1px solid var(--field-bd); background:var(--field); border-radius:8px; padding:0 10px; font-size:13px; font-family:inherit; color:var(--ink); outline:none; transition:border-color .15s; }
.layers-top input{ font-family:'JetBrains Mono',ui-monospace,monospace; font-size:12px; }
.layers-top select:hover,.layers-top input:hover{ border-color:var(--bdh); }
.layers-top select:focus,.layers-top input:focus{ border-color:var(--accent); }
.layers-top.disabled select,.layers-top.disabled input{ opacity:.45; }
.layers-actions{ display:flex; gap:4px; padding:10px; border-top:1px solid var(--line); flex:none; }
.layers-actions button{ flex:1; height:32px; display:grid; place-items:center; background:transparent; border:none; border-radius:8px; color:var(--dim); transition:background .12s,color .12s; }
.layers-actions button:hover{ background:var(--hover); color:var(--ink); }
.layers-actions button.on{ background:var(--accent); color:#fff; }
.layers-actions button.danger{ color:#F08A82; }
.layers-actions button.danger:hover{ background:rgba(224,72,63,.15); color:#FF9B93; }
.layers-actions.disabled button{ opacity:.45; }
.llock{ margin-left:auto; color:var(--muted); flex:none; display:grid; place-items:center; }
.lfx{ width:22px; height:20px; border:none; background:transparent; color:var(--dim); font-family:'Instrument Serif',Georgia,serif; font-style:italic; font-weight:700; font-size:12px; display:grid; place-items:center; flex:none; transition:color .12s; }
.lfx:hover{ color:var(--ink); }
.lrow.sel .lfx{ color:#DDE1FD; }
.lmore{ width:26px; height:26px; border:none; background:transparent; border-radius:7px; color:var(--muted); display:grid; place-items:center; opacity:0; transition:opacity .12s, background .12s; flex:none; }
.lrow:hover .lmore,.lrow.sel .lmore{ opacity:1; }
.lmore:hover{ background:var(--hover); color:var(--ink); }
.lrow .llock{ margin-left:0; }
.lrow .lname{ flex:1; }
.lt-fx{ flex:0 0 44px; }
.lt-fx label{ display:block; font-size:10.5px; margin-bottom:6px; }
#fxBtn{ width:100%; height:34px; border:1px solid var(--field-bd); background:var(--field); border-radius:8px; color:var(--dim); font-style:italic; font-weight:700; font-size:13px; font-family:'Instrument Serif',Georgia,serif; transition:all .12s; }
#fxBtn:hover{ background:var(--hover); color:var(--ink); }
.fx-dialog{ position:fixed; z-index:120; left:50%; top:50%; transform:translate(-50%,-50%); width:580px; max-width:94vw; background:var(--panel); border:1px solid var(--line); border-radius:14px; box-shadow:0 40px 90px -20px rgba(0,0,0,.75); display:flex; flex-direction:column; }
.fxd-head{ display:flex; align-items:center; justify-content:space-between; padding:13px 16px; border-bottom:1px solid var(--line); font-weight:700; font-size:13.5px; color:var(--ink); cursor:move; user-select:none; touch-action:none; }
.fxd-x{ width:28px; height:28px; border:none; background:transparent; border-radius:7px; color:var(--muted); font-size:13px; }
.fxd-x:hover{ background:var(--hover); color:var(--ink); }
.fxd-body{ display:grid; grid-template-columns:195px 1fr; min-height:330px; }
.fxd-list{ border-right:1px solid var(--line); padding:8px; overflow-y:auto; max-height:400px; }
.fxd-row{ display:flex; align-items:center; gap:9px; padding:8px 10px; border-radius:8px; font-size:13px; color:var(--dim); cursor:pointer; user-select:none; transition:background .12s,color .12s; }
.fxd-row:hover{ background:var(--hover); color:var(--ink); }
.fxd-row.cur{ background:var(--accent); color:#fff; }
.fxd-row.dis{ opacity:.35; cursor:default; }
.fxd-row.dis:hover{ background:transparent; color:var(--dim); }
.fxd-row input[type=checkbox]{ accent-color:var(--accent); flex:none; }
.fxd-chk{ width:13px; flex:none; }
.fxd-settings{ padding:16px; overflow-y:auto; max-height:400px; }
.fxd-title{ font-size:10.5px; font-weight:700; letter-spacing:.12em; text-transform:uppercase; color:var(--muted); margin-bottom:14px; }
.fxd-settings input[type=color]{ width:100%; height:34px; padding:0; border:2px solid var(--field-bd); border-radius:9px; background:none; }
.fxd-off{ font-size:12.5px; color:var(--muted); margin-top:6px; }
.fxd-foot{ display:flex; justify-content:flex-end; gap:8px; padding:12px 16px; border-top:1px solid var(--line); }
.lhead{ display:flex; gap:6px; margin-bottom:10px; }
.lrow{ display:flex; align-items:center; gap:9px; padding:6px 8px; border-radius:9px; cursor:pointer; border:1px solid transparent; color:var(--dim); }
.lrow:hover{ background:var(--soft); }
.lrow.sel{ background:rgba(43,63,238,.18); border-color:rgba(43,63,238,.4); color:#DDE1FD; }
.lrow.sel .lname{ color:#DDE1FD; }
.lrow.hid .lname,.lrow.hid .lthumb{ opacity:.4; }
.lrow.over{ box-shadow:inset 0 2px 0 var(--accent); }
.lrow.dragging{ opacity:.5; }
.leye{ width:24px; height:24px; border:none; background:transparent; color:var(--muted); display:flex; align-items:center; justify-content:center; border-radius:6px; flex:none; }
.leye:hover{ background:var(--hover); color:var(--ink); }
.lthumb{ width:34px; height:34px; border-radius:6px; background:var(--field); border:1px solid var(--field-bd); overflow:hidden; display:flex; align-items:center; justify-content:center; flex:none; }
.lthumb img{ width:100%; height:100%; object-fit:cover; }
.lthumb .tt{ font-family:'Instrument Serif',Georgia,serif; font-weight:700; font-size:16px; color:var(--dim); }
.lthumb .sw{ width:20px; height:20px; border-radius:4px; }
.lthumb .ph{ color:var(--muted); font-size:16px; }
.lname{ font-size:13px; color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.panel-empty{ color:var(--muted); font-size:13.5px; line-height:1.5; }
.field{ margin-bottom:14px; }
.field label{ display:block; font-size:10.5px; font-weight:700; text-transform:uppercase; letter-spacing:.12em; color:var(--muted); margin-bottom:6px; }
.field input[type=text],.field input[type=number],.field select,.field textarea{
  width:100%; border:1px solid var(--field-bd); background:var(--field); border-radius:8px; padding:0 10px; height:34px; line-height:32px; font-size:13px; font-family:inherit; color:var(--ink); outline:none; transition:border-color .15s; }
.field input[type=number]{ font-family:'JetBrains Mono',ui-monospace,monospace; font-size:12px; }
.field textarea{ height:auto; line-height:1.45; padding:8px 10px; }
.field input:hover,.field select:hover,.field textarea:hover{ border-color:var(--bdh); }
.field input:focus,.field select:focus,.field textarea:focus{ border-color:var(--accent); }
.field textarea{ resize:vertical; min-height:60px; }
.row2{ display:flex; gap:8px; } .row2 > *{ flex:1; }
.color-row{ display:flex; align-items:center; gap:8px; }
.color-row input[type=color]{ width:38px; height:34px; padding:0; border:2px solid var(--field-bd); border-radius:9px; background:none; }
.btn-row{ display:flex; gap:6px; flex-wrap:wrap; }
.al-row{ display:flex; gap:4px; }
.al-btn.on{ background:var(--accent); border-color:var(--accent); color:#fff; }
.sw-mix{ display:flex; align-items:center; gap:10px; }
.sw-mix input[type=range]{ flex:1; }
.sw-mix input[type=number]{ width:64px; height:34px; border:1px solid var(--field-bd); background:var(--field); border-radius:8px; padding:0 10px; color:var(--ink); font-family:'JetBrains Mono',ui-monospace,monospace; font-size:12px; outline:none; }
.sw-mix input[type=number]:focus{ border-color:var(--accent); }
.rad-all{ display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.rad-all input{ flex:1; }
.rad-ic{ width:44px; height:34px; flex:none; display:grid; place-items:center; color:var(--dim); }
.rad-grid{ display:grid; grid-template-columns:1fr 44px 1fr; gap:8px; align-items:center; justify-items:stretch; }
.rad-grid .al-btn{ width:100%; height:34px; }
.al-btn{ flex:1; height:30px; border:1px solid var(--field-bd); background:var(--field); border-radius:7px; display:grid; place-items:center; color:var(--dim); transition:all .12s; }
.al-btn:hover{ background:var(--hover); color:var(--ink); border-color:var(--bdh); }
.al-btn:active{ background:var(--accent); border-color:var(--accent); color:#fff; }
.mini-btn{ font-size:12px; font-weight:600; border:1px solid var(--field-bd); background:var(--field); border-radius:8px; padding:7px 10px; color:var(--ink); }
.mini-btn:hover{ background:var(--hover); }
.mini-btn.danger{ color:#F08A82; border-color:rgba(224,72,63,.4); }
.layer-name{ font-weight:700; font-size:14px; margin-bottom:2px; color:var(--ink); }
.layer-type{ font-size:10.5px; color:var(--muted); text-transform:uppercase; letter-spacing:.12em; margin-bottom:14px; }

.overlay{ position:fixed; inset:0; background:rgba(20,18,14,.86); display:flex; flex-direction:column; align-items:center; justify-content:center; gap:16px; z-index:100; }
.overlay #overlayMsg{ font-size:14px; color:var(--muted); font-weight:600; }
.spinner{ width:38px; height:38px; border:3px solid var(--line); border-top-color:var(--accent); border-radius:50%; animation:spin .8s linear infinite; }
@keyframes spin{ to{ transform:rotate(360deg); } }
.toast{ position:fixed; bottom:22px; left:50%; transform:translateX(-50%); background:#0D0D0D; color:var(--ink); border:1px solid var(--line); padding:11px 18px; border-radius:10px; font-size:13.5px; z-index:200; box-shadow:var(--shadow); max-width:80vw; }
.toast.err{ background:var(--danger); color:#fff; border-color:transparent; }


/* ---------- light editor theme ---------- */
body.light{
  --bg:#F3F2EF; --panel:#FFFFFF; --ink:#1B1B19; --muted:#8A8880; --line:#E6E4DE;
  --soft:#F1EFEA; --field:#F5F4F1; --field-bd:#DCD9D2; --hover:#ECEAE4;
  --dim:#6E6C66; --bdh:#B9B6AE; --dots:#CFCFCF; --canvas:#E3E3E3;
  --shadow:0 6px 24px rgba(30,28,24,.14), 0 1px 2px rgba(30,28,24,.06);
}
body.light .editor{ color-scheme:light; }
body.light .lrow.sel,body.light .lrow.sel .lname{ color:#2B3FEE; }
body.light .toast{ background:#1B1B19; color:#F5F4F1; border-color:transparent; }
body.light .overlay{ background:rgba(243,242,239,.88); }
body.light .stage{ box-shadow:0 24px 50px -18px rgba(30,28,24,.35); }
/* ===================== TEMPLIFY HOME (scoped .tf) ===================== */
.tf{ --bg:#FAF8F4; --fg:#191713; --card:#FFFFFF; --mut2:#5C574E; --mut3:#989286; --bd:#E8E4DB;
  --acc:#2B3FEE; --accsoft:#E9EBFE; --gold:#C79A3B;
  --serif:'Instrument Serif',Georgia,serif; --tmono:'JetBrains Mono',ui-monospace,monospace;
  background:var(--bg); color:var(--fg); font-family:'Schibsted Grotesk',system-ui,sans-serif; display:block; min-height:100vh; line-height:1.5; }
.tf *{ box-sizing:border-box; }
.tf button{ font-family:inherit; cursor:pointer; border:none; background:none; color:inherit; }
.tf ::selection{ background:var(--acc); color:#fff; }
.tf em{ font-family:var(--serif); font-style:italic; font-weight:400; color:var(--acc); letter-spacing:-.01em; }
@keyframes tfRise{ from{opacity:0; transform:translateY(16px)} to{opacity:1; transform:none} }
@keyframes tfCardIn{ from{opacity:0; transform:translateY(12px)} to{opacity:1; transform:none} }
@keyframes tfBlink{ 50%{opacity:0} }
@keyframes tfDrift{ 0%,100%{transform:translate(0,0)} 30%{transform:translate(46px,-38px)} 60%{transform:translate(14px,-70px)} 80%{transform:translate(-20px,-24px)} }

/* --- nav --- */
.tf-nav{ position:sticky; top:0; z-index:50; background:rgba(250,248,244,.85); backdrop-filter:blur(14px); border-bottom:1px solid var(--bd); }
.tf-nav-in{ max-width:1280px; margin:0 auto; height:68px; display:flex; align-items:center; gap:24px; padding:0 40px; }
.tf-logo{ display:flex; align-items:center; gap:10px; flex:none; font-weight:800; font-size:21px; letter-spacing:-.02em; }
.tf-mark{ width:30px; height:30px; border-radius:9px; background:var(--fg); position:relative; overflow:hidden; }
.tf-mark::before{ content:""; position:absolute; inset:6px 6px 12px 12px; background:var(--acc); border-radius:3px; }
.tf-mark::after{ content:""; position:absolute; inset:13px 13px 6px 6px; background:var(--gold); border-radius:3px; mix-blend-mode:screen; }
.tf-mark-sm{ width:24px; height:24px; border-radius:7px; }
.tf-brand-sm{ font-size:16px; }
.tf-navsearch{ flex:1; max-width:440px; display:flex; align-items:center; gap:10px; height:42px; padding:0 16px; background:var(--card); border:1px solid var(--bd); border-radius:11px; color:var(--mut3); transition:border-color .2s, box-shadow .2s; }
.tf-navsearch:focus-within{ border-color:var(--acc); box-shadow:0 0 0 3px var(--accsoft); }
.tf-navsearch input{ border:none; outline:none; background:none; width:100%; font-size:14px; color:var(--fg); font-family:inherit; }
.tf-navsearch input::placeholder{ color:var(--mut3); }
.tf-navsearch kbd{ font-family:var(--tmono); font-size:11px; color:var(--mut3); border:1px solid var(--bd); border-radius:5px; padding:2px 6px; background:var(--bg); }
.tf-navlinks{ margin-left:auto; display:flex; gap:22px; font-size:14px; font-weight:500; color:var(--mut2); }
.tf-navlinks a{ cursor:pointer; transition:color .15s; }
.tf-navlinks a:hover{ color:var(--fg); }
.tf-navright{ display:flex; align-items:center; gap:12px; }
.tf-ico{ position:relative; width:38px; height:38px; border-radius:10px; display:grid; place-items:center; color:var(--mut2); transition:background .15s,color .15s; }
.tf-ico:hover{ background:#F0EDE6; color:var(--fg); }
.tf-dot{ position:absolute; top:8px; right:9px; width:7px; height:7px; border-radius:50%; background:var(--acc); border:2px solid var(--bg); }
.tf-premium{ display:flex; align-items:center; gap:7px; height:38px; padding:0 16px; border-radius:10px; background:var(--fg); color:var(--bg); font-size:13.5px; font-weight:600; transition:transform .15s, box-shadow .15s; }
.tf-premium:hover{ transform:translateY(-1px); box-shadow:0 6px 16px rgba(25,23,19,.25); }
.tf-premium svg{ color:var(--gold); }
.tf-avwrap{ position:relative; }
.tf-avatar{ width:38px; height:38px; border-radius:50%; background:linear-gradient(135deg,#F2B85C,#E1633C); display:grid; place-items:center; font-weight:700; font-size:14px; color:#fff; border:2px solid var(--card); box-shadow:0 0 0 1px var(--bd); transition:box-shadow .15s; }
.tf-avwrap:hover .tf-avatar{ box-shadow:0 0 0 2px var(--acc); }
.tf-dd{ position:absolute; top:calc(100% + 10px); right:0; width:216px; background:var(--card); border:1px solid var(--bd); border-radius:14px; box-shadow:0 16px 40px rgba(25,23,19,.12); padding:8px; opacity:0; visibility:hidden; transform:translateY(-6px); transition:all .18s; z-index:60; }
.tf-avwrap:hover .tf-dd{ opacity:1; visibility:visible; transform:translateY(0); }
.tf-dd-head{ padding:10px 12px; border-bottom:1px solid var(--bd); margin-bottom:6px; }
.tf-dd-head strong{ display:block; font-size:14px; }
.tf-dd-head span{ font-size:12px; color:var(--mut3); }
.tf-dd a{ display:block; padding:9px 12px; border-radius:8px; font-size:13.5px; color:var(--mut2); cursor:pointer; transition:background .12s; }
.tf-dd a:hover{ background:var(--bg); color:var(--fg); }

/* --- hero --- */
.tf-hero{ position:relative; text-align:center; padding:88px 24px 60px; overflow:hidden; }
.tf-hero::before{ content:""; position:absolute; inset:0; pointer-events:none; background:
  radial-gradient(560px 300px at 18% 0%,rgba(43,63,238,.07),transparent 65%),
  radial-gradient(500px 280px at 85% 10%,rgba(199,154,59,.09),transparent 60%); }
.tf-hero-grid{ position:absolute; inset:0; background-image:linear-gradient(var(--bd) 1px,transparent 1px),linear-gradient(90deg,var(--bd) 1px,transparent 1px); background-size:56px 56px; opacity:.35; -webkit-mask-image:radial-gradient(ellipse 70% 80% at 50% 20%,black,transparent); mask-image:radial-gradient(ellipse 70% 80% at 50% 20%,black,transparent); pointer-events:none; }
.tf-hero-badge{ position:relative; display:inline-flex; align-items:center; gap:8px; font-size:12.5px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--acc); background:var(--accsoft); border:1px solid #CBD2FB; border-radius:99px; padding:6px 14px; margin-bottom:26px; animation:tfRise .6s .05s both; }
.tf-h1{ position:relative; font-size:clamp(40px,5.6vw,66px); line-height:1.04; font-weight:800; letter-spacing:-.035em; max-width:820px; margin:0 auto 20px; animation:tfRise .6s .15s both; }
.tf-sub{ position:relative; font-size:18px; color:var(--mut2); max-width:540px; margin:0 auto 38px; animation:tfRise .6s .25s both; }
.tf-herosearch{ position:relative; max-width:600px; margin:0 auto; display:flex; align-items:center; height:60px; background:var(--card); border:1.5px solid var(--bd); border-radius:16px; padding:0 8px 0 22px; color:var(--mut3); box-shadow:0 20px 45px -18px rgba(25,23,19,.18); transition:border-color .2s, box-shadow .2s; animation:tfRise .6s .35s both; }
.tf-herosearch:focus-within{ border-color:var(--acc); box-shadow:0 0 0 4px var(--accsoft),0 20px 45px -18px rgba(25,23,19,.18); }
.tf-herosearch svg{ flex:none; margin-right:12px; }
.tf-herosearch input{ flex:1; border:none; outline:none; background:none; font-size:16px; color:var(--fg); font-family:inherit; }
.tf-herosearch input::placeholder{ color:var(--mut3); }
.tf-searchbtn{ height:44px; padding:0 22px; border-radius:11px; background:var(--acc); color:#fff; font-size:14.5px; font-weight:600; transition:filter .15s; }
.tf-searchbtn:hover{ filter:brightness(1.1); }
.tf-trending{ position:relative; margin-top:20px; font-size:13.5px; color:var(--mut3); animation:tfRise .6s .45s both; }
.tf-trending button{ color:var(--mut2); font-size:13.5px; text-decoration:underline; text-underline-offset:3px; text-decoration-color:var(--bd); margin:0 4px; transition:color .15s; }
.tf-trending button:hover{ color:var(--acc); }

/* --- discovery / filters --- */
.tf-discovery{ padding:24px 0 0; }
.tf-disc-in{ max-width:1280px; margin:0 auto; padding:0 40px; }
.tf-seclabel{ display:flex; align-items:baseline; gap:14px; margin-bottom:18px; }
.tf-seclabel h2{ font-size:13px; font-weight:700; letter-spacing:.12em; text-transform:uppercase; color:var(--mut3); margin:0; }
.tf-rule{ flex:1; height:1px; background:var(--bd); }
.tf-chips{ display:flex; gap:10px; flex-wrap:wrap; }
.tf-chip{ display:flex; align-items:center; gap:9px; padding:11px 18px; border-radius:12px; background:var(--card); border:1px solid var(--bd); font-size:14.5px; font-weight:600; color:var(--mut2); transition:all .18s; }
.tf-chip .ico{ width:26px; height:26px; border-radius:8px; display:grid; place-items:center; font-size:13px; color:#191713; flex:none; }
.tf-chip .count{ font-size:12px; font-weight:500; color:var(--mut3); font-family:var(--tmono); }
.tf-chip.active .count{ color:rgba(250,248,244,.55); }
.tf-chip:hover{ border-color:var(--mut3); transform:translateY(-1px); }
.tf-chip.active{ background:var(--fg); border-color:var(--fg); color:var(--bg); box-shadow:0 8px 20px -8px rgba(25,23,19,.4); }
.tf-subfilters{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-top:16px; padding:14px 16px; background:linear-gradient(to right,#F3F0E9,#FAF8F4); border:1px dashed var(--bd); border-radius:12px; }
.tf-typelabel{ font-size:12px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--mut3); margin-right:6px; }
.tf-apill{ padding:7px 15px; border-radius:99px; font-size:13.5px; font-weight:500; color:var(--mut2); background:var(--card); border:1px solid var(--bd); transition:all .15s; }
.tf-apill:hover{ border-color:var(--acc); color:var(--acc); }
.tf-apill.active{ background:var(--acc); border-color:var(--acc); color:#fff; }

/* --- grid --- */
.tf-gridwrap{ max-width:1280px; margin:0 auto; padding:34px 40px 80px; }
.tf-gridhead{ display:flex; align-items:center; justify-content:space-between; margin-bottom:22px; }
.tf-h2{ font-size:24px; font-weight:700; letter-spacing:-.02em; margin:0; }
.tf-count{ font-size:13px; color:var(--mut3); margin:4px 0 0; }
.tf-sort{ display:flex; align-items:center; gap:8px; font-size:13.5px; color:var(--mut2); border:1px solid var(--bd); background:var(--card); border-radius:9px; padding:8px 14px; }
.tf-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:26px 22px; }
@media (max-width:1100px){ .tf-grid{ grid-template-columns:repeat(3,1fr); } }
@media (max-width:820px){ .tf-grid{ grid-template-columns:repeat(2,1fr); } }
@media (max-width:520px){ .tf-grid{ grid-template-columns:1fr; } }
.tf-card{ display:flex; flex-direction:column; gap:12px; cursor:pointer; animation:tfCardIn .45s both; }
.tf-card-img{ position:relative; aspect-ratio:4/5; border-radius:14px; overflow:hidden; border:1px solid var(--bd); background:var(--card); box-shadow:0 1px 2px rgba(25,23,19,.05); transition:transform .25s cubic-bezier(.2,.8,.3,1), box-shadow .25s; }
.tf-card:hover .tf-card-img{ transform:translateY(-4px); box-shadow:0 22px 40px -16px rgba(25,23,19,.25); }
.tf-card-img .mini-mount{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; overflow:hidden; }
.tf-card-overlay{ position:absolute; inset:0; background:rgba(25,23,19,.38); backdrop-filter:blur(2px); display:grid; place-items:center; opacity:0; transition:opacity .22s; z-index:2; }
.tf-card:hover .tf-card-overlay{ opacity:1; }
.tf-edit-btn{ display:flex; align-items:center; gap:8px; height:44px; padding:0 22px; border-radius:12px; background:var(--bg); color:var(--fg); font-size:14.5px; font-weight:700; transform:translateY(8px); transition:transform .22s, background .15s; box-shadow:0 10px 24px rgba(0,0,0,.25); }
.tf-card:hover .tf-edit-btn{ transform:translateY(0); }
.tf-edit-btn:hover{ background:#fff; }
.tf-card-badge{ position:absolute; top:12px; left:12px; font-size:11px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; padding:4px 9px; border-radius:7px; z-index:3; }
.tf-b-featured{ background:var(--fg); color:var(--gold); }
.tf-save{ position:absolute; top:10px; right:10px; width:32px; height:32px; border-radius:9px; display:grid; place-items:center; background:rgba(250,248,244,.9); color:var(--mut2); z-index:3; opacity:0; transition:all .18s; }
.tf-card:hover .tf-save{ opacity:1; }
.tf-save:hover{ background:#fff; color:var(--fg); }
.tf-save.saved{ opacity:1; background:var(--acc); color:#fff; }
.tf-card-meta{ display:flex; flex-direction:column; gap:2px; }
.tf-asset{ font-size:11px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--mut3); margin:0; }
.tf-card-row{ display:flex; align-items:baseline; justify-content:space-between; gap:10px; }
.tf-card-title{ font-size:14.5px; font-weight:600; letter-spacing:-.01em; margin:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tf-price{ font-size:13px; font-weight:700; font-family:var(--tmono); white-space:nowrap; }
.tf-price.tf-free{ color:#1B7A3D; }
.tf-rating{ display:flex; align-items:center; gap:5px; font-size:12.5px; color:var(--mut3); }
.tf-rating svg{ color:var(--gold); }
.tf-empty{ text-align:center; color:var(--mut3); padding:60px; font-size:15px; }

/* --- editor showcase --- */
.tf-editorsec{ padding:0 0 100px; }
.tf-editorsec-in{ max-width:1280px; margin:0 auto; padding:0 40px; }
.tf-editorsec-head{ display:flex; align-items:flex-end; justify-content:space-between; gap:24px; margin-bottom:28px; flex-wrap:wrap; }
.tf-h2b{ font-size:clamp(28px,3.4vw,42px); font-weight:800; letter-spacing:-.03em; line-height:1.1; max-width:520px; margin:0; }
.tf-editorsec-right{ max-width:380px; }
.tf-editorsec-right p{ font-size:15.5px; color:var(--mut2); margin:0 0 16px; }
.tf-dark-btn{ display:inline-flex; align-items:center; gap:8px; height:44px; padding:0 20px; border-radius:11px; background:var(--fg); color:var(--bg); font-size:14.5px; font-weight:600; transition:transform .15s, box-shadow .15s; }
.tf-dark-btn:hover{ transform:translateY(-1px); box-shadow:0 8px 20px rgba(25,23,19,.3); }
.tfe-frame{ border-radius:20px; overflow:hidden; border:1px solid #23211C; box-shadow:0 40px 90px -30px rgba(25,23,19,.45); background:#1C1A16; font-size:12px; color:#B9B4A8; }
.tfe-top{ display:flex; align-items:center; gap:6px; height:48px; padding:0 14px; background:#232019; border-bottom:1px solid #302D25; }
.tfe-dots{ display:flex; gap:6px; margin-right:10px; }
.tfe-dots i{ width:10px; height:10px; border-radius:50%; }
.tfe-dots i:nth-child(1){ background:#F26D5F; } .tfe-dots i:nth-child(2){ background:#F2BE4C; } .tfe-dots i:nth-child(3){ background:#5FBF6E; }
.tfe-menu{ display:flex; gap:2px; }
.tfe-menu button{ padding:6px 10px; border-radius:6px; font-size:12.5px; color:#B9B4A8; transition:background .12s; }
.tfe-menu button:hover{ background:#333026; color:#EFEBE0; }
.tfe-doc{ margin-left:14px; display:flex; align-items:center; gap:8px; font-size:12.5px; color:#EFEBE0; background:#2B2820; padding:6px 12px; border-radius:7px; }
.tfe-savedot{ width:6px; height:6px; border-radius:50%; background:#5FBF6E; }
.tfe-dim{ color:#8F8A7D; }
.tfe-spacer{ flex:1; }
.tfe-icobtn{ width:30px; height:30px; border-radius:7px; display:grid; place-items:center; color:#B9B4A8; transition:background .12s; }
.tfe-icobtn:hover{ background:#333026; color:#EFEBE0; }
.tfe-zoom{ display:flex; align-items:center; gap:2px; background:#2B2820; border-radius:7px; padding:2px; margin:0 8px; font-family:var(--tmono); }
.tfe-zoom span{ padding:0 8px; font-size:11.5px; color:#EFEBE0; }
.tfe-zoom button{ width:24px; height:24px; border-radius:6px; color:#B9B4A8; }
.tfe-zoom button:hover{ background:#333026; color:#EFEBE0; }
.tfe-export{ display:flex; align-items:center; gap:7px; height:34px; padding:0 16px; border-radius:8px; background:var(--acc); color:#fff; font-size:13px; font-weight:700; transition:filter .15s; }
.tfe-export:hover{ filter:brightness(1.12); }
.tfe-body{ display:grid; grid-template-columns:56px 1fr 248px; min-height:520px; }
@media (max-width:900px){ .tfe-body{ grid-template-columns:56px 1fr; } .tfe-props{ display:none; } }
.tfe-tray{ background:#232019; border-right:1px solid #302D25; display:flex; flex-direction:column; align-items:center; gap:6px; padding:12px 0; }
.tfe-tool{ width:40px; height:40px; border-radius:10px; display:grid; place-items:center; color:#8F8A7D; position:relative; transition:all .15s; }
.tfe-tool:hover{ background:#333026; color:#EFEBE0; }
.tfe-tool.active{ background:var(--acc); color:#fff; }
.tfe-tip{ position:absolute; left:calc(100% + 10px); top:50%; transform:translateY(-50%); background:#0E0D0A; color:#EFEBE0; font-size:11px; padding:5px 9px; border-radius:6px; white-space:nowrap; opacity:0; pointer-events:none; transition:opacity .15s; z-index:10; }
.tfe-tool:hover .tfe-tip{ opacity:1; }
.tfe-canvas{ position:relative; background:#14120E; background-image:radial-gradient(#26231C 1px,transparent 1px); background-size:22px 22px; display:grid; place-items:center; padding:36px; overflow:hidden; }
.tfe-artboard{ width:min(380px,80%); aspect-ratio:210/297; background:#fff; border-radius:3px; box-shadow:0 30px 60px -20px rgba(0,0,0,.6); position:relative; color:#191713; }
.tfe-band{ position:absolute; top:0; left:0; right:0; height:26%; background:linear-gradient(130deg,#0E7C6B,#17B49B); border-radius:3px 3px 0 0; }
.tfe-cross{ position:absolute; top:18px; right:20px; width:26px; height:26px; }
.tfe-cross::before,.tfe-cross::after{ content:""; position:absolute; background:rgba(255,255,255,.92); border-radius:2px; }
.tfe-cross::before{ left:10px; top:0; width:6px; height:26px; }
.tfe-cross::after{ top:10px; left:0; width:26px; height:6px; }
.tfe-abtitle{ position:absolute; top:8%; left:8%; color:#fff; font-weight:800; font-size:clamp(13px,2vw,19px); letter-spacing:-.02em; line-height:1.15; width:56%; }
.tfe-absub{ position:absolute; top:29.5%; left:8%; font-size:10px; color:#0E7C6B; font-weight:700; letter-spacing:.14em; text-transform:uppercase; }
.tfe-abline{ position:absolute; left:8%; height:5px; border-radius:3px; background:#E4E1D8; }
.tfe-abimg{ position:absolute; right:8%; top:37%; width:34%; aspect-ratio:1; border-radius:6px; background:linear-gradient(140deg,#BFE3DC,#7CC4B7); overflow:hidden; }
.tfe-abimg::after{ content:""; position:absolute; bottom:-12%; left:15%; width:70%; aspect-ratio:1; border-radius:50%; background:#3E9483; }
.tfe-abfoot{ position:absolute; bottom:5%; left:8%; right:8%; display:flex; justify-content:space-between; align-items:center; border-top:1px solid #E4E1D8; padding-top:8px; font-size:8px; color:#989286; font-family:var(--tmono); }
.tfe-sel{ position:absolute; top:6.5%; left:6%; width:60%; height:16%; border:1.5px solid var(--acc); background:rgba(43,63,238,.05); }
.tfe-h{ position:absolute; width:9px; height:9px; background:#fff; border:1.5px solid var(--acc); border-radius:2px; }
.tfe-h.tl{top:-5px;left:-5px} .tfe-h.tm{top:-5px;left:calc(50% - 5px)} .tfe-h.tr{top:-5px;right:-5px}
.tfe-h.ml{top:calc(50% - 5px);left:-5px} .tfe-h.mr{top:calc(50% - 5px);right:-5px}
.tfe-h.bl{bottom:-5px;left:-5px} .tfe-h.bm{bottom:-5px;left:calc(50% - 5px)} .tfe-h.br{bottom:-5px;right:-5px}
.tfe-rot{ position:absolute; top:-26px; left:calc(50% - 6px); width:12px; height:12px; border:1.5px solid var(--acc); border-radius:50%; background:#fff; }
.tfe-rot::after{ content:""; position:absolute; left:calc(50% - .75px); top:12px; width:1.5px; height:9px; background:var(--acc); }
.tfe-dimtag{ position:absolute; bottom:-24px; left:calc(50% - 34px); background:var(--acc); color:#fff; font-family:var(--tmono); font-size:9.5px; padding:3px 7px; border-radius:5px; }
.tfe-caret{ display:inline-block; width:1.5px; height:1em; background:#fff; vertical-align:text-bottom; margin-left:2px; animation:tfBlink 1.05s steps(1) infinite; }
.tfe-cursor{ position:absolute; bottom:18%; left:24%; pointer-events:none; animation:tfDrift 7s ease-in-out infinite; }
.tfe-cursor svg{ filter:drop-shadow(0 2px 4px rgba(0,0,0,.4)); }
.tfe-tag{ margin-left:12px; margin-top:-4px; background:#E1633C; color:#fff; font-size:10.5px; font-weight:700; padding:3px 8px; border-radius:6px 6px 6px 2px; display:inline-block; }
.tfe-props{ background:#232019; border-left:1px solid #302D25; padding:16px 16px 20px; display:flex; flex-direction:column; gap:18px; overflow-y:auto; }
.tfe-group h4{ font-size:10.5px; font-weight:700; letter-spacing:.12em; text-transform:uppercase; color:#8F8A7D; margin:0 0 10px; }
.tfe-row{ display:flex; gap:8px; margin-bottom:8px; }
.tfe-field{ flex:1; background:#2B2820; border:1px solid #383428; border-radius:8px; padding:7px 10px; display:flex; align-items:center; justify-content:space-between; gap:6px; font-size:12px; color:#EFEBE0; transition:border-color .15s; }
.tfe-field:hover{ border-color:#4A4535; }
.tfe-field label{ font-size:9.5px; color:#8F8A7D; text-transform:uppercase; letter-spacing:.05em; }
.tfe-field.tfe-wide{ flex:2; }
.tfe-val{ font-family:var(--tmono); font-size:11.5px; color:#EFEBE0; }
.tfe-seg{ display:flex; background:#2B2820; border:1px solid #383428; border-radius:8px; padding:3px; gap:2px; }
.tfe-seg button{ flex:1; height:26px; border-radius:6px; display:grid; place-items:center; color:#8F8A7D; transition:all .12s; }
.tfe-seg button:hover{ color:#EFEBE0; }
.tfe-seg button.on{ background:#3A3628; color:#EFEBE0; }
.tfe-swrow{ display:flex; align-items:center; gap:10px; }
.tfe-swatch{ width:34px; height:34px; border-radius:9px; background:linear-gradient(130deg,#0E7C6B,#17B49B); border:2px solid #383428; flex:none; }
.tfe-hex{ flex:1; display:flex; align-items:center; gap:8px; background:#2B2820; border:1px solid #383428; border-radius:8px; padding:8px 10px; font-family:var(--tmono); font-size:12px; color:#EFEBE0; }
.tfe-hex span{ color:#8F8A7D; }
.tfe-pct{ margin-left:auto; }
.tfe-slider{ -webkit-appearance:none; appearance:none; width:100%; height:4px; border-radius:2px; background:linear-gradient(to right,var(--acc) 0% 84%,#383428 84%); outline:none; }
.tfe-slider::-webkit-slider-thumb{ -webkit-appearance:none; width:15px; height:15px; border-radius:50%; background:#fff; border:2px solid var(--acc); cursor:pointer; box-shadow:0 2px 6px rgba(0,0,0,.4); }
.tfe-sliderrow{ display:flex; align-items:center; gap:10px; }
.tfe-sliderrow .tfe-val{ width:38px; text-align:right; }
.tfe-layers{ display:flex; flex-direction:column; gap:3px; }
.tfe-layer{ padding:7px 9px; border-radius:7px; font-size:12px; color:#B9B4A8; transition:background .12s; cursor:default; }
.tfe-layer:hover{ background:#2B2820; }
.tfe-layer.sel{ background:rgba(43,63,238,.18); color:#DDE1FD; border:1px solid rgba(43,63,238,.4); }

/* --- footer --- */
.tf-footer{ border-top:1px solid var(--bd); }
.tf-footer-in{ max-width:1280px; margin:0 auto; padding:44px 40px; display:flex; align-items:center; justify-content:space-between; gap:20px; flex-wrap:wrap; color:var(--mut3); font-size:13.5px; }
.tf-flinks{ display:flex; gap:24px; }
.tf-flinks a{ color:var(--mut2); cursor:pointer; }
.tf-flinks a:hover{ color:var(--fg); }
@media (max-width:760px){
  .tf-nav-in{ padding:0 18px; gap:14px; }
  .tf-navlinks{ display:none; }
  .tf-navright{ margin-left:auto; }
  .tf-disc-in,.tf-gridwrap,.tf-editorsec-in{ padding-left:18px; padding-right:18px; }
  .tf-editorsec-head{ flex-direction:column; align-items:flex-start; }
  .tf-h1{ font-size:40px; }
}
/* export dropdown */
.exp-wrap{ position:relative; }
.exp-btn{ display:flex; align-items:center; gap:7px; }
.exp-menu{ position:absolute; right:0; top:calc(100% + 6px); background:var(--panel); border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow); padding:6px; min-width:200px; z-index:60; display:flex; flex-direction:column; gap:2px; }
.exp-item{ display:flex; align-items:center; justify-content:space-between; text-align:left; background:transparent; border:none; padding:9px 12px; border-radius:8px; font-size:13px; font-weight:600; color:var(--ink); }
.exp-item:hover{ background:var(--soft); }
.exp-tag{ font-family:'JetBrains Mono',ui-monospace,monospace; font-size:11px; color:var(--muted); font-weight:500; }
/* top control bar — canvas size */
.canvasbar{ display:flex; align-items:center; justify-content:center; gap:12px; padding:8px 16px; background:var(--panel); border-bottom:1px solid var(--line); flex:none; }
.cs-wrap{ position:relative; }
.cs-btn{ display:flex; align-items:center; gap:8px; background:var(--field); border:1px solid var(--field-bd); border-radius:10px; padding:8px 12px; font-size:13px; color:var(--ink); }
.cs-btn b{ font-weight:700; }
.cs-btn:hover{ background:var(--hover); }
.cs-dims{ font-size:12px; color:var(--muted); font-family:'JetBrains Mono',ui-monospace,monospace; }
.cs-menu{ position:fixed; background:var(--panel); border:1px solid var(--line); border-radius:16px; box-shadow:0 34px 80px -20px rgba(0,0,0,.55); z-index:135; width:760px; max-width:92vw; display:grid; grid-template-columns:196px 1fr; overflow:hidden; }
.cs-menu.hidden{ display:none; }
.cs-panel-btn{ display:flex; align-items:center; justify-content:space-between; gap:8px; width:100%; background:var(--field,#f4f4f6); border:1px solid var(--field-bd,#e2e2ea); border-radius:9px; padding:9px 11px; font-size:13px; font-weight:600; color:var(--ink,#14161c); cursor:pointer; }
.cs-panel-btn:hover{ background:var(--hover,#eceef3); }
.csm-side{ border-right:1px solid var(--line); padding:12px 10px; display:flex; flex-direction:column; gap:3px; background:rgba(0,0,0,.14); }
.csm-cat{ display:flex; align-items:center; gap:11px; text-align:left; padding:9px 11px; background:transparent; border:none; border-radius:10px; font-size:13.5px; font-weight:600; color:var(--dim); transition:background .12s,color .12s; }
.csm-cat:hover{ background:var(--hover); color:var(--ink); }
.csm-cat.active{ background:rgba(43,63,238,.18); color:var(--ink); box-shadow:inset 0 0 0 1px rgba(43,63,238,.45); }
.csm-cico{ width:24px; height:24px; border-radius:7px; display:grid; place-items:center; flex:none; }
.csm-main{ padding:14px 16px 16px; max-height:520px; overflow-y:auto; }
.csm-h{ font-size:14px; font-weight:700; color:var(--ink); margin:4px 0 12px; }
.csm-chips{ display:flex; gap:6px; flex-wrap:wrap; margin-bottom:14px; }
.csm-chip{ display:flex; align-items:center; gap:7px; padding:6px 13px 6px 8px; border-radius:99px; font-size:12.5px; font-weight:600; color:var(--dim); background:var(--field); border:1px solid var(--field-bd); transition:all .12s; }
.csm-chip:hover{ color:var(--ink); border-color:var(--bdh); }
.csm-chip.active{ border-color:var(--accent); color:var(--ink); background:rgba(43,63,238,.15); }
.csm-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
.csm-card{ display:flex; flex-direction:column; align-items:flex-start; gap:2px; text-align:left; padding:0 0 9px; border-radius:12px; border:1px solid transparent; background:transparent; overflow:hidden; transition:background .12s,border-color .12s; }
.csm-card:hover{ background:var(--hover); }
.csm-card.active{ border-color:var(--accent); background:rgba(43,63,238,.12); }
.csm-vis{ width:100%; aspect-ratio:128/84; background:var(--field); border-radius:12px 12px 0 0; display:block; margin-bottom:7px; }
.csm-vis-svg{ width:100%; height:100%; display:block; }
.csm-name{ font-size:12.5px; font-weight:600; color:var(--ink); padding:0 10px; }
.csm-sub{ font-size:11px; color:var(--muted); font-family:'JetBrains Mono',ui-monospace,monospace; padding:0 10px; }
.csm-custom{ display:flex; align-items:flex-end; gap:10px; max-width:420px; }
.csm-custom .field{ flex:1; margin-bottom:0; }
.csm-custom .primary{ height:34px; }
/* text layouts flyout */
.text-menu{ position:fixed; z-index:70; width:326px; max-height:calc(100vh - 96px); overflow-y:auto; background:var(--panel,#fff); border:1px solid var(--line,#ececf2); border-radius:16px; box-shadow:0 14px 44px rgba(20,28,60,.18); padding:10px; }
.tm-head{ font-size:13px; font-weight:700; padding:4px 6px 8px; }
.tm-addbox{ display:flex; align-items:center; gap:8px; width:100%; padding:10px; border:1px dashed var(--line,#dcdce6); border-radius:10px; background:transparent; font-size:13px; font-weight:600; color:var(--ink,#14161c); margin-bottom:10px; }
.tm-addbox:hover{ background:var(--soft,#f2f2fb); border-color:var(--accent,#5b5bf5); }
.tm-sec{ margin-bottom:10px; }
.tm-sec h4{ font-size:11px; text-transform:uppercase; letter-spacing:.6px; color:var(--muted,#6e7280); margin:6px 4px 8px; }
.tm-grid{ display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.tm-item{ display:flex; flex-direction:column; gap:5px; background:transparent; border:none; padding:4px; border-radius:10px; cursor:pointer; }
.tm-item:hover{ background:var(--soft,#f2f2fb); }
.tm-thumb{ position:relative; width:100%; height:84px; border-radius:8px; overflow:hidden; background:#f4f4f6; border:1px solid var(--line,#ececf2); display:flex; align-items:center; justify-content:center; }
.tm-thumb .mini{ position:relative; transform-origin:center; }
.tm-name{ font-size:11.5px; color:var(--muted,#6e7280); text-align:left; padding-left:2px; }
/* text flyout — two-column vertical grid */
#textMenu{ width:326px; }
.tm-grid2{ display:grid; grid-template-columns:1fr 1fr; gap:8px; }
