/* 节点画布 (template/studio/canvas.html + js/canvas.js) 和画布列表 */
.cv-page .stage { overflow: hidden; padding: 0; }
.cv-root { position: relative; height: 100%; min-height: 0; overflow: hidden; background: var(--bg); }
.cv-stage { position: absolute; inset: 0; overflow: hidden; outline: none; cursor: grab; touch-action: none; background-image: radial-gradient(rgba(255, 255, 255, .09) 1px, transparent 1px); }
.cv-stage.panning { cursor: grabbing; }
.cv-world { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; }
.cv-edges { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.cv-edges path { fill: none; stroke-width: 2.2; stroke-linecap: round; }
.cv-edges .hit { stroke: transparent; stroke-width: 16; pointer-events: stroke; cursor: pointer; }
.cv-edges .line.text { stroke: var(--cyan); }
.cv-edges .line.image { stroke: var(--pink); }
.cv-edges .line.temp { stroke: #fff; stroke-dasharray: 6 6; }
.cv-edges .line.on { stroke: #fff; stroke-width: 3.2; }

/* 节点 */
.cv-node { position: absolute; width: 300px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: 0 14px 34px -14px rgba(0, 0, 0, .8); cursor: default; }
.cv-node.on { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan), 0 14px 34px -14px rgba(0, 0, 0, .8); }
.cv-node.busy { border-color: var(--violet); }
.cv-node.note { background: #3a3417; border-color: rgba(250, 204, 21, .3); }
.cv-head { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--line-2); font-size: 13px; font-weight: 600; cursor: move; user-select: none; -webkit-user-select: none; touch-action: none; }
.cv-head .ic { width: 16px; height: 16px; flex: none; color: var(--cyan); }
.cv-head b { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 600; }
.cv-run { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border: 0; border-radius: 8px; color: #fff; background: var(--grad); font: inherit; font-size: 12px; cursor: pointer; }
.cv-run .ic { width: 12px; height: 12px; color: #fff; fill: currentColor; }
.cv-run:disabled { opacity: .55; cursor: wait; }
.cv-x { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 7px; background: none; color: var(--muted); cursor: pointer; }
.cv-x:hover { background: rgba(255, 255, 255, .08); color: var(--fg); }
.cv-x .ic { width: 14px; height: 14px; color: inherit; }
.cv-body { display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.cv-body textarea, .cv-body select { width: 100%; border: 1px solid var(--line-2); border-radius: 9px; background: rgba(0, 0, 0, .25); color: var(--fg); font: inherit; font-size: 13px; }
.cv-body textarea { display: block; min-height: 84px; padding: 8px 10px; line-height: 1.5; resize: vertical; }
.cv-body select { height: 32px; padding: 0 6px; }
.cv-body textarea:focus, .cv-body select:focus { outline: none; border-color: var(--cyan); }
.cv-node.note textarea { background: none; border: 0; color: #fde68a; min-height: 110px; }
.cv-row { display: flex; gap: 6px; min-width: 0; }
.cv-row select { flex: 1; min-width: 0; }
.cv-cost { flex: none; align-self: center; font-size: 12px; color: var(--muted); white-space: nowrap; }
.cv-result { max-height: 240px; overflow: auto; padding: 8px 10px; border-radius: 9px; background: rgba(0, 0, 0, .25); font-size: 13px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }
.cv-files { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px; }
.cv-file { position: relative; display: block; border-radius: 9px; overflow: hidden; background: rgba(0, 0, 0, .25); }
.cv-file img { display: block; width: 100%; height: auto; -webkit-user-drag: none; }
.cv-file a { position: absolute; right: 6px; top: 6px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: #fff; background: rgba(0, 0, 0, .6); }
.cv-file a .ic { width: 14px; height: 14px; }
.cv-body audio { width: 100%; height: 36px; }
.cv-actions { display: flex; justify-content: flex-end; gap: 6px; }
.cv-mini { height: 28px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: none; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; }
.cv-mini:hover { color: var(--fg); border-color: var(--cyan); }
.cv-pick { height: 96px; border: 1px dashed var(--line); border-radius: 10px; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.cv-pick:hover { color: var(--fg); border-color: var(--cyan); }
.cv-err { padding: 7px 10px; border-radius: 8px; font-size: 12px; line-height: 1.5; color: #fecaca; background: rgba(239, 68, 68, .14); overflow-wrap: anywhere; }
.cv-err a { margin-left: 6px; color: #fff; text-decoration: underline; }

/* 连接点 */
.cv-port { position: absolute; width: 22px; height: 22px; display: grid; place-items: center; cursor: crosshair; touch-action: none; z-index: 2; }
.cv-port i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--bg); background: var(--cyan); transition: transform .12s; }
.cv-port.image i { background: var(--pink); }
.cv-port:hover i, .cv-port.hot i { transform: scale(1.45); }
.cv-port.out { right: -12px; top: 9px; }
.cv-port.in { left: -12px; }
.cv-port em { position: absolute; right: 22px; font-style: normal; font-size: 11px; white-space: nowrap; color: var(--muted); pointer-events: none; opacity: 0; transition: opacity .12s; }
.cv-node:hover .cv-port em, .cv-port.hot em { opacity: 1; }

/* 顶栏 / 工具栏 */
.cv-bar { position: absolute; left: 12px; right: 12px; top: 12px; z-index: 10; display: flex; align-items: center; gap: 8px; pointer-events: none; }
.cv-bar > * { pointer-events: auto; }
.cv-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 11px; color: var(--muted); background: var(--panel-3); border: 1px solid var(--line-2); }
.cv-icon:hover { color: var(--fg); }
.cv-icon .ic { width: 18px; height: 18px; }
.cv-title { flex: 0 1 280px; min-width: 0; height: 38px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--panel-3); color: var(--fg); font: inherit; font-size: 14px; font-weight: 600; }
.cv-title:focus { outline: none; border-color: var(--cyan); }
.cv-save { flex: none; font-size: 12px; color: var(--muted); white-space: nowrap; pointer-events: none; }
.cv-save.err { color: #fca5a5; }
.cv-spacer { flex: 1; pointer-events: none; }
.cv-run-all { display: inline-flex; align-items: center; gap: 7px; flex: none; height: 38px; padding: 0 15px; border: 0; border-radius: 11px; color: #fff; background: var(--grad); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.cv-run-all .ic { width: 14px; height: 14px; fill: currentColor; }
.cv-run-all:disabled { opacity: .55; cursor: wait; }
.cv-tools { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); z-index: 10; display: flex; flex-direction: column; gap: 2px; padding: 5px; border-radius: 13px; background: var(--panel-3); border: 1px solid var(--line-2); }
.cv-tools button { position: relative; display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 9px; background: none; color: var(--muted); cursor: pointer; }
.cv-tools button:hover { background: rgba(255, 255, 255, .07); color: var(--fg); }
.cv-tools .ic { width: 19px; height: 19px; }
@media (any-hover: hover) {
  .cv-tools button:hover::after { content: attr(data-tip); position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%); padding: 5px 10px; border-radius: 8px; font-size: 12px; white-space: nowrap; color: #fff; background: #1e2536; border: 1px solid var(--line-2); pointer-events: none; }
}
.cv-zoom { position: absolute; right: 12px; bottom: 12px; z-index: 10; display: flex; border-radius: 11px; overflow: hidden; background: var(--panel-3); border: 1px solid var(--line-2); }
.cv-zoom button { min-width: 36px; height: 36px; padding: 0 6px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.cv-zoom button:hover { color: var(--fg); background: rgba(255, 255, 255, .06); }
#cv-zoom-val { min-width: 56px; font-variant-numeric: tabular-nums; }
.cv-empty { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(420px, calc(100% - 120px)); text-align: center; color: var(--muted); font-size: 13px; pointer-events: none; }
.cv-empty .ic { width: 38px; height: 38px; color: var(--cyan); }
.cv-empty b { font-size: 16px; color: var(--fg); }
.cv-palette { position: absolute; z-index: 20; width: 260px; max-height: 60%; overflow: auto; padding: 6px; border-radius: 13px; background: var(--panel-3); border: 1px solid var(--line-2); box-shadow: 0 20px 50px -10px rgba(0, 0, 0, .8); }
.cv-palette button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 9px; background: none; color: var(--fg); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.cv-palette button:hover, .cv-palette button:focus { outline: none; background: rgba(255, 255, 255, .08); }
.cv-palette .ic { width: 18px; height: 18px; flex: none; color: var(--cyan); }
.cv-palette small { display: block; color: var(--muted); font-size: 12px; }
.cv-drop { position: absolute; inset: 12px; z-index: 30; display: grid; place-items: center; border: 2px dashed var(--cyan); border-radius: 16px; background: rgba(7, 9, 15, .7); font-size: 15px; pointer-events: none; }
@media (max-width: 640px) {
  .cv-save { display: none; }
  .cv-run-all span { display: none; }
  .cv-run-all { width: 38px; padding: 0; justify-content: center; }
  .cv-tools { top: auto; bottom: 12px; left: 12px; right: 112px; transform: none; flex-direction: row; overflow-x: auto; }
  .cv-tools button { flex: none; }
  .cv-zoom #cv-zoom-out, .cv-zoom #cv-zoom-in { display: none; }
}

/* 画布列表 */
.cvl-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; }
.cvl-head h1 { margin: 0 0 6px; font: 700 30px var(--display); }
.cvl-head p { margin: 0; color: var(--muted); }
.cvl-new { display: flex; gap: 8px; flex-wrap: wrap; }
.cvl-new form { margin: 0; }
.cvl-usage { margin: 0 0 22px; font-size: 13px; color: var(--muted); }
.cvl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 16px; }
.cvl-card { min-width: 0; border-radius: 14px; overflow: hidden; background: var(--panel-2); border: 1px solid var(--line-2); }
.cvl-card:hover { border-color: var(--cyan); }
.cvl-thumb { display: grid; place-items: center; height: 160px; background: rgba(0, 0, 0, .25); color: var(--muted); }
.cvl-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cvl-thumb .ic { width: 34px; height: 34px; }
.cvl-meta { display: flex; align-items: center; gap: 8px; padding: 11px 12px; }
.cvl-meta > a { flex: 1; min-width: 0; }
.cvl-meta b, .cvl-meta small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cvl-meta small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.cvl-meta form { margin: 0; }
.cvl-del { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.cvl-del:hover { color: #fca5a5; background: rgba(239, 68, 68, .12); }
.cvl-del .ic { width: 16px; height: 16px; }
.cvl-none { padding: 70px 20px; text-align: center; color: var(--muted); }
.cvl-none .ic { width: 38px; height: 38px; color: var(--cyan); }
