/* ───────────────────────────────────────────────────────────────────────────
   Creativity — a ComfyUI-style infinite node canvas.
   Phase 1: blank white grid canvas, zoom, infinite pan, left rail + New Workflow.
   All selectors are scoped under .cz-body so nothing here leaks to other pages.
   ─────────────────────────────────────────────────────────────────────────── */

.cz-body {
  /* Lock the studio chrome + canvas to the viewport so the canvas fills the
     remaining height and never scrolls the page itself. */
  overflow: hidden;
}
/* Immersive canvas: suppress the free-credits nudge banner here so it can't
   push the stage down or steal canvas height. (It still shows on other pages.) */
.cz-body .otp-verify-banner { display: none !important; }
.cz-body .site-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* The stage = left rail + canvas, taking all height under the header strip. */
.cz-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  position: relative;
}

/* ── Left rail ──────────────────────────────────────────────────────────── */
.cz-rail {
  flex: 0 0 240px;
  width: 240px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 14px;
  background: var(--surface-strong);
  border-right: 1px solid var(--border);
  z-index: 3;
}
.cz-rail-title {
  font-family: "Sora", sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 4px;
}
.cz-new-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(0, 212, 255, 0.35);
  background: linear-gradient(180deg, rgba(0, 212, 255, 0.16), rgba(0, 212, 255, 0.06));
  color: var(--text-primary);
  font-family: "DM Sans", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.cz-new-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 212, 255, 0.6);
  box-shadow: 0 10px 26px rgba(0, 212, 255, 0.22);
}
.cz-new-btn svg { width: 18px; height: 18px; }

.cz-rail-empty {
  margin-top: 4px;
  padding: 14px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

/* ── Canvas viewport ────────────────────────────────────────────────────── */
.cz-canvas {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  background: #ffffff;
  cursor: grab;
  /* Two layered grids: fine (minor) lines + heavier (major) lines every 5th.
     Sizes + positions are driven from JS via CSS custom properties so the grid
     pans and zooms in lockstep with the world. */
  --cz-grid: 24px;
  --cz-ox: 0px;
  --cz-oy: 0px;
  background-image:
    linear-gradient(to right, rgba(20, 24, 34, 0.10) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(20, 24, 34, 0.10) 1px, transparent 1px),
    linear-gradient(to right, rgba(20, 24, 34, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(20, 24, 34, 0.05) 1px, transparent 1px);
  background-size:
    calc(var(--cz-grid) * 5) calc(var(--cz-grid) * 5),
    calc(var(--cz-grid) * 5) calc(var(--cz-grid) * 5),
    var(--cz-grid) var(--cz-grid),
    var(--cz-grid) var(--cz-grid);
  background-position:
    var(--cz-ox) var(--cz-oy),
    var(--cz-ox) var(--cz-oy),
    var(--cz-ox) var(--cz-oy),
    var(--cz-ox) var(--cz-oy);
}
.cz-canvas.is-panning { cursor: grabbing; }

/* The world layer — nodes live here; it translates + scales as one.
   NOTE: no persistent `will-change: transform`. A permanent compositing layer is
   rasterized once at 1× and then GPU-scaled, which blurs node text/SVG on
   zoom-in. We promote the layer ONLY while actively panning/zooming (.is-moving,
   toggled from applyView) so motion stays smooth, then drop it so the settled
   view re-rasterizes crisply at the current zoom. */
.cz-world {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
}
.cz-world.is-moving { will-change: transform; }

/* Centre marker so an empty canvas still shows "where you are". */
.cz-origin {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  border: 2px solid rgba(0, 182, 224, 0.55);
  background: rgba(0, 212, 255, 0.12);
  pointer-events: none;
}

/* ── Floating HUD (zoom controls + readout), bottom-right of canvas ───────── */
.cz-hud {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 12px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  z-index: 4;
  user-select: none;
}
.cz-hud button {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.cz-hud button:hover { background: rgba(255, 255, 255, 0.07); border-color: var(--border-strong); }
.cz-zoom-readout {
  min-width: 52px;
  text-align: center;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  cursor: pointer;
}

/* Active-workflow chip, top-left of the canvas. */
.cz-wf-chip {
  position: absolute;
  top: 14px;
  left: 14px;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 10px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  z-index: 4;
}
.cz-wf-chip.is-shown { display: inline-flex; }
.cz-wf-chip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.cz-wf-chip-name { font-weight: 600; font-size: 0.9rem; color: var(--text-primary); }

/* ── New-workflow modal ─────────────────────────────────────────────────── */
.cz-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 6, 11, 0.66);
  backdrop-filter: blur(4px);
}
.cz-modal.is-open { display: flex; }
.cz-modal-card {
  width: 100%;
  max-width: 420px;
  padding: 24px;
  border-radius: 18px;
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-glow);
}
.cz-modal-title {
  font-family: "Sora", sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  margin: 0 0 4px;
}
.cz-modal-sub {
  color: var(--text-muted);
  font-size: 0.86rem;
  margin: 0 0 16px;
}
.cz-field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.cz-input {
  width: 100%;
  padding: 11px 13px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: rgba(10, 13, 20, 0.6);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: "DM Sans", sans-serif;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.cz-input:focus { border-color: var(--landing-accent); box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.16); }
