:root {
  --bg: #0e1012;
  --bg-2: #13161a;
  --panel: #191c21;
  --panel-2: #20242a;
  --line: #2a2f37;
  --line-2: #363c46;
  --fg: #eef1f4;
  --muted: #9ba3ad;
  --faint: #6a727d;
  --accent: #22b892;
  --accent-2: #52dcb6;
  --accent-ink: #04221a;
  --accent-soft: rgba(34, 184, 146, 0.14);
  --good: #5bd48a;
  --warn: #f2b35e;
  --bad: #ff8a80;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 12px 32px rgba(0, 0, 0, 0.35);
  --check-a: #1a1d22;
  --check-b: #15181c;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f5f6;
    --bg-2: #eceff1;
    --panel: #ffffff;
    --panel-2: #f6f8f9;
    --line: #e0e4e8;
    --line-2: #cfd5db;
    --fg: #181c20;
    --muted: #5a636d;
    --faint: #939ba5;
    --accent: #0f9a78;
    --accent-2: #15ad88;
    --accent-ink: #ffffff;
    --accent-soft: rgba(15, 154, 120, 0.1);
    --good: #1b8a4b;
    --warn: #b76b0b;
    --bad: #b3261e;
    --shadow: 0 1px 2px rgba(10, 20, 30, 0.05), 0 10px 28px rgba(10, 20, 30, 0.07);
    --check-a: #e6eaed;
    --check-b: #dde2e6;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f3f5f6; --bg-2: #eceff1; --panel: #ffffff; --panel-2: #f6f8f9; --line: #e0e4e8; --line-2: #cfd5db;
  --fg: #181c20; --muted: #5a636d; --faint: #939ba5; --accent: #0f9a78; --accent-2: #15ad88; --accent-ink: #ffffff;
  --accent-soft: rgba(15, 154, 120, 0.1); --good: #1b8a4b; --warn: #b76b0b; --bad: #b3261e; --check-a: #e6eaed; --check-b: #dde2e6;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 70% -10%, var(--accent-soft), transparent 60%), var(--bg);
  color: var(--fg);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--accent-2); }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg .fill { fill: currentColor; stroke: none; }
kbd {
  font: 11px/1 ui-monospace, SFMono-Regular, Consolas, monospace; padding: 2px 5px; border-radius: 5px;
  border: 1px solid var(--line-2); border-bottom-width: 2px; background: var(--panel-2); color: var(--muted);
}

/* ------------------------------------------------------------------ layout: one screen */
.app {
  height: 100dvh;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
}
.rail {
  display: flex; flex-direction: column; gap: 16px; min-height: 0; overflow-y: auto; padding: 16px 6px 16px 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  /* the gutter is always reserved, so the controls keep their width when a scrollbar appears */
  scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: transparent transparent;
}
.rail:hover, .rail:focus-within { scrollbar-color: var(--line-2) transparent; }
.rail::-webkit-scrollbar { width: 10px; }
.rail::-webkit-scrollbar-thumb { background: transparent; border-radius: 99px; border: 3px solid var(--panel); }
.rail:hover::-webkit-scrollbar-thumb { background: var(--line-2); }
.stage {
  display: flex; flex-direction: column; gap: 10px; min-height: 0; min-width: 0; padding: 10px; container-type: inline-size;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ------------------------------------------------------------------ app header (top of the rail) */
.rail-head {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding-bottom: 12px; margin-bottom: -4px; border-bottom: 1px solid var(--line);
}
.logo {
  width: 30px; height: 30px; border-radius: 9px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 7px; flex: none;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
}
.logo i { background: var(--accent-ink); border-radius: 1px; }
.logo i:nth-child(2), .logo i:nth-child(3) { opacity: 0.45; }
.brand-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.name b { font-weight: 700; color: var(--accent-2); }
.status { display: flex; align-items: center; gap: 6px; color: var(--faint); font-size: 11px; min-width: 0; }
.status span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status .dot { width: 6px; height: 6px; }
.icon-btn.small { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn.small svg { width: 16px; height: 16px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 20%, transparent); }
.dot.busy { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.dot.err { background: var(--bad); }
@keyframes pulse { 50% { opacity: 0.35; } }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; flex: none;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted); padding: 0; text-decoration: none;
}
.icon-btn:hover:not(:disabled) { color: var(--fg); border-color: var(--line-2); }
.icon-btn.soft { background: var(--panel-2); }
.icon-btn[aria-pressed="true"] { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: var(--accent-soft); }

