/* Draw mode: paint stack, cursor, transform overlay, tool rail, panel (brushes / colour / layers / onion). */

/* paint stack: display:contents so each canvas blends with the 3D stage underneath (same stacking context as .stage-cv) */
.paint-stack{display:contents}
.paint-stack canvas{position:absolute;inset:0;width:100%;height:100%;z-index:2;pointer-events:none;image-rendering:auto}
.paint-stack.inactive canvas.onion-cv{opacity:.6}
.paint-xf{position:absolute;inset:0;width:100%;height:100%;z-index:4;pointer-events:none;overflow:visible;display:none}
.paint-xf .xf-box{fill:none;stroke:var(--sel);vector-effect:non-scaling-stroke}
.paint-xf .xf-h{fill:#fff;stroke:var(--sel)}
.paint-xf .xf-rot{fill:var(--sel);stroke:#fff}
.paint-cursor{position:absolute;left:0;top:0;border-radius:50%;pointer-events:none;z-index:20;opacity:0;
  border:1px solid rgba(255,255,255,.9);box-shadow:0 0 0 1px rgba(0,0,0,.45);transition:opacity .12s;will-change:transform}

/* ---------- rail ---------- */
.dr-rail{display:flex;flex-direction:column;align-items:center;gap:4px;padding:6px 0}
.dr-rail .dr-tool .ico{font-size:21px}
.dr-sep{width:22px;height:1px;background:var(--stroke2);margin:6px 0}
.dr-vsl{display:flex;flex-direction:column;align-items:center;gap:5px;position:relative}
.dr-vsl .track{position:relative;width:26px;height:132px;border-radius:13px;background:var(--glass2);border:1px solid var(--stroke);cursor:ns-resize;overflow:visible;touch-action:none}
.dr-vsl .track i{position:absolute;left:0;right:0;bottom:0;border-radius:12px;background:var(--active)}
.dr-vsl .track b{position:absolute;left:3px;width:18px;height:14px;border-radius:7px;background:#fff;box-shadow:0 1px 4px rgba(0,0,0,.35)}
.dr-vsl output{font:500 10px var(--mono);color:var(--fg3);min-height:12px}
.dr-vsl.drag output{color:var(--fg)}
.dr-dot{width:32px;height:32px;border-radius:50%;border:2px solid var(--stroke2);background:conic-gradient(from 0deg,#ff453a,#ffd60a,#30d158,#64d2ff,#0a84ff,#bf5af2,#ff453a);padding:3px;position:relative}
.dr-dot i{display:block;width:100%;height:100%;border-radius:50%;box-shadow:0 0 0 2px var(--bg)}
.dr-readout{font:500 11.5px var(--mono);color:var(--fg3);white-space:nowrap}

/* ---------- panel ---------- */
.dr-panel{display:flex;flex-direction:column;gap:10px;min-height:0}
.dr-panel>.seg{flex:none}
.dr-body{min-height:0}
.dr-body .row label{width:76px}
.dr-note{font-size:11.5px;color:var(--fg3);margin:6px 2px 0}
.dr-hint{font-size:11.5px;margin-top:10px;line-height:1.4}

.dr-brushes{display:flex;flex-direction:column;gap:4px}
.dr-brush{display:flex;align-items:center;gap:10px;border:1px solid transparent;background:none;border-radius:12px;padding:4px 8px 4px 10px;text-align:left;transition:background .15s}
.dr-brush:hover{background:var(--hover)}
.dr-brush.on{background:var(--sel-soft);border-color:color-mix(in srgb,var(--sel) 45%,transparent)}
.dr-brush .bn{display:flex;align-items:center;gap:8px;width:118px;flex:none;font:500 12.5px var(--sans);color:var(--fg)}
.dr-brush .bn .ico{font-size:18px;color:var(--fg2)}
.dr-brush canvas{flex:1;min-width:0;height:28px;width:100%}

.dr-wheelbox{display:grid;place-items:center;padding:4px 0 2px}
.dr-wheel{touch-action:none;cursor:crosshair}
.dr-hexrow{display:flex;align-items:center;gap:10px;margin-top:8px}
.dr-hex{flex:1;text-transform:lowercase}
.dr-cur{display:flex;width:56px;height:30px;border-radius:9px;overflow:hidden;border:1px solid var(--stroke2);flex:none}
.dr-cur button,.dr-cur i{flex:1;border:0;display:block}
.dr-swatches{display:grid;grid-template-columns:repeat(8,1fr);gap:6px}
.dr-swatches.sm{grid-template-columns:repeat(12,1fr);gap:5px}
.dr-swatches .sw{aspect-ratio:1;border-radius:50%;border:1px solid var(--stroke2);padding:0;display:grid;place-items:center;transition:transform .12s}
.dr-swatches .sw:hover{transform:scale(1.12)}
.dr-swatches .sw.add{background:var(--glass2);color:var(--fg3)}
.dr-swatches .sw.add .ico{font-size:16px}
.dr-swatches .muted{grid-column:1/-1;font-size:11.5px}

.dr-layers{display:flex;flex-direction:column;gap:3px;max-height:300px;overflow:auto;margin:0 -2px;padding:0 2px}
.dr-layer{display:flex;align-items:center;gap:9px;padding:5px 4px 5px 6px;border-radius:11px;border:1px solid transparent;cursor:pointer;position:relative;user-select:none;transition:background .12s}
.dr-layer:hover{background:var(--hover)}
.dr-layer.on{background:var(--sel-soft);border-color:color-mix(in srgb,var(--sel) 40%,transparent)}
.dr-layer.hid .lth,.dr-layer.hid .ln{opacity:.45}
.dr-layer.clip{margin-left:16px}
.dr-layer.drag{opacity:.4}
.dr-layer.above::before,.dr-layer.below::after{content:'';position:absolute;left:6px;right:6px;height:2px;border-radius:2px;background:var(--sel)}
.dr-layer.above::before{top:-2px}.dr-layer.below::after{bottom:-2px}
.dr-layer .lth{width:56px;height:32px;border-radius:6px;flex:none;border:1px solid var(--stroke);
  background:#fff linear-gradient(45deg,#e6e6e6 25%,transparent 25%,transparent 75%,#e6e6e6 75%) 0 0/10px 10px;object-fit:contain}
.dr-layer .ln{flex:1;min-width:0}
.dr-layer .ln b{display:block;font:500 12.5px var(--sans);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dr-layer .tags{display:flex;gap:4px;align-items:center;min-height:14px}
.dr-layer .tag{font:500 9.5px var(--mono);color:var(--fg3)}
.dr-layer .ico.tag{font-family:'Material Symbols Outlined';font-size:13px}
.dr-layer .eye{border:0;background:none;color:var(--fg3);width:26px;height:26px;border-radius:50%;display:grid;place-items:center;flex:none}
.dr-layer .eye:hover{background:var(--hover);color:var(--fg)}
.dr-layer .eye .ico{font-size:17px}
.dr-lacts{display:flex;flex-wrap:wrap;gap:2px;margin-top:8px;padding-top:8px;border-top:1px solid var(--stroke)}
.dr-lacts .rot90 .ico{transform:rotate(90deg)}
.dr-body .tgl{margin:6px 0}
.dr-body select.field{flex:1;padding:6px 28px 6px 10px;font-size:12.5px}

.dr-refs{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}
.dr-refs .ref{position:relative;aspect-ratio:16/10;border-radius:9px;border:1px solid var(--stroke);background:var(--glass2);overflow:hidden;padding:0;display:grid;place-items:center;color:var(--fg3);font-size:10.5px}
.dr-refs .ref span{font-size:10.5px}
.dr-refs .ref .ico{font-size:18px}
.dr-refs .ref img{width:100%;height:100%;object-fit:cover;display:block}
.dr-refs .ref.on{border-color:var(--sel);box-shadow:0 0 0 2px var(--sel-soft)}
.dr-refs .ref .vid{position:absolute;right:3px;bottom:3px;background:rgba(0,0,0,.55);border-radius:50%;width:16px;height:16px;display:grid;place-items:center;color:#fff}
.dr-refs .ref .vid .ico{font-size:12px}
.dr-refs .dr-hint{grid-column:1/-1;margin:0}
