/* wangyan-5285
 * 改图神器（/edit）页样式 —— 1:1 移植 业主指定的版式基准 的编辑器版式。
 * 品牌色映射到全站主题令牌（--primary 等），默认主题下与版式基准逐值一致；
 * 中性色/圆角/阴影用版式基准原值。作用域全部收在 .editor-page 内，不碰共享 style.css。
 */
/* 令牌挂在 :root 而不是 .editor-page：实用工具弹窗（#toolOverlay）在 .editor-page
   之外渲染，挂在页面上会导致弹窗内所有 var() 颜色失效——按钮变成白字透明底、标题消失。 */
/* 批次33：页底整块透明之后，编辑器里的字直接压在全站视频上，
   原来那套「浅底深字」的中性色是按实心 pastel 页底调的，一透明就不够读了。
   下面两个值是拿视频最坏帧（亮色 rgb(203,205,208) / 暗色 rgb(57,57,60)）
   逐条算出来的最低安全档，不是随手挑的：
     --editor-muted  #64748b → #475569   页头副标题 2.99 → 4.76（14px 正文要 4.5）
     --editor-accent 新增 #9a5b00        「导出图片」小标题原来内联 #e67e00，2.39 → 4.55
   暗色那套在文件末尾的 html[data-theme="dark"] 里另给。 */
:root {
    --editor-bg: #f4fcfd;
    --editor-surface: #ffffff;
    --editor-text: #005566;
    --editor-text-soft: #006678;
    --editor-muted: #475569;
    --editor-accent: #9a5b00;
    --editor-line: #cdf2f5;
    --editor-line-strong: #a3e8ed;
    --editor-primary: var(--primary);
    --editor-primary-dark: var(--primary-dark);
    --editor-primary-soft: var(--primary-light);
    --editor-radius: 10px;
    --editor-shadow: 0 14px 36px rgba(0, 85, 102, 0.08);
}

.editor-page {
    width: 100%;
    padding: 0 0 6px;
    /* 批次33：整页 pastel 渐变底整块删掉，页底交给全站视频背景。
       画布/面板各自有底（见下），不会露视频进工作区 */
}

