:root {
  --paper: #f4f1ea;
  --paper-2: #faf7f0;
  --ink: #16150f;
  --ink-soft: #4a4740;
  --ink-mute: #8a857a;
  --line: #16150f;
  --accent: #c4513a;
  --accent-2: #a93f2c;
  --yellow: #f4c542;
  --ok: #3e8a6c;
  --panel: #141310;
  --panel-2: #1e1c18;
  --bw: 3px;
  --font: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --black: 'Archivo Black', var(--font);
  /* shared motion "feel" — one small overshoot then a firm settle, reads as clicking solidly into place */
  --spring-solid: cubic-bezier(.5, 1.7, .42, 1);
  --spring-soft:  cubic-bezier(.34, 1.45, .6, 1);
  --hintbar-h: 30px;
}
* { box-sizing: border-box; }
/* accessibility: visible focus + reduced motion */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.tool:focus-visible { outline-offset: -3px; outline-color: var(--yellow); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }
html, body { margin: 0; padding: 0; height: 100%; background: var(--paper); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
body { user-select: none; -webkit-user-select: none; }
input, textarea, select, [contenteditable="true"] { user-select: text; -webkit-user-select: text; }
button { font-family: var(--font); }
kbd { font: 700 .62rem var(--font); background: rgba(0,0,0,.08); border: 1px solid rgba(0,0,0,.25); border-bottom-width: 2px; border-radius: 2px; padding: 0 4px; margin-left: 5px; line-height: 1.4; }
.clip-controls kbd, .panel kbd { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.3); }

/* ── shared button — art-palette button aesthetic (same border weight), shallower shadow ── */
.t-btn { font: 700 .8rem var(--font); padding: 7px 12px; border: 2.5px solid var(--ink); background: var(--paper-2); color: var(--ink); cursor: pointer; border-radius: 3px; box-shadow: 2px 2px 0 var(--ink);
  transition: transform .13s var(--spring-solid), box-shadow .13s var(--spring-solid), background 90ms; }
