/* ===========================================================================
 * BrushVector — styles
 * =========================================================================== */
:root {
  --bg-titlebar: #1b1e24;
  --bg-menubar:  #272b33;
  --bg-panel:    #2e333d;
  --bg-panel-2:  #343a45;
  --bg-tile:     #3a4150;
  --bg-tile-h:   #454d5e;
  --canvas:      #6f7384;
  --canvas-grid: #44485a;
  --text:        #e7e9ee;
  --text-dim:    #9aa0ad;
  --accent:      #f4c430;
  --accent-d:    #d9ac1c;
  --danger:      #d9534f;
  --line:        #3d434f;
  --sil:         #111418;     /* silhouette colour */
  --radius:      6px;
  --panel-w:     306px;
  --inspector-w: 250px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg-panel); color: var(--text);
  font-size: 13px; user-select: none; overflow: hidden;
}
body { display: flex; flex-direction: column; }
button { font-family: inherit; color: inherit; cursor: pointer; }

/* ---------- Menu bar ---------- */
.menubar {
  height: 44px; flex: 0 0 44px; background: var(--bg-menubar);
  display: flex; align-items: center; padding: 0 12px; gap: 14px;
  border-bottom: 1px solid var(--line);
}
.menus { display: flex; gap: 2px; }
.menu { position: relative; }
.menu-btn { background: none; border: none; padding: 6px 12px; border-radius: 5px; font-size: 13px; }
.menu-btn:hover, .menu.open .menu-btn { background: var(--bg-panel-2); }
.menu-list {
  position: absolute; top: 100%; left: 0; margin: 4px 0 0; padding: 6px; list-style: none;
  background: var(--bg-panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  min-width: 190px; box-shadow: 0 10px 30px rgba(0,0,0,.4); z-index: 50; display: none;
}
.menu.open .menu-list { display: block; }
.menu-list li { padding: 7px 10px; border-radius: 4px; display: flex; justify-content: space-between; align-items: center; }
.menu-list li:hover { background: var(--accent); color: #1b1e24; }
.menu-list li:hover .kbd { color: #1b1e24; }
.menu-list li.sep { height: 1px; background: var(--line); margin: 5px 2px; padding: 0; pointer-events: none; }
.kbd { color: var(--text-dim); font-size: 11px; }

.tools-center { display: flex; gap: 6px; margin: 0 auto; }
.tools-right { display: flex; align-items: center; gap: 8px; }
.tool-divider { width: 1px; align-self: stretch; margin: 4px 2px; background: var(--line); flex: 0 0 auto; }
.tool {
  width: 34px; height: 34px; background: none; border: 1px solid transparent; border-radius: 6px;
  display: grid; place-items: center; color: var(--text-dim);
}
/* standardised tool icons carry their own currentColor fills/strokes + authored stroke-width */
.tool svg { width: 20px; height: 20px; }
.tool:hover { background: var(--bg-panel-2); color: var(--text); }
.tool.active { color: var(--accent); border-color: var(--accent); }
.tools-center .tool svg { stroke-linecap: round; stroke-linejoin: round; }
.panel[hidden] { display: none; }   /* let the shape library hide + the canvas reflow */

/* draw / vector tool row — always visible in the toolbar */
.draw-group { display: flex; align-items: center; gap: 6px; }
.subtools {
  display: flex; align-items: center; gap: 3px; padding-left: 8px; margin-left: 2px;
  border-left: 1px solid var(--line);
}
.subtool {
  width: 30px; height: 30px; background: none; border: 1px solid transparent; border-radius: 6px;
  display: grid; place-items: center; color: var(--text-dim);
}
.subtool svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.subtool:hover { background: var(--bg-panel-2); color: var(--text); }
.subtool.active { color: var(--accent); border-color: var(--accent); }

/* combine (boolean) popover */
.combine-wrap { position: relative; }
.combine-menu {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 6px; padding: 5px;
  list-style: none; background: var(--bg-panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  min-width: 160px; box-shadow: 0 12px 30px rgba(0,0,0,.45); z-index: 60; display: none;
}
.combine-menu.open { display: block; }
.combine-menu li { padding: 7px 10px; border-radius: 4px; font-size: 12px; white-space: nowrap; }
.combine-menu li:hover { background: var(--accent); color: #1b1e24; }
.combine-menu li.sep { height: 1px; background: var(--line); margin: 4px 2px; padding: 0; pointer-events: none; }

.studio-field select { background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 8px 10px; font-size: 13px; outline: none; }
.studio-field select:focus { border-color: var(--accent); }
.save-back { z-index: 140; }
.save-back .modal { width: 360px; }
.save-back .modal-body { display: flex; flex-direction: column; gap: 12px; }

.sym-controls { display: flex; align-items: center; gap: 6px; background: var(--bg-panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px 3px 8px; color: var(--text-dim); font-size: 12px; }
.sym-controls[hidden] { display: none; }
.sym-controls input { width: 34px; background: var(--bg-panel); border: 1px solid var(--line); color: var(--text); border-radius: 4px; padding: 4px 5px; font-size: 12px; outline: none; text-align: right; }
.sym-controls .chip { padding: 5px 9px; }
.sym-controls .chip.active { background: var(--accent); color: #1b1e24; border-color: var(--accent); }

.grid-size { display: flex; align-items: center; gap: 2px; background: var(--bg-panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 7px; color: var(--text-dim); }
.grid-size input { width: 38px; background: none; border: none; color: var(--text); font-size: 12px; outline: none; -moz-appearance: textfield; text-align: right; }
.grid-size input::-webkit-outer-spin-button, .grid-size input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.grid-size span { font-size: 11px; }
.snap-mode { display: flex; align-items: center; gap: 4px; background: var(--bg-panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 4px; }
.snap-mode[hidden] { display: none; }
.snap-mode select { background-color: var(--bg-panel); border: 1px solid var(--line); color: var(--text); border-radius: 4px; padding: 4px 22px 4px 6px; font-size: 12px; outline: none; appearance: none; -webkit-appearance: none; -moz-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23aeb3c0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 6px center; }
.snap-mode input[type=number] { width: 46px; background: var(--bg-panel); border: 1px solid var(--line); color: var(--text); border-radius: 4px; padding: 4px 6px; font-size: 12px; outline: none; text-align: right; -moz-appearance: textfield; }
.snap-mode input[type=number]::-webkit-inner-spin-button, .snap-mode input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.snap-mode input[type=number]:focus { border-color: var(--accent); }

/* background-colour picker (top-right) */
.bg-pick { position: relative; display: flex; }
.bg-swatch { width: 26px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.bg-swatch.none { background: repeating-conic-gradient(#c9cdd6 0% 25%, #f4f5f8 0% 50%) 50% / 12px 12px; }
.bg-pop { position: absolute; top: 34px; right: 0; z-index: 60; width: 264px; display: flex; flex-direction: column; gap: 14px; padding: 14px; background: var(--bg-panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.bg-pop[hidden] { display: none; }
.bg-sec { display: flex; flex-direction: column; gap: 9px; }
.bg-pop-head { font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--text-dim); }
.bg-row2 { display: flex; align-items: center; gap: 8px; }
.bg-sw { width: 40px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 7px; background: none; cursor: pointer; flex: 0 0 auto; }
.bg-hex { flex: 1 1 auto; min-width: 0; background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 7px; padding: 7px 9px; font-family: ui-monospace, monospace; font-size: 13px; outline: none; }
.bg-hex::placeholder { color: var(--text-dim); }
.bg-row2 .chip { flex: 0 0 auto; }
.bg-check { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text); cursor: pointer; }

.zoom {
  position: relative; background: var(--accent); color: #1b1e24; border-radius: 6px;
  display: flex; align-items: center; gap: 6px; padding: 7px 10px; font-weight: 600; min-width: 78px;
}
.zoom .caret { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; margin-left: auto; }
.zoom-list {
  position: absolute; top: 100%; right: 0; margin: 5px 0 0; padding: 5px; list-style: none;
  background: var(--bg-panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius); min-width: 100%; z-index: 50; display: none;
}
.zoom.open .zoom-list { display: block; }
.zoom-list li { padding: 6px 10px; border-radius: 4px; }
.zoom-list li:hover { background: var(--accent); color: #1b1e24; }

/* ---------- Workspace ---------- */
.workspace { flex: 1 1 auto; display: flex; min-height: 0; }
.panel { background: var(--bg-panel); display: flex; flex-direction: column; min-height: 0; }
.library   { width: var(--panel-w); flex: 0 0 var(--panel-w); border-right: 1px solid var(--line); padding: 12px; }
.inspector { width: var(--inspector-w); flex: 0 0 var(--inspector-w); border-left: 1px solid var(--line); }

/* category select */
.cat-select {
  position: relative; background: var(--accent); color: #1b1e24; font-weight: 600;
  border-radius: var(--radius); padding: 10px 12px; display: flex; align-items: center; cursor: pointer;
}
.cat-select .caret { width: 18px; height: 18px; margin-left: auto; fill: none; stroke: currentColor; stroke-width: 2; }
.cat-list {
  position: absolute; top: 100%; left: 0; right: 0; margin: 5px 0 0; padding: 5px; list-style: none;
  background: var(--bg-panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius); z-index: 40; display: none;
}
.cat-select.open .cat-list { display: block; }
.cat-list li { padding: 7px 10px; border-radius: 4px; }
.cat-list li:hover { background: var(--accent); color: #1b1e24; }

/* search */
.search { position: relative; margin: 10px 0; }
.search-ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; fill: none; stroke: var(--text-dim); stroke-width: 2; }
.search input {
  width: 100%; background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--radius); padding: 9px 10px 9px 32px; font-size: 13px; outline: none;
}
.search input:focus { border-color: var(--accent); }

/* shape grid */
.shape-grid {
  flex: 1 1 auto; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
  align-content: start; overflow: hidden; padding: 2px;
}
.shape-tile {
  aspect-ratio: 1 / 1; background: var(--canvas); border: 2px solid transparent; border-radius: var(--radius);
  display: grid; place-items: center; padding: 8px; transition: box-shadow .1s, border-color .1s;
}
.shape-tile:hover { box-shadow: inset 0 0 0 2px var(--bg-tile-h); }
.shape-tile.selected { border-color: var(--accent); }
.shape-tile.empty { background: var(--bg-panel-2); pointer-events: none; opacity: .5; }
.shape-tile svg { width: 100%; height: 100%; }
.shape-tile { position: relative; }
.shape-grid.managing .shape-tile { border-color: rgba(214,77,77,.4); }
.tile-del { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: #d64d4d; color: #fff; font-size: 11px; line-height: 18px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.tile-del:hover { background: #ef5b5b; }
.manage-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px;
  padding: 6px 10px; background: rgba(214,77,77,.15); border: 1px solid rgba(214,77,77,.5); border-radius: var(--radius); font-size: 12px; color: var(--text); }
.manage-bar[hidden] { display: none; }
.shape-tile svg path { fill: var(--sil); }

/* pager */
.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.page-arrow {
  width: 40px; height: 30px; background: var(--bg-tile); border: none; border-radius: var(--radius);
  display: grid; place-items: center; color: var(--text);
}
.page-arrow svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.page-arrow:hover { background: var(--bg-tile-h); }
.page-arrow.primary { background: var(--accent); color: #1b1e24; }
.page-arrow.primary:hover { background: var(--accent-d); }
.page-arrow:disabled { opacity: .4; cursor: default; }
#pageLabel { color: var(--text-dim); font-size: 12px; }

/* floating selection actions */
.float-actions {
  position: absolute; z-index: 30; display: flex; align-items: center; gap: 1px; padding: 4px;
  background: var(--bg-menubar); border: 1px solid var(--line); border-radius: 9px;
  box-shadow: 0 6px 22px rgba(0,0,0,.45); transform: translate(-50%, calc(-100% - 12px));
}
.float-actions[hidden] { display: none; }
.float-btn { width: 30px; height: 30px; display: grid; place-items: center; background: none; border: 1px solid transparent; border-radius: 6px; color: var(--text-dim); }
.float-btn[hidden], .fa-sep[hidden] { display: none; }   /* the class display overrides the [hidden] attribute otherwise */
.float-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.float-btn:hover { background: var(--bg-panel-2); color: var(--text); }
.float-btn.active { color: var(--accent); border-color: var(--accent); }
.float-btn.danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.fa-sep { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }

/* ---------- Canvas ---------- */
.canvas-area { flex: 1 1 auto; position: relative; overflow: hidden; background: var(--canvas); min-width: 0; }
.canvas-stage { position: absolute; inset: 0; }
/* touch-action:none keeps the browser from claiming a pen/touch drag for panning mid-stroke
   (which cancels the pointer stream → the stroke "stops" then jumps to a straight line on release,
   and drops the pressure samples). Drawing handles its own pan/zoom. */
#board { width: 100%; height: 100%; display: block; touch-action: none; }
.canvas-hint {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  background: rgba(0,0,0,.35); color: #fff; padding: 6px 14px; border-radius: 20px; font-size: 12px;
  pointer-events: none; transition: opacity .3s;
}
.placing #board { cursor: copy; }
/* eyedropper cursor — bold dropper with a dark outline so it reads on any background; hotspot at the tip */
.eyedrop #board, .eyedrop #board * { cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'><g fill='none' stroke='%23000' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'><path d='M3 25l1-4 11-11'/><path d='M18 7l3-3a2.3 2.3 0 0 1 3.3 3.3l-3 3'/><path d='M13 9l6 6'/></g><g fill='none' stroke='%23fff' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'><path d='M3 25l1-4 11-11'/><path d='M18 7l3-3a2.3 2.3 0 0 1 3.3 3.3l-3 3'/><path d='M13 9l6 6'/></g></svg>") 3 25, crosshair; }
/* close-up colour loupe that follows the cursor while the eyedropper is active */
.eye-loupe { position: fixed; z-index: 200; pointer-events: none; display: flex; align-items: center; gap: 9px; padding: 7px; background: var(--bg-panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 22px rgba(0,0,0,.45); }
.eye-loupe[hidden] { display: none; }
.eye-loupe .eye-chip { width: 46px; height: 46px; border-radius: 9px; border: 2px solid rgba(255,255,255,.85); box-shadow: inset 0 0 0 1px rgba(0,0,0,.35); }
.eye-loupe .eye-chip.empty { background: repeating-conic-gradient(#c9cdd6 0% 25%, #f4f5f8 0% 50%) 50% / 12px 12px; }
.eye-loupe .eye-hex { font-family: ui-monospace, monospace; font-size: 13px; color: var(--text); padding-right: 6px; }
.sel-lock #board, .sel-lock #board * { cursor: move !important; }
/* ---- animation timeline (bottom dock) ---- */
.anim-panel { flex: 0 0 auto; height: 230px; position: relative; display: flex; flex-direction: column; background: var(--bg-panel); border-top: 1px solid var(--line); }
.anim-resize { position: absolute; top: -3px; left: 0; right: 0; height: 7px; cursor: ns-resize; z-index: 6; }
.anim-resize::after { content: ""; position: absolute; left: 50%; top: 3px; width: 36px; height: 3px; margin-left: -18px; border-radius: 2px; background: var(--line); }
.anim-resize:hover::after { background: var(--accent); }
.anim-panel[hidden] { display: none; }
.anim-transport { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.an-tgroup { display: inline-flex; gap: 2px; }
.an-tbtn { background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; width: 30px; height: 28px; display: grid; place-items: center; font-size: 12px; }
.an-tbtn:hover { border-color: var(--accent); }
.an-tbtn.an-play.playing { background: var(--accent); color: #1b1e24; border-color: var(--accent); }
.an-key { display: inline-flex; align-items: center; justify-content: center; height: 30px; line-height: 1; background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--accent); border-radius: 5px; padding: 0 12px; font-size: 12px; vertical-align: middle; }
.an-key:hover:not(:disabled) { background: var(--accent); color: #1b1e24; border-color: var(--accent); }
.an-key:disabled { opacity: .45; cursor: default; }
.an-auto { color: var(--text-dim); }
.an-auto.active { background: var(--danger, #c0413b); color: #fff; border-color: var(--danger, #c0413b); }
.an-onion { color: var(--text-dim); }
.an-onion.active { background: var(--accent); color: #1b1e24; border-color: var(--accent); }
.an-keyscope { color: var(--text-dim); min-width: 74px; }
.an-keyscope.active { background: #6cc6ff; color: #1b1e24; border-color: #6cc6ff; }
.an-onion-opts { display: inline-flex; gap: 6px; }
.an-onion-opts[hidden] { display: none; }
.an-onion-opts input { width: 38px; }
.an-interp { display: inline-flex; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.an-interp[hidden] { display: none; }
.an-interp button { background: var(--bg-panel-2); border: none; color: var(--text-dim); padding: 6px 9px; font-size: 11px; }
.an-interp button + button { border-left: 1px solid var(--line); }
.an-interp button:hover { color: var(--text); }
.an-field { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); }
.an-field input { width: 50px; background: var(--bg-panel); border: 1px solid var(--line); color: var(--text); border-radius: 4px; padding: 4px 6px; font-size: 12px; text-align: right; -moz-appearance: textfield; }
.an-field input::-webkit-inner-spin-button, .an-field input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.an-field select { background: var(--bg-panel); border: 1px solid var(--line); color: var(--text); border-radius: 4px; padding: 4px 6px; font-size: 12px; outline: none; }
.an-dim { color: var(--text-dim); }
.an-spacer { flex: 1 1 auto; }
.anim-body { flex: 1 1 auto; display: flex; min-height: 0; }
.anim-labels { width: 168px; flex: 0 0 168px; border-right: 1px solid var(--line); overflow: hidden; }
.anim-corner { height: 22px; line-height: 22px; padding: 0 10px; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 3; background: var(--bg-panel); }
.anim-labels { scrollbar-width: none; }
.anim-labels::-webkit-scrollbar { display: none; }
/* graph view: the curve area is fixed, so the legend column scrolls on its own when channels overflow */
.anim-body.graph .anim-labels { overflow-y: auto; scrollbar-width: thin; }
.anim-body.graph .anim-labels::-webkit-scrollbar { display: block; width: 8px; }
.anim-body.graph .anim-labels::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 4px; }
.anim-label { height: 26px; display: flex; align-items: center; padding: 0 10px; font-size: 12px; color: var(--text); border-bottom: 1px solid rgba(255,255,255,.05); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.anim-label:hover { background: var(--bg-panel-2); }
.anim-label.sel { color: var(--accent); }
.anim-caret { display: inline-block; width: 12px; flex: 0 0 12px; text-align: center; font-size: 9px; color: var(--text-dim); cursor: pointer; transition: transform .1s; }
.anim-caret.open { transform: rotate(90deg); }
.anim-caret:hover { color: var(--text); }
.anim-lname { overflow: hidden; text-overflow: ellipsis; }
.anim-label.anim-sub { height: 22px; padding-left: 26px; font-size: 11px; color: var(--text-dim); gap: 7px; }
.anim-label.anim-sub2 { padding-left: 42px; }
.anim-pdot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }
.anim-chan { cursor: pointer; user-select: none; }
.anim-chan:hover { color: var(--text); background: var(--bg-panel-2); }
.anim-chan.off { opacity: .5; }
.anim-riglabel .anim-lname { color: #8fc0ff; }
.anim-lane.anim-sub-lane { height: 22px; background: rgba(255,255,255,.015); }
.anim-sub-lane .anim-key { top: 11px; width: 8px; height: 8px; }
.anim-empty { padding: 18px 12px; font-size: 12px; color: var(--text-dim); line-height: 1.5; }
.anim-scroll { flex: 1 1 auto; position: relative; overflow: hidden; }
.anim-ruler { height: 22px; position: relative; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; }
.anim-tick { position: absolute; top: 0; bottom: 0; border-left: 1px solid rgba(255,255,255,.07); }
.anim-tick.major { border-left-color: rgba(255,255,255,.22); }
.anim-tick span { position: absolute; top: 4px; left: 3px; font-size: 9px; color: var(--text-dim); }
.anim-lanes { position: absolute; top: 22px; left: 0; right: 0; bottom: 0; overflow-y: auto; overflow-x: hidden; }
.anim-lane { height: 26px; position: relative; border-bottom: 1px solid rgba(255,255,255,.05); }
.anim-key { position: absolute; top: 13px; width: 9px; height: 9px; background: var(--accent); transform: translate(-50%, -50%) rotate(45deg); border: 1px solid #1b1e24; cursor: pointer; }
.anim-key:hover { background: #fff; }
.anim-key.sel { background: #fff; border-color: var(--accent); }
/* keyframe shape encodes its easing: ◆ linear · ● ease · ■ hold */
.anim-key.i-bezier { border-radius: 50%; transform: translate(-50%, -50%); }
.anim-key.i-hold { transform: translate(-50%, -50%); border-radius: 1px; }
.an-interp button.active { background: var(--accent); color: #1b1e24; }
.an-view { display: inline-flex; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.an-view button { background: var(--bg-panel-2); border: none; color: var(--text-dim); padding: 6px 10px; font-size: 11px; }
.an-view button + button { border-left: 1px solid var(--line); }
.an-view button.active { background: var(--accent); color: #1b1e24; }
.an-scene-name { background: var(--bg-panel); border: 1px solid var(--line); color: var(--text); border-radius: 4px; padding: 4px 6px; font-size: 12px; }
/* particle emitter config panel (floats top-RIGHT so the timeline can't clip it; scrolls if tall) + on-canvas gizmo */
.brush-panel.emitter-panel { left: auto; right: 12px; }   /* beat .brush-panel's later `left:12px` (equal specificity) */
.emitter-panel { width: 200px; gap: 6px; }
.emitter-panel [hidden] { display: none !important; }   /* the .em-row/.em-grad/.em-check display rules would otherwise override the `hidden` attribute */
.emitter-panel .em-add { width: 100%; height: auto; padding: 7px 8px; white-space: nowrap; }
.emitter-panel #emitterBody { display: flex; flex-direction: column; gap: 6px; }
.emitter-panel .em-row { display: grid; grid-template-columns: 56px 1fr; align-items: center; gap: 6px; color: var(--text-dim); font-size: 12px; margin: 0; }
.emitter-panel .em-row input[type=number], .emitter-panel .em-row select { width: 100%; background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 3px 5px; font-size: 12px; }
.emitter-panel .em-row input[type=color] { width: 100%; height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: none; }
.emitter-panel .em-2 { display: flex; gap: 5px; } .emitter-panel .em-2 input { width: 100%; }
.emitter-panel .em-2 input[type=color] { flex: 0 0 30px; height: 22px; padding: 0; }
.emitter-panel .em-row input[type=range] { width: 100%; accent-color: var(--accent); }
.emitter-panel .em-check { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); }
.emitter-panel .em-head { margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-dim); }
.emitter-panel .em-actions { display: flex; gap: 6px; align-items: stretch; }
.emitter-panel .em-actions button { height: auto; min-height: 28px; width: auto; padding: 5px 8px; white-space: nowrap; }
.emitter-panel .em-actions #emSetShape { flex: 1 1 auto; }
.emitter-panel .em-actions #emDelete { flex: 0 0 34px; }
.emitter-panel .em-grad { display: flex; flex-direction: column; gap: 5px; }
.emitter-panel .em-grad-bar { height: 12px; border-radius: 4px; border: 1px solid var(--line); }
.emitter-panel .em-grad-stops { display: flex; flex-direction: column; gap: 4px; }
.emitter-panel .em-stop { display: grid; grid-template-columns: 1fr 48px 22px; gap: 5px; align-items: center; }
.emitter-panel .em-stop input[type=color] { width: 100%; height: 20px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; }
.emitter-panel .em-stop input[type=number] { width: 100%; background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 4px; padding: 2px 4px; font-size: 11px; }
.emitter-panel .em-stop-del { width: 22px; height: 20px; display: grid; place-items: center; background: none; border: 1px solid var(--line); border-radius: 4px; color: var(--text-dim); font-size: 11px; }
.emitter-panel .em-stop-del:hover:not(:disabled) { color: var(--danger); border-color: var(--danger); }
.emitter-panel .em-stop-del:disabled { opacity: .4; }
.emitter-panel .em-grad-add { width: 100%; height: auto; padding: 5px; font-size: 11px; }
.stamp-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 8px; max-height: 60vh; overflow-y: auto; padding: 2px; }
.stamp-pick-grid .shape-tile { aspect-ratio: 1; }
.layer-row.emitter-layer .emitter-thumb { display: grid; place-items: center; color: #6cc6ff; font-size: 14px; background: var(--bg-panel-2); }
.layer-row.emitter-layer .emitter-bonebadge { background: #5fd08a; color: #1b1e24; }
.layer-row.emitter-layer .emitter-del { width: 20px; height: 20px; flex: 0 0 20px; display: grid; place-items: center; background: none; border: none; color: var(--text-dim); opacity: 0; transition: opacity .1s; font-size: 12px; }
.layer-row.emitter-layer:hover .emitter-del { opacity: 1; }
.layer-row.emitter-layer .emitter-del:hover { color: var(--danger); }
.emitter-giz { cursor: move; }
.emitter-tether { stroke: #5fd08a; stroke-width: 1; stroke-dasharray: 3 3; opacity: .7; }
.emitter-giz.boned .emitter-ring { stroke: #5fd08a; }
.emitter-giz .emitter-ring { fill: none; stroke: #6cc6ff; stroke-width: 1.4; stroke-dasharray: 3 3; opacity: .85; }
.emitter-giz .emitter-dot { fill: #6cc6ff; }
.emitter-giz .emitter-dir { stroke: #6cc6ff; stroke-width: 1.4; }
.emitter-giz.sel .emitter-ring { stroke: #ffcf4a; stroke-dasharray: none; opacity: 1; }
.emitter-giz.sel .emitter-dot { fill: #ffcf4a; } .emitter-giz.sel .emitter-dir { stroke: #ffcf4a; }
/* the two animation floating panels stack vertically in the top-left corner so they never overlap */
.anim-float-col { position: absolute; top: 12px; left: 12px; z-index: 30; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; pointer-events: none; }
.anim-float-col .brush-panel { position: static; top: auto; left: auto; right: auto; pointer-events: auto; }
/* animation scene controller (floating panel, top-left like the brush/rig/fractal panels) */
.scene-panel { width: 186px; gap: 7px; }
.scene-panel select { width: 100%; background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 5px 7px; font-size: 12px; }
.scene-panel .an-scene-name { width: 100%; }
.scene-panel .sp-actions { display: flex; gap: 6px; }
.scene-panel .sp-actions button { flex: 1; padding: 5px 6px; }
.scene-panel #anAddEmitter { width: 100%; height: auto; padding: 7px 8px; white-space: nowrap; }   /* full-width row button, not the 30px transport square */
/* per-object animation controls (stacks under the scene panel, top-left) */
.anim-obj-panel { width: 200px; gap: 8px; }
.anim-obj-panel .aop-row { display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 8px; color: var(--text-dim); margin: 0; }
.anim-obj-panel .aop-row input[type=range] { width: 100%; }
.anim-obj-panel .aop-row input[type=number] { width: 100%; background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 4px 6px; font-size: 12px; }
.anim-obj-panel .aop-row output { text-align: right; font-variant-numeric: tabular-nums; min-width: 26px; }
.anim-obj-panel .aop-u { color: var(--text-dim); }
.an-lock { width: auto; padding: 6px 10px; }
.an-lock.active { background: #6cc6ff; color: #1b1e24; border-color: #6cc6ff; }
.an-follow { width: auto; padding: 6px 10px; }
.an-follow:hover:not(:disabled) { background: #5fd08a; color: #1b1e24; border-color: #5fd08a; }
/* follow-through floating panel (non-modal so the canvas preview stays visible) */
.follow-panel { position: fixed; top: 60px; right: 12px; width: 286px; background: var(--bg-panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 48px rgba(0,0,0,.5); z-index: 90; font-size: 12px; }
.fp-head { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; border-bottom: 1px solid var(--line); font-weight: 600; }
.fp-x { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 14px; }
.fp-x:hover { color: var(--text); }
.fp-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.fp-note { color: var(--text-dim); font-size: 11px; line-height: 1.4; margin: 2px 0; }
.ft-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.ft-row > span { width: 56px; color: var(--text-dim); }
.ft-row select, .ft-row input[type=number] { flex: 1; background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 4px; padding: 3px 6px; }
.ft-row label { display: flex; align-items: center; gap: 5px; flex: 1; color: var(--text-dim); }
.ft-check { cursor: pointer; }
.ft-check input { flex: 0 0 auto; }
.ft-check span { color: var(--text); }
.ft-sld { display: grid; grid-template-columns: 96px 1fr 28px; align-items: center; gap: 8px; margin: 5px 0; }
.ft-sld > span { color: var(--text-dim); }
.ft-sld input[type=range] { width: 100%; }
.ft-sld output { text-align: right; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.fp-actions { display: flex; gap: 6px; margin-top: 8px; }
.fp-play { flex: 1; background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 6px; cursor: pointer; }
.fp-bake { background: var(--accent); border: 1px solid var(--accent); color: #1b1e24; border-radius: 5px; padding: 6px 14px; cursor: pointer; font-weight: 600; }
.fp-cancel { background: none; border: 1px solid var(--line); color: var(--text-dim); border-radius: 5px; padding: 6px 10px; cursor: pointer; }
.an-clear { width: auto; padding: 0 10px; color: var(--text-dim); }
.an-clear:hover { color: var(--danger, #c0413b); }
.anim-marquee { position: absolute; border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); pointer-events: none; z-index: 5; }
.exp-form { display: flex; flex-direction: column; gap: 12px; min-width: 320px; }
.exp-form .exp-lab { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.exp-form .exp-row { display: flex; gap: 12px; }
.exp-form .exp-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-dim); flex: 1; }
.exp-form input[type=number], .exp-form select { background: var(--bg-panel); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 6px 8px; font-size: 13px; width: 100%; }
.exp-form input[type=color] { width: 32px; height: 24px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; }
.exp-status { font-size: 12px; color: var(--text-dim); min-height: 16px; }
#expRun { align-self: flex-start; }
.sprite-studio { display: flex; gap: 16px; width: 86vw; max-width: 1100px; }
.sprite-studio .sp-controls { flex: 0 0 260px; display: flex; flex-direction: column; gap: 12px; }
.sprite-studio .sp-controls .exp-row { display: flex; gap: 8px; }
.sprite-studio .sp-controls .exp-row label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--text-dim); flex: 1; }
.sprite-studio input[type=number], .sprite-studio select { background: var(--bg-panel); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 5px 7px; font-size: 12px; width: 100%; }
.sp-preview-wrap { flex: 1 1 auto; min-width: 0; max-height: 68vh; overflow: auto; background: repeating-conic-gradient(#2a2e36 0% 25%, #23262d 0% 50%) 50% / 16px 16px; border: 1px solid var(--line); border-radius: 6px; display: flex; align-items: flex-start; justify-content: center; padding: 8px; }
#spPreview { display: block; max-width: 100%; image-rendering: pixelated; }
/* graph / F-curve editor */
.anim-graph { position: absolute; top: 22px; left: 0; right: 0; bottom: 0; width: 100%; height: calc(100% - 22px); }
.anim-graph .gcurve { fill: none; stroke-width: 1.5; }
.anim-graph .ggrid { stroke: rgba(255,255,255,.06); stroke-width: 1; }
.anim-graph .gzero { stroke: rgba(255,255,255,.16); stroke-width: 1; }
.anim-graph .gpt { cursor: grab; }
.anim-graph .gpt.sel { stroke: #fff; stroke-width: 2; }
.anim-graph .ghandle-line { stroke: rgba(255,255,255,.45); stroke-width: 1; stroke-dasharray: 2 2; }
.anim-graph .ghandle { fill: #1b1e24; stroke: #fff; stroke-width: 1.5; cursor: grab; }
.anim-graph .glegend { font-size: 10px; }
.anim-playhead { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid var(--accent); pointer-events: none; z-index: 4; }
.anim-playhead::before { content: ""; position: absolute; top: 0; left: -5px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid var(--accent); }
.space-pan #board, .space-pan #board * { cursor: grab !important; }
.space-pan #board:active, .space-pan #board:active * { cursor: grabbing !important; }

/* selection handles */
.sel-box { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.sel-box.group-box { stroke-dasharray: none; stroke-width: 1.5; }   /* unified group box reads as one solid frame */
.sel-handle { fill: var(--accent); stroke: #1b1e24; stroke-width: 1; vector-effect: non-scaling-stroke; }
.sel-handle[data-corner="tl"], .sel-handle[data-corner="br"] { cursor: nwse-resize; }
.sel-handle[data-corner="tr"], .sel-handle[data-corner="bl"] { cursor: nesw-resize; }
.sel-box { pointer-events: none; }
.skew-handle { fill: var(--bg-menubar); stroke: var(--accent); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
/* default = extrude/stretch (drag perpendicular to the edge) */
.skew-handle[data-edge="top"], .skew-handle[data-edge="bottom"] { cursor: ns-resize; }
.skew-handle[data-edge="left"], .skew-handle[data-edge="right"] { cursor: ew-resize; }
/* skew mode = shear (drag along the edge) */
.skew-mode .skew-handle[data-edge="top"], .skew-mode .skew-handle[data-edge="bottom"] { cursor: ew-resize; }
.skew-mode .skew-handle[data-edge="left"], .skew-mode .skew-handle[data-edge="right"] { cursor: ns-resize; }
.skew-mode .skew-handle { fill: var(--accent); }
.rot-line { stroke: var(--accent); stroke-width: 1; opacity: .8; vector-effect: non-scaling-stroke; pointer-events: none; }
.rot-handle { fill: #1b1e24; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke;
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12a9 9 0 1 0 3-6.7"/><path d="M3 3v5h5"/></svg>') 12 12, grab; }
#objects .obj { cursor: move; }
.node-handle { fill: var(--accent); stroke: #1b1e24; stroke-width: 1; vector-effect: non-scaling-stroke; cursor: grab; }
.node-handle:hover { fill: #fff; }
.node-handle.sel { fill: #fff; stroke: var(--accent); }
.marquee { fill: rgba(244,196,48,0.12); stroke: var(--accent); stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; pointer-events: none; }
.combine-preview { fill: rgba(58,91,217,0.16); stroke: #3a5bd9; stroke-width: 1.6; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; pointer-events: none; }
.brush-cursor { fill: none; stroke: var(--accent); stroke-width: 1.25; opacity: .85; vector-effect: non-scaling-stroke; pointer-events: none; }
/* freehand carve: faint ghost of the original so you can see what you're carving against */
.carve-ghost { fill-rule: evenodd; stroke: var(--text-dim); stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; pointer-events: none; }
/* continuous-carve op toggle buttons */
.pen-ops { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin: 5px 0; }
.pen-op { display: flex; align-items: center; gap: 6px; background: var(--bg-panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 7px; color: var(--text); cursor: pointer; text-align: left; }
.pen-op svg { width: 20px; height: 20px; flex: 0 0 20px; }
.pen-op .po-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.pen-op .po-text b { font-size: 11px; font-weight: 600; }
.pen-op .po-text i { font-size: 9px; color: var(--text-dim); font-style: normal; white-space: nowrap; }
.pen-op:hover:not(:disabled) { border-color: var(--accent); }
.pen-op.active { border-color: var(--accent); color: var(--accent); }
.pen-op.active .po-text i { color: var(--accent); }
.pen-op:disabled { opacity: .4; cursor: default; }
.ctrl-handle { fill: var(--bg-menubar); stroke: var(--accent); stroke-width: 1.4; vector-effect: non-scaling-stroke; cursor: grab; }
.ctrl-handle:hover { fill: var(--accent); }
.node-link { stroke: var(--accent); stroke-width: 1; opacity: .7; vector-effect: non-scaling-stroke; pointer-events: none; }
/* brush centerline editing (Points tool on a brush stroke) */
.cl-link { stroke: var(--accent); stroke-width: 2; opacity: .8; vector-effect: non-scaling-stroke; stroke-linecap: round; cursor: copy; }
.cl-link:hover { opacity: 1; }
.cl-node, .tree-node { fill: var(--accent); stroke: #1b1e24; stroke-width: 1; vector-effect: non-scaling-stroke; cursor: grab; }
.cl-node:hover, .tree-node:hover { fill: #fff; }
.cl-node.sel, .tree-node.sel { fill: #fff; stroke: var(--accent); }
.tree-link { stroke: var(--accent); stroke-width: 1.5; opacity: .6; vector-effect: non-scaling-stroke; pointer-events: none; }
/* bone rig overlay */
.rig-bound { fill: none; stroke: var(--accent); stroke-width: 1.2; stroke-dasharray: 5 4; opacity: .6; vector-effect: non-scaling-stroke; pointer-events: none; }
.rig-bone { stroke: var(--accent); stroke-width: 3; opacity: .85; stroke-linecap: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.rig-bone.sel { stroke: #fff; stroke-width: 4; opacity: 1; }
.rig-bone.stretch { stroke-dasharray: 5 3; }
.rig-bone.locked { stroke: #6cc6ff; opacity: 1; }
.rig-joint.locked { fill: #6cc6ff; stroke: #1b1e24; }
.rig-wdot { stroke: none; pointer-events: none; }
.rig-wbrush { fill: var(--accent); fill-opacity: .08; stroke: var(--accent); stroke-opacity: .85; stroke-width: 1.3; vector-effect: non-scaling-stroke; pointer-events: none; }
.rig-wbrush.reduce { fill: #4ea1ff; stroke: #4ea1ff; fill-opacity: .08; }
.rig-wbrush.smooth { fill: #4ec97a; stroke: #4ec97a; fill-opacity: .08; }
/* Add/Reduce/Smooth toggle: stack under the label and span the panel */
#rigWeightDirRow { flex-direction: column; align-items: stretch; gap: 6px; }
#rigWeightDirRow .seg-toggle { margin-left: 0; width: 100%; }
#rigWeightDirRow .seg-toggle button { flex: 1 1 0; padding: 5px 4px; text-align: center; }
.rig-weight { margin-top: 4px; }
.rig-weight .bp-hint { margin: 4px 0 6px; }
.rig-joint { fill: #1b1e24; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; cursor: grab; }
.rig-joint:hover { fill: var(--accent); }
.rig-joint.sel { fill: #fff; stroke: var(--accent); }
.rig-joint.root { fill: var(--accent); stroke: #1b1e24; }
.rig-joint.has-limit { stroke: #4ea1ff; }
.rig-limit-wedge { fill: #4ea1ff; opacity: .16; pointer-events: none; }
.rig-limit-ray { stroke: #4ea1ff; stroke-width: 1.5; opacity: .7; vector-effect: non-scaling-stroke; pointer-events: none; }
.rig-limit { fill: #1b1e24; stroke: #4ea1ff; stroke-width: 2; vector-effect: non-scaling-stroke; cursor: grab; }
.rig-limit:hover { fill: #4ea1ff; }
/* rotation handle on the selected bone — swing it about its parent joint */
.rig-rot-line { stroke: #5fd08a; stroke-width: 1.4; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; pointer-events: none; }
.rig-rotate { fill: #1b1e24; stroke: #5fd08a; stroke-width: 2; vector-effect: non-scaling-stroke; cursor: grab; }
.rig-rotate:hover { fill: #5fd08a; }
/* bone rows in the layers panel (nested sublist under a rigged group) */
.bone-row .name { color: var(--text-dim); font-size: 12px; }
.bone-row.active { background: var(--bg-panel-2); border-color: var(--accent); }
.bone-row.active .name { color: var(--text); }
.bone-row .thumb.bone-thumb { width: 22px; height: 22px; flex: 0 0 22px; background: transparent; }
.bone-thumb svg { width: 16px; height: 16px; fill: none; stroke: var(--accent); stroke-width: 2; }
.bone-thumb svg circle { fill: var(--accent); stroke: none; }
.bone-badge { background: rgba(78,161,255,.18); color: #8cc2ff; }
.bone-root-badge { background: var(--bg-tile); color: var(--text-dim); border: 1px solid var(--line); }
/* bone-tree track: guide columns + caret, all the same 16px width with the vertical
   at each cell's centre (8px) so a child's elbow lines up under its parent's caret */
.bone-tree { display: inline-flex; align-self: stretch; align-items: center; flex: 0 0 auto; }
.bone-tree .bg { width: 16px; flex: 0 0 16px; position: relative; align-self: stretch; }
.bone-tree .bg.v::before, .bone-tree .bg.tee::before { content: ""; position: absolute; left: 8px; top: -4px; bottom: -4px; border-left: 1px solid var(--line); }
.bone-tree .bg.ell::before { content: ""; position: absolute; left: 8px; top: -4px; height: calc(50% + 4px); border-left: 1px solid var(--line); }
.bone-tree .bg.tee::after, .bone-tree .bg.ell::after { content: ""; position: absolute; left: 8px; top: 50%; width: 8px; border-top: 1px solid var(--line); }
.bcaret { width: 16px; height: 16px; flex: 0 0 16px; background: none; border: none; padding: 0; display: grid; place-items: center; color: var(--text-dim); cursor: pointer; }
.bcaret svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; }
.bcaret-sp { width: 16px; flex: 0 0 16px; }
/* rig panel */
.rig-status { font-size: 11px; color: var(--text-dim); margin: 6px 0 8px; padding: 6px 8px; background: var(--bg-panel-2); border: 1px solid var(--line); border-radius: 5px; }
.rig-pose-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; color: var(--text-dim); }
.rig-pose-row[hidden] { display: none; }
.rig-check { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-dim); margin-bottom: 8px; cursor: pointer; }
.rig-check[hidden] { display: none; }
.rig-check input { accent-color: var(--accent); }
.rig-pose-row .seg-toggle { margin-left: auto; }
.seg-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg-toggle button { background: var(--bg-panel-2); border: none; color: var(--text-dim); padding: 5px 12px; font-size: 12px; cursor: pointer; }
.seg-toggle button + button { border-left: 1px solid var(--line); }
.seg-toggle button.active { background: var(--accent); color: #1b1e24; }
/* FK Move/Scale/Both: stack under the label and span the panel so nothing clips */
#rigFkModeRow { flex-direction: column; align-items: stretch; gap: 6px; }
#rigFkModeRow .seg-toggle { margin-left: 0; width: 100%; }
#rigFkModeRow .seg-toggle button { flex: 1 1 0; padding: 5px 4px; text-align: center; }
/* perspective grid handles */
.persp-horizon { stroke: var(--accent); stroke-width: 1.6; opacity: .85; vector-effect: non-scaling-stroke; pointer-events: none; }
.persp-vp { fill: var(--accent); stroke: #1b1e24; stroke-width: 1.5; vector-effect: non-scaling-stroke; pointer-events: all; cursor: grab; }
.persp-vp:hover { fill: #fff; }
.persp-h { fill: var(--bg-menubar); stroke: var(--accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; pointer-events: all; cursor: ns-resize; }
.floor-line { stroke: #5fd08a; stroke-width: 2; stroke-dasharray: 7 5; opacity: .9; vector-effect: non-scaling-stroke; pointer-events: stroke; cursor: move; }
.floor-handle { fill: var(--bg-menubar); stroke: #5fd08a; stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: all; cursor: move; }
.floor-hatch { stroke: #5fd08a; stroke-width: 1.4; opacity: .5; vector-effect: non-scaling-stroke; pointer-events: none; }
.floor-rotspoke { stroke: #5fd08a; stroke-width: 1.2; opacity: .55; vector-effect: non-scaling-stroke; pointer-events: none; }
.floor-rot { fill: #5fd08a; stroke: #1b1e24; stroke-width: 1.5; vector-effect: non-scaling-stroke; pointer-events: all; cursor: grab; }
.floor-giz.antislip .floor-line { stroke-dasharray: none; }
.floor-handle:hover, .floor-line:hover, .floor-rot:hover { stroke: #7fe6a8; }
.an-floor-opts select { background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 2px 4px; font-size: 12px; }
.an-floor-opts .an-check { display: flex; align-items: center; gap: 5px; }
/* animation barriers — anchored in the top-left column, under the scene panel. each barrier (left
   column) pairs with its own No-slip toggle (right column) */
.barrier-panel { width: 210px; gap: 8px; }
.barrier-panel .br-grid { display: grid; grid-template-columns: auto 1fr; gap: 9px 14px; align-items: center; }
.barrier-panel .br-cell { display: flex; align-items: center; gap: 7px; margin: 0; color: var(--text); font-size: 12px; cursor: pointer; }
.barrier-panel .br-cell input { accent-color: #5fd08a; }
.barrier-panel .br-slip { color: var(--text-dim); }
.barrier-panel .br-slip input:disabled { opacity: .4; }
.barrier-panel .br-slip input:disabled + span { opacity: .45; }
.barrier-panel .br-reset-btn { width: 100%; margin-top: 2px; }
.barrier-panel > .br-cell { color: var(--text); }   /* the "Keep bone lengths" row below the grid */
.persp-h:hover { fill: var(--accent); }
.mesh-edge { stroke: rgba(244,196,48,.55); stroke-width: 1; vector-effect: non-scaling-stroke; pointer-events: none; }
.mesh-vert { fill: var(--bg-menubar); stroke: var(--accent); stroke-width: 1.3; vector-effect: non-scaling-stroke; cursor: grab; }
.mesh-vert.hull { fill: var(--accent); }
.mesh-vert:hover { fill: #fff; }

/* motion-path editor (on-canvas trajectory of the selected object) */
.mp-curve { fill: none; stroke: #f5c518; stroke-width: 1.6; vector-effect: non-scaling-stroke; opacity: .9; }
.mp-tick { fill: #f5c518; opacity: .65; }
.mp-key { fill: #1b1e24; stroke: #f5c518; stroke-width: 2; vector-effect: non-scaling-stroke; cursor: grab; }
.mp-key:hover { fill: #f5c518; }
.mp-key.sel { fill: #fff; stroke: #fff; }
.mp-hline { stroke: rgba(245,197,24,.6); stroke-width: 1; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; }
.mp-handle { fill: #1b1e24; stroke: #f5c518; stroke-width: 1.5; vector-effect: non-scaling-stroke; cursor: grab; }
.mp-handle.ghost { opacity: .55; }
.mp-handle:hover { fill: #f5c518; }
.mp-rotline { stroke: #6cc6ff; stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.mp-rot { fill: #1b1e24; stroke: #6cc6ff; stroke-width: 1.5; vector-effect: non-scaling-stroke; cursor: grab; }
.mp-rot:hover { fill: #6cc6ff; }
.mp-curve.bone { stroke: #6cc6ff; }                                   /* bone tip trajectory (cyan, matches the rig handles) */
.mp-key.bone { stroke: #6cc6ff; }
.mp-key.bone:hover { fill: #6cc6ff; }

.mesh-panel { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 41;
  display: flex; align-items: center; gap: 10px; padding: 7px 12px; background: var(--bg-menubar);
  border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 6px 22px rgba(0,0,0,.45); font-size: 12px; color: var(--text); max-width: calc(100% - 24px); flex-wrap: wrap; justify-content: center; }
.mesh-panel[hidden] { display: none; }
/* while mesh-editing, lift the hint pill above the docked mesh toolbar */
body.mesh-editing .canvas-hint { bottom: 86px; }
.mesh-panel .mp-title { font-weight: 600; color: var(--text-dim); }
.mesh-panel label { display: flex; align-items: center; gap: 6px; color: var(--text-dim); }
.mesh-panel input[type=range] { width: 90px; accent-color: var(--accent); }
.mesh-panel .chip { padding: 5px 10px; }
.mesh-panel .chip.active { background: var(--accent); color: #1b1e24; border-color: var(--accent); }

/* ---------- Left dock: contextual panels (brush / shape / combine / text) ---------- */
.left-dock { width: 244px; flex: 0 0 244px; border-right: 1px solid var(--line); padding: 14px; overflow-y: auto; }
.left-dock .brush-panel { position: static; top: auto; left: auto; width: auto; z-index: auto; background: none; border: none; border-radius: 0; box-shadow: none; padding: 0; max-height: none; overflow: visible; }
/* brush mode icon switch */
/* mode row: stacks the label above a full-width row of equal draw-mode icons (6 of them) */
.bp-mode-row { flex-direction: column; align-items: stretch; gap: 5px; }
.bp-modes { display: flex; gap: 4px; }
/* standard-shapes panel — kinds laid out 3 per row so they're not cramped */
.shape-kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
#fracKinds { grid-template-columns: repeat(4, 1fr); }
.fr-btn-row { display: flex; gap: 6px; }
.fr-btn-row .la-mask { margin-top: 8px; }
.sh-row[hidden] { display: none !important; }
/* cap rows: label above the full-width dropdown (so long option names aren't clipped) */
.brush-panel .sh-cap-row { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.brush-panel .sh-cap-row > span { color: var(--text-dim); font-size: 12px; }
.brush-panel .sh-row input[type=range] { flex: 1 1 auto; min-width: 0; accent-color: var(--accent); }
.brush-panel .sh-row output { color: var(--text); }
.brush-panel .bp-draw-hint { font-size: 11px; color: var(--text-dim); line-height: 1.4; }
.bp-mode { flex: 1 1 0; min-width: 0; height: 30px; background: none; border: 1px solid var(--line); border-radius: 6px; display: grid; place-items: center; color: var(--text-dim); cursor: pointer; }
.bp-mode svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bp-mode:hover { background: var(--bg-panel-2); color: var(--text); }
.bp-mode.active { color: var(--accent); border-color: var(--accent); }
/* move-objects toggle in the draw panel */
.bp-movebtn { display: flex; align-items: center; gap: 7px; width: 100%; margin-top: 6px; background: var(--bg-panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; color: var(--text); cursor: pointer; font-size: 12px; }
.bp-movebtn svg { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.bp-movebtn:hover { border-color: var(--accent); }
.bp-movebtn.active { background: var(--accent); color: #1b1e24; border-color: var(--accent); }

/* ---------- Vector brush panel ---------- */
.brush-panel { position: absolute; top: 12px; left: 12px; z-index: 30; width: 210px;
  display: flex; flex-direction: column; gap: 9px; padding: 11px 13px; background: var(--bg-menubar);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 26px rgba(0,0,0,.5); font-size: 12px; color: var(--text);
  max-height: calc(100% - 24px); overflow-y: auto; }
.brush-panel[hidden] { display: none; }
.brush-panel .bp-head { display: flex; align-items: center; justify-content: space-between; }
.brush-panel .bp-title { font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; font-size: 11px; }
.brush-panel .bp-reset { background: none; border: none; color: var(--accent); font-size: 11px; font-weight: 600; cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.brush-panel .bp-reset:hover { background: var(--bg-panel-2); }
.brush-panel .bp-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text-dim); }
.brush-panel .bp-row select { flex: 1 1 auto; min-width: 0; background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 5px 7px; font-size: 12px; }
/* font picker */
.fontpick { position: relative; flex: 1 1 auto; min-width: 0; }
.fontpick-btn { display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 5px 7px; font-size: 13px; cursor: pointer; overflow: hidden; }
.fontpick-btn:hover { border-color: var(--accent); }
.fontpick-btn > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fontpick-caret { width: 14px; height: 14px; flex: 0 0 14px; fill: none; stroke: var(--text-dim); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fontpick-pop { position: absolute; top: calc(100% + 4px); left: 0; width: 240px; max-width: 80vw; background: var(--bg-panel-2); border: 1px solid var(--line); border-radius: 7px; box-shadow: 0 14px 34px rgba(0,0,0,.5); z-index: 120; padding: 6px; }
.fontpick-pop[hidden] { display: none; }
.fontpick-search { width: 100%; box-sizing: border-box; background: var(--bg-panel); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 6px 8px; font-size: 12px; outline: none; margin-bottom: 6px; }
.fontpick-search:focus { border-color: var(--accent); }
.fontpick-list { max-height: 280px; overflow-y: auto; }
.fontpick-group { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); padding: 7px 6px 3px; position: sticky; top: 0; background: var(--bg-panel-2); }
.fontpick-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; width: 100%; background: none; border: 0; color: var(--text); border-radius: 5px; padding: 7px 8px; font-size: 15px; text-align: left; cursor: pointer; }
.fontpick-row:hover { background: var(--bg-tile-h); }
.fontpick-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fontpick-cat { flex: 0 0 auto; font-size: 9px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); }
.fontpick-load { width: 100%; margin-top: 6px; background: var(--bg-tile); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 7px; font-size: 12px; cursor: pointer; }
.fontpick-load:hover { border-color: var(--accent); color: var(--accent); }
/* text panel — standardised typography controls */
.text-panel { width: 232px; }
.text-panel .tx-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.text-panel .tx-field { display: flex; flex-direction: column; gap: 3px; color: var(--text-dim); font-size: 11px; position: relative; }
.text-panel .tx-field > select, .text-panel .tx-field > input { width: 100%; box-sizing: border-box; background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 6px 7px; font-size: 12px; outline: none; }
.text-panel .tx-field > select:focus, .text-panel .tx-field > input:focus { border-color: var(--accent); }
.text-panel .tx-field-unit > input { padding-right: 18px; }
.text-panel .tx-unit { position: absolute; right: 8px; bottom: 7px; font-style: normal; font-size: 11px; color: var(--text-dim); pointer-events: none; }
.text-panel .tx-align-row { gap: 8px; margin-top: 2px; }
.text-panel .tx-seg { display: inline-flex; background: var(--bg-panel-2); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.text-panel .tx-segbtn { width: 32px; height: 28px; display: grid; place-items: center; background: none; border: 0; border-right: 1px solid var(--line); color: var(--text-dim); cursor: pointer; }
.text-panel .tx-segbtn:last-child { border-right: 0; }
.text-panel .tx-segbtn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.text-panel .tx-segbtn:hover { color: var(--text); }
.text-panel .tx-segbtn.active { background: var(--accent); color: #1b1e24; }
.text-panel .tx-align-row input[type=color] { flex: 0 0 auto; width: 36px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; cursor: pointer; margin-left: auto; }
.brush-panel .bp-slider { display: flex; flex-direction: column; gap: 2px; color: var(--text-dim); }
.brush-panel .bp-slider > span { display: flex; justify-content: space-between; }
.brush-panel .bp-slider output { color: var(--text); }
.brush-panel input[type=range] { width: 100%; accent-color: var(--accent); }
.brush-panel .bp-chk { display: flex; align-items: center; gap: 6px; color: var(--text); }
.brush-panel .bp-chk input { accent-color: var(--accent); }
.brush-panel .bp-stamp { display: flex; flex-direction: column; gap: 9px; padding-top: 7px; border-top: 1px solid var(--line); }
.brush-panel .bp-stamp[hidden] { display: none; }
.brush-panel .chip.primary { margin-top: 2px; }
.brush-panel .bp-preview { width: 100%; height: 54px; background: var(--bg-panel-2); border: 1px solid var(--line); border-radius: 7px; }
.brush-panel input[type=color] { width: 30px; height: 26px; flex: 0 0 30px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: none; cursor: pointer; }
.brush-panel input[type=color]::-webkit-color-swatch-wrapper { padding: 1px; }
.brush-panel input[type=color]::-webkit-color-swatch { border: none; border-radius: 3px; }
.text-panel .tx-area { width: 100%; box-sizing: border-box; resize: vertical; min-height: 44px; background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 7px 8px; font-size: 13px; font-family: inherit; }
.text-panel .chip { margin-top: 2px; }
.bp-stamp-pick { display: flex; align-items: center; gap: 8px; }
.bp-stamp-thumb { width: 30px; height: 30px; flex: 0 0 30px; background: var(--bg-panel-2); border: 1px solid var(--line); border-radius: 5px; display: grid; place-items: center; }
.bp-stamp-thumb svg { width: 24px; height: 24px; }
.bp-stamp-thumb.empty { opacity: .4; }
.bp-hint { font-size: 10px; color: var(--text-dim); line-height: 1.3; }
/* scatter-brush colour palette */
.bp-pal-row { align-items: flex-start !important; }
.bp-palette { display: flex; flex-wrap: wrap; gap: 5px; flex: 1 1 auto; justify-content: flex-end; }
.bp-swatch { position: relative; display: inline-flex; }
.bp-swatch input[type=color] { width: 26px; height: 22px; flex: 0 0 26px; }
.bp-swatch-x { position: absolute; top: -6px; right: -6px; width: 14px; height: 14px; line-height: 12px; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: var(--bg-panel-2); color: var(--text-dim); font-size: 12px; cursor: pointer; display: grid; place-items: center; }
.bp-swatch-x:hover { color: #fff; background: var(--danger, #c0413b); }
.bp-swatch-add { position: relative; width: 26px; min-height: 22px; align-self: stretch; padding: 0; border: 1px dashed var(--line); border-radius: 5px; background: var(--bg-panel-2); color: var(--text-dim); cursor: pointer; }
.bp-swatch-add svg { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.bp-swatch-add:hover { color: var(--text); border-color: var(--accent); }
.bp-stamp-hint { font-size: 10px; color: var(--text-dim); line-height: 1.35; margin: 2px 0 2px; }
/* hidden brush rows: beat .brush-panel .bp-slider/.bp-chk/.bp-row's display so [hidden] actually hides them */
.brush-panel .bp-slider[hidden], .brush-panel .bp-chk[hidden], .brush-panel .bp-row[hidden] { display: none; }
/* selected-shapes list: header + rows share one grid so the column labels line up */
.stamp-list-title[hidden], .stamp-list-head[hidden], .stamp-list[hidden] { display: none; }
.brush-panel .stamp-list-title { margin-top: 2px; border-top: 0; padding-top: 0; }   /* the divider above already separates it */
.stamp-list-head { display: grid; grid-template-columns: 16px 30px 1fr 18px; gap: 7px; padding: 0 0 3px; }
.stamp-list-head .freq-lbl { grid-column: 3; text-align: center; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim); }
.stamp-list { display: flex; flex-direction: column; gap: 5px; }
.stamp-row { display: grid; grid-template-columns: 16px 30px 1fr 18px; gap: 7px; align-items: center; }
.stamp-row.dragging { opacity: .45; }
.stamp-grip { color: var(--text-dim); cursor: grab; text-align: center; font-size: 13px; user-select: none; }
.stamp-thumb { width: 30px; height: 30px; background: var(--bg-tile); border: 1px solid var(--line); border-radius: 5px; display: grid; place-items: center; }
.stamp-thumb svg { width: 22px; height: 22px; }
.stamp-thumb svg path { fill: var(--text); }
.stamp-freq { min-width: 0; background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 6px 8px; font-size: 13px; text-align: center; outline: none; -moz-appearance: textfield; }
.stamp-freq:focus { border-color: var(--accent); }
.stamp-x { width: 18px; height: 18px; background: none; border: none; color: var(--text-dim); font-size: 15px; line-height: 1; cursor: pointer; border-radius: 4px; }
.stamp-x:hover { color: #fff; background: var(--danger); }
.bp-pal-hint { font-size: 10px; color: var(--text-dim); line-height: 1.3; text-align: right; }
.bp-pal-hint[hidden] { display: none; }
/* brush settings section headers + shape-creator panel */
/* the settings live in inner wrappers (#bpSettings / #penSettings); give those their own
   row rhythm — the panel's gap only spaces its direct children, not the rows inside these */
.brush-panel #bpSettings:not([hidden]), .brush-panel #penSettings:not([hidden]) { display: flex; flex-direction: column; gap: 9px; }
.brush-panel .bp-group { margin-top: 8px; padding-top: 11px; padding-bottom: 2px; border-top: 1px solid var(--line); font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-dim); }
.brush-panel .bp-divider { height: 1px; background: var(--line); margin: 9px 0; border: 0; }
.brush-panel .bp-divider[hidden] { display: none; }
.brush-panel .bp-stamp { padding-top: 0; border-top: none; }   /* its bp-group header now provides the divider */
.sp-hint { margin-top: 6px; font-size: 11px; line-height: 1.4; color: var(--text-dim); }
.sp-hint b { color: var(--text); font-weight: 600; }
.sp-hint[hidden] { display: none; }
/* mask action in the Layers panel (sits with the combine ops) */
.la-mask { width: 100%; margin-top: 8px; background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 8px; font-size: 12px; cursor: pointer; }
.la-mask:hover:not(:disabled) { background: var(--accent); color: #1b1e24; border-color: var(--accent); }
.la-mask:disabled { opacity: .4; cursor: default; }
.la-mask.active { background: var(--accent); color: #1b1e24; border-color: var(--accent); }
.la-mask[hidden] { display: none; }
#simplifyRow { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
#simplifyRow[hidden] { display: none; }
.simp-info { font-size: 11px; color: var(--text-dim); }
/* selection floating panel (mirrors the brush & shape panels): combine + transform + appearance */
.combine-panel .la-label { display: block; margin: 8px 0 2px; padding-top: 8px; border-top: 1px solid var(--line); }
.combine-panel .obj-actions { border-top: none; padding-bottom: 0; }
.combine-panel .obj-title { padding: 10px 0 2px; border-bottom: none; justify-content: flex-start; }
.combine-panel .slider-row { padding: 4px 0; }
.combine-panel .obj-grid { padding: 8px 0; }

/* ---------- Inspector ---------- */
.inspector-head, .obj-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; font-weight: 600; border-bottom: 1px solid var(--line);
}
.icon-btn {
  width: 24px; height: 24px; background: var(--bg-panel-2); border: 1px solid var(--line);
  border-radius: 5px; font-size: 15px; line-height: 1; display: grid; place-items: center; color: var(--text);
}
.icon-btn:hover:not(:disabled) { background: var(--accent); color: #1b1e24; border-color: var(--accent); }
.icon-btn:disabled { opacity: .4; cursor: default; }
.icon-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }

.layer-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1 1 auto; min-height: 60px; }
.layer-row {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 5px; margin-bottom: 3px;
  background: var(--bg-panel); border: 1px solid transparent;
}
.layer-row:hover { background: var(--bg-panel-2); }
.layer-row.active { background: var(--bg-panel-2); border-color: var(--accent); }
.layer-row .thumb { width: 26px; height: 26px; flex: 0 0 26px; background: var(--bg-tile); border-radius: 4px; display: grid; place-items: center; }
.layer-row .thumb svg { width: 20px; height: 20px; }
.layer-row .thumb svg path { fill: var(--text); }
.layer-row .name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.layer-row .badge { flex: 0 0 auto; font-size: 9px; text-transform: uppercase; letter-spacing: .04em; color: #1b1e24; background: var(--accent); border-radius: 3px; padding: 1px 4px; }
.layer-row .badge.mesh { background: #7bd3a0; }
.layer-row .swatch { flex: 0 0 auto; width: 15px; height: 15px; padding: 0; border-radius: 4px; border: 1px solid rgba(255,255,255,.35); box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); cursor: pointer; }
.layer-row .swatch:hover { border-color: var(--accent); transform: scale(1.12); }
.layer-row .vis { width: 20px; height: 20px; flex: 0 0 20px; display: grid; place-items: center; background: none; border: none; color: var(--text-dim); }
.layer-row .vis svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.layer-row .lock { width: 20px; height: 20px; flex: 0 0 20px; display: grid; place-items: center; background: none; border: none; color: var(--text-dim); opacity: 0; transition: opacity .1s; }
.layer-row:hover .lock, .folder-row:hover .lock, .layer-row .lock.on, .folder-row .lock.on { opacity: 1; }
.layer-row .lock.on, .folder-row .lock.on { color: var(--accent); }
.layer-row .lock svg, .folder-row .lock svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.folder-row .lock { width: 20px; height: 20px; flex: 0 0 20px; display: grid; place-items: center; background: none; border: none; color: var(--text-dim); opacity: 0; transition: opacity .1s; }
.layer-row.locked-layer .name { opacity: .6; }
.layer-row.hidden-layer { opacity: .45; }
.layer-empty { color: var(--text-dim); text-align: center; padding: 20px 10px; font-size: 12px; line-height: 1.5; }
.layer-row.indent { margin-left: 16px; }
.layer-row[draggable], .folder-row[draggable] { cursor: grab; }
.layer-row.dragging, .folder-row.dragging { opacity: .45; }
.layer-row.drop-before, .folder-row.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.layer-row.drop-after, .folder-row.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.folder-row.drop-into { outline: 2px solid var(--accent); outline-offset: -2px; }

.folder-row {
  display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-radius: 5px; margin-bottom: 3px;
  background: var(--bg-panel-2); border: 1px solid transparent;
}
.folder-row:hover { background: var(--bg-tile-h); }
.folder-row.active { border-color: var(--accent); }
.folder-row .caret { width: 18px; height: 18px; flex: 0 0 18px; background: none; border: none; padding: 0; display: grid; place-items: center; color: var(--text-dim); }
.folder-row .caret svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.folder-row .ficon { width: 18px; height: 18px; flex: 0 0 18px; display: grid; place-items: center; color: var(--accent); }
.folder-row .ficon svg { width: 16px; height: 16px; fill: currentColor; }
.folder-row .name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
.folder-row .count { font-size: 11px; color: var(--text-dim); background: var(--bg-panel); border-radius: 8px; padding: 1px 7px; }
.folder-row .ungroup, .folder-row .vis { width: 20px; height: 20px; flex: 0 0 20px; display: grid; place-items: center; background: none; border: none; color: var(--text-dim); }
.folder-row .ungroup svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.6; opacity: .8; }
.folder-row .ungroup:hover { color: var(--danger); }
.folder-row .vis svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.layer-actions { border-top: 1px solid var(--line); padding: 10px 14px; }
.layer-actions[hidden] { display: none; }
.la-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim); }
.la-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 8px; }
.la-grid button { background: var(--bg-panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 7px 4px; font-size: 11px; color: var(--text); }
.la-grid button:hover:not(:disabled) { background: var(--accent); color: #1b1e24; border-color: var(--accent); }
.la-grid button:disabled { opacity: .4; cursor: default; }

.obj-actions { border-top: 1px solid var(--line); padding-bottom: 16px; }
.obj-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; padding: 10px 14px; }
.obj-btn {
  background: var(--bg-panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 8px 4px;
  font-size: 11px; color: var(--text);
}
.obj-btn:hover { background: var(--bg-tile-h); }
.obj-btn:disabled { opacity: .4; cursor: default; }
.slider-row { display: flex; align-items: center; gap: 8px; padding: 4px 14px; font-size: 12px; color: var(--text-dim); }
.slider-row span:first-child { width: 44px; }
.slider-row input[type=range] { flex: 1 1 auto; accent-color: var(--accent); }
.slider-row select { flex: 1 1 auto; background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 4px 6px; font-size: 12px; }
.slider-val { width: 40px; text-align: right; color: var(--text); }
.fx-divider { height: 1px; background: var(--line); margin: 9px 0 8px; }
.fx-row { gap: 6px; }
.fx-row > span:first-child { width: 56px; }
.fx-check { width: 15px; height: 15px; flex: 0 0 15px; accent-color: var(--accent); }
.fx-color { width: 22px; height: 22px; flex: 0 0 22px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; cursor: pointer; }
.fx-color::-webkit-color-swatch-wrapper { padding: 1px; }
.fx-color::-webkit-color-swatch { border: none; border-radius: 3px; }
.fx-range { flex: 1 1 auto; min-width: 0; accent-color: var(--accent); }
.fx-select { flex: 1 1 auto; min-width: 0; background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 5px 26px 5px 7px; font-size: 12px; outline: none; appearance: none; -webkit-appearance: none; -moz-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23aeb3c0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 7px center; }
.fx-select:disabled { opacity: .5; }
.fx-chks { display: flex; flex: 1 1 auto; flex-wrap: wrap; gap: 4px 10px; min-width: 0; }
.fx-chk { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.fx-chk input { width: 13px; height: 13px; accent-color: var(--accent); }
.fx-row input:disabled, .fx-row.disabled { opacity: .5; }

/* gradient editor */
.grad-target { display: inline-flex; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.grad-target button { background: var(--bg-panel-2); border: none; color: var(--text-dim); font-size: 11px; padding: 4px 10px; cursor: pointer; }
.grad-target button + button { border-left: 1px solid var(--line); }
.grad-target button.active { background: var(--accent); color: #1b1e24; }
.grad-target button:disabled { opacity: .5; cursor: default; }
.grad-toolrow { display: flex; align-items: center; gap: 6px; }
.grad-toolrow .fx-select { flex: 1 1 auto; }
.grad-steprow { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.grad-steprow[hidden] { display: none; }
.grad-steprow input { width: 56px; background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 4px 6px; font-size: 11px; outline: none; -moz-appearance: textfield; }
.grad-steprow input::-webkit-inner-spin-button, .grad-steprow input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.grad-tool { width: 30px; flex: 0 0 30px; align-self: stretch; display: inline-flex; align-items: center; justify-content: center; background: var(--bg-panel-2); border: 1px solid var(--line); border-radius: 5px; color: var(--text-dim); font-size: 13px; cursor: pointer; }
.grad-tool:hover:not(:disabled) { background: var(--bg-panel); color: var(--text); border-color: var(--accent); }
.grad-tool.active { background: var(--accent); color: #1b1e24; border-color: var(--accent); }
.grad-tool.active:hover:not(:disabled) { background: var(--accent); color: #1b1e24; filter: brightness(1.12); }
.grad-tool:disabled { opacity: .5; cursor: default; }
.grad-tool svg { display: block; width: 17px; height: 17px; }
.grad-editor { display: flex; flex-direction: column; gap: 7px; margin: 2px 0 4px; }
.grad-bar { height: 16px; border-radius: 5px; border: 1px solid var(--line); background-image: linear-gradient(45deg,#999 25%,transparent 25%),linear-gradient(-45deg,#999 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#999 75%),linear-gradient(-45deg,transparent 75%,#999 75%); background-size: 10px 10px; background-position: 0 0,0 5px,5px -5px,-5px 0; }
.grad-stops { display: flex; flex-direction: column; gap: 5px; }
.grad-stop { display: flex; align-items: center; gap: 3px; }
.grad-stop .gs-posbox, .grad-stop .gs-opbox, .grad-stop .gs-colbox { display: flex; align-items: center; height: 26px; background: var(--bg-panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 0 4px; }
.grad-stop .gs-posbox { width: 40px; flex: 0 0 40px; }
.grad-stop .gs-opbox { width: 40px; flex: 0 0 40px; }
.grad-stop .gs-colbox { flex: 1 1 auto; min-width: 0; gap: 4px; }
.grad-stop input { background: none; border: none; color: var(--text); font-size: 10.5px; outline: none; min-width: 0; -moz-appearance: textfield; padding: 0; }
.grad-stop input::-webkit-inner-spin-button, .grad-stop input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.grad-stop .gs-pos, .grad-stop .gs-op { width: 100%; }
.grad-stop .gs-posbox span, .grad-stop .gs-opbox span { color: var(--text-dim); font-size: 9.5px; flex: 0 0 auto; margin-left: 1px; }
.grad-stop .gs-col { width: 14px; height: 14px; flex: 0 0 14px; padding: 0; border: 1px solid var(--line); border-radius: 3px; background: none; cursor: pointer; }
.grad-stop .gs-col::-webkit-color-swatch-wrapper { padding: 0; }
.grad-stop .gs-col::-webkit-color-swatch { border: none; border-radius: 2px; }
.grad-stop .gs-hex { flex: 1 1 auto; text-transform: uppercase; letter-spacing: .02em; }
.grad-stop .gs-del { width: 22px; height: 26px; flex: 0 0 22px; display: flex; align-items: center; justify-content: center; background: none; border: 1px solid var(--line); border-radius: 5px; color: var(--text-dim); cursor: pointer; font-size: 13px; }
.grad-stop .gs-del:hover:not(:disabled) { color: var(--danger, #e0594b); border-color: var(--danger, #e0594b); }
.grad-stop .gs-del:disabled { opacity: .3; cursor: default; }
.grad-addstop { align-self: flex-start; background: var(--bg-panel-2); border: 1px dashed var(--line); border-radius: 5px; color: var(--text-dim); font-size: 12px; padding: 5px 9px; cursor: pointer; }
.grad-addstop:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
/* on-canvas gradient handles */
.grad-line { stroke: #fff; stroke-width: 1.5; vector-effect: non-scaling-stroke; pointer-events: none; }
.grad-line-shadow { stroke: rgba(0,0,0,.5); stroke-width: 3.5; vector-effect: non-scaling-stroke; pointer-events: none; fill: none; }
.grad-handle { fill: #fff; stroke: #1b1e24; stroke-width: 1.5; vector-effect: non-scaling-stroke; cursor: grab; }
.grad-endcap { fill: rgba(255,255,255,.9); stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; cursor: grab; }
/* blend-mode dropdown (custom, previews on hover/keyboard) */
.blend-row { position: relative; }
.blend-dd { flex: 1 1 auto; min-width: 0; position: relative; }
.blend-trigger { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 6px; background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 5px 7px; font-size: 12px; cursor: pointer; outline: none; }
.blend-trigger:hover:not(:disabled) { border-color: var(--accent); }
.blend-trigger:disabled { opacity: .5; cursor: default; }
.blend-trigger #blendLabel { flex: 1 1 auto; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blend-trigger .chev { width: 12px; height: 12px; flex: 0 0 12px; fill: none; stroke: var(--text-dim); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .12s; }
.blend-trigger.open .chev { transform: rotate(180deg); }
.blend-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 5px); margin: 0; padding: 4px; list-style: none; max-height: 244px; overflow-y: auto; background: var(--bg-panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 14px 40px rgba(0,0,0,.5); z-index: 120; }
.blend-menu[hidden] { display: none; }
.blend-menu li { padding: 7px 10px; font-size: 12px; color: var(--text); border-radius: 5px; cursor: pointer; white-space: nowrap; }
.blend-menu li.hl, .blend-menu li:hover { background: var(--accent); color: #1b1e24; }
/* icon dropdown for line caps */
.cap-dd { position: relative; flex: 1 1 auto; min-width: 0; }
.cap-trigger { width: 100%; display: flex; align-items: center; gap: 8px; background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 5px 8px; font-size: 12px; cursor: pointer; outline: none; }
.cap-trigger:hover { border-color: var(--accent); }
.cap-trigger .cap-name { flex: 1 1 auto; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cap-ico { flex: 0 0 auto; display: inline-flex; align-items: center; }
.cap-ico svg { width: 30px; height: 14px; display: block; }
.cap-chev { width: 13px; height: 13px; flex: 0 0 13px; fill: none; stroke: currentColor; stroke-width: 2; transition: transform .12s; }
.cap-trigger.open .cap-chev { transform: rotate(180deg); }
.cap-menu { margin: 0; padding: 4px; list-style: none; background: var(--bg-panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 14px 40px rgba(0,0,0,.5); z-index: 130; overflow-y: auto; }
.cap-menu[hidden] { display: none; }
.cap-menu li { display: flex; align-items: center; gap: 10px; padding: 6px 9px; font-size: 12px; color: var(--text); border-radius: 5px; cursor: pointer; white-space: nowrap; }
.cap-menu li .cap-ico svg { width: 32px; height: 14px; }
.cap-menu li.sel { background: rgba(244,196,48,.14); }
.cap-menu li:hover { background: var(--accent); color: #1b1e24; }
/* mask layers */
.layer-row .badge.mask-badge, .folder-row .badge.mask-badge { background: #c9a23a; color: #1b1e24; }
.layer-row .mask-thumb svg path { fill: none; stroke: var(--text-dim); stroke-width: 7; }
/* mask = the clipping layer at the top of a group; clipped = the layers it affects below it */
.layer-row.mask-layer { background: rgba(201,162,58,.10); }
.layer-row.mask-layer .name { font-style: italic; }
.layer-row.clipped { border-left: 2px solid #c9a23a; }
.layer-row .clip-spine { flex: 0 0 auto; width: 13px; height: 13px; margin: 0 1px 0 -2px; color: #c9a23a; display: inline-grid; place-items: center; }
.layer-row .clip-spine svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; }
.layer-row .badge.clip-badge { background: transparent; color: #c9a23a; border: 1px solid #c9a23a; }
.mask-stencil { pointer-events: visibleStroke; }
.add-set-btn {
  margin: 4px 14px 0; padding: 9px; width: calc(100% - 28px); background: var(--bg-panel-2);
  border: 1px solid var(--line); color: var(--text); border-radius: 5px; font-size: 12px;
}
.add-set-btn:hover { background: var(--accent); color: #1b1e24; border-color: var(--accent); }
.add-set-btn:disabled { opacity: .5; cursor: default; }
.danger-btn {
  margin: 8px 14px 14px; padding: 9px; width: calc(100% - 28px); background: transparent;
  border: 1px solid var(--danger); color: var(--danger); border-radius: 5px; font-size: 12px;
}
.danger-btn:hover { background: var(--danger); color: #fff; }
.danger-btn:disabled, .obj-actions.disabled { opacity: .5; }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: grid; place-items: center; z-index: 100; }
.modal-back[hidden] { display: none; }
.modal { background: var(--bg-panel); border: 1px solid var(--line); border-radius: 10px; width: 460px; max-width: 90vw; max-height: 80vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.modal-back.modal-wide .modal { width: auto; max-width: 95vw; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); font-weight: 600; }
.modal-body { padding: 16px; overflow-y: auto; font-size: 13px; line-height: 1.6; color: var(--text); }
.modal-body table { width: 100%; border-collapse: collapse; }
.modal-body td { padding: 5px 4px; border-bottom: 1px solid var(--line); }
.modal-body td:last-child { text-align: right; color: var(--text-dim); }
.modal-body .kbd { background: var(--bg-panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 2px 7px; color: var(--text); }

/* keybinding editor (Edit → Keyboard shortcuts) */
.km-hint { margin: 0 0 10px; color: var(--text-dim); font-size: 12px; }
.km-table td:last-child { text-align: right; }
.km-key { min-width: 64px; background: var(--bg-panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 4px 10px; color: var(--text); font: inherit; font-size: 12px; cursor: pointer; }
.km-key:hover { border-color: var(--accent); }
.km-key.km-capturing { border-color: var(--accent); color: var(--accent); font-style: italic; }
.km-bad td { color: var(--danger, #e0594b); }
.km-bad .km-key { border-color: var(--danger, #e0594b); }
.km-warn { margin-left: 8px; color: var(--danger, #e0594b); font-size: 11px; }
.km-notice { margin: 0 0 10px; padding: 7px 10px; border: 1px solid var(--danger, #e0594b); border-radius: 6px; background: rgba(224, 89, 75, .12); color: var(--danger, #e0594b); font-size: 12px; }
.km-foot { margin: 12px 0 4px; }
.km-fixed { margin: 10px 0 0; color: var(--text-dim); font-size: 11px; line-height: 1.7; }

/* shared form-field styling (used by the Save-shape modal) */
.studio-field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-dim); }
.studio-field input { background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 8px 10px; font-size: 13px; outline: none; }
.studio-field input:focus { border-color: var(--accent); }
.studio-actions { display: flex; gap: 8px; justify-content: flex-end; }
.chip { background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 8px 12px; font-size: 12px; }
.chip:hover { background: var(--bg-tile-h); }
.chip.primary { background: var(--accent); color: #1b1e24; border-color: var(--accent); font-weight: 600; }
.chip.primary:hover { background: var(--accent-d); }

/* ---------- Colour Picker ---------- */
.cp-back { position: fixed; inset: 0; background: transparent; pointer-events: none; z-index: 150; }
.cp-back[hidden] { display: none; }
.cp { position: absolute; pointer-events: auto; background: var(--bg-panel); border: 1px solid var(--line); border-radius: 12px; width: 740px; max-width: 96vw; box-shadow: 0 24px 70px rgba(0,0,0,.55); overflow: hidden; }
.cp-tabs { display: flex; align-items: center; background: var(--bg-titlebar); cursor: move; user-select: none; }
.cp-tab { background: none; border: none; color: var(--text-dim); padding: 14px 20px; font-size: 14px; font-weight: 600; border-bottom: 2px solid transparent; }
.cp-tab:hover { color: var(--text); }
.cp-tab.active { color: var(--text); background: var(--bg-panel); }
.cp-close { margin-left: auto; margin-right: 8px; }
.cp-body { padding: 0; }
.cp-pane[hidden] { display: none; }
.cp-pane[data-pane="3d"]:not([hidden]) { display: flex; flex-direction: column; }
.cp-pane[data-pane="2d"]:not([hidden]) { display: flex; flex-direction: column; gap: 14px; padding: 16px; }
.cp-2d-row { display: flex; gap: 12px; align-items: flex-start; }
/* preview cells overlaid on the canvas (object + floor swatches top, shape + material bottom) */
.cp-stage { position: relative; width: 100%; line-height: 0; }
#cpSphere { display: block; width: 100%; height: auto; background: var(--bg-panel-2); cursor: crosshair; touch-action: none; }
.cp-cells { position: absolute; inset: 0; display: flex; line-height: 1.4; pointer-events: none; }   /* let canvas clicks (colour pick) through; only the controls catch */
.cp-cell { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.cp-cell + .cp-cell { border-left: 1px solid rgba(0,0,0,.35); }
.cp-cell-top, .cp-cell-bot { display: flex; align-items: center; gap: 7px; padding: 9px; }
.cp-cell-top > *, .cp-cell-bot > * { pointer-events: auto; }
.cp-cell-gap { flex: 1 1 auto; pointer-events: none; }
.cp-cellsw { width: 30px; height: 30px; flex: 0 0 30px; padding: 0; border: 1px solid rgba(255,255,255,.55); border-radius: 6px; background: none; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.cp-cellsw::-webkit-color-swatch-wrapper { padding: 2px; }
.cp-cellsw::-webkit-color-swatch { border: none; border-radius: 4px; }
.cp-cellsel { background: rgba(22,24,30,.86); border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 7px 9px; font-size: 13px; font-weight: 600; outline: none; cursor: pointer; min-width: 0; }
.cp-floormat { flex: 0 0 auto; }
.cp-shape, .cp-mat { flex: 1 1 0; }
/* floor / camera height row */
.cp-globals { display: flex; gap: 28px; padding: 12px 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cp-gfield { display: flex; align-items: center; gap: 12px; flex: 1 1 0; min-width: 0; font-size: 13px; color: var(--text); white-space: nowrap; }
.cp-gfield input { flex: 1 1 auto; min-width: 0; accent-color: var(--accent); }
/* three light columns, always visible */
.cp-lights { display: flex; }
.cp-lcol { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 14px; padding: 14px 16px 18px; }
.cp-lcol + .cp-lcol { border-left: 1px solid var(--line); }
.cp-lhead { display: flex; align-items: center; gap: 9px; font-size: 15px; color: var(--text); padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.cp-lhead input { width: 18px; height: 18px; accent-color: var(--accent); }
.cp-dir2 { display: flex; gap: 16px; }
.cp-dir2 label { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 7px; font-size: 13px; color: var(--text); }
.cp-dir2 label input { margin-top: 0; }
.cp-ring { position: absolute; width: 22px; height: 22px; margin: 0; border: 2.5px solid var(--accent); border-radius: 50%; box-shadow: 0 0 0 1px #1b1e24; transform: translate(-50%, -50%); pointer-events: none; }
.cp-inline { display: flex; align-items: center; gap: 8px; }
.cp-inline .cp-slider, .cp-inline .cp-temp-range { flex: 1 1 auto; min-width: 0; }
.cp-field { font-size: 14px; color: var(--text); }
.cp-field > span { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.cp-temp output { display: block; text-align: center; font-weight: 600; margin-bottom: 4px; }
.cp-temp-range { width: 100%; height: 14px; border-radius: 7px; -webkit-appearance: none; appearance: none;
  background: linear-gradient(90deg, #d23, #f93, #fc6, #fff, #cfe6ff, #6cf); outline: none; }
.cp-temp-range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 22px; border-radius: 5px; background: #eee; border: 1px solid #888; cursor: pointer; }
.cp-temp-range::-moz-range-thumb { width: 16px; height: 22px; border-radius: 5px; background: #eee; border: 1px solid #888; cursor: pointer; }
.cp-temp-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.cp-slider { width: 100%; accent-color: var(--accent); margin-top: 4px; }
.cp-field output { font-weight: 600; color: var(--text); }
.cp-num { width: 64px; background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 7px 9px; font-size: 14px; outline: none; margin-left: auto; }
.cp-sel { background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 7px 9px; font-size: 13px; outline: none; }
.cp-row .cp-sel, .cp-row .cp-num { margin-left: auto; }
.cp-cellsel, .cp-sel { appearance: none; -webkit-appearance: none; -moz-appearance: none; padding-right: 28px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23aeb3c0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; }
.cp-lcolor { width: 36px; height: 36px; flex: 0 0 36px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; cursor: pointer; }
.cp input[type=color]::-webkit-color-swatch-wrapper { padding: 2px; }
.cp input[type=color]::-webkit-color-swatch { border: none; border-radius: 4px; }
.cp-2d-base { display: flex; flex-direction: column; gap: 10px; flex: 0 0 auto; }
#cpSquare { width: 200px; height: 168px; border-radius: 8px; cursor: crosshair; touch-action: none; display: block; }
#cpHue { width: 200px; height: 14px; border-radius: 8px; cursor: pointer; touch-action: none; display: block; }
.cp-gen { flex: 1 1 auto; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cp-gen-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim); }
.cp-gen-cards { display: flex; gap: 8px; }
.cp-gen-card { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.cp-gen-sw { width: 100%; height: 132px; border-radius: 10px; border: 1px solid var(--line); }
.cp-gen-hex { font-family: ui-monospace, monospace; font-size: 11px; color: var(--text); }
.cp-gen-acts { display: flex; gap: 4px; }
.cp-gen-add, .cp-gen-copy { width: 22px; height: 22px; border-radius: 5px; border: 1px solid var(--line); background: var(--bg-input); color: var(--text-dim); cursor: pointer; font-size: 13px; line-height: 1; padding: 0; }
.cp-gen-add:hover, .cp-gen-copy:hover { color: var(--text); border-color: var(--accent); }
.cp-harm-pick { display: flex; flex-direction: column; gap: 6px; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim); }
.cp-harm-pick select { width: 100%; text-transform: none; letter-spacing: normal; }
.cp-foot { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); background: var(--bg-titlebar); }
.cp-sel-swatch { width: 34px; height: 34px; border-radius: 6px; border: 1px solid var(--line); background: #8e8e8e; }
.cp-add-swatch { padding: 7px 11px; font-size: 16px; line-height: 1; }
/* saved swatches row across the top of the canvas */
.swatch-bar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 40; display: flex; gap: 6px; padding: 6px 8px; background: var(--bg-panel); border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 8px 24px rgba(0,0,0,.4); max-width: 70%; overflow-x: auto; }
.swatch-bar[hidden] { display: none; }
.swatch-chip { width: 26px; height: 26px; flex: 0 0 26px; padding: 0; border-radius: 6px; border: 1px solid rgba(255,255,255,.4); box-shadow: inset 0 0 0 1px rgba(0,0,0,.3); cursor: pointer; }
.swatch-chip:hover { border-color: var(--accent); transform: scale(1.1); }
.swatch-add { position: relative; width: 26px; height: 26px; flex: 0 0 26px; padding: 0; border-radius: 6px; border: 1px dashed var(--line); background: var(--bg-panel-2); color: var(--text-dim); cursor: pointer; }
.swatch-add svg { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 4; stroke-linecap: round; }
.swatch-add:hover { color: var(--text); border-color: var(--accent); }
.cp-sel-lbl { font-size: 14px; color: var(--text); }
.cp-hex { width: 150px; background: var(--bg-panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 8px 10px; font-size: 14px; outline: none; }
.cp-foot-gap { flex: 1 1 auto; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: #1b1e24; border: 1px solid var(--line); color: var(--text);
  padding: 9px 16px; border-radius: 8px; z-index: 120; box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.proj-name-wrap { display: flex; align-items: center; gap: 6px; }
.proj-name-wrap input { flex: 1 1 auto; min-width: 0; }
.proj-ext { color: var(--text-dim); font-size: 13px; white-space: nowrap; }
