:root {
  --bg: #141514;
  --panel: #1d1f1e;
  --panel-2: #242725;
  --field: #111312;
  --text: #f2f3ef;
  --muted: #a6aaa5;
  --border: #373b38;
  --accent: #d7bb69;
  --accent-strong: #f2d778;
  --accent-ink: #17150d;
  --danger: #d66f6f;
  --success: #83c898;
  --warning: #d9a65c;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0,0,0,.22);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; min-height: 100%; background: var(--bg); }
body { height: 100%; margin: 0; min-width: 320px; overflow: hidden; background: radial-gradient(circle at 15% -10%, rgba(215,187,105,.10), transparent 36%), var(--bg); }
button, input, select { font: inherit; }
button { color: inherit; }

.topbar {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 10px;
  background: #0c0c11;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-brand,
.topbar-status {
  display: flex;
  align-items: center;
  min-width: 0;
}

.topbar-brand { gap: 9px; }
.topbar-status { gap: 8px; justify-content: flex-end; }
.brand-kicker {
  color: var(--accent);
  font-size: .58rem;
  font-weight: 850;
  letter-spacing: .14em;
  white-space: nowrap;
}
.topbar h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.42rem;
  font-weight: 500;
  letter-spacing: -.025em;
  white-space: nowrap;
}
.topbar-subtitle {
  padding-left: 9px;
  border-left: 1px solid var(--border);
  color: var(--muted);
  font-size: .76rem;
  white-space: nowrap;
}

.step-label {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: .73rem;
  font-weight: 800;
  letter-spacing: .16em;
}

h2 { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Helvetica, Arial, sans-serif; font-size: 1.38rem; font-weight: 500; }
h3 { margin: 0 0 14px; font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.privacy-note { color: var(--muted); font-size: .72rem; white-space: nowrap; }

.badge, .batch-state {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 750;
  letter-spacing: .02em;
}
.badge-waiting { color: var(--warning); }
.badge-ready { color: var(--success); border-color: rgba(131,200,152,.4); background: rgba(131,200,152,.08); }
.badge-fallback { color: var(--warning); border-color: rgba(217,166,92,.4); background: rgba(217,166,92,.08); }
.badge-error { color: var(--danger); }

.app-shell {
  display: grid;
  grid-template-columns: minmax(350px, 430px) minmax(0, 1fr);
  gap: 14px;
  height: calc(100vh - 48px);
  padding: 10px clamp(10px, 2vw, 24px);
  overflow: hidden;
  max-width: 1680px;
  margin: 0 auto;
}
.sidebar {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  min-height: 0;
  height: 100%;
  position: static;
  align-self: stretch;
}
.workspace {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  padding-right: 3px;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}
.workspace > .panel {
  flex: 0 0 auto;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  align-self: start;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #111312;
}
.sidebar-nav-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 62px;
  padding: 7px 3px;
  border: 0;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: .63rem;
  font-weight: 760;
}
.sidebar-nav-button:last-child { border-bottom: 0; }
.sidebar-nav-button svg { width: 21px; height: 21px; fill: currentColor; }
.sidebar-nav-button:hover { color: var(--text); background: rgba(255,255,255,.035); }
.sidebar-nav-button.is-active { color: var(--accent); background: rgba(215,187,105,.09); box-shadow: inset 3px 0 0 var(--accent); }
.sidebar-nav-button:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: -3px; }
.sidebar-panels {
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: none;
  overflow-y: auto;
  padding-right: 3px;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}
.sidebar-panel[hidden] { display: none; }

.panel { border: 1px solid var(--border); border-radius: var(--radius); background: linear-gradient(180deg, rgba(255,255,255,.012), transparent 120px), var(--panel); box-shadow: var(--shadow); }
.import-panel, .settings-panel, .preview-panel, .batch-panel { padding: 16px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 16px; }

.button {
  border: 1px solid transparent;
  border-radius: 10px;
  min-height: 40px;
  padding: 9px 14px;
  font-weight: 760;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .15s ease, opacity .15s ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:focus-visible, input:focus-visible, select:focus-visible, .drop-zone:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }
.button:disabled { opacity: .36; cursor: not-allowed; }
.button-primary { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.button-primary:hover:not(:disabled) { background: var(--accent-strong); }
.button-secondary { background: var(--panel-2); border-color: var(--border); }
.button-secondary:hover:not(:disabled), .button-ghost:hover:not(:disabled) { border-color: var(--accent); }
.button-ghost { background: transparent; border-color: var(--border); }
.button-danger { color: #ffdada; background: rgba(214,111,111,.12); border-color: rgba(214,111,111,.55); }
.button-small { min-height: 34px; padding: 6px 10px; font-size: .82rem; }
.button-large { min-height: 48px; padding-inline: 20px; }

.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 190px;
  border: 1px dashed #555b57;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  background: rgba(0,0,0,.12);
  transition: border-color .16s ease, background .16s ease;
}
.drop-zone.is-dragging { border-color: var(--accent); background: rgba(215,187,105,.08); }
.drop-zone > span { color: var(--muted); font-size: .84rem; }
.drop-icon { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 50%; color: var(--accent); font-size: 1.55rem; background: var(--panel-2); }
.drop-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; justify-content: center; }
.queue-summary { display: flex; justify-content: space-between; gap: 10px; padding: 13px 2px 9px; color: var(--muted); font-size: .78rem; }
.queue-summary strong { color: var(--text); }
.queue-list { max-height: 344px; overflow: auto; border-top: 1px solid var(--border); }
.empty-queue { padding: 22px 8px; text-align: center; color: var(--muted); font-size: .84rem; }
.queue-item { display: grid; grid-template-columns: minmax(0,1fr) 30px; align-items: stretch; border-bottom: 1px solid var(--border); background: transparent; }
.queue-item:hover, .queue-item.is-selected { background: rgba(215,187,105,.07); }
.queue-select { display: grid; grid-template-columns: 46px minmax(0,1fr) auto; align-items: center; gap: 10px; min-width: 0; padding: 9px 4px; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.queue-delete { align-self: center; display: grid; place-items: center; width: 27px; height: 27px; margin-right: 2px; border: 1px solid transparent; border-radius: 7px; color: var(--muted); background: transparent; cursor: pointer; font-size: 1.05rem; line-height: 1; }
.queue-delete:hover:not(:disabled) { color: #ffdada; border-color: rgba(214,111,111,.5); background: rgba(214,111,111,.1); }
.queue-delete:disabled { opacity: .3; cursor: not-allowed; }
.queue-thumb { width: 46px; height: 46px; border-radius: 7px; object-fit: cover; background: #fff; border: 1px solid var(--border); }
.queue-copy { min-width: 0; }
.queue-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .84rem; font-weight: 700; }
.queue-meta { display: block; margin-top: 2px; color: var(--muted); font-size: .7rem; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #59605b; }
.status-dot.processing { background: var(--warning); box-shadow: 0 0 0 4px rgba(217,166,92,.12); }
.status-dot.done { background: var(--success); }
.status-dot.error { background: var(--danger); }

.settings-panel { box-shadow: none; }
.field { display: grid; gap: 7px; margin-bottom: 14px; color: #dfe1dd; font-size: .83rem; font-weight: 700; }
.field > span:first-child, .range-field > span { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.field output { color: var(--accent); font-variant-numeric: tabular-nums; font-size: .78rem; }
select, input[type="text"] { width: 100%; min-height: 42px; border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; color: var(--text); background: var(--field); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.control-group { padding-top: 15px; margin-top: 15px; border-top: 1px solid var(--border); }
.check-row { display: flex; align-items: center; gap: 9px; margin: 10px 0; color: #dfe1dd; font-size: .83rem; font-weight: 700; }
.check-row input { width: 17px; height: 17px; accent-color: var(--accent); }
.color-input-wrap { display: grid; grid-template-columns: 48px 1fr; gap: 8px; }
input[type="color"] { width: 48px; height: 42px; border: 1px solid var(--border); border-radius: 9px; padding: 3px; background: var(--field); }
.background-color-field { transition: opacity .16s ease; }
.background-color-field.is-disabled { opacity: .42; }
.background-color-field input:disabled { cursor: not-allowed; }

.preview-panel { min-height: 650px; }
.preview-heading { align-items: flex-end; }
.preview-actions, .batch-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.comparison-tabs { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 10px; width: max-content; max-width: 100%; margin-bottom: 14px; background: var(--field); }
.tab { min-height: 34px; border: 0; border-radius: 7px; padding: 7px 11px; color: var(--muted); background: transparent; font-weight: 740; cursor: pointer; }
.tab.is-active { color: var(--accent-ink); background: var(--accent); }
.preview-stage { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.preview-cell { min-width: 0; margin: 0; }
.preview-cell figcaption { margin-bottom: 7px; color: var(--muted); font-size: .76rem; font-weight: 760; text-transform: uppercase; letter-spacing: .09em; }
.image-frame { position: relative; display: grid; place-items: center; overflow: hidden; min-height: 420px; border: 1px solid var(--border); border-radius: 11px; background-color: #ecebe5; }
.checkerboard { background-image: linear-gradient(45deg,#deddd7 25%,transparent 25%),linear-gradient(-45deg,#deddd7 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#deddd7 75%),linear-gradient(-45deg,transparent 75%,#deddd7 75%); background-size: 22px 22px; background-position: 0 0,0 11px,11px -11px,-11px 0; }
.image-frame img, .image-frame canvas, .vector-preview svg { display: block; max-width: 100%; max-height: 70vh; width: auto; height: auto; object-fit: contain; }
.vector-preview { display: grid; place-items: center; width: 100%; height: 100%; min-height: 420px; padding: 12px; color: #000; }
.vector-preview svg { max-height: 68vh; }
.placeholder { max-width: 290px; padding: 24px; color: #6c6f6c; text-align: center; line-height: 1.5; }
.processed-cell { display: none; }
.preview-stage.mode-vector { grid-template-columns: 1fr; }
.preview-stage.mode-vector .original-cell, .preview-stage.mode-vector .processed-cell { display: none; }
.preview-stage.mode-vector .vector-cell { display: block; }
.preview-stage.mode-processed { grid-template-columns: 1fr; }
.preview-stage.mode-processed .original-cell, .preview-stage.mode-processed .vector-cell { display: none; }
.preview-stage.mode-processed .processed-cell { display: block; }
.spinner-wrap { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: #474b48; background: rgba(236,235,229,.88); font-weight: 760; }
.spinner-wrap[hidden] { display: none; }
.spinner { width: 32px; height: 32px; border: 3px solid rgba(0,0,0,.16); border-top-color: #242725; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.metrics { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 8px; margin-top: 12px; }
.metric { min-width: 0; padding: 10px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel-2); }
.metric span { display: block; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }
.metric strong { display: block; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; font-size: .84rem; white-space: nowrap; }

.batch-panel { box-shadow: none; }
.batch-progress-wrap { margin-bottom: 16px; }
.progress-labels { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; color: var(--muted); font-size: .8rem; }
progress { width: 100%; height: 12px; accent-color: var(--accent); }
.batch-note { margin: 13px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.app-footer { display: flex; justify-content: space-between; gap: 18px; padding: 18px 12px 10px; color: var(--muted); font-size: .75rem; border-top: 1px solid var(--border); }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 390px minmax(0,1fr); }
  .metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .preview-stage { grid-template-columns: 1fr; }
  .image-frame, .vector-preview { min-height: 360px; }
  .privacy-note { display: none; }
}

@media (max-width: 820px) {
  body { height: auto; min-height: 100%; overflow: auto; }
  .brand-kicker, .topbar-subtitle { display: none; }
  .app-shell { grid-template-columns: 1fr; height: auto; min-height: calc(100vh - 48px); overflow: visible; }
  .workspace { height: auto; overflow: visible; padding-right: 0; }
  .sidebar {
    grid-template-columns: 1fr;
    gap: 8px;
    height: auto;
    position: static;
  }
  .sidebar-nav {
    flex-direction: row;
    width: 100%;
  }
  .sidebar-nav-button {
    flex: 1;
    flex-direction: row;
    min-height: 44px;
    border-right: 1px solid var(--border);
    border-bottom: 0;
  }
  .sidebar-nav-button:last-child { border-right: 0; }
  .sidebar-nav-button.is-active { box-shadow: inset 0 -3px 0 var(--accent); }
  .sidebar-panels { max-height: none; overflow: visible; padding-right: 0; }
  .queue-list { max-height: 280px; }
  .preview-panel { min-height: 0; }
}

@media (max-width: 560px) {
  .topbar { padding-inline: 9px; }
  .topbar h1 { font-size: 1.22rem; }
  .badge { max-width: 145px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .app-shell { padding-inline: 8px; }
  .panel { border-radius: 11px; }
  .import-panel, .settings-panel, .preview-panel, .batch-panel { padding: 14px; }
  .section-heading, .preview-heading { align-items: flex-start; flex-direction: column; }
  .preview-actions, .batch-buttons, .drop-actions { width: 100%; }
  .preview-actions .button, .batch-buttons .button, .drop-actions .button { flex: 1 1 auto; }
  .comparison-tabs { width: 100%; }
  .tab { flex: 1; font-size: .78rem; padding-inline: 6px; }
  .image-frame, .vector-preview { min-height: 300px; }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .app-footer { flex-direction: column; }
}

/* === PUBLISHED GREEN MACARONI HEADER =================================== */
.topbar {
  justify-content: flex-start;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  margin-right: 4px;
  user-select: none;
}

.brand a {
  display: block;
  flex: 0 0 auto;
}

.brandLogo {
  display: block;
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.brandName {
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Helvetica, Arial, sans-serif;
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -.02em;
  white-space: nowrap;
  /* text-transform: uppercase; */
}

.ver {
  color: #858a86;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  white-space: nowrap;
}

.brandSecondary {
  padding-left: 10px;
  border-left: 1px solid var(--border);
  color: var(--muted);
  font-size: .72rem;
  white-space: nowrap;
}

.topbarSpacer {
  flex: 1 1 auto;
}

.topbar-status {
  gap: 8px;
  flex: 0 1 auto;
}

.topbar .badge {
  min-height: 28px;
  padding: 4px 10px;
  font-size: .7rem;
}

.topbar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  background: var(--panel-2);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
  cursor: pointer;
}

.topbar-button:hover {
  border-color: var(--accent);
  background: #202321;
}

.topbar-button:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.topbar-button-ghost {
  background: transparent;
}

/* === APPS MODAL ======================================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, .62);
}

.modal.open {
  display: flex;
}

.modalCard {
  width: min(680px, 100%);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(0, 0, 0, .55);
}

.modalHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}

.modalTitle {
  font-weight: 800;
  letter-spacing: .04em;
}

.modalBody {
  padding: 14px;
}

.modalBody .muted {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.45;
}

.appsLinks {
  display: grid;
  gap: 10px;
}

.appLink {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  text-decoration: none;
  background: var(--panel-2);
}

.appLink:hover {
  border-color: var(--accent);
  background: #292c2a;
}

.appIcon {
  display: grid;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--field);
}

.appIcon img {
  display: block;
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.appText {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.appName {
  font-weight: 800;
}

.appDesc {
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.35;
}

@media (max-width: 1050px) {
  .brandSecondary,
  .privacy-note {
    display: none;
  }
}

@media (max-width: 650px) {
  .ver {
    display: none;
  }

  .brandName {
    font-size: 1rem;
  }

  .topbar-button {
    padding-inline: 7px;
  }
}

@media (max-width: 440px) {
  .topbar-status {
    display: none;
  }

  .topbar {
    gap: 6px;
    padding-inline: 7px;
  }

  .brandLogo {
    width: 28px;
    height: 28px;
  }

  .brandName {
    font-size: .96rem;
  }
}

/* === VW08 · NODE ECONOMY + CUSTOM MAGNIFYING NODE VIEWER ============== */
.field small {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 500;
  line-height: 1.45;
}

.control-warning {
  margin: -3px 0 14px;
  padding: 9px 10px;
  border: 1px solid rgba(217,166,92,.34);
  border-radius: 9px;
  color: #e7d6b7;
  background: rgba(217,166,92,.08);
  font-size: .74rem;
  line-height: 1.45;
}
.control-warning strong { color: var(--warning); }

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.preview-toolbar .comparison-tabs { margin-bottom: 0; }

.node-view-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
  min-width: 0;
}
.node-viewer-button.is-active {
  color: var(--node-button-text, var(--accent-ink));
  border-color: var(--node-color, var(--accent));
  background: var(--node-color, var(--accent));
}
.node-viewer-button > span {
  font-size: 1.05rem;
  line-height: 1;
}
.node-appearance-field {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  transition: opacity .16s ease;
}
.node-appearance-field:has(:disabled) { opacity: .42; }
.node-color-field input[type="color"] {
  width: 34px;
  height: 30px;
  min-height: 0;
  border-radius: 7px;
  padding: 2px;
}
.node-shape-field select {
  width: auto;
  min-width: 78px;
  min-height: 30px;
  padding: 3px 24px 3px 8px;
  border-radius: 7px;
  font-size: .76rem;
}
.node-zoom-field {
  display: grid;
  grid-template-columns: auto minmax(72px,110px) 28px;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
}
.node-zoom-field input { min-width: 0; }
.node-zoom-field output {
  color: var(--node-color, var(--accent));
  font-variant-numeric: tabular-nums;
}
.node-zoom-field:has(input:disabled) { opacity: .42; }

.vector-frame.is-node-viewing { cursor: crosshair; }
.node-overlay {
  position: absolute;
  z-index: 4;
  display: none;
  overflow: visible;
  pointer-events: none;
}
.vector-frame.is-node-viewing .node-overlay { display: block; }
.node-overlay .node-marker,
.node-lens .node-marker {
  fill: var(--node-color, #E3C561);
  stroke: var(--node-stroke, rgba(0,0,0,.78));
  stroke-width: .65;
  stroke-opacity: .68;
  vector-effect: non-scaling-stroke;
}
.node-overlay .node-marker { fill-opacity: .56; }
.node-lens .node-marker { fill-opacity: .72; }

.node-lens {
  position: absolute;
  z-index: 7;
  width: 176px;
  height: 176px;
  overflow: hidden;
  border: 2px solid var(--node-color, var(--accent));
  border-radius: 50%;
  background: #ecebe5;
  box-shadow: 0 7px 24px rgba(0,0,0,.5), inset 0 0 0 1px rgba(255,255,255,.35);
  pointer-events: none;
}
.node-lens[hidden] { display: none; }
.node-lens svg { display: block; width: 100%; height: 100%; }
.node-lens::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 22px rgba(0,0,0,.28);
  pointer-events: none;
}

.metrics { grid-template-columns: repeat(6,minmax(0,1fr)); }

@media (max-width: 1050px) {
  .metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
}

@media (max-width: 680px) {
  .preview-toolbar { align-items: stretch; }
  .preview-toolbar .comparison-tabs,
  .node-view-controls { width: 100%; justify-content: flex-start; }
  .node-zoom-field { flex: 1; grid-template-columns: auto minmax(60px,1fr) 28px; }
  .node-lens { width: 150px; height: 150px; }
}

@media (max-width: 560px) {
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
}


/* === VW15 exact-value slider controls ============================== */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.range-input-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 76px;
  align-items: center;
  gap: 9px;
}
.range-input-row input[type="range"] {
  min-width: 0;
}
.range-number-input {
  width: 76px;
  min-width: 0;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 7px;
  color: var(--accent);
  background: var(--field);
  font: inherit;
  font-size: .78rem;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.range-number-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.range-number-input:invalid {
  border-color: var(--danger);
}
@media (max-width: 430px) {
  .range-input-row { grid-template-columns: minmax(0, 1fr) 70px; gap: 7px; }
  .range-number-input { width: 70px; }
}


/* VW17: square Vector fill color swatch */
#fillColorInput {
  border-radius: 0;
}

/* === VW20 · FLAT COLOR TRACING ======================================== */
.control-intro {
  margin: -2px 0 14px;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 500;
  line-height: 1.5;
}

.color-trace-controls {
  padding: 15px 13px 1px;
  border: 1px solid rgba(227, 197, 97, .24);
  border-radius: 11px;
  background: rgba(227, 197, 97, .045);
}

.color-trace-controls h3 {
  color: var(--accent);
}

.custom-palette-field {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(0, 0, 0, .12);
}

.custom-palette-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.palette-add-button,
.palette-pick-button,
.palette-delete-button {
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--muted);
  background: var(--field);
  font-weight: 760;
  cursor: pointer;
}

.palette-add-button {
  min-height: 28px;
  padding: 4px 8px;
  font-size: .68rem;
}

.palette-add-button:hover:not(:disabled),
.palette-pick-button:hover:not(:disabled),
.palette-pick-button.is-active {
  border-color: var(--accent);
  color: var(--accent);
}

.palette-add-button:disabled,
.palette-pick-button:disabled,
.palette-delete-button:disabled {
  opacity: .34;
  cursor: not-allowed;
}

.custom-palette-inputs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.custom-palette-swatch {
  position: relative;
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, .018);
  font-size: .65rem;
  font-weight: 700;
  text-align: center;
}

.custom-palette-swatch input[type="color"] {
  width: 100%;
  height: 38px;
  border-radius: 6px;
  cursor: pointer;
}

.custom-palette-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 26px;
  gap: 4px;
}

.palette-pick-button,
.palette-delete-button {
  min-width: 0;
  min-height: 25px;
  padding: 3px 4px;
  font-size: .62rem;
}

.palette-pick-button {
  display: inline-grid;
  place-items: center;
  line-height: 0;
}

.palette-pick-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.palette-delete-button {
  color: #d8aaa8;
  font-size: .86rem;
  line-height: 1;
}

.palette-delete-button:hover:not(:disabled) {
  border-color: rgba(214, 111, 111, .72);
  color: #ffdada;
  background: rgba(214, 111, 111, .1);
}

.custom-palette-number {
  line-height: 1;
}

#paletteEyedropperHint {
  min-height: 2.8em;
}

.original-frame,
#originalFrame {
  transition: border-color .15s ease, box-shadow .15s ease;
}

#originalFrame.is-picking-color {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(227, 197, 97, .22);
}

body.is-picking-palette-color #originalPreview {
  cursor: crosshair;
}

.result-palette-panel {
  margin-top: 14px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--panel-2);
}

.result-palette-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 11px;
}

.result-palette-heading > div {
  display: grid;
  gap: 3px;
}

.result-palette-heading strong {
  color: var(--text);
  font-size: .82rem;
}

.result-palette-heading span {
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.4;
}

.result-palette-count {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid rgba(227, 197, 97, .28);
  border-radius: 999px;
  color: var(--accent) !important;
  background: rgba(227, 197, 97, .07);
  font-variant-numeric: tabular-nums;
  font-weight: 760;
  white-space: nowrap;
}

.result-palette-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 8px;
}

.result-palette-swatch {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 5px 7px 5px 5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: var(--field);
  font-size: .68rem;
  font-weight: 740;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.result-palette-swatch:hover {
  border-color: var(--accent);
}

.result-palette-swatch input[type="color"] {
  width: 40px;
  height: 32px;
  border: 0;
  border-radius: 5px;
  padding: 0;
  cursor: pointer;
}

.result-palette-swatch span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 430px) {
  .custom-palette-inputs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .result-palette-heading { align-items: stretch; flex-direction: column; }
  .result-palette-count { align-self: flex-start; }
  .result-palette-swatches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