/* ------------------------------------------------------------------ shared controls */
.label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hint { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.hint.warn { color: var(--warn); }
.help { margin: 0; font-size: 12px; color: var(--faint); }
.link { background: none; border: 0; padding: 0; color: var(--accent-2); font-size: 12px; align-self: flex-start; }
.link:hover { text-decoration: underline; }

input, select {
  font: inherit; color: inherit; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px 10px; width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select {
  -webkit-appearance: none; appearance: none; padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ba3ad' 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 8px center; background-size: 14px;
}
select option { background: var(--panel); color: var(--fg); }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; padding: 0; background: transparent; border: 0; }
input[type="range"]:focus { box-shadow: none; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 99px; background: var(--line-2); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 99px; background: var(--line-2); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: var(--accent); border: 2px solid var(--panel); }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--panel); }
input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type="range"]:disabled { opacity: 0.4; }

.primary {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  padding: 13px 16px; border: 0; border-radius: 12px; font-weight: 700; font-size: 15px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: var(--accent-ink);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform 0.08s, filter 0.15s;
}
.primary:hover:not(:disabled) { filter: brightness(1.06); }
.primary:active:not(:disabled) { transform: translateY(1px); }
.primary.wide { width: auto; min-width: 240px; }
.ghost { background: transparent; border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 14px; color: var(--fg); }

/* segmented control */
.seg { display: flex; padding: 3px; gap: 3px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.seg button {
  flex: 1 1 0; min-width: 0; padding: 4px 2px; border: 0; border-radius: 7px; background: transparent; color: var(--muted);
  font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.seg button[aria-checked="true"] { background: var(--panel-2); color: var(--fg); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); font-weight: 600; }
.seg button:hover:not([aria-checked="true"]):not(:disabled) { color: var(--fg); }

/* pill toggles */
.pill {
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-2);
  background: transparent; color: var(--faint); letter-spacing: 0.01em; white-space: nowrap;
}
.pill[aria-pressed="true"] { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: var(--accent-soft); }
.pill:hover { color: var(--fg); }

.check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { width: 15px; height: 15px; margin: 2px 0 0; padding: 0; accent-color: var(--accent); flex: none; }
.check small { display: block; font-size: 11px; color: var(--faint); }

/* ------------------------------------------------------------------ rail */
.group { display: flex; flex-direction: column; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; }


.dims { display: flex; flex-direction: column; gap: 4px; }
.slider { display: grid; grid-template-columns: 14px minmax(0, 1fr) 52px; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.slider > span { text-align: center; }
.slider.wide { grid-template-columns: 52px minmax(0, 1fr) 34px; }
.slider.wide > span { text-align: left; }
.slider output { font-variant-numeric: tabular-nums; text-align: right; color: var(--fg); font-size: 12px; }
.slider .num { padding: 3px 6px; font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; border-radius: 7px; }

.modes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.modes button {
  padding: 6px 4px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-2); color: var(--muted);
  font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.modes button:first-child { grid-column: span 2; }
.modes button:hover { color: var(--fg); border-color: var(--line-2); }
.modes button[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--fg); font-weight: 600; }

.palette-opts { display: flex; flex-direction: column; gap: 8px; }
.palette-opts.off { display: none; }

.advanced { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; flex: none; }
.advanced summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.advanced[open] summary { margin-bottom: 12px; }
.adv-body { display: flex; flex-direction: column; gap: 14px; }

.go-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; margin: auto 0 -16px; padding: 10px 0 16px; flex: none;
  position: sticky; bottom: -16px; z-index: 1;
  background: linear-gradient(to bottom, transparent, var(--panel) 10px);
}
.go-row .primary { height: 46px; gap: 8px; padding: 0 14px; }
.go-sub { font-size: 12px; font-weight: 500; opacity: 0.75; }
.go-sub::before { content: "· "; }
.go-sub:empty { display: none; }
.go-row .live { width: 46px; height: 46px; }

/* ------------------------------------------------------------------ stage: viewer */
.viewer-bar { display: flex; align-items: center; gap: 8px; flex: none; min-width: 0; flex-wrap: wrap; }
.open-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; max-width: 220px; padding: 0 10px; flex: 0 1 auto; min-width: 0;
  border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--fg); font-size: 12px;
}
.open-btn:hover { border-color: var(--accent); }
.open-btn svg { width: 15px; height: 15px; flex: none; color: var(--accent-2); }
.open-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.views { width: 260px; }
.steps { flex: 0 1 380px; min-width: 0; }
.zoom { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.zoom .icon-btn { width: 32px; height: 32px; }
.zoom-level {
  min-width: 56px; height: 32px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--fg);
  font-size: 12px; font-variant-numeric: tabular-nums; padding: 0 8px;
}