.editor-header { text-align: center; padding: 0 0 24px; margin: 0; }
.editor-header h1 {
    font-size: 28px; font-weight: 850; margin: 0 0 4px;
    /* 批次33：渐变字要按「最亮那一端」算对比度。原来尾端 #00efbf 是荧光薄荷，
       压在视频最坏帧上只有 1.07:1 —— 标题的右半截等于看不见。
       换成深青 #0f766e 后 3.44:1，28px/850 属大字（WCAG 大字只需 3:1）刚好过线，
       左端仍是主题近黑 #18181b（11.12:1），整体从「黑→荧光绿」变成「黑→深青」，
       科技感保留、不再刺眼。暗色主题另有覆盖（末尾），仍走亮薄荷。 */
    background: linear-gradient(135deg, var(--editor-primary) 0%, #0f766e 100%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}
.editor-header p { color: var(--editor-muted); font-size: 14px; margin: 0; }

.editor-layout { display: flex; gap: 16px; align-items: stretch; min-height: 400px; }
.editor-layout-main {
    position: relative; display: grid; grid-template-columns: 360px minmax(0, 1fr);
    gap: 16px; align-items: start; flex: 1 1 0%;
}

/* 左侧工具手风琴外壳：半透明白卡 */
.editor-panels {
    position: relative; display: flex; flex-direction: column; overflow: hidden;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.04);
}
.editor-section-title {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 14px 18px; font-size: 14px; font-weight: 650;
    color: var(--editor-primary-dark); background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
/* 批次33：页里有两条 .editor-section-title，「编辑工具」跟主题走黑/白，
   「导出图片」原本是内联 style="color:#e67e00" 的橙色强调。内联压得住任何 CSS，
   而 #e67e00 在亮色主题压半透明面板只有 2.39:1（14px 要 4.5），是整页最差的一处；
   内联又没法用媒体查询翻面。所以把橙色收进这里当修饰类，走 --editor-accent 令牌：
   亮 #9a5b00(4.55:1) / 暗 #f0a04b(7.64:1)，强调色还在，两套主题都读得清。 */
.editor-section-title.accent { color: var(--editor-accent); }
.editor-section-title svg { width: 20px; height: 20px; flex-shrink: 0; }

.editor-accordion-item { border-bottom: 1px solid var(--editor-line); }
.editor-accordion-item:last-of-type { border-bottom: none; }
.editor-accordion-header {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 14px 18px; border: none; background: transparent;
    color: var(--editor-text-soft); font-size: 14px; font-weight: 650;
    cursor: pointer; text-align: left; user-select: none;
    transition: background 0.15s, color 0.15s;
}
.editor-accordion-header:hover { background: transparent; color: var(--editor-primary-dark); }
.editor-accordion-header svg { width: 20px; height: 20px; flex-shrink: 0; }
.editor-accordion-header .acc-arrow { margin-left: auto; width: 16px; height: 16px; opacity: 0.4; transition: transform 0.2s; }
.editor-accordion-item.open .editor-accordion-header {
    color: var(--editor-primary-dark); background: rgba(255, 255, 255, 0.85);
    font-size: 16px; font-weight: 750; border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.editor-accordion-item.open .editor-accordion-header .acc-arrow { transform: rotate(180deg); opacity: 0.8; }
.editor-accordion-body { display: none; padding: 8px 18px 18px; background: transparent; }
.editor-accordion-item.open .editor-accordion-body { background: rgba(255, 255, 255, 0.85); display: block; }

.editor-toolbar-section { margin-bottom: 0; }
.editor-toolbar-label {
    display: block; font-size: 14px; font-weight: 750; color: var(--editor-muted);
    text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px;
}
.editor-tool-group { display: flex; flex-direction: row; gap: 6px; }
.editor-tool-btn {
    flex: 1 1 0%; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 0 10px; border: 1.5px solid var(--editor-line); border-radius: 8px;
    background: #fff; color: var(--editor-text-soft); font-size: 14px; font-weight: 650;
    cursor: pointer; transition: 0.2s;
}
.editor-tool-btn:hover { border-color: var(--editor-primary); background: var(--editor-primary-soft); }
.editor-tool-btn.active { border-color: var(--editor-primary); background: var(--editor-primary-soft); color: var(--editor-primary-dark); }
.editor-tool-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.editor-tool-btn.primary {
    /* 主行动按钮（压缩并下载 / 下载图片 / 添加图片）。文字色跟主题令牌
       --primary-foreground 翻：亮色白字压深底、暗色深字压白底，两模式都可见。
       末尾「退青绿改主色」把暗色底翻成近白渐变，故这里不能写死白字（会隐形）。 */
    background: linear-gradient(135deg, var(--editor-primary) 0%, #0f766e 100%);
    color: var(--primary-foreground, #fff); border-color: transparent; box-shadow: 0 8px 18px rgba(0, 197, 239, 0.2);
    width: 100%; min-height: 40px; font-size: 14px;
}
.editor-tool-btn.primary:hover { background: linear-gradient(135deg, #0f766e 0%, var(--editor-primary) 100%); }
.editor-tool-btn.primary svg { width: 18px; height: 18px; }

.editor-input-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.editor-input-row label { font-size: 13px; font-weight: 650; color: var(--editor-muted); white-space: nowrap; min-width: 32px; }
.editor-input-row input, .editor-input-row select {
    height: 36px; padding: 0 10px; border: 1px solid var(--editor-line-strong); border-radius: 8px;
    outline: none; background: #f4fcfd; color: var(--editor-text); font-size: 14px; width: 100%; min-width: 0;
}
.editor-input-row input:focus, .editor-input-row select:focus {
    border-color: var(--editor-primary); box-shadow: 0 0 0 3px rgba(0, 197, 239, 0.14);
}
.editor-input-row select { cursor: pointer; }
.editor-input-row input[type="range"] {
    appearance: none; -webkit-appearance: none; width: auto; height: 6px; border-radius: 3px;
    background: var(--editor-line); outline: none; cursor: pointer; padding: 0; margin: 0; transition: background 0.2s;
}
.editor-input-row input[type="range"]::-webkit-slider-thumb {
    appearance: none; -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
    background: linear-gradient(135deg, var(--editor-primary) 0%, #00bfa5 100%);
    cursor: pointer; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 197, 239, 0.35);
    transition: transform 0.15s, box-shadow 0.15s;
}
.editor-input-row input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); box-shadow: 0 2px 10px rgba(0, 197, 239, 0.5); }

.editor-info { margin-top: 12px; padding: 10px 12px; background: #f9fefd; border-radius: 8px; font-size: 12px; color: var(--editor-muted); line-height: 1.6; }
.editor-info span { font-weight: 700; color: var(--editor-text-soft); }

/* 改尺寸预设 / 证件照比例 按钮（两行小方块） */
.editor-resize-preset-btn, .editor-crop-id-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 50px; padding: 6px 8px; border: 1.5px solid var(--editor-line-strong); border-radius: 8px;
    background: #f6fafd; color: var(--editor-text); cursor: pointer; transition: 0.15s; user-select: none;
    font-size: 13px;
}
.editor-resize-preset-btn:hover, .editor-crop-id-btn:hover {
    background: #e0f4f6; border-color: #00bfa5; transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0, 191, 165, 0.15);
}
.editor-resize-preset-btn.active, .editor-crop-id-btn.active {
    background: rgba(0, 197, 239, 0.1); color: #0891b2; border-color: var(--editor-primary);
    box-shadow: 0 0 0 1px rgba(0, 197, 239, 0.2);
}
.id-btn-sub { font-size: 11px; color: var(--editor-muted); }

/* 裁剪比例按钮：::before 画一个按比例的小框示意 */
.editor-crop-ratio-btn {
    flex: 1 1 0%; min-width: 64px; height: 34px; padding: 0 9px;
    border: 1px solid var(--editor-line-strong); border-radius: 6px; background: #f9fcfd;
    color: var(--editor-text); font-size: 13px; cursor: pointer; transition: 0.15s;
    display: inline-flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap;
}
.editor-crop-ratio-btn::before {
    content: ""; display: inline-block;
    width: calc(1px * var(--pw, 10)); height: calc(1px * var(--ph, 12));
    border: 1px solid #999; border-radius: 1px; flex-shrink: 0;
}
.editor-crop-ratio-btn:hover::before { border-color: #00bfa5; }
.editor-crop-ratio-btn.active::before { border-color: var(--editor-primary); background: rgba(0, 197, 239, 0.15); }
.editor-crop-ratio-btn[data-ratio="free"]::before, .editor-crop-ratio-btn[data-ratio="custom"]::before { display: none; }
.editor-crop-ratio-btn:hover { background: #e0f7fa; border-color: #00bfa5; }
.editor-crop-ratio-btn.active {
    background: rgba(0, 197, 239, 0.1); color: #0891b2; border-color: var(--editor-primary);
    font-weight: 600; box-shadow: 0 0 0 1px rgba(0, 197, 239, 0.2);
}
.editor-crop-actions { display: none; flex-direction: column; align-items: stretch; gap: 6px; }
.editor-crop-actions.visible { display: flex; }

/* 右侧画布卡 */
.editor-canvas-area {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px; box-shadow: 0 1px 3px rgba(16, 24, 40, 0.04);
    overflow: hidden; display: flex; flex-direction: column;
}
.editor-canvas-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; border-bottom: 1px solid var(--editor-line); gap: 12px;
}
.editor-canvas-toolbar .hint { color: var(--editor-muted); font-size: 13px; }
.editor-zoom-group { display: flex; align-items: center; gap: 2px; }
.editor-zoom-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
    border: 1px solid var(--editor-line); border-radius: 6px; background: #fff;
    color: var(--editor-text-soft); font-size: 15px; cursor: pointer; flex-shrink: 0;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.editor-zoom-btn:hover { border-color: var(--editor-primary); background: var(--editor-primary-soft); color: var(--editor-primary-dark); }
.editor-zoom-label { font-size: 12px; font-weight: 650; color: var(--editor-primary-dark); min-width: 38px; text-align: center; cursor: pointer; user-select: none; }
.editor-zoom-label:hover { text-decoration: underline; }
.editor-zoom-slider {
    width: 80px; height: 6px; appearance: none; -webkit-appearance: none;
    background: var(--editor-line); border-radius: 3px; outline: none; cursor: pointer; transition: background 0.2s;
}
.editor-zoom-slider::-webkit-slider-thumb {
    appearance: none; -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
    background: linear-gradient(135deg, var(--editor-primary) 0%, #00bfa5 100%);
    cursor: pointer; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 197, 239, 0.35);
}

/* 画布工作区：透明棋盘格 */
.editor-canvas-wrap {
    flex: 1 1 0%; min-height: 400px; max-height: 65vh; display: grid; place-items: center;
    padding: 16px; overflow: auto; position: relative;
    background:
        linear-gradient(45deg, #f8fafc 25%, transparent 25%) 0 0 / 24px 24px,
        linear-gradient(-45deg, #f8fafc 25%, transparent 25%) 0 12px,
        linear-gradient(45deg, transparent 75%, #f8fafc 75%) 12px -12px,
        linear-gradient(-45deg, transparent 75%, #f8fafc 75%) -12px 0,
        #fff;
}
.editor-canvas-wrap.has-crop { cursor: crosshair; }
.editor-crop-box {
    position: absolute; display: none; z-index: 2; pointer-events: none; box-sizing: border-box;
    border: 2px dashed #00c5ef; background: rgba(0, 197, 239, 0.12);
}
.editor-canvas-container { position: relative; display: inline-block; }
.editor-canvas-container img, .editor-canvas-container canvas {
    display: block; max-width: 100%; max-height: 58vh; border-radius: 4px; cursor: zoom-in;
}

/* 空态上传区（虚线框） */
.editor-upload-zone {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
    padding: 60px 20px; border: 2px dashed var(--editor-line-strong); border-radius: 12px;
    cursor: pointer; color: var(--editor-muted); transition: border-color 0.2s, background 0.2s;
}
.editor-upload-zone:hover { border-color: var(--editor-primary); background: var(--editor-primary-soft); }
.editor-upload-zone svg { width: 48px; height: 48px; stroke: var(--editor-line-strong); }
.editor-upload-zone p { margin: 0; font-size: 14px; font-weight: 650; }
.editor-upload-zone span { font-size: 12px; }

/* 导出区（左卡底部） */
.editor-export-row { display: flex; gap: 10px; align-items: center; padding: 12px 18px 16px; }
.editor-export-row select {
    flex: 1 1 0%; height: 40px; padding: 0 10px; border: 1px solid var(--editor-line-strong);
    border-radius: 8px; background: #fff; color: var(--editor-text); font-size: 14px; min-width: 0;
}
.editor-export-row .editor-tool-btn.primary { flex: 1 1 0%; width: auto; }

/* 实用工具网格：桌面 4 列 */
.edit-tools-head { display: flex; align-items: center; gap: 8px; margin: 22px 0 12px; font-size: 16px; font-weight: 750; color: #172033; }
.edit-tools-head svg { width: 18px; height: 18px; }
.edit-tools-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.edit-tool-card {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px;
    background: rgba(255, 255, 255, 0.6); border: 1px solid #e8eaed; border-radius: 12px;
    cursor: pointer; text-align: left; transition: all 0.2s; color: inherit;
}
.edit-tool-card:hover { border-color: var(--editor-primary); box-shadow: 0 4px 16px rgba(0, 197, 239, 0.12); transform: translateY(-1px); }
.edit-tool-ico {
    width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center;
    border-radius: 10px; font-size: 18px;
}
.edit-tool-card .t { font-size: 14px; font-weight: 700; color: #172033; display: block; }
/* 批次33：卡片底是半透明白（rgba(255,255,255,.6)），页底透明后它压在视频上，
   最坏帧合成出来是 rgb(234,235,236) 而不是纯白 —— 原来的 #667085 只有 4.17:1，
   12px 小字要 4.5，差一点点就差在「最坏那一帧」上。换 #475569 = 6.35:1。 */
.edit-tool-card .s { font-size: 12px; color: #475569; display: block; margin-top: 2px; }

/* 工具弹窗卡 */
.tool-overlay {
    position: fixed; inset: 0; z-index: 1050; display: none;
    align-items: center; justify-content: center; background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(3px);
}
.tool-overlay.show { display: flex; }
.tool-overlay .tool-card {
    /* 批次33：#fff 实底删掉交给家族玻璃（style.css 家族段），
       edit.css 加载在 style.css 之后，这里留 background 会反杀家族配方 */
    border-radius: 16px; box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
    padding: 26px 24px 22px; width: 880px; max-width: 96vw; max-height: 92vh;
    display: flex; flex-direction: column; gap: 12px; position: relative; overflow-y: auto;
}
.tool-card h3 {
    margin: 0; font-size: 22px; font-weight: 700; text-align: center;
    /* 批次33：同页头 h1，尾端荧光薄荷 #00efbf 压浅底 1.07:1，换深青 */
    background: linear-gradient(135deg, var(--editor-primary) 0%, #0f766e 100%);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
}
.tool-card h4 { margin: 0; font-size: 14px; font-weight: 650; color: var(--editor-primary-dark); }
.tool-close {
    position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border: none; border-radius: 8px;
    background: #f1f5f9; color: #475569; font-size: 16px; cursor: pointer;
}
.tool-close:hover { background: #e2e8f0; }

/* 顶部 toast */
.editor-toast-notice {
    position: fixed; top: 24px; left: 50%; transform: translateX(-50%); z-index: 10000;
    display: flex; align-items: center; gap: 8px; padding: 12px 24px; border-radius: 10px;
    font-size: 14px; font-weight: 600; box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    max-width: 90vw; pointer-events: auto;
}
.editor-toast-notice.toast-info { background: #e8f4fd; color: #0c5da5; border: 1px solid #bcddf5; }
.editor-toast-notice.toast-warn { background: #fff3e0; color: #b45309; border: 1px solid #ffd699; }
.editor-toast-notice.toast-success { background: #e6f7ee; color: #166534; border: 1px solid #a7e8c2; }

/* 响应式：平板两列工具、手机单列 + 手风琴改整宽叠在画布上 */
@media (max-width: 992px) {
    .editor-layout-main { grid-template-columns: 1fr; }
    .edit-tools-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 576px) {
    .edit-tools-grid { grid-template-columns: 1fr; }
    .editor-header h1 { font-size: 22px; }
    .editor-canvas-wrap { min-height: 300px; }
    /* 320px 下提示文字+缩放组一行放不下（卡片 overflow:hidden 会静默裁掉），换行排 */
    .editor-canvas-toolbar { flex-wrap: wrap; row-gap: 8px; }
    .editor-canvas-toolbar .hint { flex: 1 1 100%; }
    .editor-zoom-slider { width: 64px; }
    /* select 压不到最长选项以下，纵向堆叠各占整行 */
    .editor-export-row { flex-direction: column; align-items: stretch; }
    .editor-export-row select,
    .editor-export-row .editor-tool-btn.primary { flex: 1 1 auto; width: 100%; }
}

/* 暗色主题（批次19-A）：编辑器中性色与页底换成暗色，品牌色仍随主题令牌。
   令牌覆写挂 html[data-theme="dark"] 根级，理由同 :root——弹窗在 .editor-page 外。 */
html[data-theme="dark"] {
    --editor-bg: #0c0a18;
    --editor-surface: #171426;
    --editor-text: #bfe9f2;
    --editor-text-soft: #d7eef4;
    /* 批次33：暗色页底也透明了，字直接压视频最坏帧 rgb(57,57,60)。
       #9d96b6 实测 4.10:1，差在 4.5 线下 —— 抬到 #b3acc6 = 5.28:1。 */
    --editor-muted: #b3acc6;
    --editor-accent: #f0a04b;
    --editor-line: rgba(255, 255, 255, 0.10);
    --editor-line-strong: rgba(255, 255, 255, 0.20);
    --editor-primary-soft: rgba(var(--primary-rgb), 0.14);
}
/* 批次33：亮色那两处「深青收尾」在暗色下会反过来变成最暗的一端 ——
   #0f766e 压暗色视频最坏帧只有 2.10:1，所以暗色必须把渐变尾端换回亮薄荷。
   按钮更狠：暗色下 --editor-primary 翻成近白 #fafafa，白字压近白 = 1.05:1 全隐形，
   所以整个底改成实打实的深青渐变（白字 5.47:1），不再跟着主色翻。 */
html[data-theme="dark"] .editor-header h1,
html[data-theme="dark"] .tool-card h3 {
    background: linear-gradient(135deg, var(--editor-primary) 0%, #00efbf 100%);
    -webkit-background-clip: text; background-clip: text;
}
html[data-theme="dark"] .editor-tool-btn.primary,
html[data-theme="dark"] .editor-tool-btn.primary:hover {
    background: linear-gradient(135deg, #0f766e 0%, #155e75 100%);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}
html[data-theme="dark"] .editor-panels,
html[data-theme="dark"] .editor-canvas-area { background: rgba(23, 20, 38, 0.72); border-color: rgba(255, 255, 255, 0.08); }
html[data-theme="dark"] .editor-accordion-item.open .editor-accordion-header,
html[data-theme="dark"] .editor-accordion-item.open .editor-accordion-body { background: rgba(23, 20, 38, 0.9); }
html[data-theme="dark"] .editor-tool-btn,
html[data-theme="dark"] .editor-zoom-btn { background: #171426; }
html[data-theme="dark"] .editor-input-row input,
html[data-theme="dark"] .editor-input-row select,
html[data-theme="dark"] .editor-export-row select,
html[data-theme="dark"] #resizeWidth,
html[data-theme="dark"] #resizeHeight { background: #171426; color: #e9e5f2; border-color: rgba(255, 255, 255, 0.2); }
html[data-theme="dark"] .editor-canvas-wrap {
    background:
        linear-gradient(45deg, #1d1930 25%, transparent 25%) 0 0 / 24px 24px,
        linear-gradient(-45deg, #1d1930 25%, transparent 25%) 0 12px,
        linear-gradient(45deg, transparent 75%, #1d1930 75%) 12px -12px,
        linear-gradient(-45deg, transparent 75%, #1d1930 75%) -12px 0,
        #171426;
}
html[data-theme="dark"] .editor-resize-preset-btn,
html[data-theme="dark"] .editor-crop-ratio-btn,
html[data-theme="dark"] .editor-crop-id-btn { background: #171426; color: #e9e5f2; border-color: rgba(255, 255, 255, 0.2); }
/* 批次634：上面这条暗色底权重(0,2,1)压过 .xxx.active(0,2,0)，选中态只剩一圈 20% 的
   细阴影，暗色下几乎看不出选的是哪个 —— 与 b633 的 .nt-chip 同一类缺陷。补同等权重
   的暗色选中态（走会翻面的 --primary 族令牌），亮色那套完全不动。 */
html[data-theme="dark"] .editor-tool-btn.active,
html[data-theme="dark"] .editor-resize-preset-btn.active,
html[data-theme="dark"] .editor-crop-id-btn.active,
html[data-theme="dark"] .editor-crop-ratio-btn.active {
    background: rgba(var(--primary-rgb), 0.16);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 0 1px rgba(var(--primary-rgb), 0.35);
}
html[data-theme="dark"] .editor-crop-ratio-btn.active::before {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.25);
}
html[data-theme="dark"] .editor-info { background: rgba(255, 255, 255, 0.05); }
html[data-theme="dark"] .edit-tool-card { background: rgba(23, 20, 38, 0.72); border-color: rgba(255, 255, 255, 0.08); }
html[data-theme="dark"] .edit-tool-card .t { color: #e9e5f2; }
/* 批次33：跟亮色那条统一走令牌，别再各写一份硬编码色值 —— 亮色已经改成 #475569，
   暗色如果还钉死 #9d96b6，将来调 --editor-muted 就会两套各跑各的 */
html[data-theme="dark"] .edit-tool-card .s { color: var(--editor-muted); }
html[data-theme="dark"] .edit-tools-head { color: #e9e5f2; }
html[data-theme="dark"] .tool-card { background: #171426; }
html[data-theme="dark"] .tool-close { background: rgba(255, 255, 255, 0.08); color: #e9e5f2; }

/* ===== 批次258：/tools/{id} 单工具独立页（业主 11-08「点某一个，就只显示这一个单独的功能」）=====
   其他工具整块隐藏：DOM 保留（edit.js 加载时绑定全部控件，删了会空指针），display:none + aria-hidden。
   页头与内联卡走编辑器令牌族，暗色在文件末尾翻面。间距全用 margin（老内核禁 flex gap 口径随全站）。 */
.editor-page--single .is-single-hidden { display: none !important; }

.toolpage-hero { padding: 6px 0 20px; }
.toolpage-hero__crumb { display: flex; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--editor-muted); margin-bottom: 14px; }
.toolpage-hero__crumb a { color: var(--editor-muted); text-decoration: none; }
.toolpage-hero__crumb a:hover { color: var(--editor-primary); }
.toolpage-hero__sep { margin: 0 8px; opacity: .55; }
.toolpage-hero__here { color: var(--editor-text); font-weight: 600; }
.toolpage-hero__main { display: flex; align-items: center; }
.toolpage-hero__icon {
    flex: 0 0 56px; width: 56px; height: 56px; margin-right: 16px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 16px; font-size: 28px; color: var(--primary-foreground, #fff);
    background: linear-gradient(135deg, var(--editor-primary) 0%, #0f766e 100%);
    box-shadow: 0 10px 24px rgba(15, 118, 110, .25);
}
.toolpage-hero__text h1 { font-size: 26px; font-weight: 800; margin: 0 0 4px; color: var(--editor-text); }
.toolpage-hero__text p { margin: 0; font-size: 14px; color: var(--editor-muted); }
.toolpage-hero__tags { display: flex; flex-wrap: wrap; margin-top: 14px; }
.toolpage-hero__tags span {
    font-size: 12px; color: var(--editor-text-soft); padding: 4px 12px; margin: 0 8px 6px 0;
    border: 1px solid var(--editor-line-strong); border-radius: 999px;
    background: rgba(255, 255, 255, .5);
}
/* 弹窗类工具（二维码/拼接/九宫格等）：正文直接铺在页里，不弹弹窗 */
.toolpage-inline { max-width: 720px; margin: 0 auto; }
.toolpage-inline__card {
    background: rgba(255, 255, 255, .72); border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 14px; padding: 22px 22px 18px; box-shadow: var(--editor-shadow);
}
/* 单工具模式面板没有手风琴头，顶部补一点呼吸 */
.editor-page--single .editor-panels { padding-top: 6px; }

@media (max-width: 640px) {
    .toolpage-hero__icon { flex-basis: 46px; width: 46px; height: 46px; font-size: 23px; margin-right: 12px; border-radius: 13px; }
    .toolpage-hero__text h1 { font-size: 21px; }
    .toolpage-inline__card { padding: 16px 14px 12px; }
}

html[data-theme="dark"] .toolpage-hero__icon { background: linear-gradient(135deg, #0f766e 0%, #155e75 100%); box-shadow: 0 10px 24px rgba(0, 0, 0, .4); }
html[data-theme="dark"] .toolpage-hero__tags span { background: rgba(23, 20, 38, .72); border-color: rgba(255, 255, 255, .14); color: #d7eef4; }
html[data-theme="dark"] .toolpage-inline__card { background: rgba(23, 20, 38, .78); border-color: rgba(255, 255, 255, .08); }

/* ===== 批次433：转矢量 / 音视频分离 / 无限画布（只追加，不动上面任何一条）===== */
/* 无限画布要铺得开，单独放宽容器；其余两件仍走 720px */
.toolpage-inline--wide { max-width: 1120px; }
/* 转矢量：原图/矢量并排预览，棋盘格衬底让透明区域看得见 */
.vc-compare { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.vc-pane { flex: 1 1 240px; min-width: 0; text-align: center; }
.vc-pane__label { font-size: 12px; color: var(--editor-muted); margin-bottom: 6px; }
.vc-pane__img {
    max-width: 100%; max-height: 320px; border: 1px solid var(--editor-line-strong); border-radius: 8px;
    background-color: #fff;
    background-image: linear-gradient(45deg, #e9eef2 25%, transparent 25%, transparent 75%, #e9eef2 75%),
        linear-gradient(45deg, #e9eef2 25%, transparent 25%, transparent 75%, #e9eef2 75%);
    background-size: 16px 16px; background-position: 0 0, 8px 8px;
}
html[data-theme="dark"] .vc-pane__img {
    background-color: #232033;
    background-image: linear-gradient(45deg, #2c2940 25%, transparent 25%, transparent 75%, #2c2940 75%),
        linear-gradient(45deg, #2c2940 25%, transparent 25%, transparent 75%, #2c2940 75%);
}
/* 音视频分离：预览与进度 */
.av-video { width: 100%; max-height: 300px; border-radius: 8px; background: #000; margin-top: 10px; }
.av-progress { height: 8px; border-radius: 4px; background: var(--editor-line); overflow: hidden; margin-top: 10px; }
.av-progress__bar { height: 100%; width: 0; background: var(--editor-primary); transition: width .2s; }
/* 无限画布：工具条 + 点阵舞台 */
.ic-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.ic-bar .editor-tool-btn { margin: 0; }
.ic-zoom-label { font-size: 12px; color: var(--editor-muted); min-width: 44px; text-align: center; }
.ic-stage {
    position: relative; height: 62vh; min-height: 380px; max-height: 720px; overflow: hidden;
    border: 1px solid var(--editor-line-strong); border-radius: 10px;
    background-color: #f7fafc;
    background-image: radial-gradient(circle, rgba(0, 85, 102, .16) 1px, transparent 1px);
    background-size: 22px 22px;
    touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none;
}
.ic-stage canvas { position: absolute; left: 0; top: 0; }
.ic-empty {
    position: absolute; left: 0; top: 0; right: 0; bottom: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 20px; color: var(--editor-muted); font-size: 14px;
    pointer-events: none;
}
.ic-empty span { font-size: 12px; margin-top: 6px; opacity: .8; }
html[data-theme="dark"] .ic-stage {
    background-color: #171426;
    background-image: radial-gradient(circle, rgba(255, 255, 255, .16) 1px, transparent 1px);
}
@media (max-width: 640px) {
    .ic-stage { height: 55vh; min-height: 320px; }
    .vc-pane__img { max-height: 240px; }
}

/* ===== 批次434：工具页风格统一（业主11-10「不要有绿色有黑色，改为一种，和整体风格一致」）=====
   edit.css 只服务工具页（/edit 已退役 + /tools/{id} 独立页），不波及全站 style.css。
   把 editor 令牌重映射到整站主题令牌（随亮暗翻面），写死的青绿渐变(#0f766e/#155e75/#00efbf)
   与青白字(#bfe9f2/#d7eef4)全部退场，改走整站主色/前景。只追加，回滚＝删本段。 */
:root {
    --editor-bg: var(--background, #f4fcfd);
    --editor-surface: var(--card, #ffffff);
    --editor-text: var(--foreground, #1f2937);
    --editor-text-soft: var(--foreground, #1f2937);
    --editor-muted: var(--muted-foreground, #6b7280);
    --editor-accent: var(--primary, #00c5ef);
    --editor-line: var(--module-border, #e5e7eb);
    --editor-line-strong: var(--module-border, #e5e7eb);
    --editor-primary: var(--primary, #00c5ef);
    --editor-primary-dark: var(--primary-dark, #00a3c4);
    --editor-primary-soft: var(--primary-light, #e0f7fc);
    --editor-shadow: 0 14px 36px rgba(0, 0, 0, .08);
}
html[data-theme="dark"] {
    --editor-bg: var(--background, #0c0a18);
    --editor-surface: var(--card, #171426);
    --editor-text: var(--foreground, #fafafa);
    --editor-text-soft: var(--foreground, #fafafa);
    --editor-muted: var(--muted-foreground, #a1a1aa);
    --editor-accent: var(--primary, #00c5ef);
    --editor-line: var(--module-border, rgba(255, 255, 255, .10));
    --editor-line-strong: var(--module-border, rgba(255, 255, 255, .20));
    --editor-primary-soft: rgba(var(--primary-rgb, 0, 197, 239), .14);
}
/* 主按钮：青绿渐变 → 整站主色渐变（亮暗都跟主题令牌） */
.editor-tool-btn.primary { background: linear-gradient(135deg, var(--primary, #00c5ef) 0%, var(--primary-dark, #00a3c4) 100%); }
.editor-tool-btn.primary:hover { background: linear-gradient(135deg, var(--primary-dark, #00a3c4) 0%, var(--primary, #00c5ef) 100%); }
html[data-theme="dark"] .editor-tool-btn.primary,
html[data-theme="dark"] .editor-tool-btn.primary:hover { background: linear-gradient(135deg, var(--primary, #00c5ef) 0%, var(--primary-dark, #00a3c4) 100%); }
/* 页头图标退青绿 */
.toolpage-hero__icon { background: linear-gradient(135deg, var(--primary, #00c5ef) 0%, var(--primary-dark, #00a3c4) 100%); box-shadow: 0 10px 24px rgba(0, 0, 0, .12); }
html[data-theme="dark"] .toolpage-hero__icon { background: linear-gradient(135deg, var(--primary, #00c5ef) 0%, var(--primary-dark, #00a3c4) 100%); }
/* 渐变标题退荧光薄荷/青绿，改主色 */
.editor-header h1, .tool-card h3 { background: linear-gradient(135deg, var(--primary, #00c5ef) 0%, var(--primary-dark, #00a3c4) 100%); -webkit-background-clip: text; background-clip: text; }
html[data-theme="dark"] .editor-header h1,
html[data-theme="dark"] .tool-card h3 { background: linear-gradient(135deg, var(--primary, #00c5ef) 0%, var(--primary-dark, #00a3c4) 100%); -webkit-background-clip: text; background-clip: text; }
/* 信息条浅青底 → 中性卡底 */
.editor-info { background: var(--card, #f8fafc); }
/* 页头标签暗色青白字 → 主题前景 */
html[data-theme="dark"] .toolpage-hero__tags span { color: var(--foreground, #fafafa); background: rgba(255, 255, 255, .055); border-color: var(--module-border, rgba(255, 255, 255, .10)); }

/* ===== b649 无限画布 2.0（节点式草图 + AI 出图） ===== */
.cv-mount { width: 100%; }
.cv-app { position: relative; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.cv-top { min-width: 0; }
.cv-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cv-btn {
    display: inline-flex; align-items: center; justify-content: center; height: 32px; padding: 0 12px;
    border-radius: 8px; border: 1px solid var(--editor-line-strong); background: var(--editor-surface);
    color: var(--editor-text); font-size: 13px; line-height: 1; cursor: pointer; white-space: nowrap;
    transition: border-color .15s, color .15s, background .15s;
}
.cv-btn:hover { border-color: var(--editor-primary); color: var(--editor-primary); }
.cv-btn.is-on { background: var(--editor-primary-soft, rgba(0,197,239,.12)); border-color: var(--editor-primary); color: var(--editor-primary); }
.cv-btn--primary { background: var(--editor-primary); border-color: var(--editor-primary); color: #fff; }
.cv-btn--primary:hover { background: var(--editor-primary-dark, var(--editor-primary)); color: #fff; }
.cv-btn--accent { border-color: var(--editor-primary); color: var(--editor-primary); }
.cv-btn--icon { width: 32px; padding: 0; font-size: 16px; }
.cv-sep { width: 1px; height: 20px; background: var(--editor-line-strong); margin: 0 4px; }
.cv-zoom-label { font-size: 12px; color: var(--editor-muted); min-width: 44px; text-align: center; }
.cv-save { font-size: 12px; color: var(--editor-muted); margin-left: auto; padding-left: 8px; }
/* b659 分组清单：顶栏「分组」按钮弹出的组列表 */
.cv-gmenu {
    position: absolute; z-index: 60; display: none; width: 272px; max-width: calc(100vw - 24px);
    max-height: 300px; overflow: auto; padding: 6px; border-radius: 12px;
    border: 1px solid var(--editor-line-strong); background: var(--editor-surface);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .18);
}
.cv-gmenu__row { display: flex; align-items: stretch; gap: 4px; }
.cv-gmenu__row + .cv-gmenu__row { margin-top: 4px; }
.cv-gmenu__item {
    flex: 1 1 auto; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px;
    height: 36px; padding: 0 10px; border: 1px solid transparent; border-radius: 8px;
    background: transparent; color: var(--editor-text); font-size: 13px; cursor: pointer; text-align: left;
}
.cv-gmenu__item:hover { background: var(--editor-primary-soft, rgba(0, 197, 239, .12)); color: var(--editor-primary); }
.cv-gmenu__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-gmenu__count { flex: 0 0 auto; font-size: 11px; color: var(--editor-muted); }
.cv-gmenu__mini {
    flex: 0 0 auto; height: 36px; padding: 0 10px; border-radius: 8px;
    border: 1px solid var(--editor-line-strong); background: transparent; color: var(--editor-muted);
    font-size: 12px; cursor: pointer; white-space: nowrap;
}
.cv-gmenu__mini:hover { border-color: var(--editor-primary); color: var(--editor-primary); }
.cv-gmenu__empty { padding: 12px 12px 14px; font-size: 12px; line-height: 1.7; color: var(--editor-muted); }
.cv-body { position: relative; display: flex; gap: 10px; align-items: stretch; min-width: 0; overflow: hidden; }
.cv-stage {
    position: relative; flex: 1 1 auto; min-width: 0; height: 68vh; min-height: 460px; max-height: 840px;
    overflow: hidden; border: 1px solid var(--editor-line-strong); border-radius: 12px;
    background-color: #f7fafc;
    background-image: radial-gradient(circle, rgba(0, 85, 102, .16) 1px, transparent 1px);
    background-size: 22px 22px;
    touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none;
}
.cv-stage:active { cursor: grabbing; }
.cv-stage.is-drop { border-color: var(--editor-primary); box-shadow: inset 0 0 0 2px var(--editor-primary-soft, rgba(0,197,239,.15)); }
html[data-theme="dark"] .cv-stage {
    background-color: #141122;
    background-image: radial-gradient(circle, rgba(255, 255, 255, .14) 1px, transparent 1px);
}
.cv-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.cv-svg { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; color: var(--editor-primary); }
.cv-link { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; pointer-events: stroke; cursor: pointer; }
.cv-link:hover { stroke-width: 3; }
.cv-link.is-sel { stroke: #f43f5e; stroke-width: 2.5; }
.cv-link-label {
    font-size: 13px; font-weight: 600; fill: var(--editor-text);
    paint-order: stroke; stroke: #f7fafc; stroke-width: 4px; stroke-linejoin: round;
    text-anchor: middle; pointer-events: none;
}
html[data-theme="dark"] .cv-link-label { stroke: #141122; }
.cv-link-edit {
    position: absolute; z-index: 30; transform: translate(-50%, -50%);
    min-width: 150px; max-width: 260px; padding: 6px 10px; font-size: 13px;
    border: 1.5px solid var(--editor-primary); border-radius: 8px;
    background: var(--editor-surface); color: var(--editor-text);
    box-shadow: 0 6px 18px rgba(15, 23, 42, .18); outline: none;
    user-select: text; -webkit-user-select: text;
}
.cv-nodes { position: absolute; left: 0; top: 0; }
.cv-node { position: absolute; box-sizing: border-box; border-radius: 10px; }
.cv-node--image { background: transparent; }
.cv-node__img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 8px; pointer-events: none; }
.cv-node--text {
    padding: 6px 8px; color: var(--editor-text); border: 1px dashed transparent;
    background: rgba(255, 255, 255, .001);
}
.cv-node--text:hover { border-color: var(--editor-line-strong); }
.cv-node__text { width: 100%; height: 100%; overflow: hidden; white-space: pre-wrap; word-break: break-word; line-height: 1.5; outline: none; }
.cv-node--note {
    padding: 22px 16px 16px; background: #FFE8A3; color: #3f3421; border-radius: 6px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .14);
}
.cv-note-corner { position: absolute; right: 0; top: 0; width: 18px; height: 18px; border-radius: 0 6px 0 0; background: linear-gradient(225deg, rgba(0, 0, 0, .14) 0 50%, transparent 50%); }
.cv-note-ph { color: rgba(63, 52, 33, .55); }
.cv-node--rect, .cv-node--ellipse { background: var(--editor-primary-soft, #dbeafe); }
.cv-node--ellipse { border-radius: 50%; }
.cv-node.is-sel { box-shadow: 0 0 0 1px rgba(0, 197, 239, .35); }
.cv-node.is-link-from { box-shadow: 0 0 0 3px rgba(56, 189, 248, .5); }
.cv-node.is-editing {
    background: #fff; color: #111; border: 1px solid var(--editor-primary) !important; border-radius: 6px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .18); cursor: text;
}
.cv-node.is-editing .cv-node__text { cursor: text; }
.cv-ai-load {
    position: absolute; left: 0; top: 0; right: 0; bottom: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 10px; border-radius: 8px;
    background: rgba(15, 23, 42, .58); color: #fff; font-size: 13px; text-align: center; padding: 10px;
}
.cv-ai-load__txt { font-style: normal; line-height: 1.5; word-break: break-word; }
.cv-ai-load.is-error { background: rgba(127, 29, 29, .78); }
.cv-ai-load.is-error .cv-spin { display: none; }
.cv-spin { width: 22px; height: 22px; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: cvspin .8s linear infinite; }
@keyframes cvspin { to { transform: rotate(360deg); } }
.cv-overlay { position: absolute; left: 0; top: 0; right: 0; bottom: 0; pointer-events: none; z-index: 9000; }
.cv-sel { position: absolute; box-sizing: border-box; border: 1.5px solid var(--editor-primary); }
.cv-sel--multi { border-style: dashed; }
.cv-handle {
    position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; background: #fff;
    border: 1.5px solid var(--editor-primary); border-radius: 2px; pointer-events: auto;
}
.cv-handle--nw { left: 0; top: 0; cursor: nwse-resize; }
.cv-handle--n { left: 50%; top: 0; cursor: ns-resize; }
.cv-handle--ne { left: 100%; top: 0; cursor: nesw-resize; }
.cv-handle--e { left: 100%; top: 50%; cursor: ew-resize; }
.cv-handle--se { left: 100%; top: 100%; cursor: nwse-resize; }
.cv-handle--s { left: 50%; top: 100%; cursor: ns-resize; }
.cv-handle--sw { left: 0; top: 100%; cursor: nesw-resize; }
.cv-handle--w { left: 0; top: 50%; cursor: ew-resize; }
.cv-rot {
    position: absolute; left: 50%; top: -30px; width: 12px; height: 12px; margin-left: -6px;
    border-radius: 50%; background: #fff; border: 1.5px solid var(--editor-primary);
    pointer-events: auto; cursor: grab;
}
.cv-rot::after { content: ''; position: absolute; left: 50%; top: 12px; width: 1.5px; height: 18px; margin-left: -.75px; background: var(--editor-primary); }
.cv-selbar {
    position: absolute; z-index: 9500; display: none; align-items: center; gap: 2px; padding: 4px;
    border-radius: 8px; background: var(--editor-surface); border: 1px solid var(--editor-line-strong);
    box-shadow: var(--editor-shadow);
}
.cv-selbar button { height: 26px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--editor-text); font-size: 12px; cursor: pointer; }
.cv-selbar button:hover { background: var(--editor-primary-soft, rgba(0,197,239,.12)); }
.cv-selbar button[data-multi] { display: none; }
.cv-selbar.is-multi { flex-wrap: wrap; max-width: 340px; justify-content: center; }
.cv-selbar.is-multi button[data-multi] { display: inline-block; }
.cv-selbar__styles { display: inline-flex; align-items: center; gap: 2px; }
.cv-selbar__colors { display: inline-flex; align-items: center; gap: 4px; }
.cv-selbar__styles em { min-width: 20px; text-align: center; font-style: normal; font-size: 11px; color: var(--editor-muted); }
.cv-selbar__sep { width: 1px; height: 16px; margin: 0 4px; background: var(--editor-line-strong); }
.cv-selbar .cv-swatch {
    width: 16px; height: 16px; padding: 0; border-radius: 50%;
    border: 1.5px solid var(--editor-line-strong); box-shadow: none;
}
.cv-selbar .cv-swatch:hover { border-color: var(--editor-primary); }
.cv-selbar .cv-swatch.is-on { border-color: var(--editor-primary); box-shadow: 0 0 0 2px var(--editor-primary-soft, rgba(0,197,239,.25)); }
.cv-selbar .cv-swatch--auto {
    background: var(--editor-surface);
    background-image: linear-gradient(135deg, transparent 45%, #ef4444 45%, #ef4444 55%, transparent 55%);
}
.cv-selbar__ink, .cv-selbar__shape { display: inline-flex; align-items: center; gap: 2px; }
.cv-node--path { background: transparent; }
.cv-node__ink {
    position: absolute; left: 0; top: 0; width: 100%; height: 100%;
    overflow: visible; pointer-events: none;
}
.cv-node__ink polyline { fill: none; stroke: var(--editor-text); stroke-linecap: round; stroke-linejoin: round; }
.cv-node.is-locked { cursor: default; }
.cv-sel.is-locked { border-style: dashed; border-color: #f59e0b; }
.cv-lock {
    position: absolute; left: -8px; top: -8px; z-index: 3; height: 18px; padding: 0 6px;
    border-radius: 999px; background: #f59e0b; color: #fff; font-size: 11px; line-height: 18px;
    font-weight: 600; pointer-events: none; box-shadow: 0 2px 6px rgba(15, 23, 42, .25);
}
.cv-group {
    position: absolute; right: -8px; top: -8px; z-index: 3; height: 18px; padding: 0 6px;
    border-radius: 999px; background: #8b5cf6; color: #fff; font-size: 11px; line-height: 18px;
    font-weight: 600; pointer-events: none; box-shadow: 0 2px 6px rgba(15, 23, 42, .25);
    max-width: 148px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cv-group-edit { min-width: 220px; max-width: 320px; }
.cv-ctx {
    position: absolute; z-index: 9600; display: none; min-width: 140px; padding: 5px;
    border-radius: 10px; background: var(--editor-surface); border: 1px solid var(--editor-line-strong);
    box-shadow: var(--editor-shadow);
}
.cv-ctx__item {
    display: block; width: 100%; box-sizing: border-box; padding: 7px 10px; border: 0; border-radius: 6px;
    background: transparent; color: var(--editor-text); font-size: 13px; text-align: left; cursor: pointer;
}
.cv-ctx__item:hover { background: var(--editor-primary-soft, rgba(0, 197, 239, .12)); }
.cv-ctx__item.is-danger { color: #e11d48; }
.cv-ctx__sep { height: 1px; margin: 4px 6px; background: var(--editor-line-strong); }
html[data-theme="dark"] .cv-ctx { background: #1d1a2e; }
.cv-guide { position: absolute; display: none; background: #f43f5e; pointer-events: none; z-index: 8000; }
.cv-guide--v { top: 0; bottom: 0; width: 1px; }
.cv-guide--h { left: 0; right: 0; height: 1px; }
.cv-marquee { position: absolute; display: none; border: 1px dashed var(--editor-primary); background: rgba(56, 189, 248, .12); pointer-events: none; z-index: 8500; }
.cv-link-hint {
    position: absolute; left: 50%; top: 12px; transform: translateX(-50%); display: none;
    padding: 6px 12px; border-radius: 999px; background: rgba(15, 23, 42, .82); color: #fff;
    font-size: 12px; white-space: nowrap; pointer-events: none; z-index: 9000;
}
.cv-empty {
    position: absolute; left: 0; top: 0; right: 0; bottom: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 6px; padding: 24px; text-align: center;
    color: var(--editor-muted); pointer-events: none;
}
.cv-empty strong { font-size: 16px; color: var(--editor-text); }
.cv-empty span { max-width: 440px; font-size: 12px; line-height: 1.7; }
.cv-empty__acts { display: flex; gap: 8px; margin-top: 10px; pointer-events: auto; }
.cv-side {
    position: relative; flex: 0 0 300px; width: 300px; min-width: 0; display: flex; flex-direction: column;
    height: 68vh; min-height: 460px; max-height: 840px; overflow: hidden;
    border: 1px solid var(--editor-line-strong); border-radius: 12px; background: var(--editor-surface);
}
.cv-side__tabs { display: flex; border-bottom: 1px solid var(--editor-line); flex: 0 0 auto; }
.cv-side__tabs button {
    flex: 1; height: 40px; border: 0; border-bottom: 2px solid transparent; background: transparent;
    color: var(--editor-muted); font-size: 13px; cursor: pointer;
}
.cv-side__tabs button.is-on { color: var(--editor-primary); border-bottom-color: var(--editor-primary); font-weight: 600; }
.cv-pane { display: none; flex: 1 1 auto; flex-direction: column; gap: 8px; padding: 14px; overflow-y: auto; }
.cv-pane.is-on { display: flex; }
.cv-lbl { font-size: 12px; color: var(--editor-muted); margin-top: 4px; }
.cv-input, .cv-prompt {
    width: 100%; box-sizing: border-box; padding: 8px 10px; border-radius: 8px;
    border: 1px solid var(--editor-line-strong); background: var(--editor-bg);
    color: var(--editor-text); font-size: 13px;
}
.cv-prompt { min-height: 88px; resize: vertical; line-height: 1.6; }
.cv-input:focus, .cv-prompt:focus { outline: none; border-color: var(--editor-primary); }
.cv-two { display: flex; gap: 8px; }
.cv-two > * { flex: 1 1 0; min-width: 0; }
.cv-check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--editor-text); cursor: pointer; }
.cv-check.is-off { opacity: .5; cursor: not-allowed; }
.cv-gen { width: 100%; height: 38px; margin-top: 4px; }
.cv-ai-status { font-size: 12px; color: var(--editor-muted); min-height: 16px; line-height: 1.6; }
.cv-ai-status.is-error { color: #e11d48; }
.cv-ai-status.is-ok { color: #059669; }
.cv-hint { margin: 4px 0 0; font-size: 12px; line-height: 1.7; color: var(--editor-muted); }
.cv-danger { color: #dc2626; border-color: rgba(220, 38, 38, .4); }
.cv-light {
    position: fixed; left: 0; top: 0; right: 0; bottom: 0; z-index: 9999;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
    padding: 24px; background: rgba(0, 0, 0, .82);
}
.cv-light img { max-width: 94vw; max-height: 78vh; object-fit: contain; border-radius: 8px; }
.cv-light__bar { display: flex; gap: 10px; }
.cv-light__bar .cv-btn--primary { background: #fff; border-color: #fff; color: #111; }
.cv-fallback { padding: 40px 16px; text-align: center; color: var(--editor-muted); font-size: 14px; }
/* b649 小地图 / 底纹 / 全屏 */
.cv-mini {
    position: absolute; right: 10px; bottom: 10px; z-index: 8800;
    width: 168px; height: 118px; display: none; padding: 0;
    border: 1px solid var(--editor-line-strong); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .22);
    overflow: hidden; cursor: crosshair; user-select: none; -webkit-user-select: none; touch-action: none;
}
.cv-mini canvas { display: block; width: 100%; height: 100%; }
.cv-stage.cv-bg--grid {
    background-image:
        linear-gradient(rgba(0, 85, 102, .10) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 85, 102, .10) 1px, transparent 1px);
    background-size: 24px 24px, 24px 24px;
}
.cv-stage.cv-bg--plain { background-image: none; }
html[data-theme="dark"] .cv-stage.cv-bg--grid {
    background-image:
        linear-gradient(rgba(255, 255, 255, .09) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .09) 1px, transparent 1px);
}
.cv-app.is-full {
    position: fixed; left: 0; top: 0; right: 0; bottom: 0; z-index: 9700;
    padding: 10px; gap: 8px; border-radius: 0; overflow: hidden;
    background: var(--editor-bg, #f4f7fb);
}
.cv-app.is-full .cv-body { flex: 1 1 auto; min-height: 0; }
.cv-app.is-full .cv-stage, .cv-app.is-full .cv-side { height: auto; min-height: 0; max-height: none; }
@media (max-width: 900px) {
    .cv-side {
        position: absolute; right: 0; top: 0; bottom: 0; width: min(92vw, 340px); height: auto;
        min-height: 0; max-height: none; z-index: 9600; border-radius: 12px;
        box-shadow: 0 18px 50px rgba(15, 23, 42, .28);
        transform: translateX(calc(100% + 24px)); transition: transform .22s ease;
    }
    .cv-app.is-panel-open .cv-side { transform: none; }
    .cv-stage { height: 64vh; min-height: 380px; max-height: none; }
    .cv-save { display: none; }
}
@media (max-width: 640px) {
    .cv-tools .cv-btn { padding: 0 9px; font-size: 12px; }
    .cv-stage { height: 60vh; min-height: 340px; }
    .cv-selbar button { padding: 0 7px; }
    .cv-selbar.is-multi { max-width: calc(100vw - 24px); }
    .cv-mini { width: 118px; height: 84px; right: 8px; bottom: 8px; }
    .cv-app.is-full { padding: 6px; }
}
/* b650 失败节点重试 / 画板搜索列表 */
.cv-ai-acts { display: flex; gap: 8px; margin-top: 2px; }
.cv-ai-acts button {
    height: 26px; padding: 0 12px; border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .55); background: rgba(255, 255, 255, .14);
    color: #fff; font-size: 12px; cursor: pointer;
}
.cv-ai-acts button:hover { background: rgba(255, 255, 255, .26); }
.cv-ai-acts button:disabled { opacity: .6; cursor: default; }
.cv-ai-retry { font-weight: 600; }
.cv-board-list {
    display: flex; flex-direction: column; gap: 4px; max-height: 186px; overflow-y: auto;
    padding: 2px; border: 1px solid var(--editor-line); border-radius: 8px; background: var(--editor-bg);
}
.cv-board-list:empty { display: none; }
.cv-board-item {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent;
    color: var(--editor-text); font-size: 13px; text-align: left; cursor: pointer;
}
.cv-board-item:hover { background: var(--editor-primary-soft, rgba(0, 197, 239, .10)); }
.cv-board-item.is-on { background: var(--editor-primary-soft, rgba(0, 197, 239, .16)); color: var(--editor-primary); font-weight: 600; }
.cv-board-item__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-board-item__meta { flex: 0 0 auto; font-style: normal; font-size: 11px; color: var(--editor-muted); }
.cv-board-empty { padding: 14px 8px; text-align: center; font-size: 12px; color: var(--editor-muted); }