.t-btn:hover { background: var(--yellow); }
.t-btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.t-btn.primary { background: var(--accent); border-color: var(--ink); color: #fff; }
.t-btn.primary:hover { background: var(--accent-2); }
.t-btn.ghost { background: transparent; box-shadow: 2px 2px 0 rgba(22,21,15,.4); }
.t-btn:disabled { opacity: .4; cursor: not-allowed; }
.mini-btn { font: 800 14px/1 var(--font); min-width: 24px; height: 24px; padding: 0 5px; border: 2px solid var(--ink); background: var(--paper-2); color: var(--ink); cursor: pointer; }
.mini-btn:hover { background: var(--yellow); }
.mini-btn.on { background: var(--accent); color: #fff; border-color: var(--ink); }

/* ───────────────── classic menu bar (under the header) ───────────────── */
.menubar { display: flex; align-items: stretch; gap: 1px; padding: 0 8px; background: var(--paper); border-bottom: var(--bw) solid var(--ink); flex: none; position: relative; z-index: 90; }
.mb-top { font: 700 .82rem var(--font); padding: 5px 12px; border: 0; background: transparent; color: var(--ink); cursor: pointer; border-radius: 3px 3px 0 0; }
.mb-top:hover, .mb-top[aria-expanded="true"] { background: var(--ink); color: var(--paper); }
.mb-drop { position: fixed; z-index: 200; min-width: 210px; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 0 0 4px 4px; box-shadow: 4px 4px 0 var(--ink); padding: 4px; animation: ctxpop .14s var(--spring-solid); transform-origin: top left; }
.mb-item { display: flex; align-items: center; justify-content: space-between; gap: 22px; width: 100%; padding: 6px 10px; border: 0; border-radius: 3px; background: transparent; color: var(--ink); font: 600 .8rem var(--font); cursor: pointer; text-align: left; }
.mb-item:hover:not(:disabled), .mb-item:focus-visible { background: var(--accent); color: #fff; }
.mb-item:hover:not(:disabled) .mb-hint { color: rgba(255,255,255,.75); }
.mb-item:disabled { opacity: .38; cursor: default; }
.mb-hint { font-size: .68rem; color: var(--ink-mute); letter-spacing: .02em; }
.mb-sep { height: 2px; background: rgba(22,21,15,.14); margin: 4px 2px; }
@media (prefers-reduced-motion: reduce) { .mb-drop { animation: none; } }

/* ───────────────── topbar ───────────────── */
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; padding: 10px 16px; border-bottom: var(--bw) solid var(--ink); background: var(--paper-2); flex: none; }
.brand { display: flex; align-items: flex-end; gap: 12px; }
.brand h1 { font-family: var(--black); font-size: 1.55rem; letter-spacing: .02em; margin: 0; line-height: 1; }
.brand .tag { margin: 0 0 2px; font-size: .74rem; color: var(--ink-mute); }
.brand .tag .by a { color: var(--accent); text-decoration: none; }
.privacy { font: 700 .62rem var(--font); color: var(--ok); border: 2px solid var(--ok); padding: 2px 7px; letter-spacing: .02em; }

/* ── file actions ── */
.filebar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filebar .t-btn { padding: 6px 11px; }
.filebar-sep { width: 2px; height: 22px; background: var(--ink); opacity: .2; margin: 0 3px; }
.jitter { display: flex; align-items: center; gap: 8px; }
.jitter-toggle::before { content: ''; display: inline-block; width: 8px; height: 8px; border: 2px solid currentColor; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.jitter-toggle[aria-pressed="true"] { background: var(--ok); border-color: var(--ink); color: #fff; }
.jitter-toggle[aria-pressed="true"]::before { background: #fff; border-color: #fff; }
.jitter-range { width: 80px; }
.jitter[data-off="true"] .jitter-range, .jitter[data-off="true"] .jitter-val { opacity: .4; }
.jitter-val { font: 700 .7rem var(--font); color: var(--ink-mute); min-width: 30px; }

/* ── tools dropdown (top-right) ── */
.toolsmenu { position: relative; }
.tm-btn { display: flex; align-items: center; gap: 9px; border: 2.5px solid var(--ink); border-radius: 3px; background: var(--paper-2); padding: 5px 10px 5px 6px; cursor: pointer; box-shadow: 2px 2px 0 var(--ink); transition: transform .13s var(--spring-solid), box-shadow .13s var(--spring-solid), background 90ms; }
.tm-btn:hover { background: var(--yellow); }
.tm-btn[aria-expanded="true"], .tm-btn:active { box-shadow: 0 0 0 var(--ink); transform: translate(2px,2px); }
.tm-ico { width: 26px; height: 26px; flex: none; display: block; }
.tm-ico svg { width: 100%; height: 100%; display: block; }
.tm-txt { display: flex; flex-direction: column; align-items: flex-start; line-height: 1; text-align: left; }
.tm-txt b { font-family: var(--black); font-size: .82rem; letter-spacing: .01em; }
.tm-txt small { font: 600 .6rem var(--font); color: var(--ink-mute); margin-top: 2px; }
.tm-caret { font-size: .7rem; color: var(--ink-mute); margin-left: 2px; }
.tm-list { position: absolute; top: calc(100% + 6px); right: 0; z-index: 80; min-width: 210px; background: var(--paper); border: var(--bw) solid var(--ink); box-shadow: 6px 6px 0 var(--ink); display: flex; flex-direction: column; }
.tm-list[hidden] { display: none; }
.tm-item { display: flex; align-items: center; gap: 11px; padding: 9px 12px; text-decoration: none; color: var(--ink); border-bottom: 2px solid var(--ink); }
.tm-item:last-child { border-bottom: 0; }
.tm-item:hover { background: var(--accent); }
.tm-item:hover .tm-name { color: #fff; }
.tm-name { font-family: var(--black); font-size: .95rem; letter-spacing: .01em; }
.tm-sep { height: 2px; background: var(--ink); }
.tm-toggle { display: flex; align-items: center; gap: 11px; padding: 9px 12px; cursor: pointer; user-select: none; background: var(--paper-2); }
.tm-toggle .tm-name { font-size: .82rem; flex: 1; }
.tm-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.tm-switch { flex: none; width: 34px; height: 19px; border: 2px solid var(--ink); border-radius: 11px; background: var(--paper); position: relative; transition: background .15s var(--spring-solid); }
.tm-switch::after { content: ''; position: absolute; top: 1.5px; left: 1.5px; width: 12px; height: 12px; border-radius: 50%; background: var(--ink); transition: transform .2s var(--spring-solid); }
.tm-toggle input:checked + .tm-name + .tm-switch { background: var(--ok); }
.tm-toggle input:checked + .tm-name + .tm-switch::after { transform: translateX(15px); background: #fff; }
.tm-toggle input:focus-visible + .tm-name + .tm-switch { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ── app right-click context menu ── */
.ctxmenu { position: fixed; z-index: 200; min-width: 196px; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 4px; box-shadow: 4px 4px 0 var(--ink); padding: 4px; transform-origin: top left; }
.ctxmenu.open { animation: ctxpop .16s var(--spring-solid); }
@keyframes ctxpop { from { transform: scale(.94); opacity: .4; } to { transform: scale(1); opacity: 1; } }
.ctx-item { display: flex; align-items: center; justify-content: space-between; gap: 22px; width: 100%; padding: 6px 9px; border: 0; border-radius: 3px; background: transparent; color: var(--ink); font: 600 .8rem var(--font); cursor: pointer; text-align: left; }
.ctx-item:hover:not(:disabled), .ctx-item:focus-visible { background: var(--accent); color: #fff; }
.ctx-item:hover:not(:disabled) .ctx-hint { color: rgba(255,255,255,.75); }
.ctx-item:disabled { opacity: .38; cursor: default; }
.ctx-hint { font-size: .68rem; color: var(--ink-mute); letter-spacing: .02em; }
.ctx-sep { height: 2px; background: rgba(22,21,15,.14); margin: 4px 2px; }
@media (prefers-reduced-motion: reduce) { .ctxmenu.open { animation: none; } }

/* ── settings modal rows ── */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 2px; border-bottom: 2px solid rgba(22,21,15,.12); }
.set-text { display: flex; flex-direction: column; gap: 3px; }
.set-text b { font: 800 .92rem var(--font); color: var(--ink); }
.set-text small { font: 500 .76rem var(--font); color: var(--ink-soft); }
.set-switch { appearance: none; flex: none; width: 44px; height: 25px; border: 2.5px solid var(--ink); border-radius: 14px; background: var(--paper-2); position: relative; cursor: pointer; transition: background .15s var(--spring-solid); }
.set-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink); transition: transform .2s var(--spring-solid); }
.set-switch:checked { background: var(--ok); }
.set-switch:checked::after { transform: translateX(19px); background: #fff; }
.set-switch:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ───────────────── app shell ───────────────── */
.app { display: flex; flex-direction: column; height: 100%; }
.workspace { flex: 1; display: grid; grid-template-columns: 52px 1fr 232px; min-height: 0; }
@media (max-width: 760px) { .workspace { grid-template-columns: 46px 1fr; } .rightcol { display: none; } }

/* ── left tool palette ── */
.tools { display: flex; flex-direction: column; background: var(--panel); border-right: var(--bw) solid var(--ink); overflow-y: auto; }
/* left bar — flat "membrane / microwave touch panel" buttons: subtle sheen, light passover on
   hover, a brief tactile pulse + spring when picked. Distinct from the chunky art-palette buttons. */
.tool { position: relative; height: 46px; border: 0; border-bottom: 1px solid rgba(0,0,0,.55); background: linear-gradient(180deg, #1b1915, #141310); color: var(--paper); cursor: pointer; display: grid; place-items: center; font-size: 1.15rem;
  transition: transform .2s var(--spring-soft), filter .14s ease, background .3s ease, color .3s ease, box-shadow .3s ease; }
.tool::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,.06), transparent 42%); pointer-events: none; }   /* membrane top sheen */
.tool::after { content: ''; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 38%, rgba(255,255,255,.09) 50%, transparent 62%); background-size: 240% 100%; background-position: 150% 0; opacity: 0; pointer-events: none; }   /* light passover */
.tool:hover { filter: brightness(1.22); }
.tool:hover::after { animation: toolShimmer .62s ease; }
@keyframes toolShimmer { 0% { background-position: 150% 0; opacity: 0; } 30% { opacity: 1; } 100% { background-position: -50% 0; opacity: 0; } }
.tool:active { transform: scale(.93); }
.tool:hover .tool-tip { opacity: 1; transform: translateY(-50%) translateX(0); }
.tool[aria-pressed="true"] { background: var(--tool-sel-bg, var(--accent)); color: var(--tool-sel-fg, #fff); box-shadow: inset 4px 0 0 var(--tool-sel-strip, var(--yellow)), inset 0 1px 0 rgba(255,255,255,.18); }
.tool.justpicked { animation: toolPulse .44s var(--spring-solid); }   /* brief pulse when selected */
@keyframes toolPulse { 0% { transform: scale(1); } 38% { transform: scale(1.09); } 100% { transform: scale(1); } }
.tool svg { width: 31px; height: 31px; display: block; position: relative; }
.tool .tool-k { position: absolute; bottom: 2px; right: 3px; font: 700 .52rem var(--font); color: var(--ink-mute); z-index: 1; }
.tool[aria-pressed="true"] .tool-k { color: var(--tool-sel-fg, #fff); opacity: .7; }
.tool-tip { position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%) translateX(-4px); white-space: nowrap; background: var(--ink); color: var(--paper); font: 700 .72rem var(--font); padding: 5px 9px; border: 2px solid var(--ink); box-shadow: 3px 3px 0 rgba(0,0,0,.3); opacity: 0; pointer-events: none; z-index: 60; transition: opacity .1s, transform .1s; }
.tool-tip kbd { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.3); color: var(--paper); }
.tool-sep { height: 8px; border-bottom: 1px solid #000; }

/* ── centre: options bar + canvas + hint bar ── */
.centre { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #d9d4c8; }
.optbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; min-height: 44px; padding: 5px 12px; border-bottom: var(--bw) solid var(--ink); background: var(--paper-2); flex: none; }
.opt-group { display: flex; align-items: center; gap: 7px; }
/* bold tool indicator: [icon] NAME, name filled fg + outlined bg (live colour reminder) */
.tool-ind { display: flex; align-items: center; gap: 8px; }
.tool-ind .ti-ico { width: 24px; height: 24px; color: var(--ink); flex: none; }
.tool-ind .ti-ico svg { width: 100%; height: 100%; display: block; }
.tool-ind .ti-name { font-family: var(--black); font-size: 1.62rem; letter-spacing: .02em; text-transform: uppercase; line-height: 1; -webkit-text-stroke: 2px var(--bg, #fff); paint-order: stroke fill; transition: color .3s ease; }
.optbar.pulse { animation: optpulse .45s ease-out; }
@keyframes optpulse {
  0% { box-shadow: inset 0 0 0 3px var(--pulse); background: color-mix(in srgb, var(--pulse) 16%, var(--paper-2)); }
  100% { box-shadow: inset 0 0 0 0 transparent; background: var(--paper-2); }
}
.opt-group .lbl { font: 800 .58rem var(--font); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-mute); }
.opt-sep { width: 2px; align-self: stretch; background: var(--ink); opacity: .18; margin: 4px 0; }
.opt-name { font: 800 .9rem var(--font); letter-spacing: .02em; }
.opt-num { width: 52px; font: 600 .82rem var(--font); padding: 4px 5px; border: 2px solid var(--ink); background: var(--paper-2); }
input[type=range].opt-range { -webkit-appearance: none; appearance: none; width: 96px; height: 6px; background: var(--ink); border: 0; cursor: pointer; }
input[type=range].opt-range::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 18px; background: var(--accent); border: 2px solid var(--ink); cursor: grab; }
input[type=range].opt-range::-moz-range-thumb { width: 14px; height: 18px; background: var(--accent); border: 2px solid var(--ink); border-radius: 0; cursor: grab; }
.opt-readout { font: 600 .78rem var(--font); color: var(--ink-soft); font-variant-numeric: tabular-nums; min-width: 30px; }
.seg { display: flex; border: 2px solid var(--ink); }
.seg button { border: 0; border-right: 2px solid var(--ink); background: var(--paper-2); font: 700 .72rem var(--font); padding: 5px 9px; cursor: pointer; color: var(--ink); transition: background .12s, color .12s; }
.seg button:active { transform: scale(.96); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.seg button:not([aria-pressed="true"]):hover { background: var(--yellow); }
.opt-check { display: inline-flex; align-items: center; gap: 5px; font: 700 .74rem var(--font); cursor: pointer; }

/* canvas stage */
.stage { flex: 1; position: relative; overflow: hidden; min-height: 0; }
.canvas-host { position: absolute; inset: 0; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.stage.tool-pan #view { cursor: grab; }
.stage.tool-pan.panning #view { cursor: grabbing; }
.stage.tool-paint #view { cursor: crosshair; }
.stage.tool-pick #view { cursor: crosshair; }
.stage.tool-move #view { cursor: move; }
.stage.tool-text #view { cursor: text; }
.stage.text-width-handle #view { cursor: nwse-resize; }   /* must come after the tool cursors (equal specificity) */

/* drop overlay */
.dropzone { position: absolute; inset: 0; z-index: 40; display: none; place-items: center; background: rgba(244,197,66,.22); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.dropzone.hot { display: grid; }
.dropzone span { font: 800 1.1rem var(--black); color: var(--ink); background: var(--paper); border: var(--bw) dashed var(--ink); padding: 18px 28px; box-shadow: 8px 8px 0 var(--ink); }

/* ── hint bar ── */
.hintbar { display: flex; align-items: center; gap: 14px; height: var(--hintbar-h); padding: 4px 12px; border-top: var(--bw) solid var(--ink); background: var(--panel); color: var(--paper); flex: none; font: 600 .74rem var(--font); position: relative; z-index: 72; }
.hintbar .hint-icon { color: var(--yellow); font-weight: 800; }
.hintbar .hint-txt { color: #cdc8bd; }
.hintbar .hint-txt b { color: var(--paper); font-weight: 700; }
.hintbar .hint-right { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--ink-mute); }
.hintbar .hint-right .z { color: var(--paper); cursor: pointer; }
.hintbar .hint-right .z:hover { color: var(--yellow); }
.hintbar .hint-txt { transition: opacity .18s ease; }
.hintbar .hint-txt.flash-err { font-weight: 700; animation: hintflash .7s ease; }
@keyframes hintflash { 0%,35%,75%,100% { color: #cdc8bd; } 15%,55% { color: #ff5a4d; } }
.hintbar .hint-txt.fade-restore { animation: hintfade .2s ease; }
@keyframes hintfade { from { opacity: 0; } to { opacity: 1; } }

/* ───────────────── right column: colour + layers ───────────────── */
.rightcol { display: flex; flex-direction: column; background: var(--panel); border-left: var(--bw) solid var(--ink); min-height: 0; }
.panel { display: flex; flex-direction: column; min-height: 0; }
.panel-head { font: 800 .66rem var(--font); letter-spacing: .08em; min-height: 34px; padding: 6px 10px; border-bottom: 2px solid #000; display: flex; align-items: center; justify-content: space-between; gap: 6px; background: var(--panel-2); color: var(--paper); flex: none; }
.panel-head .ph-btns { display: flex; gap: 4px; }

/* colour panel */
.colour-panel { flex: none; padding: 10px; border-bottom: var(--bw) solid var(--ink); }
.colour-current { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.swatch-stack { position: relative; width: 46px; height: 46px; flex: none; }
.swatch-fg, .swatch-bg { position: absolute; width: 30px; height: 30px; border: 2px solid #000; box-shadow: 0 0 0 1px rgba(255,255,255,.25); cursor: pointer; }
.swatch-fg { top: 0; left: 0; z-index: 2; }
.swatch-bg { bottom: 0; right: 0; z-index: 1; }
.swatch-swap { position: absolute; top: -2px; right: -2px; z-index: 3; font-size: .7rem; border: 0; background: transparent; color: var(--paper); cursor: pointer; }
.colour-inputs { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.colour-inputs input[type=color] { width: 100%; height: 26px; padding: 0; border: 2px solid #000; background: none; cursor: pointer; }
.hex-row { display: flex; gap: 5px; }
.hex-row input { flex: 1; font: 600 .78rem var(--font); padding: 4px 6px; border: 2px solid #000; background: var(--panel-2); color: var(--paper); text-transform: uppercase; }
.swatches { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }
.swatches .sw { aspect-ratio: 1; border: 1px solid rgba(0,0,0,.5); cursor: pointer; }
.swatches .sw:hover { outline: 2px solid var(--yellow); outline-offset: -1px; }
.recent-lbl { font: 700 .56rem var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-mute); margin: 9px 0 4px; }

/* layers panel */
.layers-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.layers-list { flex: 1; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 5px; }
.layer { display: flex; align-items: center; gap: 6px; padding: 3px 5px; border: 2px solid #000; background: var(--panel-2); color: var(--paper); cursor: pointer; }
.layer.sel { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.layer.dragging { opacity: .5; }
.layer.drop-above { box-shadow: inset 0 3px 0 var(--yellow); }
.layer.drop-below { box-shadow: inset 0 -3px 0 var(--yellow); }
.layer .lyr-thumb { width: 34px; height: 28px; flex: none; border: 1px solid #000; background-color: #fff; background-image: linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(-45deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(-45deg,transparent 75%,#ccc 75%); background-size: 10px 10px; background-position: 0 0,0 5px,5px -5px,-5px 0; image-rendering: pixelated; }
.layer .lyr-thumb canvas, .layer .lyr-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.layer .lyr-mid { flex: 1; min-width: 0; }
.layer .lyr-name { font: 700 .72rem var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer .lyr-name.editing { white-space: normal; outline: 2px solid var(--accent); outline-offset: 1px; background: var(--paper); border-radius: 2px; padding: 0 3px; cursor: text; }
.layer .lyr-type { font: 600 .56rem var(--font); color: var(--ink-mute); text-transform: uppercase; letter-spacing: .05em; }
/* action icons in a compact 2x2 grid — white by default, semantic colour on the active row */
.layer .lyr-btns { display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px; flex: none; }
.lyr-btns .lyr-del { opacity: .55; transition: opacity .12s ease; }
.layer:hover .lyr-del { opacity: 1; }
.layer .lyr-ico { width: 23px; height: 21px; border: 0; background: rgba(255,255,255,.08); border-radius: 4px; color: #fff; cursor: pointer; font-size: .92rem; line-height: 1; display: grid; place-items: center; transition: color .12s, background .12s, transform .1s; }
.layer .lyr-ico:hover { background: rgba(255,255,255,.2); transform: translateY(-1px); }
.layer .lyr-ico.on { color: var(--yellow); }
/* active layer: icons glow into their own semantic colours so it's obvious which row is live */
.layer.sel .lyr-ico { color: #fff; }
.layer.sel .lyr-ico[data-act="vis"] { color: #6ee7a8; }
.layer.sel .lyr-ico[data-act="lock"] { color: #ffd34d; }
.layer.sel .lyr-ico[data-act="dup"] { color: #7fc8f0; }
.layer.sel .lyr-ico[data-act="del"] { color: #ff8f7a; }
.layer.sel .lyr-ico.on { color: var(--yellow); }
.layer.locked .lyr-thumb { opacity: .5; }
.layer-opacity { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-top: 2px solid #000; background: var(--panel-2); }
.layer-opacity .lbl { font: 800 .56rem var(--font); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-mute); }
.layer-opacity input[type=range] { flex: 1; }
.layer-opacity .val { font: 600 .72rem var(--font); color: var(--paper); min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }

/* ───────────────── modal (standardised: .3s spring pop, .6s blur ramp) ───────────────── */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px;
  background: rgba(20,19,15,0); -webkit-backdrop-filter: blur(0px); backdrop-filter: blur(0px);
  opacity: 0; pointer-events: none;
  transition: background .6s ease, backdrop-filter .6s ease, -webkit-backdrop-filter .6s ease, opacity .25s ease; }
.modal.open { background: rgba(20,19,15,.42); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 1; pointer-events: auto; }
/* clear variant: no blur/dim, so live previews behind stay visible (dynamics settings) */
.modal.clear.open { background: rgba(20,19,15,.08); -webkit-backdrop-filter: none; backdrop-filter: none; }
.modal-card { width: min(440px, 95vw); max-height: 90vh; overflow: auto; background: var(--paper); border: var(--bw) solid var(--ink); box-shadow: 10px 10px 0 var(--ink);
  transform: translateY(10px) scale(.96); opacity: 0; transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .28s ease; }
.modal.open .modal-card { transform: none; opacity: 1; }
@media (prefers-reduced-motion: reduce) { .modal-card { transition: opacity .12s ease; transform: none; } }

/* ── shared factory layout: browse/search left, deep exploration right ── */
.factory-card { width: min(880px, 96vw); height: min(620px, 90vh); display: flex; flex-direction: column; }
.factory-body { flex: 1; display: grid; grid-template-columns: 250px 1fr; min-height: 0; }
@media (max-width: 680px) { .factory-card { width: 96vw; } .factory-body { grid-template-columns: 1fr; } .factory-right { display: none; } }
.factory-left { display: flex; flex-direction: column; min-height: 0; border-right: var(--bw) solid var(--ink); background: var(--paper-2); }
.factory-search { margin: 12px; font: 600 .85rem var(--font); padding: 8px; border: 2px solid var(--ink); background: var(--paper); }
.factory-list { flex: 1; overflow-y: auto; padding: 0 12px 12px; display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.factory-right { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding: 16px; gap: 14px; }
.factory-sub { display: flex; flex-direction: column; gap: 6px; }
.factory-sub > .lbl { font: 800 .6rem var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-mute); }
.modal-head { padding: 13px 18px; border-bottom: var(--bw) solid var(--ink); background: var(--paper-2); display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { font-family: var(--black); font-size: 1.05rem; margin: 0; }
.modal-x { border: 0; background: transparent; font-size: 1.2rem; cursor: pointer; color: var(--ink); }
.modal-body { padding: 18px; }
.modal-field { display: flex; flex-direction: column; gap: 5px; font: 700 .72rem var(--font); margin-bottom: 13px; }
.modal-field input, .modal-field select { font: 600 .85rem var(--font); padding: 7px; border: 2px solid var(--ink); background: var(--paper-2); }
.modal-row { display: flex; gap: 12px; }
.modal-row .modal-field { flex: 1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 6px; }
.preset-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
.preset { text-align: left; border: 2px solid var(--ink); background: var(--paper-2); padding: 8px 10px; cursor: pointer; }
.preset.sel { color: #fff; border-color: var(--ink); animation: preset-party 1.6s linear infinite, preset-pop .28s var(--spring-solid, ease-out); background-image: linear-gradient(115deg, #c4513a, #d4a017, #3e8a6c, #2b6cb0, #7b4bd1, #c4513a); background-size: 480% 100%; text-shadow: 0 1px 0 rgba(0,0,0,.35); }
.preset.sel b, .preset.sel span { color: #fff; }
@keyframes preset-party { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
@keyframes preset-pop { from { transform: scale(.93); } 60% { transform: scale(1.04); } to { transform: scale(1); } }
.preset:hover { background: var(--yellow); }
.preset b { display: block; font: 800 .8rem var(--font); }
.preset span { font: 600 .66rem var(--font); color: var(--ink-mute); }

/* ── colour factory (rebuilt): big SV picker is the hero, info on the right ── */
.cf-card { width: min(760px, 96vw); max-height: 92vh; display: flex; flex-direction: column; }
.cf-mode.seg { margin-left: auto; margin-right: 10px; }
.cf-body { display: flex; gap: 0; min-height: 0; }
.cf-stage { flex: 1.35; display: flex; gap: 10px; padding: 18px; min-width: 0; background: var(--paper); }
.cf-sv, .cf-hue { border: 2px solid var(--ink); cursor: crosshair; display: block; border-radius: 4px; }
.cf-sv { flex: 1; width: 100%; height: auto; aspect-ratio: 6 / 5; min-height: 0; }
.cf-hue { flex: none; width: 26px; align-self: stretch; height: auto; }
.cf-side { flex: none; width: 300px; display: flex; flex-direction: column; gap: 13px; padding: 18px; border-left: var(--bw) solid var(--ink); background: var(--paper-2); overflow-y: auto; }
.cf-target.seg { width: 100%; }
.cf-target.seg button { flex: 1; }
.cf-readout { display: flex; align-items: center; gap: 8px; }
.cf-prev { width: 40px; height: 40px; border: 2px solid var(--ink); border-radius: 5px; flex: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.3); }
.cf-hex { flex: 1; min-width: 0; font: 800 1rem var(--font); padding: 9px 10px; border: 2px solid var(--ink); border-radius: 5px; background: var(--paper); text-transform: uppercase; letter-spacing: .04em; }
.cf-eye { flex: none; width: 40px; height: 40px; font-size: 1.1rem; border: 2px solid var(--ink); border-radius: 5px; background: var(--paper); cursor: pointer; }
.cf-eye:hover { background: var(--yellow, #ffe01b); }
.cf-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cf-fields label { display: flex; align-items: center; gap: 5px; font: 800 .66rem var(--font); color: var(--ink-mute); }
.cf-fields input { width: 100%; min-width: 0; font: 600 .8rem var(--font); padding: 6px 4px; border: 2px solid var(--ink); border-radius: 4px; background: var(--paper); }
.cf-fsep { display: none; }
.cf-sub { display: flex; flex-direction: column; gap: 6px; }
.cf-lbl { font: 800 .6rem var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-mute); }
.cf-swatches { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.cf-actions { margin-top: auto; display: flex; justify-content: flex-end; padding-top: 4px; }
.cf-grad { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 2px solid var(--ink); border-radius: 6px; background: var(--paper); }
.cf-grad[hidden] { display: none; }
.cf-grad-hint { font: 600 .66rem var(--font); color: var(--ink-mute); line-height: 1.4; }
@media (max-width: 620px) { .cf-body { flex-direction: column; } .cf-side { width: auto; border-left: 0; border-top: var(--bw) solid var(--ink); } }
/* gradient editor */
.cf-grad-bar { position: relative; height: 26px; border: 2px solid var(--ink); border-radius: 4px; cursor: copy;
  background-image: linear-gradient(45deg,#ccc 25%,transparent 25%),linear-gradient(-45deg,#ccc 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#ccc 75%),linear-gradient(-45deg,transparent 75%,#ccc 75%); background-size: 12px 12px; }
.cf-grad-stop { position: absolute; top: 50%; width: 15px; height: 15px; transform: translate(-50%, -50%); border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--ink); cursor: grab; padding: 0; }
.cf-grad-stop.sel { box-shadow: 0 0 0 2.5px var(--accent); width: 18px; height: 18px; z-index: 2; }
.cf-grad-ctl { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.cf-grad-angle { display: flex; align-items: center; gap: 6px; font: 800 .62rem var(--font); color: var(--ink-mute); }
.cf-grad-angle input { width: 90px; }
.cf-grad-use.on { background: var(--yellow, #ffe01b); }
.cf-sw { aspect-ratio: 1; border: 2px solid var(--ink); cursor: pointer; }
.cf-sw:hover { outline: 2px solid var(--yellow); outline-offset: 1px; }
.cf-pal-item { text-align: left; border: 2px solid transparent; background: transparent; color: var(--ink); cursor: pointer; padding: 7px 9px; font: 700 .82rem var(--font); }
.cf-pal-item:hover { border-color: var(--ink); background: var(--paper); }
.cf-pal-item.sel { border-color: var(--accent); background: var(--paper); }
.cf-empty { font: 600 .72rem var(--font); color: var(--ink-mute); }

/* font picker */
.font-search { width: 100%; font: 600 .85rem var(--font); padding: 8px; border: 2px solid var(--ink); background: var(--paper-2); }
.font-list { flex: 1; overflow-y: auto; padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.font-row { display: flex; align-items: center; gap: 8px; text-align: left; border: 2px solid transparent; background: transparent; color: var(--ink); cursor: pointer; padding: 8px 9px; font-size: 1.15rem; line-height: 1.4; white-space: nowrap; overflow: hidden; }
.font-row:hover { border-color: var(--ink); background: var(--paper-2); }
.font-row.sel { border-color: var(--accent); background: var(--paper-2); }
.font-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.font-star { flex: none; border: 0; background: transparent; cursor: pointer; font-size: 1.05rem; line-height: 1; color: var(--ink-mute); opacity: 0; transition: opacity .12s, color .12s, transform .1s; padding: 2px 4px; }
.font-row:hover .font-star, .font-star.on { opacity: 1; }
.font-star.on { color: var(--yellow, #f4c542); }
.font-star:hover { transform: scale(1.22); color: var(--accent); }
.font-group { font: 800 .6rem var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-mute); padding: 8px 9px 3px; position: sticky; top: 0; background: var(--paper-2); z-index: 1; }
.font-empty { color: var(--ink-mute); font: 600 .85rem var(--font); padding: 20px; text-align: center; }
/* font factory right panel */
.ff-specimen { min-height: 96px; display: flex; align-items: center; border: 2px solid var(--ink); background: var(--paper-2); padding: 10px 14px; overflow: hidden; line-height: 1.05; word-break: break-word; }
.ff-sample { font: 600 .85rem var(--font); padding: 7px; border: 2px solid var(--ink); background: var(--paper-2); }
.ff-weights { display: flex; flex-wrap: wrap; gap: 4px; }
.ff-w { border: 2px solid var(--ink); background: var(--paper-2); font: 700 .72rem var(--font); padding: 5px 8px; cursor: pointer; }
.ff-w:hover { background: var(--yellow); }
.ff-w[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.ff-style-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ff-sizes { display: flex; flex-direction: column; gap: 6px; border-top: 2px dashed var(--ink); padding-top: 10px; }
.ff-size-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.15; }

/* expression engine modal */
.expr-help { font: 600 .76rem var(--font); color: var(--ink-mute); margin: 0 0 14px; }
.expr-mod { border: 2px solid var(--ink); margin-bottom: 10px; }
.expr-mod.off { opacity: .55; }
.expr-mod-head { display: flex; align-items: baseline; gap: 10px; padding: 8px 10px; background: var(--paper-2); border-bottom: 2px solid var(--ink); flex-wrap: wrap; }
.expr-mod-head b { font-size: .9rem; }
.expr-desc { font: 600 .68rem var(--font); color: var(--ink-mute); }
.expr-mod-body { padding: 9px 10px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.expr-sigs { display: flex; gap: 12px; flex-wrap: wrap; }
.expr-sig { font: 700 .76rem var(--font); }
.expr-amt { display: flex; align-items: center; gap: 7px; font: 800 .58rem var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-mute); margin-left: auto; }
.expr-amt-val { font-variant-numeric: tabular-nums; color: var(--ink-soft); }

/* ───────────────── art palette — a warm, chunky "paint box" drawer ───────────────── */
.artp { position: fixed; left: 0; right: 0; bottom: var(--hintbar-h); z-index: 70; transform: translateY(calc(100% - 22px)); transition: transform .29s var(--spring-solid); }
.artp.open { transform: translateY(0); }
/* a short squash on the panel as it lands, so the drawer reads as thunking solidly into place */
.artp.open .artp-panel { transform-origin: bottom center; animation: drawerThunk .26s ease-out .2s both; }
@keyframes drawerThunk { 0% { transform: scaleY(1); } 35% { transform: scaleY(1.018); } 70% { transform: scaleY(.995); } 100% { transform: scaleY(1); } }
/* wooden drawer-pull tab, centred, peeking up from the bottom */
.artp-tab { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 13px; padding: 22px 34px 17px; cursor: pointer; color: #2a1c0e; font-family: var(--black); font-size: 1.18rem; letter-spacing: .02em;
  background: linear-gradient(180deg, #d8b07a 0%, #c8974f 55%, #b5853c 100%);
  border: var(--bw) solid var(--ink); border-bottom: 0; border-radius: 15px 15px 0 0;
  box-shadow: -3px -6px 0 rgba(22,21,15,.22), inset 0 3px 0 rgba(255,255,255,.4); }
.artp-tab::before { content: ''; position: absolute; inset: 0; border-radius: 15px 15px 0 0; pointer-events: none;
  background: repeating-linear-gradient(92deg, rgba(90,55,15,0) 0 11px, rgba(90,55,15,.07) 11px 12px); }
.artp-tab::after { content: ''; position: absolute; top: 7px; left: 50%; transform: translateX(-50%); width: 56px; height: 6px; border-radius: 3px;
  background: rgba(40,25,8,.28); box-shadow: inset 0 1.5px 0 rgba(0,0,0,.3), 0 1px 0 rgba(255,255,255,.25); }
.artp-tab:hover { filter: brightness(1.06); }
.artp-tab svg, .artp-tab span { position: relative; }
.artp-tab svg { width: 30px; height: 30px; }
/* shortcut hint — a proper little 3D keyboard key (prominent shortcut style) */
.kbd3d { position: relative; display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; font: 800 .82rem var(--font); line-height: 1; color: #2a1c0e; background: linear-gradient(#fffdf7, #efe7d6); border: 2px solid #2a1c0e; border-radius: 6px; box-shadow: 0 3px 0 #2a1c0e; }
/* idle flash — two gentle pulses; the key "taps" in time with each pulse */
.artp.flash .artp-tab { animation: tabflash .55s ease 2; }
.artp.flash .artp-tab .kbd3d { animation: keytap .55s ease 2; }
@keyframes tabflash { 0%, 100% { filter: brightness(1); box-shadow: -3px -6px 0 rgba(22,21,15,.22), inset 0 3px 0 rgba(255,255,255,.4); } 50% { filter: brightness(1.18); box-shadow: -3px -10px 0 rgba(244,197,66,.5), inset 0 3px 0 rgba(255,255,255,.5); } }
@keyframes keytap { 0%, 100% { transform: translateY(0); box-shadow: 0 3px 0 #2a1c0e; } 45% { transform: translateY(3px); box-shadow: 0 0 0 #2a1c0e; } }
/* rounded-square shortcut style — subtle, used in the left toolbar */
.kbd-sq { display: inline-grid; place-items: center; min-width: 16px; height: 16px; padding: 0 3px; font: 700 .64rem var(--font); line-height: 1; color: var(--ink-soft); background: rgba(22,21,15,.07); border: 1px solid rgba(22,21,15,.18); border-radius: 4px; }

/* per-dynamic indicator chips (under the smooth indicator) */
.dyn-ind { position: absolute; top: 84px; right: 14px; z-index: 8; display: flex; flex-direction: column; align-items: flex-end; gap: 0; }
.dyn-chip { display: flex; align-items: center; gap: 6px; max-height: 44px; opacity: 1; overflow: hidden;
  transition: max-height .28s ease, opacity .22s ease, margin .28s ease; }
.dyn-chip.gone { max-height: 0; opacity: 0; pointer-events: none; }
.dyn-chip .dc-main { display: flex; align-items: center; gap: 6px; background: none; border: 0; cursor: pointer; color: var(--ink); padding: 4px 0; }
.dyn-chip .dc-ico { position: relative; width: 30px; height: 30px; display: grid; place-items: center; }
.dyn-chip .dc-ico > svg:not(.dc-ring) { width: 17px; height: 12px; }
.dyn-chip .dc-ring { position: absolute; inset: 0; width: 30px; height: 30px; transform: rotate(-90deg); }
.dyn-chip .dc-ring circle { fill: none; stroke-width: 2.4; }
.dyn-chip .dc-ring-track { stroke: rgba(22,21,15,.14); }
.dyn-chip .dc-ring-val { stroke: var(--ok); stroke-linecap: round; transition: stroke-dasharray .2s ease; }
.dyn-chip .dc-name { font-size: .58rem; font-weight: 700; letter-spacing: .06em; }
.dyn-chip .dc-switch { width: 26px; height: 14px; border: 1.5px solid var(--ink); border-radius: 8px; background: var(--ok); cursor: pointer; position: relative; padding: 0; }
.dyn-chip .dc-switch::after { content: ''; position: absolute; top: 1px; width: 9px; height: 9px; border-radius: 50%; background: var(--paper); border: 1px solid var(--ink); right: 1px; transition: right .15s ease; }
.dyn-chip .dc-switch[aria-checked="false"] { background: var(--paper-2); }
.dyn-chip .dc-switch[aria-checked="false"]::after { right: 13px; }

/* smoothing ask modal + dynamics header toggle + teach line */
.smooth-ask { max-width: 440px; }
.smooth-ask p { margin: 0; padding: 16px 18px 4px; line-height: 1.55; font-size: .92rem; }
.smooth-ask-again { display: flex; align-items: center; gap: 8px; font-size: .8rem; padding: 10px 18px 0; cursor: pointer; }
.smooth-ask-again input { width: 16px; height: 16px; accent-color: var(--accent); }
.smooth-ask-btns { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 18px 18px; }
.dyn-gaugedrive { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: .62rem; font-weight: 700; letter-spacing: .04em; opacity: .85; cursor: default; }
.dyn-gd-switch { width: 28px; height: 15px; border: 1.5px solid var(--ink); border-radius: 9px; background: var(--paper-2); cursor: pointer; position: relative; padding: 0; }
.dyn-gd-switch::after { content: ''; position: absolute; top: 1px; left: 1px; width: 9px; height: 9px; border-radius: 50%; background: var(--paper); border: 1px solid var(--ink); transition: left .15s ease; }
.dyn-gd-switch[aria-checked="true"] { background: var(--ok); }
.dyn-gd-switch[aria-checked="true"]::after { left: 14px; }
.dyn-teach { font-size: .66rem; opacity: .75; padding: 6px 2px 0; min-height: 1.2em; font-style: italic; }
.dyn-mico-label { display: block; font-size: .5rem; font-weight: 700; font-style: normal; letter-spacing: .05em; text-transform: uppercase; text-align: center; opacity: .7; margin-top: 1px; }
.dyn-help { width: 21px; height: 21px; border: 2px solid var(--ink); border-radius: 50%; background: var(--paper); color: var(--ink); font: 800 .68rem var(--font); cursor: help; padding: 0; line-height: 1; box-shadow: 1.5px 1.5px 0 var(--ink); }
.dyn-help:hover { background: var(--yellow); transform: translate(1px, 1px); box-shadow: .5px .5px 0 var(--ink); }

/* SMOOTH ON indicator (canvas top-right, unobtrusive) */
.smooth-ind { position: absolute; top: 12px; right: 14px; z-index: 8; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.smooth-ind[hidden] { display: none; }
.si-main { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: transparent; cursor: pointer; padding: 2px 4px; border-radius: 4px; opacity: .85; }
.si-main:hover { opacity: 1; background: rgba(22,21,15,.06); }
.smooth-ind svg { width: 40px; height: 16px; overflow: hidden; color: var(--ok); }
.smooth-ind .si-wave { animation: siwave 1.1s linear infinite; }
.smooth-ind.off { opacity: .45; filter: grayscale(1); }
.smooth-ind .si-clock { display: inline-flex; align-items: center; gap: 3px; margin-left: 5px; }
.smooth-ind .si-clock svg { width: 15px; height: 15px; transform: rotate(-90deg); overflow: visible; }
.smooth-ind .si-clock circle { fill: none; stroke-width: 2.4; }
.smooth-ind .si-clock-track { stroke: rgba(22,21,15,.16); }
.smooth-ind .si-clock-val { stroke: var(--ok); stroke-linecap: round; }
.smooth-ind .si-clock b { font-size: .55rem; font-weight: 700; }
.smooth-ind.off .si-wave { animation: none; }
@keyframes siwave { from { transform: translateX(0); } to { transform: translateX(-12px); } }
.si-main span { font: 800 .56rem var(--font); letter-spacing: .08em; color: var(--ink-soft); }
.si-switch { width: 30px; height: 17px; border: 2px solid var(--ink); border-radius: 10px; background: var(--ok); position: relative; cursor: pointer; padding: 0; transition: background .15s var(--spring-solid); }
.si-switch::after { content: ''; position: absolute; top: 1px; left: 1px; width: 11px; height: 11px; border-radius: 50%; background: #fff; transition: transform .2s var(--spring-solid); transform: translateX(13px); }
.si-switch[aria-checked="false"] { background: var(--paper-2); }
.si-switch[aria-checked="false"]::after { transform: translateX(0); background: var(--ink); }
.si-switch:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .smooth-ind .si-wave, .artp.flash .artp-tab, .artp.flash .artp-tab .kbd3d, .artp.open .artp-panel,
  .tool.justpicked, .tool:hover::after, .t-btn:hover::after { animation: none; }
  .tool, .t-btn, .tm-btn { transition: none; }
}

.artp-panel { background: #e7decb; border-top: var(--bw) solid var(--ink); box-shadow: inset 0 5px 0 rgba(255,255,255,.4); max-height: 54vh; overflow-y: auto; padding: 18px 24px 24px; }
.artp-grid { display: grid; grid-template-columns: 1.25fr 1fr 1.45fr; gap: 22px; max-width: 1520px; margin: 0 auto; align-items: start; }
@media (max-width: 1080px) { .artp-grid { grid-template-columns: 1fr 1fr; } .artp-col-dyn { grid-column: 1 / -1; } }
@media (max-width: 680px) { .artp-grid { grid-template-columns: 1fr; } }
.artp-col { display: flex; flex-direction: column; gap: 16px; }
.artp-sec { position: relative; background: var(--paper-2); border: var(--bw) solid var(--ink); border-radius: 5px; box-shadow: 4px 4px 0 var(--ink); padding: 15px 16px 16px; }
.artp-sec h4 { display: inline-block; font: 800 .62rem var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--paper); background: var(--ink); padding: 3px 10px; border-radius: 3px; margin: 0 0 13px; }
.artp-desc { font: 500 .72rem var(--font); color: var(--ink-soft); margin: -8px 0 12px; line-height: 1.35; }

/* chunky pressable buttons — raised, and they press IN when selected */
.artp-cat, .artp-sub, .artp-grade-btn { border: 2.5px solid var(--ink); border-radius: 4px; background: var(--paper); color: var(--ink); cursor: pointer; box-shadow: 3px 3px 0 var(--ink); transition: transform .05s ease, box-shadow .05s ease, background .1s; font-family: var(--font); }
.artp-cat:hover, .artp-sub:hover, .artp-grade-btn:hover { background: var(--yellow); }
.artp-cat:active, .artp-sub:active, .artp-grade-btn:active { transform: translate(3px,3px); box-shadow: 0 0 0 var(--ink); }
.artp-cat[aria-pressed="true"], .artp-sub[aria-pressed="true"], .artp-grade-btn[aria-pressed="true"] { background: var(--accent); color: #fff; transform: translate(3px,3px); box-shadow: inset 2.5px 2.5px 0 rgba(0,0,0,.3); }
.artp-cats { display: flex; gap: 9px; margin-bottom: 13px; }
.artp-cat { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 12px 4px 9px; }
.artp-cat svg { width: 28px; height: 28px; }
.artp-cat span { font: 800 .6rem var(--font); }
.artp-subs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 13px; }
.artp-sub { display: flex; align-items: center; gap: 7px; padding: 8px 12px; font: 800 .74rem var(--font); }
.artp-sub-glyph { font-size: 1.05rem; line-height: 1; }
.artp-grade { display: flex; align-items: center; gap: 8px; }
.artp-grade-lbl { font: 800 .58rem var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-mute); }
.artp-grade-btn { padding: 7px 12px; font: 800 .76rem var(--font); }

/* chunky sliders */
.artp-slider { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.artp-slider .opt-range { flex: 1; height: 12px; border: 2.5px solid var(--ink); background: var(--paper); border-radius: 3px; }
.artp-slider .opt-range::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 24px; background: var(--accent); border: 2.5px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); border-radius: 4px; }
.artp-slider .opt-range::-moz-range-thumb { width: 22px; height: 24px; background: var(--accent); border: 2.5px solid var(--ink); border-radius: 4px; }
.artp-val { font: 800 .8rem var(--font); color: var(--ink); min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.artp-slabel { font: 800 .56rem var(--font); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-mute); min-width: 54px; }
.jit-preview { width: 100%; height: auto; aspect-ratio: 320 / 60; background: #fff; border: 2.5px solid var(--ink); border-radius: 4px; box-shadow: 3px 3px 0 var(--ink); margin-bottom: 12px; display: block; }
.artp-toggle { display: inline-flex; align-items: center; gap: 9px; font: 800 .82rem var(--font); margin-bottom: 12px; cursor: pointer; }
.artp-toggle input { width: 18px; height: 18px; accent-color: var(--ok); }
.artp-swatches { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin-bottom: 12px; }
.artp-swatches .sw { aspect-ratio: 1; border: 2px solid var(--ink); border-radius: 3px; cursor: pointer; box-shadow: 1.5px 1.5px 0 rgba(22,21,15,.55); }
.artp-swatches .sw:hover { transform: translate(1px,1px); box-shadow: 0 0 0; }

/* dynamics rows (on the warm card) */
.dyn-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.dyn-ring { width: 32px; height: 32px; color: var(--accent); flex: none; }
.dyn-ring svg { width: 100%; height: 100%; }
.dyn-head-txt b { font: 800 .92rem var(--font); display: block; }
.dyn-head-txt small { font: 600 .68rem var(--font); color: var(--ink-soft); }
/* live preview canvas */
.dyn-preview { width: 100%; height: auto; aspect-ratio: 520 / 104; background: #fff; border: 2.5px solid var(--ink); border-radius: 4px; box-shadow: 3px 3px 0 var(--ink); margin-bottom: 12px; display: block; }
.dyn-colhead, .dyn-row { display: grid; grid-template-columns: 44px 32px 28px 28px 28px 0.65fr minmax(92px, 0.5fr) 20px 30px; align-items: center; gap: 9px; }
.dyn-colhead { margin-bottom: 8px; align-items: end; }
.dyn-colhead .dyn-spacer { grid-column: 1 / 3; }
/* descriptive animated column header */
.dyn-colh { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.dyn-colh-ic { width: 36px; height: 20px; color: var(--ink); }
.dyn-colh-ic svg { width: 100%; height: 100%; }
.dyn-colh-l { font: 800 .52rem var(--font); letter-spacing: .03em; text-transform: uppercase; color: var(--ink-mute); }
.dyn-col svg, .dyn-mico svg { width: 18px; height: 18px; }
.dyn-amt-lbl { font: 800 .56rem var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-mute); text-align: right; align-self: center; }
.dyn-row { padding: 8px 0; border-top: 2px dashed rgba(22,21,15,.14); }
/* fade the row when off — but NOT the lightswitch (you still need to see/flip it) */
.dyn-row.off .dyn-mico, .dyn-row.off .sag-check, .dyn-row.off .dyn-amt, .dyn-row.off .dyn-set, .dyn-row.off .dyn-cog { opacity: .35; filter: grayscale(1); pointer-events: none; }
.dyn-mico { width: 28px; height: 28px; color: var(--ink); display: grid; place-items: center; }
.dyn-mico svg { width: 26px; height: 26px; }
/* header animations */
.dyn-colh-ic .sh-speed, .dyn-colh-ic .sh-speed-dot { animation: shspeed 1.3s ease-in-out infinite; }
@keyframes shspeed { 0%,100% { transform: translateX(-3px); opacity: .5; } 50% { transform: translateX(3px); opacity: 1; } }
.dyn-colh-ic .sh-dir { animation: shdir 3s ease-in-out infinite; }
@keyframes shdir { 0% { transform: rotate(-55deg); } 50% { transform: rotate(55deg); } 100% { transform: rotate(-55deg); } }
.dyn-colh-ic .sh-cur { stroke-dasharray: 46; stroke-dashoffset: 46; animation: shcur 2.4s ease-in-out infinite; }
@keyframes shcur { 0% { stroke-dashoffset: 46; } 55% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .dyn-colh-ic * { animation: none !important; stroke-dashoffset: 0 !important; } }

/* ── standardised tick/x checkbox (site-wide) ── */
.sag-check { display: grid; place-items: center; cursor: pointer; }
.sag-check input { position: absolute; opacity: 0; pointer-events: none; }
.sag-check-box { width: 34px; height: 34px; border: 2.5px solid var(--ink); border-radius: 4px; background: var(--paper); display: grid; place-items: center; box-shadow: 2px 2px 0 var(--ink); transition: transform .05s, box-shadow .05s, background .1s; }
.sag-check-box::after { content: '✕'; font: 800 .92rem var(--font); color: var(--ink-mute); }
.sag-check:hover .sag-check-box { background: var(--yellow); }
.sag-check input:checked + .sag-check-box { background: var(--ok); border-color: var(--ink); transform: translate(2px,2px); box-shadow: inset 2px 2px 0 rgba(0,0,0,.28); }
.sag-check input:checked + .sag-check-box::after { content: '✓'; color: #fff; }

/* chunky lightswitch */
.dyn-switch { width: 40px; height: 22px; border-radius: 12px; border: 2.5px solid var(--ink); background: #d6cdba; position: relative; cursor: pointer; padding: 0; box-shadow: inset 1.5px 1.5px 0 rgba(0,0,0,.12); }
.dyn-switch span { position: absolute; top: 1.5px; left: 1.5px; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 1.5px solid var(--ink); transition: transform .16s ease; }
.dyn-switch[aria-checked="true"] { background: var(--ok); }
.dyn-switch[aria-checked="true"] span { transform: translateX(17px); }
.dyn-amt { width: 100%; height: 10px; border: 2.5px solid var(--ink); background: var(--paper); border-radius: 3px; }
.dyn-amt::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 18px; background: var(--accent); border: 2.5px solid var(--ink); box-shadow: 1.5px 1.5px 0 var(--ink); border-radius: 3px; }
.dyn-amt::-moz-range-thumb { width: 16px; height: 18px; background: var(--accent); border: 2.5px solid var(--ink); border-radius: 3px; }
/* per-module settings cog (opens the dynamics settings modal) */
.dyn-set { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dyn-set-l { font: 800 .5rem var(--font); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-mute); }
.dyn-set select.dyn-set-c { width: 100%; font: 700 .68rem var(--font); padding: 2px 3px; border: 2px solid var(--ink); border-radius: 3px; background: var(--paper); color: var(--ink); }
.dyn-set input.dyn-set-c { width: 100%; height: 8px; border: 2px solid var(--ink); background: var(--paper); border-radius: 3px; }
.dyn-set input.dyn-set-c::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 14px; background: var(--accent); border: 2px solid var(--ink); border-radius: 3px; }
.dyn-set input.dyn-set-c::-moz-range-thumb { width: 12px; height: 14px; background: var(--accent); border: 2px solid var(--ink); border-radius: 3px; }
.dyn-colh[data-sig] { cursor: help; border-radius: 4px; }
.dyn-colh[data-sig]:hover { background: rgba(244,197,66,.25); }
.dyn-cog { width: 28px; height: 28px; padding: 0; display: grid; place-items: center; color: var(--ink); background: var(--paper); border: 2.5px solid var(--ink); border-radius: 4px; box-shadow: 2px 2px 0 var(--ink); cursor: pointer; transition: transform .05s, box-shadow .05s, background .12s; }
.dyn-cog svg { width: 16px; height: 16px; }
.dyn-cog:hover { background: var(--yellow); }
.dyn-cog:active { transform: translate(2px,2px); box-shadow: inset 2px 2px 0 rgba(0,0,0,.22); }
.dyn-cog:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* dynamics settings modal rows: a labelled select / slider / switch per setting */
.dynset-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; padding: 12px 2px; border-bottom: 2px solid rgba(22,21,15,.12); }
.dynset-row:last-child { border-bottom: 0; }
.dynset-text { display: flex; flex-direction: column; gap: 3px; }
.dynset-text b { font: 800 .88rem var(--font); color: var(--ink); }
.dynset-text small { font: 500 .74rem var(--font); color: var(--ink-soft); }
.dynset-ctl { display: flex; align-items: center; gap: 9px; justify-self: end; }
.dynset-ctl select { font: 700 .8rem var(--font); padding: 6px 8px; border: 2.5px solid var(--ink); background: var(--paper-2); border-radius: 3px; cursor: pointer; }
.dynset-ctl .opt-range { width: 120px; }
.dynset-val { font: 800 .72rem var(--font); color: var(--ink-mute); min-width: 34px; text-align: right; }

/* cursor-centric radial control factory — two-ring pie (right-click) */
.bdisc { position: fixed; z-index: 90; width: 0; height: 0; }
.bdisc[hidden] { display: none; }
.pie-svg { position: absolute; left: 0; top: 0; width: 280px; height: 280px; transform: translate(-50%,-50%); overflow: visible; filter: drop-shadow(3px 4px 0 rgba(22,21,15,.28)); }
.pie-path { fill: var(--paper-2); stroke: var(--ink); stroke-width: 2; cursor: pointer; transition: fill .08s; }
.pie-sub .pie-path, .pie-col .pie-path { fill: var(--paper); }      /* outer ring a touch lighter — 2 colour layers */
.pie-seg:hover .pie-path { fill: var(--yellow); }
.pie-cat.on .pie-path, .pie-sub.on .pie-path, .pie-size.on .pie-path { fill: var(--accent); }
.pie-col .pie-path { stroke-width: 1.5; }
.pie-col:hover .pie-path { fill: inherit; stroke: var(--yellow); stroke-width: 3; }
.pie-factory .pie-path { fill: var(--ink); }
.pie-ico div { width: 24px; height: 24px; color: var(--ink); display: grid; place-items: center; pointer-events: none; }
.pie-ico div svg { width: 100%; height: 100%; }
.pie-cat.on .pie-ico div { color: #fff; }
.pie-txt { text-anchor: middle; dominant-baseline: central; font: 800 .82rem var(--font); pointer-events: none; }
.pie-cat.on .pie-txt, .pie-sub.on .pie-txt, .pie-size.on .pie-txt { fill: #fff; }
.pie-hub circle { cursor: grab; }
.pie-hub:active circle { cursor: grabbing; }
.pie-num { text-anchor: middle; dominant-baseline: central; font: 800 .74rem var(--font); fill: #fff; mix-blend-mode: difference; pointer-events: none; }

/* welcome tour */
.tour-card { width: min(540px, 96vw); position: relative; padding: 0; overflow: hidden; }
.tour-card .modal-x { position: absolute; top: 10px; right: 10px; z-index: 2; background: var(--paper-2); border: 2px solid var(--ink); border-radius: 3px; width: 26px; height: 26px; line-height: 1; }
.tour-vis { background: #fff; border-bottom: var(--bw) solid var(--ink); min-height: 140px; display: grid; place-items: center; padding: 22px; }
.tour-vis > * { max-width: 100%; }
.tour-big { font-size: 3.4rem; color: var(--accent); }
.tour-tools { display: flex; gap: 12px; }
.tour-tool { width: 30px; height: 30px; color: var(--ink); }
.tour-tool svg { width: 100%; height: 100%; }
.tour-media { display: flex; gap: 16px; }
.tour-cat { display: flex; flex-direction: column; align-items: center; gap: 5px; font: 800 .6rem var(--font); }
.tour-cat-ic { width: 32px; height: 32px; color: var(--ink); }
.tour-cat-ic svg { width: 100%; height: 100%; }
.tour-demo { width: 74%; }
.tour-demo svg { width: 100%; height: auto; display: block; }
.tour-demo-pie { width: auto; }
.tour-pie { width: 124px; height: 124px; }
.tour-body { padding: 16px 22px 6px; }
.tour-body h2 { font-family: var(--black); font-size: 1.15rem; margin: 0 0 8px; }
.tour-body p { font: 600 .88rem var(--font); line-height: 1.45; color: var(--ink-soft); margin: 0; }
.tour-foot { display: flex; align-items: center; justify-content: space-between; padding: 14px 22px; border-top: 2px dashed rgba(22,21,15,.18); }
.tour-dots { display: flex; gap: 7px; }
.tour-dot { width: 9px; height: 9px; border: 2px solid var(--ink); border-radius: 50%; }
.tour-dot.on { background: var(--accent); }
.tour-nav { display: flex; gap: 9px; }

/* art palette intro modal */
.intro-lead { font: 600 .88rem var(--font); margin: 0 0 14px; }
.intro-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
@media (max-width: 480px) { .intro-cards { grid-template-columns: 1fr; } }
.intro-card { border: 2.5px solid var(--ink); border-radius: 5px; background: var(--paper-2); box-shadow: 3px 3px 0 var(--ink); padding: 12px 13px 14px; }
.intro-card .intro-demo { background: #fff; border: 2px solid var(--ink); border-radius: 3px; margin-bottom: 10px; }
.intro-card .intro-demo svg { width: 100%; height: 64px; display: block; }
.intro-card b { font: 800 .92rem var(--font); display: block; margin-bottom: 4px; }
.intro-card p { font: 600 .74rem var(--font); color: var(--ink-soft); margin: 0; }
.intro-smooth { stroke-dasharray: 240; stroke-dashoffset: 240; animation: introdraw 2.8s ease-in-out infinite; }
@keyframes introdraw { 0% { stroke-dashoffset: 240; } 50% { stroke-dashoffset: 0; } 82% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 0; } }
.intro-dyn { transform-origin: center; animation: introdyn 3.2s ease-in-out infinite; }
@keyframes introdyn { 0% { fill: #c4513a; transform: scaleY(1); } 33% { fill: #3e8a6c; transform: scaleY(1.12); } 66% { fill: #f4c542; transform: scaleY(.9); } 100% { fill: #c4513a; transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .intro-smooth, .intro-dyn { animation: none; stroke-dashoffset: 0; } }

/* text editing overlay */
/* outline (not border) so the dashed frame adds zero layout offset — content sits exactly on the render */
.text-edit { position: absolute; z-index: 50; margin: 0; padding: 0; border: 0; outline: 1px dashed var(--accent); outline-offset: 0; background: transparent; color: inherit; overflow: hidden; white-space: pre; line-height: 1.2; resize: none; }

/* ── radial brush quick menu: one SVG wheel (right-click with Draw/Eraser) ── */
.qmenu { position: fixed; z-index: 160; width: 0; height: 0; }
.qmenu.open .qm-wheel { animation: qmenu-in .14s ease-out; }
@keyframes qmenu-in { from { transform: translate(-50%, -50%) scale(.82); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
/* the hub (size dial) sits ~42.7% down the wheel (viewBox -210..282) — anchor THAT on the
   cursor so the size dial opens centred under the pointer, not floating above it */
.qmenu .qm-wheel { position: absolute; left: 0; top: 0; transform: translate(-50%, -42.7%); width: 410px; height: 480px; overflow: visible; filter: drop-shadow(0 3px 0 rgba(22,21,15,.3)); }
.qm-wheel .qm-sector path, .qm-wheel .qm-sizechonk path { fill: var(--paper); stroke: var(--ink); stroke-width: 8; stroke-linejoin: round; transition: fill .09s ease; }
.qm-wheel .qm-sector.sel path, .qm-wheel .qm-sizechonk.sel path { fill: var(--yellow, #ffe01b); }
.qm-wheel .qm-ico { color: var(--ink); pointer-events: none; }
.qm-wheel .qm-label { font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-anchor: middle; fill: var(--ink); opacity: .8; pointer-events: none; transition: fill .09s ease; }
.qm-wheel .qm-sizenum { font-size: 11px; font-weight: 800; text-anchor: middle; fill: var(--ink); pointer-events: none; transition: fill .09s ease; }
.qm-wheel .qm-swatch path { stroke: var(--ink); stroke-width: 5; stroke-linejoin: round; }
.qm-wheel .qm-swatch.sel path { stroke-width: 8; }
.qm-wheel .qm-hub circle { fill: var(--paper); stroke: var(--ink); stroke-width: 8; }
.qm-wheel .qm-hub:hover circle { fill: var(--paper-2); }
.qm-wheel .qm-hub-gauge { fill: none !important; stroke-width: 6; stroke-linecap: round; pointer-events: none; }
.qm-wheel .qm-hubnum { font-size: 17px; font-weight: 800; text-anchor: middle; fill: var(--ink); pointer-events: none; }
.qm-wheel .qm-hubunit { font-size: 8px; text-anchor: middle; fill: var(--ink); opacity: .55; pointer-events: none; }
.qm-wheel.dialing .qm-sector, .qm-wheel.dialing .qm-sizechonk, .qm-wheel.dialing .qm-swatch, .qm-wheel.dialing .qm-toggle { pointer-events: none; }
.qm-wheel .qm-bar, .qm-wheel .qm-bar-link { fill: var(--paper); stroke: var(--ink); stroke-width: 8; stroke-linejoin: round; }
.qm-wheel .qm-bar-cog-glyph { font-size: 14px; text-anchor: middle; fill: var(--ink); }
.qm-wheel .qm-bar-cog:hover .qm-bar-cog-glyph { fill: var(--accent); }
.qm-wheel .qm-bar-title { font-size: 10px; font-weight: 800; letter-spacing: .14em; text-anchor: middle; fill: var(--ink); opacity: .65; }
.qm-wheel .qm-toggle-label { font-size: 9.5px; font-weight: 800; letter-spacing: .07em; text-anchor: middle; fill: var(--ink); }
.qm-wheel .qm-pill { fill: var(--paper-2); stroke: var(--ink); stroke-width: 2; }
.qm-wheel .qm-pill.on { fill: var(--ok); }
.qm-wheel .qm-knob { fill: var(--paper); stroke: var(--ink); stroke-width: 1.6; pointer-events: none; }

/* feature buttons (stamp + frame): colourful, parked at the toolbar's bottom */
.tool-sep-features { margin-top: auto; }
.tool.tool-feature svg { width: 21px; height: 21px; }
.tool.tool-feature .tool-emoji { font-size: 19px; line-height: 1; }

/* frame tool */
.frame-label-input { font: 600 .8rem var(--font); border: 2px solid var(--ink); border-radius: 3px; background: var(--paper); color: var(--ink); padding: 5px 8px; width: 150px; }

/* frame designer (band editor) */
.fr-preset-row { display: grid; gap: 4px; font: 800 .62rem var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-mute); }
.fr-preset { font: 700 .82rem var(--font); padding: 7px 8px; border: 2px solid var(--ink); border-radius: 4px; background: var(--paper-2); cursor: pointer; }
.fr-bands-head { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.fr-band-add { width: 26px; height: 26px; border: 2px solid var(--ink); border-radius: 6px; background: var(--yellow, #ffe01b); font: 800 1.1rem/1 var(--font); cursor: pointer; }
.fr-band-add:hover { transform: translateY(-1px); }
.fr-bands { display: grid; gap: 5px; max-height: 168px; overflow-y: auto; }
.fr-band { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 2px solid var(--ink); border-radius: 5px; background: var(--paper); cursor: pointer; }
.fr-band.sel { background: var(--yellow, #ffe01b); box-shadow: inset 0 0 0 1px var(--ink); }
.fr-band-dot { width: 16px; height: 16px; flex: none; border: 2px solid var(--ink); border-radius: 50%; }
.fr-band-info { flex: 1; font: 600 .72rem var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fr-band-info b { font-weight: 800; }
.fr-band-del { flex: none; width: 20px; height: 20px; border: 0; background: transparent; cursor: pointer; font-size: 1rem; line-height: 1; color: var(--ink-mute); }
.fr-band-del:hover { color: var(--accent); }
.fr-fields { display: grid; gap: 8px; margin-top: 8px; }
.fr-field-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.fr-preview-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.fr-preview { border: 2px solid var(--ink); border-radius: 4px; image-rendering: pixelated; background: #fff; }
.fr-preview-cap { font: 700 .62rem var(--font); color: var(--ink-mute); letter-spacing: .04em; }
.fr-band-ctl { display: grid; gap: 12px; margin-top: 12px; }
.fr-ctl { display: flex; align-items: center; gap: 8px; font: 800 .68rem var(--font); color: var(--ink-mute); }
.fr-ctl input[type=range] { flex: 1; }
.fr-ctl .fr-thick-val, .fr-ctl .fr-gap-val { min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.fr-ctl-lbl { min-width: 60px; }
.fr-patterns { display: flex; gap: 5px; flex-wrap: wrap; }
.fr-pat { font: 700 .64rem var(--font); padding: 5px 8px; border: 2px solid var(--ink); border-radius: 5px; background: var(--paper); cursor: pointer; }
.fr-pat[aria-pressed="true"] { background: var(--accent); color: #fff; }
.fr-colour { flex: 1; min-width: 0; }

/* stamp picker */
.stamp-card { width: min(560px, 95vw); }
.stamp-search { width: calc(100% - 36px); margin: 10px 18px 8px; padding: 8px 10px; font: 600 .85rem var(--font); border: 2px solid var(--ink); border-radius: 3px; background: var(--paper); color: var(--ink); }
.stamp-materials { display: flex; gap: 6px; padding: 0 18px 8px; flex-wrap: wrap; }
.stamp-mat { display: flex; align-items: center; gap: 7px; font: 800 .72rem var(--font); padding: 4px 9px 4px 4px; border: 2px solid var(--ink); border-radius: 8px; background: var(--paper); cursor: pointer;
  box-shadow: 2px 2px 0 rgba(22,21,15,.35); transition: transform .12s, box-shadow .12s; }
.stamp-mat:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 rgba(22,21,15,.35); }
.stamp-mat[aria-pressed="true"] { background: var(--yellow, #ffe01b); transform: translate(2px, 2px); box-shadow: 0 0 0 rgba(22,21,15,.35), inset 0 2px 3px rgba(0,0,0,.2); }
.stamp-mat-swatch { width: 26px; height: 26px; flex: none; border-radius: 5px; display: block; }
.stamp-mat-lbl { white-space: nowrap; }
.stamp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 4px; padding: 4px 18px 18px; max-height: 46vh; overflow-y: auto; }
.stamp-cell { font-size: 24px; line-height: 1; padding: 7px 0; background: var(--paper); border: 1.5px solid transparent; border-radius: 3px; cursor: pointer; }
.stamp-cell:hover { border-color: var(--ink); background: var(--paper-2); }
.stamp-empty { grid-column: 1 / -1; opacity: .6; font-size: .85rem; padding: 12px 2px; }
.stamp-current { font-size: .9rem; }
.stamp-editbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin: 0 0 8px; border: 2px solid var(--ink); border-radius: 8px; background: var(--yellow, #ffe01b); }
.stamp-editbar[hidden] { display: none; }
.stamp-edit-lbl { flex: 1; font: 700 .78rem var(--font); }
.stamp-edit-lbl b { font-size: 1.1rem; }
.stamp-edit-done { flex: none; font: 800 .74rem var(--font); padding: 5px 12px; border: 2px solid var(--ink); border-radius: 6px; background: var(--paper); cursor: pointer; }
.stamp-edit-done:hover { background: var(--paper-2); }

/* the app-standard tooltip (blocked actions etc.) */
.sag-tip { position: fixed; z-index: 320; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 3px; box-shadow: 2.5px 2.5px 0 var(--ink); font: 700 .74rem var(--font); padding: 5px 10px; pointer-events: none; opacity: 0; transform: translate(-50%, 4px); transition: opacity .14s ease, transform .14s ease; max-width: 260px; }
.sag-tip.show { opacity: 1; transform: translate(-50%, 0); }

/* WIP warning stripe under the menubar - hazard tape */
.wip-stripe { display: flex; justify-content: space-between; align-items: center; padding: 3px 14px; font: 800 .62rem var(--font); letter-spacing: .12em; color: #16150f;
  background: repeating-linear-gradient(-45deg, #ffe01b 0 18px, #16150f 18px 24px);
  border-bottom: 2px solid var(--ink); }
.wip-stripe span { background: #ffe01b; border: 1.5px solid #16150f; padding: 1px 8px; border-radius: 2px; }
.wip-stripe-modal { justify-content: center; border-bottom: 0; border-top: 2px solid var(--ink); margin-top: 4px; }

/* boot guard: hidden by default, app visible immediately (no welcome modal) */
.boot { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: var(--paper); }
.boot[hidden] { display: none; }
.boot-spin { width: 26px; height: 26px; border: 3px solid var(--ink); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── sparkles + slugs config modals ────────────────────────────────────── */
.sparkle-card { width: min(420px, 92vw); }
.sparkle-body { display: grid; gap: 10px; padding: 14px 18px; }
.sparkle-row { display: flex; gap: 6px; flex-wrap: wrap; }
.sparkle-opt { font: 700 .72rem var(--font); padding: 5px 10px; border: 2px solid var(--ink); border-radius: 3px; background: var(--paper); cursor: pointer; }
.sparkle-opt[aria-pressed="true"] { background: var(--yellow, #ffe01b); }
.sparkle-slider { display: flex; align-items: center; gap: 10px; font: 700 .72rem var(--font); }
.sparkle-slider input { flex: 1; accent-color: var(--ink); }
.sparkle-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 18px 16px; }
.slug-blurb { margin: 0; font: 500 .78rem/1.45 var(--font); opacity: .82; }
#sparkle-head-btn { border: 2px solid var(--ink); border-radius: 3px; background: var(--paper); font-size: 1rem;
  width: 32px; height: 30px; cursor: pointer; margin-left: 6px; }
#sparkle-head-btn.sparkle-pop { animation: sparkle-pop .5s cubic-bezier(.3,1.6,.5,1); }
@keyframes sparkle-pop { 0% { transform: scale(.4); } 55% { transform: scale(1.35) rotate(8deg); } 100% { transform: none; } }


/* ── COOL JUNK: the glittery drawer next to the art palette ───────────── */
.junk { position: fixed; left: 0; right: 0; bottom: var(--hintbar-h); z-index: 69; transform: translateY(calc(100% - 22px)); transition: transform .29s var(--spring-solid); pointer-events: none; }
.junk.open { transform: translateY(0); z-index: 71; }
.junk-tab, .junk-panel { pointer-events: auto; }
.junk-tab { position: absolute; bottom: 100%; left: min(calc(50% + 150px), calc(100vw - 470px)); display: flex; align-items: center; gap: 11px; padding: 18px 26px 14px; cursor: pointer; color: #2a1040; white-space: nowrap;
  font-family: var(--black); font-size: 1.02rem; letter-spacing: .02em; overflow: hidden;
  background: linear-gradient(115deg, #ffd34d, #f7b6e2, #9be8ff, #b9a7f5, #ffd34d);
  background-size: 320% 320%; animation: junk-glitz 7s linear infinite;
  border: var(--bw) solid var(--ink); border-bottom: 0; border-radius: 13px 13px 0 0; }
@keyframes junk-glitz { to { background-position: 320% 0; } }
.junk-tab-glitz { position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(circle 1.5px at 12% 30%, #fff 99%, transparent),
    radial-gradient(circle 1px at 30% 70%, #fff 99%, transparent),
    radial-gradient(circle 2px at 52% 22%, #fff 99%, transparent),
    radial-gradient(circle 1px at 68% 64%, #fff 99%, transparent),
    radial-gradient(circle 1.5px at 86% 38%, #fff 99%, transparent);
  animation: junk-twinkle 2.2s ease-in-out infinite alternate; }
@keyframes junk-twinkle { from { opacity: .35; } to { opacity: 1; } }
.junk-tab:hover { filter: brightness(1.07); }
.junk-tab span { position: relative; }
/* the drawer opens a FIXED distance - content scrolls inside, the panel never resizes */
.junk-panel { background: #e7decb; border-top: var(--bw) solid var(--ink); box-shadow: inset 0 5px 0 rgba(255,255,255,.4); height: 46vh; overflow: hidden; }

/* first meeting: just the four big chonky buttons, centred */
.junk-hello { display: none; }
.junk.hello .junk-hello { display: flex; gap: 22px; justify-content: center; align-items: center; height: 100%; padding: 0 20px; flex-wrap: wrap; overflow-y: auto; }
.junk.hello .junk-body { display: none; }
.junk-big { display: grid; justify-items: center; gap: 12px; width: 168px; padding: 26px 12px 20px; cursor: pointer;
  font: 800 .95rem var(--font); color: var(--ink);
  background: var(--junk-c, var(--paper)); border: 3px solid var(--ink); border-radius: 14px;
  box-shadow: 5px 6px 0 rgba(22,21,15,.4); transition: transform .14s, box-shadow .14s; }
.junk-big:hover { transform: translate(-2px, -2px); box-shadow: 7px 8px 0 rgba(22,21,15,.4); }
.junk-big:active { transform: translate(2px, 3px); box-shadow: 1px 1px 0 rgba(22,21,15,.4); }
.junk-big .junk-act-ico { font-size: 2.4rem; width: auto; }
.junk-big .junk-act-ico svg { width: 44px; height: 44px; }

/* everyday layout: horizontal tabs across the top, scrolling centred pane below */
.junk-body { display: flex; flex-direction: column; height: 100%; }
.junk-tabs { display: flex; justify-content: center; gap: 8px; padding: 10px 22px 0; border-bottom: var(--bw) solid var(--ink); background: #ddd2bb; flex: 0 0 auto; }
.junk-tabbtn { display: flex; align-items: center; gap: 8px; padding: 9px 16px; cursor: pointer; position: relative; top: 2px;
  font: 800 .82rem var(--font); color: var(--ink); background: var(--paper); border: 2px solid var(--ink); border-bottom: 0;
  border-radius: 9px 9px 0 0; box-shadow: 2px -1px 0 rgba(22,21,15,.16); transition: transform .12s, background .12s; }
.junk-tabbtn:hover { transform: translateY(-2px); }
.junk-tabbtn[aria-selected="true"] { background: var(--junk-c, var(--yellow, #ffe01b)); transform: translateY(0); top: 3px; box-shadow: 0 -2px 0 rgba(22,21,15,.25); }
.junk-tabbtn.disabled { opacity: .42; filter: grayscale(.7); cursor: not-allowed; }
.junk-tabbtn.disabled:hover { transform: none; }
.junk-big.disabled { opacity: .45; filter: grayscale(.7); cursor: not-allowed; }
.junk-big.disabled:hover { transform: none; box-shadow: 5px 6px 0 rgba(22,21,15,.4); }
.junk-soon { font: 800 .5rem var(--font); letter-spacing: .08em; text-transform: uppercase; background: var(--ink); color: var(--paper); padding: 1px 5px; border-radius: 8px; margin-left: 6px; }
.junk-tab-ico { font-size: 1.15rem; display: grid; place-items: center; }
.junk-tab-ico svg { width: 22px; height: 22px; }
.junk-tab-lbl { white-space: nowrap; }
.junk-sparkle-ico { display: inline-block; animation: junk-sparkle 1.7s ease-in-out infinite; }
@keyframes junk-sparkle { 0%,100% { transform: scale(1) rotate(0); opacity: .85; } 45% { transform: scale(1.25) rotate(18deg); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .junk-sparkle-ico { animation: none; } }
.junk-pane { overflow: hidden; padding: 16px 22px; flex: 1 1 auto; min-height: 0; box-sizing: border-box; }
.junk-inner { max-width: 920px; margin: 0 auto; height: 100%; display: grid; grid-template-columns: 240px 1fr; gap: 0 22px; align-items: start; }
.junk-inner .junk-sub { display: grid; gap: 8px; align-content: start; max-height: 100%; overflow-y: auto; padding-right: 4px; }
.junk-inner .junk-main { display: grid; gap: 10px; align-content: start; max-height: 100%; overflow-y: auto; min-height: 0; }
.junk-inner .junk-sub .stamp-materials { display: grid; gap: 8px; padding: 0; }
.junk-inner .junk-sub .stamp-mat { text-align: left; }
.junk-inner .stamp-search { width: 100%; box-sizing: border-box; margin: 0; }
.junk-inner .stamp-grid { grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 6px; padding: 4px 0 12px; max-height: none; overflow: visible; }
.junk-inner .stamp-cell { font-size: 34px; padding: 9px 0; }
.junk-inner .sparkle-foot { padding: 6px 0 2px; justify-content: flex-start; }
/* modals keep the stacked flow: the wrappers are transparent there */
.modal .junk-sub, .modal .junk-main { display: block; }

/* the parked junk shortcut: sits right under the last tool icon, after a separator, loud on purpose */
.tool-sep.junk-shortcut-sep { margin: 4px 0; }
.tool.junk-shortcut { background: var(--junk-c, var(--yellow, #ffe01b)); color: var(--ink); font-size: 1.25rem; }
.tool.junk-shortcut.pop { animation: junk-shortcut-pop .42s var(--spring-solid); }
@keyframes junk-shortcut-pop { 0% { transform: scale(.4) translateY(-6px); opacity: 0; } 60% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
.tool.junk-shortcut:hover { filter: brightness(1.08); }

/* new layer rows pop in - same energy as the selection box landing */
.layer.born { animation: layer-born-pop .45s var(--spring-solid); }
@keyframes layer-born-pop {
  0% { transform: scale(.72); box-shadow: 0 0 0 3px var(--yellow, #ffe01b); }
  60% { transform: scale(1.05); }
  100% { transform: none; box-shadow: none; }
}

/* sparkles vs glitter: labelled sections + a live preview run through the real engine */
.sparkle-h { margin: 4px 0 0; font: 800 .8rem var(--font); letter-spacing: .03em; }
.sparkle-h small { font: 600 .72rem var(--font); opacity: .65; }
.sparkle-preview { width: 100%; max-width: 360px; height: 84px; border: 2px solid var(--ink); border-radius: 6px; background: #221e2e; }
.slug-one { border-top: 2px dashed rgba(22,21,15,.3); margin-top: 8px; padding-top: 10px; display: grid; gap: 8px; }
.slug-one h5 { margin: 0; font: 800 .8rem var(--font); }

/* the standard colour strip (shared: art palette, frame designer, ...) */
.colour-row { display: grid; gap: 8px; }
.cr-swatches { display: grid; grid-template-columns: repeat(10, 22px); gap: 4px; }
.cr-swatches .sw, .cr-recent .sw { width: 22px; height: 22px; border-radius: 3px; }
.cr-label { font: 800 .62rem var(--font); letter-spacing: .06em; opacity: .6; text-transform: uppercase; display: block; margin-bottom: 3px; }
.cr-recent { display: flex; gap: 4px; flex-wrap: wrap; min-height: 22px; }
.cr-factory { justify-self: start; }
.frame-colour { padding: 10px 0 4px; }

/* meme maker */
.meme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; padding: 4px 0 12px; }
.meme-cell { display: grid; gap: 4px; padding: 6px; background: var(--paper); border: 2px solid var(--ink); border-radius: 6px; cursor: pointer;
  box-shadow: 2px 2px 0 rgba(22,21,15,.3); transition: transform .12s, box-shadow .12s; }
.meme-cell:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 rgba(22,21,15,.3); }
.meme-cell img { width: 100%; height: 76px; object-fit: cover; border-radius: 3px; }
.meme-cell span { font: 700 .62rem/1.25 var(--font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meme-cap input { flex: 1; padding: 7px 9px; font: 600 .8rem var(--font); border: 2px solid var(--ink); border-radius: 3px; background: var(--paper); }

/* layer "+" type menu */
.layer-type-menu { z-index: 120; display: grid; min-width: 150px;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 6px; box-shadow: 4px 4px 0 rgba(22,21,15,.4); overflow: hidden; }
.layer-type-menu button { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border: 0; background: none;
  font: 700 .78rem var(--font); color: var(--ink); cursor: pointer; text-align: left; }
.layer-type-menu button:hover { background: var(--yellow, #ffe01b); }
.ltm-kbd { margin-left: auto; opacity: .5; font: 700 .68rem var(--font); border: 1.5px solid currentColor; border-radius: 3px; padding: 0 4px; }
.ltm-ico { width: 20px; text-align: center; }

/* hello tiles: emoji and svg icons share a baseline */
.junk-big .junk-act-ico { height: 48px; display: grid; place-items: center; }