.canvas-box {
  position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; border-radius: var(--radius-sm);
  background-color: var(--check-b);
  background-image: conic-gradient(var(--check-a) 25%, transparent 0 50%, var(--check-a) 0 75%, transparent 0);
  background-size: 24px 24px;
  touch-action: none;
}
.canvas-box.has-image { cursor: grab; }
.canvas-box.dragging { cursor: grabbing; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.compare-handle {
  position: absolute; top: 0; bottom: 0; width: 24px; margin-left: -12px; cursor: ew-resize; display: flex; justify-content: center;
}
.compare-handle::before { content: ""; width: 2px; height: 100%; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); }
.compare-handle span {
  position: absolute; top: 50%; width: 30px; height: 30px; margin-top: -15px; border-radius: 50%; background: #fff; color: #222;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); display: grid; place-items: center;
}
.compare-handle span::before { content: "⟷"; font-size: 15px; }
.compare-tags { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; pointer-events: none; }
.compare-tags span {
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; color: #fff; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(6px);
}

.panel-center {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 32px; text-align: center; overflow-y: auto; background: var(--bg-2);
}
.panel-center h1 { margin: 0; font-size: 24px; letter-spacing: -0.02em; }
.lead { margin: 0; max-width: 520px; color: var(--muted); }
.empty-art { width: 132px; height: 104px; color: var(--accent-2); }
.empty-art svg { width: 100%; height: 100%; stroke-width: 1.6; stroke-linecap: square; stroke-linejoin: miter; }
.empty-art .frame { stroke: var(--line-2); stroke-linejoin: round; }
.empty-art .hill { fill: var(--accent-soft); stroke: color-mix(in srgb, var(--accent) 60%, transparent); }
.empty-art .spark { stroke: var(--accent-2); stroke-linecap: round; }
.samples { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.samples:not(:empty)::before { content: "Try a sample"; width: 100%; font-size: 12px; color: var(--faint); }
.sample {
  width: 96px; height: 72px; padding: 0; border-radius: 10px; overflow: hidden; border: 2px solid var(--line); background: var(--panel-2);
}
.sample:hover { border-color: var(--accent); }
.sample img { width: 100%; height: 100%; object-fit: cover; display: block; image-rendering: pixelated; }

.drop-hint {
  position: absolute; inset: 8px; z-index: 3; display: grid; place-items: center; border-radius: var(--radius-sm);
  border: 2px dashed var(--accent); background: color-mix(in srgb, var(--bg-2) 80%, transparent); backdrop-filter: blur(4px);
  pointer-events: none;
}
.drop-hint span { font-size: 18px; font-weight: 700; color: var(--accent-2); }

.bar-progress { width: 100%; height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar-progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width 0.25s; }
.progress-card {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); width: min(380px, calc(100% - 40px)); z-index: 2;
  display: flex; flex-direction: column; gap: 8px; padding: 10px 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: blur(10px);
  border: 1px solid var(--line); font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; box-shadow: var(--shadow);
}
.error-card {
  position: absolute; left: 50%; top: 20px; transform: translateX(-50%); max-width: calc(100% - 40px); z-index: 2;
  padding: 10px 14px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--bad) 50%, transparent);
  background: var(--panel); color: var(--bad); font-size: 13px;
}