.cz-input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(255, 109, 145, 0.16); }
.cz-field-hint { margin: 7px 2px 0; font-size: 0.78rem; color: var(--text-muted); min-height: 1em; }
.cz-field-hint.is-error { color: var(--danger); }
.cz-run-credits {
  display: flex; align-items: baseline; gap: 7px;
  margin: 6px 0 14px; padding: 15px 18px;
  border-radius: 12px;
  background: rgba(55, 217, 150, 0.1); border: 1px solid rgba(55, 217, 150, 0.3);
}
.cz-run-credits-val {
  font-family: "DM Sans", sans-serif;
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1;
  letter-spacing: -0.015em;
  color: #c6f7df;
  font-variant-numeric: tabular-nums;
}
.cz-run-credits-unit { font-size: 0.95rem; font-weight: 600; color: #8fdcbb; }

/* Insufficient-credits state on the run modal */
.cz-run-credits.is-insufficient { background: rgba(255, 109, 145, 0.1); border-color: rgba(255, 109, 145, 0.42); }
.cz-run-credits.is-insufficient .cz-run-credits-val,
.cz-run-credits.is-insufficient .cz-run-credits-unit { color: #ff8fa3; }
.cz-run-insufficient {
  display: flex; align-items: flex-start; gap: 9px;
  margin: 2px 0 12px; padding: 11px 12px; border-radius: 11px;
  background: rgba(255, 109, 145, 0.1); border: 1px solid rgba(255, 109, 145, 0.38);
}
.cz-run-insuff-ic {
  flex: 0 0 auto; width: 19px; height: 19px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--danger); color: #2a0e16; font-weight: 900; font-size: 0.8rem;
}
.cz-run-insuff-title { font-weight: 700; font-size: 0.86rem; color: #ffb3c2; margin-bottom: 2px; }
.cz-run-insuff-text { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.4; }
.cz-run-insuff-text strong { color: #ffd6df; font-weight: 800; font-variant-numeric: tabular-nums; }
.cz-topup-btn {
  display: flex; align-items: center; gap: 9px;
  margin: 0 0 16px; padding: 12px 14px; border-radius: 12px;
  text-decoration: none; font-weight: 700; font-size: 0.92rem;
  color: #04222b; background: linear-gradient(135deg, #00d4ff, #8ff1ff);
  box-shadow: 0 12px 26px rgba(0, 212, 255, 0.28);
}
.cz-topup-btn:hover { filter: brightness(1.05); }
.cz-topup-btn svg { width: 18px; height: 18px; flex: 0 0 auto; }
.cz-topup-btn span:not(.cz-topup-badge) { flex: 1 1 auto; }
.cz-topup-badge {
  flex: 0 0 auto;
  font-family: "DM Sans", sans-serif; font-weight: 800; font-size: 0.62rem; letter-spacing: 0.02em;
  color: #fff; background: linear-gradient(135deg, #ff5ed6, #9d4dff);
  padding: 3px 8px; border-radius: 999px;
  box-shadow: 0 3px 10px rgba(157, 77, 255, 0.4);
}
.cz-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.cz-btn-ghost,
.cz-btn-primary {
  padding: 10px 18px;
  border-radius: 11px;
  font-weight: 700;
  font-size: 0.9rem;
  font-family: "DM Sans", sans-serif;
  cursor: pointer;
  border: 1px solid transparent;
}
.cz-btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text-secondary); }
.cz-btn-ghost:hover { color: var(--text-primary); border-color: var(--text-muted); }
.cz-btn-primary { background: linear-gradient(180deg, #00d4ff, #00b6e0); color: #04222b; }
.cz-btn-primary:hover { filter: brightness(1.05); }
.cz-btn-primary:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }

/* ── Rail node palette + workflow actions ───────────────────────────────── */
.cz-rail-group { display: flex; flex-direction: column; gap: 8px; }
.cz-rail-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-family: "DM Sans", sans-serif;
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.cz-rail-btn:hover { background: rgba(255,255,255,0.06); border-color: var(--border-strong); color: var(--text-primary); }
.cz-rail-btn svg { width: 17px; height: 17px; flex: 0 0 auto; }
.cz-rail-run { border-color: rgba(55, 217, 150, 0.4); color: #bdf5db; }
.cz-rail-run:hover { border-color: rgba(55, 217, 150, 0.7); }
.cz-rail-run.is-running { border-color: rgba(255, 191, 105, 0.6); color: #ffd9a3; }
.cz-rail-empty code { color: var(--text-secondary); background: rgba(255,255,255,0.06); padding: 1px 5px; border-radius: 5px; }

/* ── Edges (SVG, drawn in world space; strokes stay crisp at any zoom) ────── */
.cz-edges {
  position: absolute;
  left: 0; top: 0;
  width: 1px; height: 1px;
  overflow: visible;
  pointer-events: none;
  z-index: 1;
}
.cz-edge { fill: none; stroke: #00b6e0; stroke-width: 2.5; vector-effect: non-scaling-stroke; pointer-events: none; }
/* Fat invisible hit area so the thin wire is easy to hover/click. */
.cz-edge-hit { fill: none; stroke: transparent; stroke-width: 18; vector-effect: non-scaling-stroke; pointer-events: stroke; cursor: pointer; }
.cz-edge-grp:hover .cz-edge { stroke: var(--danger); }
.cz-edge-temp { fill: none; stroke: #8ff1ff; stroke-width: 2; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; pointer-events: none; }
/* "−" cut button at the wire midpoint — appears on hover, click to unlink. */
.cz-edge-cut { opacity: 0; pointer-events: all; cursor: pointer; transition: opacity 0.12s ease; }
.cz-edge-grp:hover .cz-edge-cut { opacity: 1; }
.cz-edge-cut circle { fill: var(--danger); stroke: #fff; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.cz-edge-cut:hover circle { fill: #ff4d6d; }
.cz-edge-cut line { stroke: #fff; stroke-width: 2.4; vector-effect: non-scaling-stroke; }

/* ── Nodes ──────────────────────────────────────────────────────────────── */
.cz-nodes { position: absolute; left: 0; top: 0; z-index: 2; }
.cz-node {
  position: absolute;
  width: 240px;
  border-radius: 12px;
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-card);
  color: var(--text-primary);
  user-select: none;
  cursor: default;            /* override the canvas grab cursor inside nodes */
}
/* Contextual cursors: only the header drags; the body is normal, the prompt is
   text, controls are pointers, ports are crosshairs, the corner resizes. */
.cz-node-body, .cz-node-foot, .cz-node-title, .cz-node-ic,
.cz-thumb, .cz-thumb-name, .cz-nb-inputs, .cz-nb-inrow, .cz-nb-sec-label,
.cz-nb-credits, .cz-nb-out, .cz-preview-empty { cursor: default; }
.cz-nb-prompt { cursor: text; user-select: text; }
.cz-thumb-replace, .cz-drop, .cz-dl, .cz-nb-opts button, .cz-chip { cursor: pointer; }
.cz-node.is-selected { border-color: var(--landing-accent); box-shadow: 0 0 0 2px rgba(0,212,255,0.3), var(--shadow-card); }
.cz-node-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  min-height: 38px;            /* deterministic header height → port geometry */
  box-sizing: border-box;
  border-bottom: 1px solid var(--border);
  cursor: grab;
  border-radius: 12px 12px 0 0;
}
.cz-node-ic { flex: 0 0 auto; width: 18px; height: 18px; color: var(--landing-accent); display: inline-flex; }
.cz-node-ic svg { width: 18px; height: 18px; }
.cz-node-ic .cz-ic-img { width: 18px; height: 18px; object-fit: contain; border-radius: 4px; display: block; }
.cz-node.is-dragging .cz-node-head { cursor: grabbing; }
.cz-node-title { flex: 1 1 auto; min-width: 0; font-weight: 700; font-size: 0.84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cz-node-status { display: flex; align-items: center; gap: 1px; flex: 0 0 auto; }
.cz-st {
  width: 21px; height: 21px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; border: 1px solid transparent;
  color: var(--text-muted); background: transparent; cursor: default;
}
.cz-st svg { width: 14px; height: 14px; }
.cz-st-note { cursor: pointer; }
.cz-st-note:hover { color: var(--warning); background: rgba(255, 191, 105, 0.12); }
.cz-st-note.is-on { color: var(--warning); }
.cz-st-replay { cursor: pointer; }
.cz-st-replay:hover { color: var(--landing-accent); background: rgba(0, 212, 255, 0.12); }
.cz-st-reset { cursor: pointer; }
.cz-st-reset:hover { color: var(--text-primary); background: rgba(255,255,255,0.08); }
.cz-st-del { cursor: pointer; }
.cz-st-del:hover { color: var(--danger); background: rgba(255,109,145,0.12); }
/* Status lamps: dim by default, light up per node status. */
.cz-st-queue { color: #4a4f60; }
.cz-st-done  { color: #4a4f60; }
.cz-node.is-queued  .cz-st-queue { color: var(--warning); }
.cz-node.is-running .cz-st-queue { color: var(--warning); animation: czSpin 1s linear infinite; }
.cz-node.is-completed .cz-st-done { color: var(--success); }
.cz-node.is-error .cz-st-queue { color: var(--danger); animation: none; }
@keyframes czSpin { to { transform: rotate(360deg); } }

.cz-node.is-running  { border-color: rgba(255,191,105,0.6); }
.cz-node.is-completed { border-color: rgba(55,217,150,0.45); }
.cz-node.is-error    { border-color: rgba(255,109,145,0.6); }

/* Per-node note (one per node, ≤50 chars). Lives INSIDE the node, between the
   header and body — never collides with the error tip, which floats above. */
.cz-node-note {
  display: none; align-items: flex-start; gap: 6px;
  padding: 8px 8px 8px 9px;
  border-top: 1px solid rgba(255, 191, 105, 0.3);
  border-left: 3px solid var(--warning);        /* accent so the note is noticed */
  background: rgba(255, 191, 105, 0.16);
}
.cz-node-note.is-shown { display: flex; }
.cz-note-ic { flex: 0 0 auto; width: 15px; height: 15px; margin-top: 1px; color: var(--warning); display: inline-flex; }
.cz-note-ic svg { width: 15px; height: 15px; }
.cz-note-input {
  flex: 1 1 auto; min-width: 0; min-height: 18px;
  border: none; background: transparent; outline: none; resize: none; overflow: hidden;
  color: #ffe0b0; font-size: 0.78rem; line-height: 1.4; font-family: "DM Sans", sans-serif;
  white-space: pre-wrap; word-break: break-word;   /* show the FULL note, wrapped */
}
.cz-note-input::placeholder { color: rgba(255, 191, 105, 0.55); }
.cz-note-x {
  flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px; border-radius: 5px;
  border: none; background: transparent; color: rgba(255, 191, 105, 0.7); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.cz-note-x svg { width: 12px; height: 12px; }
.cz-note-x:hover { background: rgba(255, 109, 145, 0.18); color: var(--danger); }

.cz-node-body { padding: 10px; }
.cz-node-foot { padding: 0 10px 9px; font-size: 0.72rem; color: var(--text-muted); min-height: 0.8em; }

/* Image-upload / preview bodies */
.cz-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 18px 10px;
  border: 1px dashed var(--border-strong); border-radius: 10px;
  color: var(--text-muted); font-size: 0.8rem; text-align: center; cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.cz-drop:hover { border-color: var(--landing-accent); background: rgba(0,212,255,0.05); }
.cz-thumb { width: 100%; border-radius: 9px; display: block; background: #0b0e15; max-height: 200px; object-fit: contain; }
.cz-thumb-wrap { position: relative; }
.cz-thumb-name { margin-top: 6px; font-size: 0.74rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cz-thumb-replace { margin-top: 6px; font-size: 0.74rem; color: var(--cyan-soft); cursor: pointer; }
.cz-preview-empty { padding: 24px 10px; text-align: center; color: var(--text-muted); font-size: 0.8rem; border: 1px dashed var(--border); border-radius: 10px; }
/* Download icon (replaces the old S3 text link) — inline, click to download */
.cz-dl {
  display: inline-flex; align-items: center; justify-content: center;
  margin-top: 6px; width: 32px; height: 28px;
  border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-primary); text-decoration: none;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.cz-dl:hover { background: rgba(0, 212, 255, 0.12); border-color: var(--landing-accent); }
.cz-dl svg { width: 16px; height: 16px; }

/* Full-view (expand) button overlaid on a preview/output thumbnail */
.cz-nb-result { position: relative; }
.cz-fullview {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--border-strong);
  background: rgba(11, 14, 21, 0.66); color: #fff; cursor: pointer;
  opacity: 0.7; transition: opacity 0.14s ease, background 0.14s ease, border-color 0.14s ease;
  backdrop-filter: blur(2px);
}
.cz-thumb-wrap:hover .cz-fullview,
.cz-nb-result:hover .cz-fullview { opacity: 1; }
.cz-fullview:hover { background: rgba(0, 212, 255, 0.22); border-color: var(--landing-accent); }
.cz-fullview svg { width: 16px; height: 16px; }

/* Full-resolution lightbox viewer */
.cz-lightbox {
  position: fixed; inset: 0; z-index: 4000;
  display: none; align-items: center; justify-content: center;
  padding: 4vh 4vw;
  background: rgba(4, 6, 11, 0.92);
  backdrop-filter: blur(4px);
}
.cz-lightbox.is-open { display: flex; }
.cz-lightbox-stage { display: flex; align-items: center; justify-content: center; max-width: 100%; max-height: 100%; }
.cz-lightbox-media { max-width: 92vw; max-height: 92vh; display: block; border-radius: 10px; box-shadow: 0 24px 80px rgba(0,0,0,0.6); }
.cz-lightbox-close {
  position: fixed; top: 18px; right: 22px;
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 1px solid var(--border-strong);
  background: rgba(20, 24, 34, 0.82); color: #fff; cursor: pointer;
}
.cz-lightbox-close:hover { background: rgba(255, 109, 145, 0.18); border-color: var(--danger); }
.cz-lightbox-close svg { width: 20px; height: 20px; }
body.cz-lightbox-lock { overflow: hidden; }

/* ── Ports ──────────────────────────────────────────────────────────────── */
.cz-port {
  position: absolute;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #0b0e15;
  border: 2px solid #00b6e0;
  top: 46px;
  cursor: crosshair;
  z-index: 3;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.cz-port:hover { transform: scale(1.25); box-shadow: 0 0 0 4px rgba(0,212,255,0.18); }
.cz-port-in  { left: -8px; }
.cz-port-out { right: -8px; }
.cz-port.is-linked { background: #00b6e0; }
/* A connected input port — click it to detach the wire. */
.cz-port-in.is-linked { cursor: pointer; }
.cz-port-in.is-linked:hover { border-color: var(--danger); background: var(--danger); box-shadow: 0 0 0 4px rgba(255, 109, 145, 0.22); }
.cz-node.cz-droptarget .cz-port-in { box-shadow: 0 0 0 5px rgba(55,217,150,0.3); border-color: var(--success); }

/* ── Node search popup (double-click empty canvas) ──────────────────────── */
.cz-search {
  position: absolute;
  width: 240px;
  z-index: 20;
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-glow);
  overflow: hidden;
}
.cz-search-input {
  width: 100%;
  padding: 11px 13px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: rgba(10,13,20,0.6);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: "DM Sans", sans-serif;
  outline: none;
}
.cz-search-list { max-height: 240px; overflow-y: auto; padding: 6px; }
.cz-search-item {
  display: flex; flex-direction: column; gap: 1px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.cz-search-item:hover, .cz-search-item.is-active { background: rgba(0,212,255,0.12); }
.cz-search-item-name { font-weight: 600; font-size: 0.86rem; color: var(--text-primary); }
.cz-search-item-desc { font-size: 0.74rem; color: var(--text-muted); }
.cz-search-empty { padding: 14px 10px; text-align: center; color: var(--text-muted); font-size: 0.82rem; }

/* ── Node resize handle (Image Preview) ─────────────────────────────────── */
.cz-resize {
  position: absolute;
  right: 2px; bottom: 2px;
  width: 16px; height: 16px;
  cursor: nwse-resize;
  border-radius: 0 0 10px 0;
  background:
    linear-gradient(135deg, transparent 0 45%, var(--border-strong) 45% 55%, transparent 55% 70%, var(--border-strong) 70% 80%, transparent 80%);
  z-index: 4;
}

/* ── Nano Banana 2 node ─────────────────────────────────────────────────── */
.cz-node-nb .cz-node-body { padding: 10px; }
.cz-nb-sec-label {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-muted); margin: 12px 0 6px;
}
.cz-nb-sec-label:first-child { margin-top: 0; }
.cz-nb-cap { font-weight: 500; text-transform: none; letter-spacing: 0; color: #6b7080; margin-left: 6px; }

/* Inputs (rows must be 28px tall — see portTop geometry in JS) */
.cz-nb-inputs { margin: 0; }
.cz-nb-inrow {
  height: 28px; box-sizing: border-box;
  display: flex; align-items: center; gap: 8px;
  color: var(--text-secondary); font-size: 0.82rem;
}
.cz-nb-indot { width: 18px; height: 18px; border-radius: 5px; border: 1px dashed var(--border-strong); flex: 0 0 auto; }
.cz-nb-inthumb { width: 18px; height: 18px; border-radius: 5px; object-fit: cover; flex: 0 0 auto; }
.cz-nb-inlabel { font-weight: 600; color: var(--text-primary); }
/* Single output label, aligned to the output port on the right edge. */
.cz-nb-outlabel { margin-left: auto; font-weight: 600; font-size: 0.82rem; color: var(--text-secondary); }

/* Prompt editor (contenteditable) */
.cz-nb-prompt {
  min-height: 64px; max-height: 180px; overflow-y: auto;
  padding: 9px 10px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: rgba(10, 13, 20, 0.6);
  color: var(--text-primary); font-size: 0.84rem; line-height: 1.45;
  outline: none; white-space: pre-wrap; word-break: break-word;
}
.cz-nb-prompt:focus { border-color: var(--landing-accent); box-shadow: 0 0 0 2px rgba(0,212,255,0.14); }
.cz-nb-prompt.is-empty:before { content: attr(data-placeholder); color: #5c6170; pointer-events: none; }

/* Prompt chip (an @image reference) */
.cz-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 6px 1px 3px; margin: 0 1px; border-radius: 6px;
  background: rgba(0, 212, 255, 0.16); border: 1px solid rgba(0, 212, 255, 0.4);
  color: #bdeeff; font-size: 0.78rem; font-weight: 600; vertical-align: baseline;
  user-select: none;
}
.cz-chip img { width: 15px; height: 15px; border-radius: 3px; object-fit: cover; }

/* Icon option pickers (dimensions / quality / thinking) */
.cz-nb-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.cz-nb-opts button {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-width: 40px; padding: 6px 7px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-secondary); font-size: 0.66rem; font-weight: 600; cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.cz-nb-opts button:hover { border-color: var(--border-strong); color: var(--text-primary); }
.cz-nb-opts button.is-active { border-color: var(--landing-accent); background: rgba(0,212,255,0.12); color: #eaffff; }
.cz-nb-opts button svg { width: 16px; height: 16px; }

/* aspect-ratio swatch (a scaled rectangle) */
.cz-nb-aspect button { min-width: 44px; }
.cz-nb-aspect .cz-ar-box { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; }
.cz-ar { display: inline-block; border: 1.6px solid currentColor; border-radius: 2px; box-sizing: border-box; }
.cz-ar-auto { width: 18px; height: 18px; border-radius: 4px; font-size: 0.66rem; font-weight: 800; line-height: 16px; text-align: center; border: 1.6px solid currentColor; }
.cz-nb-arlbl { font-size: 0.6rem; }

/* quality bars icon */
.cz-qbars { display: inline-flex; align-items: flex-end; gap: 2px; height: 16px; }
.cz-qbars i { width: 3px; height: 5px; background: currentColor; opacity: 0.3; border-radius: 1px; }
.cz-qbars i:nth-child(2) { height: 8px; }
.cz-qbars i:nth-child(3) { height: 11px; }
.cz-qbars i:nth-child(4) { height: 15px; }
.cz-qbars i.on { opacity: 1; }

/* input row glyph (audio/video/image icon when no thumbnail) */
.cz-nb-inglyph { width: 18px; height: 18px; flex: 0 0 auto; color: var(--text-muted); display: inline-flex; }
.cz-nb-inglyph svg { width: 18px; height: 18px; }
.cz-nb-inrow.is-disabled { opacity: 0.38; }
.cz-port.is-disabled { opacity: 0.3; pointer-events: none; }

/* duration buttons (compact) */
.cz-nb-durs button {
  min-width: 34px; padding: 5px 7px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-secondary); font-size: 0.72rem; font-weight: 600; cursor: pointer;
}
.cz-nb-durs button:hover { border-color: var(--border-strong); color: var(--text-primary); }
.cz-nb-durs button.is-active { border-color: var(--landing-accent); background: rgba(0,212,255,0.12); color: #eaffff; }

/* audio / video player elements inside nodes */
.cz-media-el { width: 100%; display: block; border-radius: 9px; background: #0b0e15; }
audio.cz-media-el { height: 38px; }
video.cz-media-el { max-height: 220px; }

/* credits + output */
.cz-nb-credits {
  margin-top: 12px; padding: 8px 10px; border-radius: 8px;
  background: rgba(55, 217, 150, 0.08); border: 1px solid rgba(55, 217, 150, 0.28);
  font-size: 0.84rem; font-weight: 700; color: #bdf5db;
}
.cz-nb-credits-val { font-variant-numeric: tabular-nums; }
.cz-nb-out { margin-top: 8px; font-size: 0.74rem; color: var(--text-muted); }
.cz-nb-result { margin-top: 2px; }
.cz-nb-result .cz-thumb { border: 1px solid rgba(55, 217, 150, 0.4); }

/* ── Invalid node (failed pre-run validation) ───────────────────────────── */
.cz-node.cz-invalid {
  border-color: var(--danger);
  animation: czInvalidPulse 1.6s ease-in-out infinite;
}
@keyframes czInvalidPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(255, 109, 145, 0.5), 0 0 22px 4px rgba(255, 60, 100, 0.3); }
  50%      { box-shadow: 0 0 0 3px rgba(255, 109, 145, 0.72), 0 0 36px 9px rgba(255, 60, 100, 0.5); }
}
.cz-tip {
  position: absolute;
  bottom: calc(100% + 9px);
  left: 0;
  max-width: 290px;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px;
  border-radius: 10px;
  background: linear-gradient(180deg, #3c1622, #2a0e16);
  border: 1px solid rgba(255, 109, 145, 0.55);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
  color: #ffd6df; font-size: 0.78rem; font-weight: 600; line-height: 1.35;
  z-index: 6;
}
.cz-tip:after {
  content: "";
  position: absolute; top: 100%; left: 22px;
  border: 6px solid transparent;
  border-top-color: #2a0e16;
}
.cz-tip-ic {
  flex: 0 0 auto;
  width: 17px; height: 17px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--danger); color: #2a0e16; font-weight: 900; font-size: 0.74rem;
}
.cz-tip-msg { flex: 1 1 auto; }
.cz-tip-x {
  flex: 0 0 auto;
  width: 18px; height: 18px; border-radius: 5px;
  border: none; background: transparent; color: #ffb3c2; cursor: pointer;
  font-size: 0.8rem; line-height: 1;
}
.cz-tip-x:hover { background: rgba(255, 109, 145, 0.2); color: #fff; }

/* ── Prompt @-mention popup ─────────────────────────────────────────────── */
.cz-mention {
  position: absolute; z-index: 22; width: 190px;
  background: var(--surface-strong); border: 1px solid var(--border-strong);
  border-radius: 10px; box-shadow: var(--shadow-glow); overflow: hidden; padding: 5px;
}
.cz-mention-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 6px 8px; border-radius: 7px; cursor: pointer;
  background: transparent; border: none; color: var(--text-primary); font-size: 0.84rem; text-align: left;
}
.cz-mention-item:hover, .cz-mention-item.is-active { background: rgba(0,212,255,0.14); }
.cz-mention-item img { width: 22px; height: 22px; border-radius: 4px; object-fit: cover; }
.cz-mention-ic { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; }

/* ── Per-node credit confirmation popover (anchored to its node) ─────────── */
.cz-node-confirm {
  position: absolute; z-index: 30; width: 200px;
  padding: 12px 13px; border-radius: 12px;
  background: var(--surface-strong); border: 1px solid rgba(0, 212, 255, 0.42);
  box-shadow: var(--shadow-glow);
  animation: czNcPop 0.12s ease-out;
}
@keyframes czNcPop { from { opacity: 0; transform: translateY(4px) scale(0.97); } to { opacity: 1; transform: none; } }
.cz-node-confirm:after {       /* arrow pointing down to the node */
  content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 7px solid transparent; border-top-color: var(--surface-strong);
}
.cz-node-confirm.cz-nc-below:after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--surface-strong); }
.cz-nc-title { font-weight: 700; font-size: 0.82rem; color: var(--text-primary); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cz-nc-credits { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; margin-bottom: 1px; }
.cz-nc-val { font-family: "DM Sans", sans-serif; font-weight: 800; font-size: 1.4rem; line-height: 1; color: #c6f7df; flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.cz-nc-unit { font-size: 0.82rem; font-weight: 600; color: #8fdcbb; }
.cz-nc-sub { font-size: 0.76rem; color: var(--text-muted); margin-bottom: 12px; }
.cz-nc-actions { display: flex; gap: 8px; }
.cz-nc-btn { flex: 1 1 0; padding: 7px 10px; border-radius: 9px; font-weight: 700; font-size: 0.82rem; cursor: pointer; border: 1px solid transparent; font-family: "DM Sans", sans-serif; }
.cz-nc-reject { background: transparent; border-color: var(--border-strong); color: var(--text-secondary); }
.cz-nc-reject:hover { color: var(--text-primary); border-color: var(--text-muted); }
.cz-nc-approve { background: linear-gradient(180deg, #37d996, #24b87c); color: #04231a; }
.cz-nc-approve:hover { filter: brightness(1.06); }

/* ── Workspace = tabs + palette + canvas (right of the rail) ─────────────── */
.cz-workspace { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.cz-workspace .cz-canvas { flex: 1 1 auto; min-height: 0; }

/* Workflow tabs */
.cz-tabs {
  display: flex; align-items: flex-end; gap: 4px;
  min-height: 38px; padding: 5px 8px 0;
  background: var(--bg-1); border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.cz-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 9px 8px; max-width: 200px;
  border: 1px solid var(--border); border-bottom: none;
  border-radius: 9px 9px 0 0; background: var(--surface);
  color: var(--text-secondary); font-size: 0.82rem; font-weight: 600;
  cursor: pointer; white-space: nowrap; user-select: none;
}
.cz-tab.is-active { background: var(--surface-strong); color: var(--text-primary); border-color: var(--border-strong); }
.cz-tab-name { overflow: hidden; text-overflow: ellipsis; }
.cz-tab-dot, .cz-wf-item-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warning); flex: 0 0 auto; }
.cz-tab-dot.spin, .cz-wf-item-dot.spin { animation: czPulse 1.1s ease-in-out infinite; }
@keyframes czPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.cz-tab-x { border: none; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 0.9rem; line-height: 1; padding: 1px 3px; border-radius: 4px; }
.cz-tab-x:hover { background: rgba(255, 255, 255, 0.12); color: var(--text-primary); }

/* Node palette (thin top header, icon-only + native hover tooltip) */
.cz-palette {
  display: flex; align-items: center; gap: 6px;
  height: 44px; padding: 0 10px;
  background: var(--surface-strong); border-bottom: 1px solid var(--border);
}
.cz-pal-btn {
  width: 30px; height: 30px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-secondary); cursor: pointer; transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.cz-pal-btn:hover { border-color: var(--landing-accent); color: var(--text-primary); background: rgba(0, 212, 255, 0.08); }
.cz-pal-btn svg { width: 17px; height: 17px; }
.cz-pal-btn .cz-pal-img { width: 20px; height: 20px; object-fit: contain; border-radius: 5px; display: block; }
.cz-pal-sep { width: 1px; height: 20px; background: var(--border); margin: 0 3px; flex: 0 0 auto; }

/* Import button (under New Workflow) */
.cz-import-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; padding: 9px 12px; border-radius: 11px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-secondary); font-family: "DM Sans", sans-serif; font-weight: 700; font-size: 0.9rem;
  cursor: pointer; transition: border-color 0.14s ease, color 0.14s ease, background 0.14s ease;
}
.cz-import-btn:hover { border-color: var(--landing-accent); color: var(--text-primary); background: rgba(0, 212, 255, 0.06); }
.cz-import-btn svg { width: 17px; height: 17px; }

/* Sidebar workflow list — card-like rows, invisible scrollbar, lazy-loaded */
.cz-wf-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 1px; }
.cz-wf-list::-webkit-scrollbar { width: 0; height: 0; }
.cz-wf-list { scrollbar-width: none; -ms-overflow-style: none; }
.cz-wf-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 8px 10px 11px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  border-left: 3px solid transparent;
  color: var(--text-secondary); font-size: 0.86rem; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.cz-wf-item:hover { background: rgba(255, 255, 255, 0.06); color: var(--text-primary); border-color: var(--border-strong); }
.cz-wf-item.is-active { border-color: rgba(0, 212, 255, 0.45); border-left-color: var(--landing-accent); color: var(--text-primary); background: rgba(0, 212, 255, 0.1); }
.cz-wf-item-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; background: var(--warning); }
.cz-wf-item-dot.idle { background: var(--border-strong); }
.cz-wf-item-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
.cz-wf-item-meta { font-size: 0.7rem; color: var(--text-muted); font-weight: 600; flex: 0 0 auto; background: rgba(255,255,255,0.06); padding: 1px 6px; border-radius: 8px; }
.cz-wf-item-x {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: 6px;
  border: none; background: transparent; color: var(--text-muted);
  cursor: pointer; font-size: 0.8rem; line-height: 1; opacity: 0; transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.cz-wf-item:hover .cz-wf-item-x { opacity: 1; }
.cz-wf-item-x:hover { background: rgba(255, 109, 145, 0.18); color: var(--danger); }
.cz-wf-more { padding: 8px 4px; text-align: center; color: var(--text-muted); font-size: 0.76rem; }
.cz-wf-empty { padding: 12px 4px; color: var(--text-muted); font-size: 0.82rem; line-height: 1.5; }

/* Rail bottom — Run + Download pinned to the bottom */
.cz-rail-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }

/* Empty canvas state */
.cz-empty-state {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: #5c6170; text-align: center; pointer-events: none;
}
.cz-empty-state p { margin: 0; font-size: 0.95rem; }
.cz-empty-sub { font-size: 0.8rem !important; color: #8a90a3; }
.cz-empty-sub code { background: rgba(20, 24, 34, 0.08); padding: 1px 5px; border-radius: 5px; }

/* ── Muse app bar (slim header: logo + library links + remaining credits) ── */
.cz-appbar {
  display: flex; align-items: center; gap: 12px;
  height: 48px; padding: 0 14px; flex: 0 0 auto;
  background: var(--surface-strong); border-bottom: 1px solid var(--border);
}
.cz-appbar-brand { display: inline-flex; align-items: center; gap: 0.45rem; flex: 0 0 auto; }
/* Hug the small logo (don't leave the 3rem box's empty space), so the icon↔wordmark
   gap matches the main site header instead of drifting apart. */
.cz-appbar-brand .brand-icon { display: inline-flex; width: auto; height: 26px; }
.cz-appbar-brand .brand-icon-image { height: 26px; width: auto; display: block; }
.cz-appbar-links { display: flex; align-items: center; gap: 4px; }
.cz-appbar-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 8px;
  color: var(--text-secondary); text-decoration: none; font-size: 0.82rem; font-weight: 600;
}
.cz-appbar-link:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.06); }
.cz-appbar-link svg { width: 16px; height: 16px; }
.cz-appbar-spacer { flex: 1 1 auto; }
.cz-appbar-credits {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
  padding: 5px 12px; border-radius: 999px;
  background: rgba(0, 212, 255, 0.1); border: 1px solid rgba(0, 212, 255, 0.32);
  color: var(--text-primary); text-decoration: none; font-size: 0.84rem; font-weight: 600;
}
.cz-appbar-credits:hover { background: rgba(0, 212, 255, 0.18); border-color: rgba(0, 212, 255, 0.5); }
.cz-appbar-credits svg { width: 15px; height: 15px; color: var(--landing-accent); }
.cz-appbar-credits-val { font-weight: 800; font-variant-numeric: tabular-nums; }
.cz-appbar-credits-unit { color: var(--text-muted); font-weight: 600; }

/* The Workflows drawer toggle is desktop-hidden (list shows inline). */
.cz-wf-toggle { display: none; }

/* ── Mobile "Muse is best on desktop" notice — stylized ──────────────────── */
.cz-device-modal {
  position: fixed; inset: 0; z-index: 90; display: none;
  align-items: center; justify-content: center; padding: 22px;
  background: rgba(4, 6, 11, 0.72); backdrop-filter: blur(6px);
}
.cz-device-modal.is-open { display: flex; }
.cz-device-card {
  position: relative; width: 100%; max-width: 360px; overflow: hidden;
  padding: 26px 22px 22px; border-radius: 20px; text-align: center;
  background: linear-gradient(180deg, rgba(22, 26, 36, 0.98), rgba(10, 13, 20, 0.98));
  border: 1px solid rgba(0, 212, 255, 0.4);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(0, 212, 255, 0.18);
  animation: czNcPop 0.16s ease-out;
}
.cz-device-glow {
  position: absolute; top: -60px; left: 50%; transform: translateX(-50%);
  width: 220px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 212, 255, 0.35), transparent 70%);
  pointer-events: none;
}
.cz-device-icon {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 64px; height: 64px; margin-bottom: 14px; border-radius: 18px;
  color: #04222b; background: linear-gradient(135deg, #00d4ff, #8ff1ff);
  box-shadow: 0 12px 30px rgba(0, 212, 255, 0.4);
}
.cz-device-icon svg { width: 32px; height: 32px; }
.cz-device-title { position: relative; margin: 0 0 8px; font-family: "Sora", sans-serif; font-weight: 800; font-size: 1.25rem; color: #fff; }
.cz-device-text { position: relative; margin: 0 0 20px; font-size: 0.88rem; line-height: 1.55; color: var(--text-secondary); }
.cz-device-actions { position: relative; display: flex; gap: 10px; }
.cz-device-btn { flex: 1 1 0; padding: 11px 14px; border-radius: 12px; font-weight: 700; font-size: 0.9rem; cursor: pointer; border: 1px solid transparent; font-family: "DM Sans", sans-serif; }
.cz-device-ghost { background: transparent; border-color: var(--border-strong); color: var(--text-secondary); }
.cz-device-ghost:hover { color: #fff; border-color: var(--text-muted); }
.cz-device-primary { background: linear-gradient(180deg, #00d4ff, #00b6e0); color: #04222b; }
.cz-device-primary:hover { filter: brightness(1.06); }

/* ── Touch: let the canvas pan/drag instead of scrolling the page ────────── */
.cz-canvas { touch-action: none; }
.cz-node-body, .cz-nb-prompt, .cz-note-input, .cz-search, .cz-mention { touch-action: auto; }

/* ── Mobile: compact icon rail + slide-over workflow drawer ──────────────── */
@media (max-width: 760px) {
  .cz-rail {
    position: relative;
    flex: 0 0 56px; width: 56px;
    padding: 10px 6px; gap: 8px;
  }
  .cz-btn-label, .cz-rail-title { display: none; }       /* icon-only rail */
  .cz-new-btn, .cz-import-btn, .cz-rail-btn {
    width: 44px; height: 44px; min-width: 0; padding: 0; gap: 0; margin: 0 auto; justify-content: center;
  }
  .cz-wf-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; margin: 0 auto; border-radius: 11px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); cursor: pointer;
  }
  .cz-wf-toggle svg { width: 20px; height: 20px; }

  /* Workflow list → slide-over drawer anchored to the rail's right edge */
  .cz-wf-list {
    position: absolute; left: 56px; top: 0; bottom: 0;
    width: 230px; max-width: calc(100vw - 70px);
    padding: 12px; gap: 6px;
    background: var(--surface-strong); border-right: 1px solid var(--border);
    box-shadow: 14px 0 36px rgba(0, 0, 0, 0.45);
    transform: translateX(-130%); transition: transform 0.22s ease;
    z-index: 20;
  }
  .cz-wf-list.is-drawer-open { transform: translateX(0); }

  .cz-palette { overflow-x: auto; scrollbar-width: none; }
  .cz-palette::-webkit-scrollbar { display: none; }

  .cz-appbar { height: 46px; gap: 8px; padding: 0 10px; }
}
@media (max-width: 480px) {
  .cz-appbar-link span { display: none; }   /* icon-only library links */
  .cz-appbar-link { padding: 7px; }
}

/* ── Node run timer + heads-up hint (overlay floats ABOVE the node) ────────── */
.cz-node-over {
  position: absolute;
  bottom: calc(100% + 7px);
  left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex-wrap: wrap;
  pointer-events: none;
  animation: czOverIn 0.22s ease both;
}
@keyframes czOverIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.cz-node-hint {
  max-width: 260px;
  padding: 6px 11px;
  border-radius: 8px;
  background: #11151f;                              /* solid dark — high contrast on the light canvas */
  border: 1px solid rgba(255, 191, 105, 0.55);     /* subtle amber edge keeps the "heads-up" tone */
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.cz-node-timer {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  color: var(--landing-accent);
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-card);
}
.cz-rail-btn.is-busy { opacity: 0.6; pointer-events: none; }

/* The shared top-up / login modals must sit ABOVE Muse's run modal (z 80). */
.cz-body .modal-backdrop { z-index: 120; }

/* Secondary link to the full pricing page (under the recharge button). */
.cz-pricing-link {
  display: block;
  margin-top: 9px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.14s ease;
}
.cz-pricing-link:hover { color: var(--landing-accent); }

/* Fixed info note pinned to the canvas — shown for every workflow. */
.cz-res-note {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(92vw, 560px);
  padding: 7px 13px;
  border-radius: 999px;
  background: #11151f;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e8eef6;
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1.3;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.cz-res-note svg { flex: 0 0 auto; width: 15px; height: 15px; color: var(--landing-accent); }
@media (max-width: 600px) {
  .cz-res-note { font-size: 0.68rem; padding: 6px 11px; bottom: 10px; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Muse — public shared-workflow viewer (muse-share.html)
   ───────────────────────────────────────────────────────────────────────────── */
.ms-share-main { flex: 1 1 auto; min-height: 60vh; padding: 32px 18px 64px; }
.ms-share-wrap { max-width: 920px; margin: 0 auto; }
.ms-share-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.ms-share-kicker {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--landing-accent); margin-bottom: 6px;
}
.ms-share-title {
  font-family: "Sora", sans-serif; font-weight: 800; font-size: 1.7rem; line-height: 1.15;
  color: var(--text-primary); word-break: break-word;
}
.ms-share-sub { margin-top: 6px; font-size: 0.85rem; color: var(--text-muted); }
.ms-share-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.ms-copy-btn, .ms-download-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 15px; border-radius: 10px; cursor: pointer;
  font-family: "DM Sans", sans-serif; font-weight: 700; font-size: 0.85rem;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-secondary);
  transition: border-color 0.14s ease, background 0.14s ease, color 0.14s ease;
}
.ms-copy-btn:hover { border-color: var(--landing-accent); color: var(--text-primary); }
.ms-copy-btn svg, .ms-download-btn svg { width: 17px; height: 17px; }
.ms-download-btn {
  border-color: transparent; color: #061018;
  background: linear-gradient(135deg, var(--landing-accent), #4fe3ff);
}
.ms-download-btn:hover { filter: brightness(1.06); }

.ms-share-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.ms-spinner {
  width: 34px; height: 34px; margin: 0 auto 14px; border-radius: 50%;
  border: 3px solid var(--border-strong); border-top-color: var(--landing-accent);
  animation: czSpin 0.8s linear infinite;
}
.ms-share-error-ic {
  width: 46px; height: 46px; margin: 0 auto 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 109, 145, 0.14); color: var(--danger);
  font-weight: 800; font-size: 1.4rem;
}
.ms-share-error h2 { font-family: "Sora", sans-serif; font-weight: 700; font-size: 1.2rem; color: var(--text-primary); margin-bottom: 8px; }
.ms-cta {
  display: inline-block; margin-top: 16px; padding: 10px 18px; border-radius: 10px;
  background: var(--landing-accent); color: #061018; font-weight: 700; text-decoration: none;
}

.ms-json-card { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface-strong); box-shadow: var(--shadow-card); }
.ms-json-head {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.ms-json-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--border-strong); }
.ms-json-dot:nth-child(1) { background: #ff6d91; }
.ms-json-dot:nth-child(2) { background: #ffbf69; }
.ms-json-dot:nth-child(3) { background: #37d996; }
.ms-json-name { margin-left: 8px; font-size: 0.78rem; color: var(--text-muted); font-weight: 600; }
.ms-json {
  margin: 0; padding: 18px;
  max-height: 64vh; overflow: auto;
  font-family: "SFMono-Regular", "Consolas", "Liberation Mono", Menlo, monospace;
  font-size: 0.8rem; line-height: 1.55; color: #cfe3ee;
  white-space: pre; tab-size: 2;
}
@media (max-width: 560px) {
  .ms-share-title { font-size: 1.35rem; }
  .ms-share-actions { width: 100%; }
  .ms-copy-btn, .ms-download-btn { flex: 1 1 auto; justify-content: center; }
}