/* ------------------------------------------------------------------ stage: info line + palette */
.stage-foot { flex: none; display: flex; flex-direction: column; gap: 6px; }
.info { display: flex; align-items: center; gap: 12px; min-height: 32px; min-width: 0; padding: 0 2px 0 4px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.info .meta { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info .meta b { font-weight: 600; color: var(--fg); }
.info .meta .sep { color: var(--faint); margin: 0 6px; }
.info .actions { flex: none; display: flex; gap: 6px; }
.info .actions button {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--fg); font-size: 12px; white-space: nowrap;
}
.info .actions button:hover:not(:disabled) { border-color: var(--line-2); }
.info .actions button.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.info .actions button.accent:hover:not(:disabled) { filter: brightness(1.06); }
.info .actions svg { width: 14px; height: 14px; }
.info .scale { width: auto; height: 32px; padding: 0 26px 0 10px; font-size: 12px; border-radius: 8px; }
@container (max-width: 560px) { .info .actions span { display: none; } .info .actions button { padding: 0 9px; } }

.info .meta .src { color: var(--fg); }

/* pictures of the session + batch actions */
.batch-row { display: flex; align-items: center; gap: 12px; height: 60px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.strip {
  flex: 1 1 auto; min-width: 0; height: 100%; display: flex; align-items: center; gap: 6px; overflow-x: auto; overflow-y: hidden;
  padding: 0 2px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.tile { position: relative; flex: none; width: 48px; height: 48px; }
.tile-pick {
  width: 100%; height: 100%; padding: 0; border-radius: 9px; overflow: hidden; border: 2px solid transparent; background: var(--bg-2);
}
.tile-pick canvas { width: 100%; height: 100%; display: block; }
.tile-pick[aria-current="true"] { border-color: var(--accent); }
.tile-pick:hover:not([aria-current="true"]) { border-color: var(--line-2); }
.tile:not(.done):not(.running) .tile-pick:not([aria-current="true"]) canvas { opacity: 0.55; }
.tile .badge {
  position: absolute; right: -3px; bottom: -3px; width: 17px; height: 17px; border-radius: 50%; display: none; place-items: center;
  font-size: 11px; font-weight: 800; pointer-events: none; border: 2px solid var(--panel);
}
.tile.done .badge { display: grid; background: var(--good); color: var(--panel); }
.tile.failed .badge { display: grid; background: var(--bad); color: var(--panel); }
.tile .badge svg { width: 10px; height: 10px; stroke-width: 3.2; }
.tile.running .tile-pick::after {
  content: ""; position: absolute; inset: 12px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.35); border-top-color: #fff;
  animation: spin 0.9s linear infinite;
}
.tile.running .tile-pick { position: relative; }
.tile .x {
  position: absolute; top: -5px; right: -5px; width: 18px; height: 18px; padding: 0; border-radius: 50%; display: none; place-items: center;
  border: 1px solid var(--line-2); background: var(--panel); color: var(--muted); font-size: 13px; line-height: 1;
}
.tile:hover .x, .tile .x:focus-visible { display: grid; }
.tile .x:hover { color: var(--bad); border-color: var(--bad); }
.tile.add {
  display: grid; place-items: center; padding: 0; border-radius: 9px; border: 1.5px dashed var(--line-2); background: transparent; color: var(--muted);
}
.tile.add:hover:not(:disabled) { color: var(--accent-2); border-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

.batch-actions { flex: none; display: flex; align-items: center; gap: 6px; }
.batch-status { display: flex; flex-direction: column; gap: 5px; width: 92px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.batch-status .bar-progress { height: 4px; }
.batch-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--fg); font-size: 12px; white-space: nowrap;
}
.batch-btn:hover:not(:disabled) { border-color: var(--line-2); }
.batch-btn svg { width: 14px; height: 14px; }
.batch-btn.stop { color: var(--bad); }
.batch-btn.stop svg { width: 12px; height: 12px; }
@container (max-width: 640px) { .batch-status { display: none; } .batch-btn span { display: none; } .batch-btn { padding: 0 9px; } }

.swatches { display: flex; flex-wrap: wrap; gap: 3px; padding: 0 4px; }
.swatches:empty { display: none; }
.swatches button {
  width: 18px; height: 18px; padding: 0; border-radius: 4px; border: 1px solid color-mix(in srgb, var(--fg) 15%, transparent);
}
.swatches button:hover { transform: scale(1.25); }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 30; padding: 8px 14px; border-radius: 10px;
  background: var(--fg); color: var(--bg); font-size: 13px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  animation: toastIn 0.18s ease-out;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 6px); } }

/* ------------------------------------------------------------------ about dialog */
dialog {
  border: 1px solid var(--line); border-radius: 18px; padding: 0; background: var(--panel); color: var(--fg);
  width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
dialog::backdrop { background: rgba(6, 8, 10, 0.6); backdrop-filter: blur(3px); }
.dialog { display: flex; flex-direction: column; gap: 14px; padding: 20px 22px 22px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; }
.dialog-head h2 { margin: 0; font-size: 18px; }
.dialog .lead { max-width: none; }
.steps-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 13px; }
.steps-list b { color: var(--fg); }
.dialog .help { line-height: 1.7; }

/* ------------------------------------------------------------------ small screens: stack and scroll */
@media (max-width: 900px) {
  .app { height: auto; min-height: 100dvh; grid-template-columns: 1fr; grid-template-rows: auto auto; gap: 12px; padding: 12px; }
  .stage { order: -1; }
  .canvas-box { min-height: 60vh; }
  .rail { overflow: visible; }
  .go-row { position: static; margin: 4px 0 0; padding: 0; background: none; }
  .rail { padding: 16px; scrollbar-gutter: auto; }
  .views { width: 100%; }
  .steps { flex-basis: 100%; }
}
@media (max-height: 760px) and (min-width: 901px) {
  .rail { padding: 12px 2px 12px 12px; gap: 12px; }
  .go-row { margin-bottom: -12px; padding-bottom: 12px; bottom: -12px; }
  .rail .help { display: none; }
}
