* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #20c997;
    --primary-hover: #16966f;
    --text: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: #999999;
    --surface: #fff;
    --surface-hover: #f0f0f0;
    --border: #e0e0e0;
    --canvas-bg: #fafafa;
    --canvas-grid: #e0e0e0;
    --body-bg: #f8f8f8;
    --toolbar-bg: #fff;
    --input-bg: #fafafa;
}

body.dark {
    --primary: #5dd6b1;
    --primary-hover: #20c997;
    --text: #e5e5e5;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --surface: #262626;
    --surface-hover: #3a3a3a;
    --border: #3a3a3a;
    --canvas-bg: #0d0d0d;
    --canvas-grid: #1a1a1a;
    --body-bg: #0d0d0d;
    --toolbar-bg: #262626;
    --input-bg: #262626;
}

html {
    background: var(--canvas-bg);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--canvas-bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Visually hide accessibility-only labels while keeping them available to screen readers. */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

body.dark {
    color: var(--text);
}

/* 项目首页 */
.home-page {
    flex: 1 0 auto;
    min-height: 100vh;
    color: #f2f3f5;
    background-color: #111213;
    background-image:
        radial-gradient(circle, rgba(255, 255, 255, 0.055) 0, rgba(255, 255, 255, 0.055) 0.85px, transparent 1.15px),
        linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 220px);
    background-size: 32px 32px, 100% 100%;
}

.home-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    padding: 12px 32px;
    background: rgba(19, 20, 20, 0.92);
    backdrop-filter: blur(14px);
    border-bottom: 0;
}

.home-logo {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 16px;
    font-weight: 600;
    color: #eef0f2;
}

.home-logo svg {
    width: 19px;
    height: 19px;
    color: #5dd6b1;
}

.home-actions {
    display: flex;
    gap: 8px;
}

.home-actions .action-btn {
    min-height: 36px;
    padding: 7px 12px;
    border-color: #36383b;
    background: #222325;
    color: #c8cbd0;
    box-shadow: none;
}

.home-actions .action-btn:hover {
    border-color: #505359;
    background: #2c2e31;
    color: #fff;
}

.home-actions .user-btn {
    background: #e9ebee !important;
    color: #17181a !important;
}

.home-content {
    width: 100%;
    max-width: 1340px;
    margin: 0 auto;
    padding: 20px 32px 64px;
}

.home-launch {
    width: min(1080px, 100%);
    margin: 0 auto;
}

.home-actions .home-icon-action {
    width: 36px;
    min-width: 36px;
    padding-inline: 0;
    justify-content: center;
}

.home-launch-heading {
    margin-bottom: 22px;
    text-align: center;
}

.home-launch-kicker,
.recent-projects-heading>div>span {
    display: block;
    margin-bottom: 5px;
    color: #737b86;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0;
}

.home-launch-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    margin-bottom: 12px;
    padding: 0 10px;
    border: 1px solid rgba(93, 214, 177, .22);
    border-radius: 999px;
    color: #9ce8cf;
    background: rgba(43, 155, 119, .08);
    letter-spacing: .04em;
}

.home-launch-kicker svg {
    width: 14px;
    height: 14px;
}

.home-launch h1 {
    margin: 0;
    color: #f4f5f6;
    font-size: clamp(30px, 4.2vw, 52px);
    font-weight: 760;
    line-height: 1.14;
    letter-spacing: -.045em;
}

.home-launch h1 em {
    color: transparent;
    background: linear-gradient(100deg, #91f0d0, #a6a1ff);
    background-clip: text;
    -webkit-background-clip: text;
    font-style: normal;
}

.home-launch-heading p {
    margin: 12px auto 0;
    color: #8c939d;
    font-size: 14px;
    line-height: 1.65;
}

.home-prompt-box {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    border: 1px solid #40454a;
    border-radius: 18px;
    background:
        radial-gradient(520px 170px at 10% -35%, rgba(76, 211, 166, .08), transparent 70%),
        #1c1e20;
    box-shadow: 0 24px 68px rgba(0, 0, 0, 0.32);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.home-prompt-box:focus-within {
    border-color: rgba(93, 214, 177, .62);
    box-shadow: 0 0 0 3px rgba(93, 214, 177, .08), 0 30px 82px rgba(0, 0, 0, 0.38);
    transform: translateY(-1px);
}

.home-prompt-box textarea {
    display: block;
    width: 100%;
    min-height: 172px;
    resize: vertical;
    padding: 22px 24px 8px;
    border: 0;
    outline: 0;
    background: transparent;
    color: #f2f3f5;
    font: inherit;
    font-size: 16px;
    line-height: 1.65;
}

.home-prompt-box textarea::placeholder {
    color: #7d848d;
}

.home-prompt-hint {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0 24px;
    color: #707780;
    font-size: 11px;
    line-height: 1.4;
    transition: opacity .18s ease, transform .18s ease;
}

.home-prompt-hint i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #69dcb6;
    box-shadow: 0 0 0 4px rgba(105, 220, 182, .08);
}

.home-prompt-box.has-value .home-prompt-hint {
    opacity: 0;
    transform: translateY(-3px);
    pointer-events: none;
}

.home-prompt-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 62px;
    padding: 10px 12px 14px;
}

.home-input-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.home-prompt-submit {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 12px;
}

.home-prompt-submit>span {
    color: #676d75;
    font-size: 11px;
    white-space: nowrap;
}

.home-node-entry,
.home-submit-btn,
.home-skill-chip {
    border: 1px solid #3b3e42;
    background: #282a2d;
    color: #c4c8ce;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.home-node-entry {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 11px;
}

.home-node-entry svg {
    width: 14px;
    height: 14px;
}

.home-node-entry.home-blank-btn {
    border-color: rgba(101, 224, 183, .28);
    color: #b9f1de;
    background: rgba(56, 181, 140, .1);
}

.home-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(145deg, #eafff7, #72dfba);
    color: #07110d;
    box-shadow: 0 8px 20px rgba(63, 204, 156, .18);
}

.home-submit-btn svg {
    width: 20px;
    height: 20px;
}

.home-node-entry:hover,
.home-skill-chip:hover {
    border-color: #5c626b;
    background: #32353a;
    color: #fff;
}

.home-node-entry.home-blank-btn:hover {
    border-color: rgba(101, 224, 183, .52);
    color: #effff9;
    background: rgba(56, 181, 140, .18);
}

.home-submit-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-2px);
}

.home-submit-btn:disabled {
    color: #8b9490;
    background: #33383a;
    box-shadow: none;
    cursor: not-allowed;
    filter: none;
    opacity: .58;
    transform: none;
}

.home-skill-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 9px;
    margin-top: 16px;
}

.home-skill-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 8px 13px;
    border-radius: 8px;
    font-size: 13px;
}

.home-skill-chip svg {
    width: 17px;
    height: 17px;
    color: #72cdb1;
}

.home-skill-chip:nth-child(2) svg {
    color: #e4a85b;
}

.home-skill-chip:nth-child(3) svg {
    color: #62c69c;
}

.home-skill-chip:nth-child(4) svg {
    color: #d9869e;
}

.home-skill-more svg {
    color: #aeb4bd;
}

.recent-projects {
    margin-top: 64px;
}

.recent-projects-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.recent-projects-heading h2 {
    margin: 0;
    color: #f0f1f3;
    font-size: 20px;
    font-weight: 600;
}

.recent-projects-heading small {
    color: #777e87;
    font-size: 12px;
}

.recent-projects-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.project-batch-toggle,
.project-batch-toolbar button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 11px;
    color: #aeb8c4;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid #3b3f46;
    border-radius: 8px;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: color .16s ease, border-color .16s ease, background .16s ease;
}

.project-batch-toggle:hover,
.project-batch-toggle.active,
.project-batch-toolbar button:hover:not(:disabled) {
    color: #effbf7;
    background: rgba(71, 143, 221, 0.16);
    border-color: rgba(111, 181, 255, .52);
}

.project-batch-toggle svg,
.project-batch-toolbar button svg {
    width: 15px;
    height: 15px;
}

.project-batch-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 54px;
    padding: 10px 13px;
    margin: -4px 0 15px;
    color: #bac4ce;
    background: linear-gradient(90deg, rgba(60, 127, 211, .16), rgba(42, 45, 50, .72));
    border: 1px solid rgba(102, 171, 247, .28);
    border-radius: 10px;
}

.project-batch-toolbar[hidden] {
    display: none;
}

.project-batch-toolbar>div:first-child {
    display: flex;
    align-items: baseline;
    min-width: 0;
    gap: 10px;
}

.project-batch-toolbar strong {
    flex: 0 0 auto;
    color: #e4faf3;
    font-size: 13px;
}

.project-batch-toolbar span {
    overflow: hidden;
    color: #94a5b5;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-batch-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
}

.project-batch-toolbar button.danger {
    color: #ffb8b8;
    border-color: rgba(239, 108, 108, .32);
}

.project-batch-toolbar button.danger:hover:not(:disabled) {
    color: #fff4f4;
    background: rgba(202, 71, 71, .18);
    border-color: rgba(255, 133, 133, .55);
}

.project-batch-toolbar button:disabled {
    opacity: .46;
    cursor: not-allowed;
}

.projects-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.project-card {
    position: relative;
    min-width: 0;
    background: #222325;
    border: 1px solid #33363a;
    border-radius: 9px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.project-card:hover {
    border-color: #575b62;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
    transform: translateY(-2px);
}

.project-card.new-project {
    min-height: 214px;
    border: 1px dashed #484c52;
    background: rgba(35, 36, 38, 0.78);
}

.project-card.new-project:hover {
    border-color: #5a9f89;
    background: #27292c;
}

.project-card .card-content {
    min-height: 158px;
    padding: 38px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.project-card .plus-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-bottom: 10px;
    border: 1px solid #464a50;
    border-radius: 8px;
    color: #b8bec6;
}

.project-card .plus-icon svg {
    width: 19px;
    height: 19px;
}

.project-card .card-title {
    font-size: 14px;
    font-weight: 600;
    color: #e5e7ea;
}

.project-card .card-desc {
    min-height: 55px;
    padding: 12px 14px;
    border-top: 1px solid #323438;
    color: #747b85;
    font-size: 11px;
}

.project-card .card-preview {
    aspect-ratio: 16 / 9;
    height: auto;
    background: #1c1d1f;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
}

.project-card .card-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.project-card .card-info {
    padding: 11px 13px 13px;
    border-top: 1px solid #303236;
}

.project-card .card-info .info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.project-card .card-info .project-id {
    font-size: 10px;
    color: #747b84;
}

.project-card .card-info .more-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: #2c2e31;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #8d939c;
}

.project-card .card-info .project-title {
    font-size: 14px;
    font-weight: 600;
    color: #e5e7e9;
    margin-bottom: 4px;
}

.project-card .card-info .project-time {
    font-size: 11px;
    color: #737a83;
}

@media (max-width: 720px) {
    .home-header {
        padding: 10px 14px;
    }

    .home-logo {
        font-size: 14px;
    }

    .home-actions .action-btn {
        padding: 7px 9px;
        font-size: 0;
    }

    .home-actions .action-btn svg {
        margin: 0;
    }

    .home-content {
        padding: 16px 14px 42px;
    }

    .home-launch h1 {
        font-size: 21px;
    }

    .home-prompt-box textarea {
        min-height: 132px;
        padding: 15px 15px 8px;
    }

    .home-prompt-hint { margin-inline: 15px; }
    .home-prompt-footer { align-items: flex-end; }
    .home-prompt-submit>span { display: none; }
    .home-input-tools { gap: 6px; }
    .home-node-entry { width: 36px; padding: 0; }
    .home-node-entry span { display: none; }

    .home-submit-btn {
        margin-left: auto;
    }

    .home-skill-list {
        justify-content: flex-start;
    }

    .home-skill-chip {
        flex: 1 1 calc(50% - 8px);
        justify-content: flex-start;
    }

    .recent-projects {
        margin-top: 44px;
    }

    .recent-projects-heading small {
        display: none;
    }

    .recent-projects-actions {
        gap: 0;
    }

    .project-batch-toggle {
        min-height: 30px;
        padding: 0 9px;
    }

    .project-batch-toolbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 9px;
        padding: 11px;
    }

    .project-batch-toolbar>div:first-child {
        width: 100%;
    }

    .project-batch-toolbar span {
        white-space: normal;
    }

    .project-batch-actions {
        width: 100%;
    }

    .project-batch-toolbar button {
        flex: 1;
        padding: 0 8px;
    }

    .projects-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
}

/* 返回按钮 */
.back-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.back-btn:hover {
    background: var(--surface-hover);
}

.project-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: 12px;
}

/* 顶部工具栏 */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 48px;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.toolbar-left h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
}

.new-project-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.new-project-btn:hover {
    background: var(--text-secondary);
    color: #fff;
}

.toolbar-center {
    display: flex;
    gap: 8px;
}

.tool-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: var(--surface-hover);
    border-color: var(--border);
    color: var(--text-secondary);
}

.tool-btn .icon {
    font-size: 16px;
}

.toolbar-right {
    display: flex;
    gap: 10px;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--surface-hover);
}

.action-btn.primary {
    background: var(--text-secondary);
    border-color: var(--border);
    color: #fff;
}

.action-btn.primary:hover {
    background: #374151;
}

/* 🎯 智能体悬浮指令栏（选中智能体节点时显示，对标 LibTV 底部悬浮输入框） */
.agent-composer-bar {
    position: fixed;
    left: 50%;
    bottom: 84px;
    transform: translateX(-50%) translateY(12px);
    width: min(560px, calc(100vw - 40px));
    background: #1c1e21;
    border: 1px solid #34383f;
    border-radius: 16px;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.4);
    padding: 14px 16px 12px;
    z-index: 900;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.agent-composer-bar.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.agent-composer-refs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.agent-composer-refs:empty {
    display: none;
}

.agent-composer-ref-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #262a2f;
    border: 1px solid #383d44;
    border-radius: 8px;
    padding: 4px 9px 4px 4px;
    font-size: 12px;
    color: #c7cbd1;
    max-width: 160px;
}

.agent-composer-ref-chip img {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    object-fit: cover;
    flex-shrink: 0;
}

.agent-composer-ref-chip i {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: #8a9099;
}

.agent-composer-ref-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-composer-textarea {
    width: 100%;
    min-height: 44px;
    max-height: 120px;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    color: #e6e8eb;
    font-size: 13px;
    line-height: 1.5;
    font-family: inherit;
}

.agent-composer-textarea::placeholder {
    color: #6b7078;
}

.agent-composer-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.agent-composer-model {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    color: #9aa0a8;
}

.agent-composer-model i {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.agent-composer-select {
    flex: 1 1 auto;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: #c7cbd1;
    font-size: 12px;
    cursor: pointer;
}

.agent-composer-select option {
    background: #1c1e21;
    color: #e6e8eb;
}

.agent-composer-credit {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    color: #9aa0a8;
    flex-shrink: 0;
}

.agent-composer-credit i {
    width: 13px;
    height: 13px;
    color: #f5c451;
}

.agent-composer-send {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e6e8eb;
    border: none;
    color: #1c1e21;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease;
}

.agent-composer-send:hover {
    background: #ffffff;
}

.agent-composer-send:disabled {
    background: #4a4e55;
    color: #8a9099;
    cursor: not-allowed;
}

.agent-composer-send i {
    width: 15px;
    height: 15px;
}

/* 智能体节点保留本体智能体库入口，避免旧流程丢失选择器和运行按钮 */
body.canvas-mode .node.agent-node .creation-footer {
    display: flex;
}

/* 画布容器 */
.canvas-container {
    position: fixed;
    top: 48px;
    left: 0;
    right: 0;
    bottom: 0;
    transition: left 0.2s ease;
    will-change: left;
    overflow: hidden;
    background:
        linear-gradient(90deg, var(--canvas-grid) 1px, transparent 1px),
        linear-gradient(var(--canvas-grid) 1px, transparent 1px);
    background-size: 20px 20px;
    background-color: var(--canvas-bg);
    cursor: default;
}

.canvas-container:active {
    cursor: default;
}

.canvas-container.grabbing {
    cursor: grabbing;
}

/* 按住空格时临时覆盖节点和按钮自己的光标；输入控件继续保留文本编辑光标。 */
.canvas-container.space-pan-ready,
.canvas-container.space-pan-ready .canvas,
.canvas-container.space-pan-ready .node,
.canvas-container.space-pan-ready .node *,
.canvas-container.space-pan-ready .canvas-node-group,
.canvas-container.space-pan-ready .canvas-node-group * {
    cursor: grab !important;
}

.canvas-container.space-pan-ready textarea,
.canvas-container.space-pan-ready input,
.canvas-container.space-pan-ready select,
.canvas-container.space-pan-ready [contenteditable="true"] {
    cursor: text !important;
}

.canvas-container.space-pan-active,
.canvas-container.space-pan-active * {
    cursor: grabbing !important;
}

/* 空画布快捷工作流：首页只提供起点，不遮挡画布操作。 */
.empty-canvas-launcher {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 14;
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(1120px, calc(100vw - 260px));
    transform: translate(-50%, -50%);
    transform-origin: center center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 180ms ease, visibility 180ms ease;
}

.empty-canvas-launcher.is-visible {
    opacity: 1;
    visibility: visible;
}

.projects-grid.is-batch-selecting,
.recent-projects.is-batch-selecting {
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.projects-grid.is-batch-selecting .project-card:not(.new-project) {
    cursor: cell;
}

.projects-grid.is-batch-selecting img {
    -webkit-user-drag: none;
    user-drag: none;
}

.projects-grid.is-batch-dragging,
.projects-grid.is-batch-dragging *,
.recent-projects.is-batch-dragging,
.recent-projects.is-batch-dragging * {
    cursor: crosshair !important;
}

.project-card.is-selected {
    border-color: #5dd6b1;
    box-shadow: 0 0 0 2px rgba(76, 159, 243, .25), 0 13px 32px rgba(0, 0, 0, .25);
}

.project-card-select {
    position: absolute;
    z-index: 3;
    top: 10px;
    left: 10px;
    display: grid;
    width: 24px;
    height: 24px;
    padding: 0;
    place-items: center;
    color: transparent;
    background: rgba(15, 17, 20, .74);
    border: 1px solid rgba(230, 239, 249, .38);
    border-radius: 7px;
    cursor: pointer;
    opacity: 0;
    transform: scale(.9);
    transition: opacity .16s ease, color .16s ease, background .16s ease, border-color .16s ease, transform .16s ease;
}

.project-card-select svg {
    width: 15px;
    height: 15px;
}

.projects-grid.is-batch-selecting .project-card-select,
.project-card:hover .project-card-select,
.project-card.is-selected .project-card-select {
    opacity: 1;
    transform: scale(1);
}

.project-card.is-selected .project-card-select {
    color: #0d2c49;
    background: #8adbc3;
    border-color: #8adbc3;
}

.project-selection-rect {
    position: fixed;
    z-index: 9500;
    pointer-events: none;
    background: rgba(75, 159, 240, .16);
    border: 1px solid #6fc8ad;
    border-radius: 5px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .2), inset 0 0 28px rgba(102, 183, 255, .08);
}

/* 新建项目 / 空白画布的首屏只展示默认导航。
   用户创建出节点后 launcher 自动隐藏，节点列表随即恢复。 */
body.canvas-mode:has(.empty-canvas-launcher.is-visible) .node-sidebar {
    display: none !important;
}

.empty-canvas-launcher-inner {
    width: 100%;
}

.empty-canvas-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
    color: #aab1bd;
}

.empty-canvas-hint>span:last-child {
    display: grid;
    gap: 3px;
}

.empty-canvas-hint strong {
    color: #e8ebf0;
    font-size: 16px;
    font-weight: 600;
}

.empty-canvas-hint small {
    color: #747d8b;
    font-size: 12px;
}

.empty-canvas-pointer {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid #3d4653;
    border-radius: 50%;
    background: #20242a;
    color: #f5f7fa;
}

.empty-canvas-pointer svg {
    width: 18px;
    height: 18px;
}

.beginner-idea-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    width: min(760px, 100%);
    margin: 0 auto 14px;
    padding: 8px;
    border: 1px solid #3b4552;
    border-radius: 14px;
    background: rgba(30, 34, 40, .96);
    box-shadow: 0 14px 36px rgba(0, 0, 0, .22);
    pointer-events: auto;
}

.beginner-idea-form textarea {
    min-width: 0;
    height: 46px;
    padding: 12px 13px;
    resize: none;
    border: 0;
    outline: 0;
    color: #eef2f6;
    background: transparent;
    font: inherit;
    font-size: 13px;
    line-height: 1.55;
}

.beginner-idea-form textarea::placeholder { color: #7d8795; }

.beginner-idea-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    align-self: stretch;
    min-width: 104px;
    padding: 0 18px;
    border: 0;
    border-radius: 10px;
    color: #10231d;
    background: #68d7b4;
    font-weight: 700;
    cursor: pointer;
}

.beginner-idea-form button svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.beginner-idea-form button:disabled { cursor: default; opacity: .45; }
.beginner-idea-form button:not(:disabled):hover { background: #7ce4c3; }

.beginner-or,
.beginner-safety-note {
    color: #75808e;
    font-size: 11px;
    text-align: center;
}

.beginner-or { margin: 0 0 10px; }
.beginner-safety-note {
    margin: 12px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    line-height: 1.35;
}
.beginner-safety-note > svg {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    stroke-width: 1.8;
}

.starter-workflow-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.starter-workflow-card {
    position: relative;
    min-width: 0;
    height: 92px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 20px;
    align-items: center;
    gap: 12px;
    padding: 15px 16px;
    overflow: hidden;
    border: 1px solid #353b45;
    border-radius: 8px;
    background: #202329;
    color: #e8ebf0;
    text-align: left;
    cursor: pointer;
    pointer-events: auto;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.starter-workflow-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--starter-accent, #20c997);
}

.starter-workflow-card:hover {
    transform: translateY(-2px);
    border-color: #596372;
    background: #252930;
}

.starter-workflow-card:focus-visible {
    outline: 2px solid #5dd6b1;
    outline-offset: 3px;
}

.starter-workflow-card>span:nth-child(2) {
    min-width: 0;
    display: grid;
    gap: 5px;
}

.starter-workflow-card strong,
.starter-workflow-card small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.starter-workflow-card strong {
    font-size: 14px;
    font-weight: 600;
}

.starter-workflow-card small {
    color: #8e97a5;
    font-size: 11px;
}

.starter-workflow-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    background: color-mix(in srgb, var(--starter-accent, #20c997) 15%, #242830);
    color: var(--starter-accent, #20c997);
}

.starter-workflow-icon svg {
    width: 21px;
    height: 21px;
}

.starter-workflow-arrow {
    width: 17px;
    height: 17px;
    color: #697382;
}

.starter-story {
    --starter-accent: #5dd6b1;
}

.starter-character {
    --starter-accent: #e8a44d;
}

.starter-video {
    --starter-accent: #63c99d;
}

.starter-digital {
    --starter-accent: #d87a91;
}

@media (max-width: 1100px) {
    .empty-canvas-launcher {
        width: min(680px, calc(100vw - 230px));
    }

    .starter-workflow-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .empty-canvas-launcher {
        width: min(520px, calc(100vw - 40px));
    }

    .empty-canvas-launcher-inner {
        width: 100%;
        max-width: 100%;
    }

    .empty-canvas-hint {
        margin-bottom: 18px;
    }

    .beginner-idea-form { grid-template-columns: 1fr; }
    .beginner-idea-form button { min-height: 42px; }

    .starter-workflow-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .starter-workflow-card {
        height: 76px;
    }
}

.canvas {
    position: relative;
    width: 100000px;
    height: 100000px;
    transform-origin: 0 0;
    transform: translate(0px, 0px) scale(1);
    text-rendering: optimizeLegibility;
}

/* 仅在拖动画布时启用合成层，结束交互后立即恢复浏览器的清晰文字栅格化。 */
.canvas-container.canvas-interacting .canvas { will-change: transform; }
.canvas .node, .canvas .node input, .canvas .node textarea, .canvas .node button, .canvas .node select {
    -webkit-font-smoothing: subpixel-antialiased;
}

.connections-layer {
    position: absolute;
    pointer-events: none;
    z-index: 1;
}

.connections-layer path {
    fill: none;
    pointer-events: stroke;
    cursor: pointer;
    transition: stroke-width 0.15s, stroke 0.15s;
    vector-effect: non-scaling-stroke;
}

.connections-layer path.conn-line {
    stroke: var(--text-secondary);
    stroke-width: 1;
}

.connections-layer path.conn-hit {
    stroke: transparent;
    stroke-width: 16;
}

.connections-layer g:hover .conn-line {
    stroke: #8293aa;
    stroke-width: 1.45;
}

/* ========== v1.31 画布小地图 ========== */
.canvas-minimap {
    --minimap-default: #8b98a8;
    --minimap-text: #9b8afb;
    --minimap-image: #54cfac;
    --minimap-video: #69aef8;
    --minimap-audio: #e7a742;
    --minimap-agent: #e27cab;
    --minimap-skill: #b991ff;
    --minimap-style: #de8c67;
    --minimap-effect: #d36ff0;
    --minimap-editStudio: #61c985;
    --minimap-whiteboard: #d8c997;
    --minimap-connection: rgba(164, 176, 190, .28);
    position: fixed;
    right: 18px;
    bottom: 82px;
    z-index: 2400;
    width: 220px;
    height: 166px;
    display: none;
    overflow: hidden;
    border: 1px solid rgba(119, 128, 139, .44);
    border-radius: 14px;
    background: rgba(31, 33, 37, .94);
    color: #edf1f4;
    box-shadow: 0 12px 34px rgba(0, 0, 0, .34);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    user-select: none;
    transition: width .2s ease, height .2s ease, border-radius .2s ease, opacity .2s ease;
}
body.canvas-mode .canvas-minimap { display: flex; flex-direction: column; }
body.canvas-mode .canvas-minimap.is-user-hidden { display: none; }
body.media-viewport-focus-active .canvas-minimap { opacity: 0; pointer-events: none; }
.canvas-minimap-header {
    flex: 0 0 34px;
    min-height: 34px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 6px 0 10px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.canvas-minimap-title { min-width: 0; display: inline-flex; align-items: center; gap: 6px; font-size: 11px; }
.canvas-minimap-title svg { width: 14px; height: 14px; color: #65ddb9; }
.canvas-minimap-title b { font-weight: 700; white-space: nowrap; }
.canvas-minimap-count { margin-right: auto; color: #929aa5; font-size: 9px; white-space: nowrap; }
.canvas-minimap-action {
    width: 25px;
    height: 25px;
    flex: 0 0 25px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #9ca5b0;
    cursor: pointer;
}
.canvas-minimap-action:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.canvas-minimap-action:focus-visible { outline: 2px solid #65ddb9; outline-offset: 1px; }
.canvas-minimap-action svg { width: 13px; height: 13px; }
.canvas-minimap-surface {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    background:
        radial-gradient(circle, rgba(255,255,255,.09) 0, rgba(255,255,255,.09) .6px, transparent .85px) 0 0 / 12px 12px,
        rgba(12, 14, 17, .64);
    cursor: crosshair;
    touch-action: none;
}
.canvas-minimap-surface:focus-visible { outline: 2px solid #65ddb9; outline-offset: -3px; }
.canvas-minimap-stage { position: absolute; inset: 0; display: block; width: 100%; height: 100%; pointer-events: none; }
.canvas-minimap-viewport {
    position: absolute;
    min-width: 6px;
    min-height: 6px;
    border: 1.5px solid #65ddb9;
    border-radius: 3px;
    background: rgba(82, 211, 164, .15);
    box-shadow: 0 0 0 1px rgba(8, 16, 14, .45), inset 0 0 12px rgba(82, 211, 164, .08);
    pointer-events: none;
}
.canvas-minimap-viewport.is-offscreen { border-style: dashed; background: rgba(82, 211, 164, .24); }
.canvas-minimap-empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 5px;
    color: #777f89;
    font-size: 10px;
    pointer-events: none;
}
.canvas-minimap-empty[hidden] { display: none; }
.canvas-minimap-empty svg { width: 18px; height: 18px; }
.canvas-minimap.is-dragging .canvas-minimap-surface { cursor: grabbing; }
.canvas-minimap.is-collapsed {
    width: 44px;
    height: 44px;
    border-radius: 13px;
}
.canvas-minimap.is-collapsed .canvas-minimap-header { flex: 1; justify-content: center; padding: 0; border: 0; }
.canvas-minimap.is-collapsed :is(.canvas-minimap-title, .canvas-minimap-count, .canvas-minimap-action:not(.canvas-minimap-toggle), .canvas-minimap-surface) { display: none; }
.canvas-minimap.is-collapsed .canvas-minimap-toggle { width: 44px; height: 44px; flex-basis: 44px; color: #65ddb9; }
.canvas-minimap.is-collapsed .canvas-minimap-toggle svg { width: 18px; height: 18px; }

body:not(.dark).canvas-mode .canvas-minimap {
    --minimap-default: #657586;
    --minimap-text: #6656d9;
    --minimap-image: #168264;
    --minimap-video: #337abf;
    --minimap-audio: #a96800;
    --minimap-agent: #b34776;
    --minimap-skill: #7e57c2;
    --minimap-style: #b55f38;
    --minimap-effect: #9a42b5;
    --minimap-editStudio: #26834b;
    --minimap-whiteboard: #89783e;
    --minimap-connection: rgba(78, 92, 108, .25);
    color: #242a32;
    border-color: #afb8c1;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 10px 30px rgba(31, 35, 40, .18);
}
body:not(.dark).canvas-mode .canvas-minimap-header { border-bottom-color: #d0d7de; }
body:not(.dark).canvas-mode .canvas-minimap-title svg,
body:not(.dark).canvas-mode .canvas-minimap.is-collapsed .canvas-minimap-toggle { color: #168264; }
body:not(.dark).canvas-mode .canvas-minimap-count { color: #66717e; }
body:not(.dark).canvas-mode .canvas-minimap-action { color: #5f6b78; }
body:not(.dark).canvas-mode .canvas-minimap-action:hover { color: #1f2328; background: #eaeef2; }
body:not(.dark).canvas-mode .canvas-minimap-surface {
    background:
        radial-gradient(circle, rgba(89,99,110,.22) 0, rgba(89,99,110,.22) .6px, transparent .85px) 0 0 / 12px 12px,
        #f6f8fa;
}
body:not(.dark).canvas-mode .canvas-minimap-viewport {
    border-color: #168264;
    background: rgba(32, 201, 151, .14);
    box-shadow: 0 0 0 1px rgba(255,255,255,.75), inset 0 0 10px rgba(32,201,151,.08);
}
body.shortplay-canvas-mode .canvas-minimap { top: 86px; right: 322px; bottom: auto; }

@media (max-width: 1100px) {
    body.shortplay-canvas-mode .canvas-minimap { top: auto; right: 12px; bottom: 78px; }
}
@media (max-width: 760px) {
    .canvas-minimap { right: 10px; bottom: calc(76px + env(safe-area-inset-bottom)); }
    .canvas-minimap:not(.is-collapsed) { width: 160px; height: 116px; }
    .canvas-minimap:not(.is-collapsed) .canvas-minimap-count { display: none; }
    body.shortplay-canvas-mode .canvas-minimap { top: auto; right: 10px; bottom: calc(76px + env(safe-area-inset-bottom)); }
}

/* v1.16 · 创作面板稳定性与 @ 素材紧凑显示 */
.media-composer-mention-menu {
    width: min(256px, calc(100vw - 24px)) !important;
    max-height: min(310px, calc(100vh - 24px)) !important;
    padding: 6px !important;
}
.media-composer-mention-menu section + section { margin-top: 5px; padding-top: 5px; }
.media-composer-mention-menu section > header { padding: 4px 7px; font-size: 9px; }
.media-composer-mention-menu button { min-height: 42px !important; padding: 5px 7px !important; gap: 8px !important; }
.media-composer-mention-menu button > img,
.media-composer-mention-menu button > video { width: 34px !important; height: 34px !important; flex-basis: 34px !important; border-radius: 7px !important; }
.media-composer-mention-menu button b { font-size: 11px !important; }
.media-composer-mention-menu button small { font-size: 9px !important; }

body.dark.canvas-mode .media-composer-panel :is(.media-composer-prompt-wrap, .media-composer-prompt) {
    color: #eef1f4 !important;
    background: #181a1d !important;
}

@keyframes composerWorkingSpin { to { transform: rotate(360deg); } }
.media-composer-prompt-tools button.is-loading svg,
[data-prompt-action].is-loading svg {
    animation: composerWorkingSpin .72s linear infinite !important;
    transform-origin: center !important;
    will-change: transform;
}

.save-status {
    display: none;
    align-items: center;
    gap: 6px;
    min-width: 86px;
    padding: 5px 9px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 999px;
    color: #9ca3af;
    background: rgba(31, 41, 55, 0.66);
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
}

body.canvas-mode .save-status {
    display: inline-flex;
}

.save-status::before {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 16%, transparent);
    content: "";
}

.save-status[data-state="saving"]::before,
.save-status[data-state="retry"]::before {
    animation: save-status-pulse 1s ease-in-out infinite;
}

.save-status[data-state="pending"],
.save-status[data-state="saving"] {
    color: #8adbc3;
}

.save-status[data-state="saved"] {
    color: #6ee7b7;
}

.save-status[data-state="local"],
.save-status[data-state="retry"] {
    color: #fbbf24;
}

.save-status[data-state="error"] {
    color: #fca5a5;
}

@keyframes save-status-pulse {
    50% {
        opacity: 0.35;
        transform: scale(0.72);
    }
}


/* 编组底板独立位于连线和节点下方，避免灰色面板遮住内容或交互。 */
.canvas-node-group-backdrop {
    position: absolute;
    z-index: 0;
    pointer-events: none;
    box-sizing: border-box;
    border-radius: 16px;
    background: rgba(111, 118, 128, .105);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .026),
        0 14px 42px rgba(0, 0, 0, .12);
    transition: background-color .16s ease, box-shadow .16s ease;
}

.canvas-node-group-backdrop.is-composite {
    background: rgba(122, 128, 138, .13);
}

.canvas-node-group-backdrop.is-selected {
    background: rgba(80, 112, 153, .16);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .035),
        0 16px 48px rgba(0, 0, 0, .16);
}

/* 画布编组：上层只负责清晰描边、标题和拖动命中。 */
.canvas-node-group {
    position: absolute;
    /* 外框位于节点上方，标题按钮才能稳定可点；框体自身不接收命中，节点仍优先响应。 */
    z-index: 11;
    pointer-events: none;
    box-sizing: border-box;
    border: 1px solid rgba(148, 163, 184, .5);
    border-radius: 16px;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    touch-action: none;
    opacity: 1;
    visibility: visible;
}

/* 取消选中只改变描边，不隐藏编组；外框只会在显式“解组”后移除。 */
.canvas-node-group:not([hidden]) {
    display: block;
}

.canvas-node-group.is-composite {
    border-color: rgba(166, 175, 187, .64);
}

.canvas-node-group.is-hovered {
    border-color: rgba(134, 180, 240, .82);
}

.canvas-node-group.is-selected {
    border-color: rgba(93, 214, 177, .92);
    box-shadow:
        0 0 0 1px rgba(93, 214, 177, .18),
        0 0 22px rgba(32, 201, 151, .08);
}

.canvas-node-group-title {
    position: absolute;
    top: 5px;
    left: 8px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    max-width: calc(100% - 16px);
    height: 24px;
    padding: 0 4px 0 5px;
    color: #d1d5db;
    background: rgba(48, 52, 59, .98);
    border: 1px solid rgba(169, 177, 188, .42);
    border-radius: 7px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
    font-size: 11px;
    line-height: 1;
    pointer-events: auto;
    cursor: grab;
    user-select: none;
    z-index: 2;
}

.canvas-node-group-drag-handle {
    position: absolute;
    inset: 0 0 auto 0;
    height: 34px;
    pointer-events: auto;
    cursor: grab;
    touch-action: none;
    z-index: 1;
}

.canvas-node-group-hit {
    position: absolute;
    pointer-events: auto;
    z-index: 1;
    cursor: grab;
    touch-action: none;
}

.canvas-node-group-hit-left,
.canvas-node-group-hit-right {
    top: 34px;
    bottom: calc(var(--group-hit-size, 16px) * -0.5);
    width: var(--group-hit-size, 16px);
}

.canvas-node-group-hit-left {
    left: calc(var(--group-hit-size, 16px) * -0.5);
}

.canvas-node-group-hit-right {
    right: calc(var(--group-hit-size, 16px) * -0.5);
}

.canvas-node-group-hit-bottom {
    left: 0;
    right: 0;
    bottom: calc(var(--group-hit-size, 16px) * -0.5);
    height: var(--group-hit-size, 16px);
}

.canvas-node-group-hit:active { cursor: grabbing; }

.canvas-node-group-drag-handle:active { cursor: grabbing; }

.canvas-node-group-title:active { cursor: grabbing; }
.canvas-node-group.is-selected .canvas-node-group-title {
    color: #effbf7;
    background: rgba(46, 62, 83, .99);
    border-color: rgba(93, 214, 177, .7);
}

.canvas-node-group-grip {
    width: 12px;
    height: 12px;
    flex: 0 0 auto;
    opacity: .72;
}

.canvas-node-group-name {
    min-width: 24px;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.canvas-node-group-name.is-editing {
    outline: none;
    user-select: text;
    cursor: text;
    color: var(--text-primary);
}

.canvas-node-group-rename,
.canvas-node-group-tools-button,
.canvas-node-group-ungroup,
.canvas-node-group-delete {
    height: 18px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 0 4px;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
}

.canvas-node-group-rename {
    width: 18px;
    justify-content: center;
}

.canvas-node-group-rename:hover,
.canvas-node-group-tools-button:hover,
.canvas-node-group-ungroup:hover,
.canvas-node-group-delete:hover { background: rgba(148, 163, 184, .16); }
.canvas-node-group-rename svg,
.canvas-node-group-tools-button svg,
.canvas-node-group-ungroup svg,
.canvas-node-group-delete svg { width: 13px; height: 13px; }
.canvas-node-group-ungroup span { font-size: 11px; line-height: 1; }
.canvas-node-group-delete { width: 18px; justify-content: center; color: #fca5a5; }
.canvas-node-group-delete:hover { background: rgba(248, 113, 113, .16); color: #fecaca; }

.canvas-node-group-tools { position:relative; display:inline-flex; pointer-events:auto; }
.canvas-node-group-tools-button { width:18px; justify-content:center; }
.canvas-node-group-tools-menu {
    position:absolute; top:25px; left:-8px; z-index:80; width:138px; display:none; padding:5px;
    color:#e8edf2; background:#24272b; border:1px solid rgba(255,255,255,.13); border-radius:9px;
    box-shadow:0 14px 34px rgba(0,0,0,.38); pointer-events:auto;
}
.canvas-node-group-tools.is-open .canvas-node-group-tools-menu { display:block; }
.canvas-node-group-tools-menu button {
    width:100%; height:30px; display:flex; align-items:center; gap:8px; padding:0 8px;
    color:inherit; background:transparent; border:0; border-radius:6px; font-size:12px; cursor:pointer; white-space:nowrap;
}
.canvas-node-group-tools-menu button:hover { background:rgba(255,255,255,.08); }
.canvas-node-group-tools-menu button svg { width:14px; height:14px; flex:0 0 auto; }
.canvas-node-group-tools-divider { height:1px; margin:4px 3px; background:rgba(255,255,255,.11); }
body:not(.dark) .canvas-node-group-tools-menu { color:#24292f; background:#fff; border-color:#d0d7de; }
body:not(.dark) .canvas-node-group-tools-menu button:hover { background:#eaeef2; }
body:not(.dark) .canvas-node-group-tools-divider { background:#d8dee4; }

/* 节点通用样式 - 简洁风格 */
.node {
    position: absolute;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    min-width: 180px;
    max-width: 240px;
    z-index: 10;
    transition: box-shadow 0.2s;
    border: 1px solid var(--border);
    cursor: grab;
}

.node:active {
    cursor: grabbing;
}

.node textarea,
.node input,
.node select,
.node button,
.node audio,
.node video {
    cursor: auto;
}

.node:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.node.selected {
    box-shadow: 0 0 0 1px var(--text-secondary);
    border-color: var(--border);
    background: var(--surface);
}

.node.selected .node-icon,
.node.selected .node-title {
    color: var(--primary);
}

.node.dragging {
    opacity: 0.9;
    z-index: 100;
    box-shadow: none;
}

.canvas-container.canvas-interacting .node,
.canvas-container.canvas-interacting .connections-layer path {
    transition: none !important;
}

.node.zoomed {
    cursor: zoom-out;
}

/* 双击媒体节点时放大的是整张画布视口，节点本身仍保持原来的世界尺寸。
   独立 class 只负责聚焦层级和反馈，不参与宽高计算。 */
body.canvas-mode .node.media-viewport-focused {
    z-index: 1000;
    cursor: zoom-out;
    filter: drop-shadow(0 18px 36px rgba(0, 0, 0, 0.36));
}

body.canvas-mode .node.image-node.media-viewport-focused .image-preview-box,
body.canvas-mode .node.video-node.media-viewport-focused .video-preview-box {
    border-color: rgba(126, 174, 236, 0.78);
    box-shadow: 0 0 0 1px rgba(99, 157, 232, 0.18);
}

body.canvas-mode .node.video-node.media-viewport-focused .video-preview {
    cursor: default;
    pointer-events: auto;
}

/* 图片和视频采用轻量媒体节点，工具类节点继续保留实体卡片。 */
.node.image-node,
.node.video-node {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

/* 🎯 修复：媒体加载后节点若只剩min/max-width没有明确width，
   会被浏览器按图片/视频原始像素尺寸撑大，冲出卡片边界。固定宽度，内容用aspect-ratio自适应缩放。 */
.node.image-node:not(.zoomed):has(.image-preview:not([hidden])),
.node.video-node:not(.zoomed):has(.video-preview:not([hidden])) {
    width: 220px;
    min-width: 220px;
    max-width: 220px;
    box-sizing: border-box;
}

.node.image-node:hover,
.node.video-node:hover,
.node.image-node.selected,
.node.video-node.selected,
.node.image-node.zoomed,
.node.video-node.zoomed {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

.node.zoomed .image-preview-box {
    border-color: var(--border);
}

/* 媒体放大仅扩大内容，标题、端口和操作按钮保持稳定的屏幕尺寸。 */
body.canvas-mode .node.image-node.zoomed,
body.canvas-mode .node.video-node.zoomed {
    --media-zoom-ui-scale: 1;
    box-sizing: border-box;
    filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.3));
}

body.canvas-mode .node.image-node.zoomed .node-header,
body.canvas-mode .node.video-node.zoomed .node-header {
    min-height: calc(30px * var(--media-zoom-ui-scale));
    padding: calc(3px * var(--media-zoom-ui-scale)) calc(2px * var(--media-zoom-ui-scale)) calc(6px * var(--media-zoom-ui-scale));
    gap: calc(5px * var(--media-zoom-ui-scale));
}

body.canvas-mode .node.image-node.zoomed .node-icon,
body.canvas-mode .node.video-node.zoomed .node-icon {
    width: calc(14px * var(--media-zoom-ui-scale));
    height: calc(14px * var(--media-zoom-ui-scale));
}

body.canvas-mode .node.image-node.zoomed .node-title,
body.canvas-mode .node.video-node.zoomed .node-title {
    font-size: calc(12px * var(--media-zoom-ui-scale));
    line-height: calc(18px * var(--media-zoom-ui-scale));
}

body.canvas-mode .node.image-node.zoomed .img-dim,
body.canvas-mode .node.video-node.zoomed .img-dim,
body.canvas-mode .node.video-node.zoomed .vid-dim {
    font-size: calc(11px * var(--media-zoom-ui-scale)) !important;
    line-height: calc(18px * var(--media-zoom-ui-scale));
}

body.canvas-mode .node.image-node.zoomed .node-content,
body.canvas-mode .node.video-node.zoomed .node-content {
    padding: 0;
}

body.canvas-mode .node.image-node.zoomed .image-preview-box,
body.canvas-mode .node.video-node.zoomed .video-preview-box {
    border: 1px solid #555b64;
    border-radius: calc(9px * var(--media-zoom-ui-scale));
    box-shadow: none;
    background: #111214;
}

body.canvas-mode .node.image-node.zoomed.selected .image-preview-box,
body.canvas-mode .node.video-node.zoomed.selected .video-preview-box {
    border-color: #7f9fc8;
    box-shadow: 0 0 0 1px rgba(111, 167, 238, 0.18);
}

body.canvas-mode .node.image-node.zoomed .image-preview,
body.canvas-mode .node.video-node.zoomed .video-preview {
    border-radius: calc(8px * var(--media-zoom-ui-scale));
    object-fit: contain !important;
}

body.canvas-mode .node.image-node.zoomed .node-port,
body.canvas-mode .node.video-node.zoomed .node-port {
    width: var(--media-zoom-port-size);
    height: var(--media-zoom-port-size);
}

body.canvas-mode .node.image-node.zoomed .input-port,
body.canvas-mode .node.video-node.zoomed .input-port {
    left: calc(var(--media-zoom-port-size) / -2);
}

body.canvas-mode .node.image-node.zoomed .output-port,
body.canvas-mode .node.video-node.zoomed .output-port {
    right: calc(var(--media-zoom-port-size) / -2);
}

body.canvas-mode .node.image-node.zoomed .node-port::after,
body.canvas-mode .node.video-node.zoomed .node-port::after {
    width: var(--media-zoom-port-visual-size);
    height: var(--media-zoom-port-visual-size);
    font-size: var(--media-zoom-port-font-size);
    border-width: calc(1px * var(--media-zoom-ui-scale));
}

body.canvas-mode .node.image-node.zoomed .media-delete-btn,
body.canvas-mode .node.image-node.zoomed .media-replace-btn,
body.canvas-mode .node.video-node.zoomed .media-delete-btn,
body.canvas-mode .node.video-node.zoomed .media-replace-btn {
    bottom: calc(8px * var(--media-zoom-ui-scale));
    width: var(--media-zoom-button-size);
    height: var(--media-zoom-button-size);
    border-radius: calc(7px * var(--media-zoom-ui-scale));
    opacity: 0.72;
}

body.canvas-mode .node.video-node.zoomed .media-delete-btn,
body.canvas-mode .node.video-node.zoomed .media-replace-btn {
    top: auto;
    bottom: calc(12px * var(--media-zoom-ui-scale));
    z-index: 4;
}

body.canvas-mode .node.image-node.zoomed .media-delete-btn,
body.canvas-mode .node.video-node.zoomed .media-delete-btn {
    right: calc(8px * var(--media-zoom-ui-scale));
}

body.canvas-mode .node.image-node.zoomed .media-replace-btn {
    right: calc(42px * var(--media-zoom-ui-scale));
}

body.canvas-mode .node.video-node.zoomed .media-replace-btn {
    right: calc(42px * var(--media-zoom-ui-scale));
    top: auto;
}

body.canvas-mode .node.image-node.zoomed .media-delete-btn svg,
body.canvas-mode .node.image-node.zoomed .media-replace-btn svg,
body.canvas-mode .node.video-node.zoomed .media-delete-btn svg,
body.canvas-mode .node.video-node.zoomed .media-replace-btn svg {
    width: var(--media-zoom-button-icon-size);
    height: var(--media-zoom-button-icon-size);
}

.image-preview-box.media-load-error {
    min-height: 120px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed rgba(248, 113, 113, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview-box.media-load-error::after {
    content: "图片已失效";
    color: #fca5a5;
    font-size: 12px;
    font-weight: 600;
}

.inline-image-edit-panel {
    position: fixed;
    width: 116px;
    max-height: calc(100vh - 44px);
    overflow-y: auto;
    padding: 7px;
    border-radius: 10px;
    background: rgba(34, 34, 34, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
    color: #f3f4f6;
    z-index: 3200;
    display: flex;
    flex-direction: column;
    gap: 5px;
    will-change: transform, left, top;
    box-sizing: border-box;
}

.inline-image-edit-panel.attached-right {
    border-top-left-radius: 4px;
}

.inline-image-edit-panel.attached-left {
    border-top-right-radius: 4px;
}

.inline-edit-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    margin-bottom: 1px;
}

.inline-edit-close {
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #d1d5db;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

.inline-edit-btn,
.inline-edit-save {
    width: 100%;
    min-height: 31px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
}

.inline-edit-btn:hover {
    border-color: rgba(32, 201, 151, 0.7);
    color: #8adbc3;
}

.inline-edit-btn svg,
.inline-edit-save svg {
    width: 14px;
    height: 14px;
}

.inline-apply-crop {
    border-color: rgba(245, 158, 11, 0.55);
}

.inline-edit-save {
    border-color: #20c997;
    background: #20c997;
    color: #fff;
}

.inline-edit-color-row,
.inline-edit-brush-row,
.inline-edit-size-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #9ca3af;
    font-size: 10px;
    padding: 1px 2px;
}

.inline-edit-brush-row {
    gap: 5px;
}

.inline-edit-brush-size {
    width: 63px;
    accent-color: #9ca3af;
    cursor: pointer;
}

.inline-edit-size-row select {
    width: 52px;
    height: 25px;
    padding: 0 5px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 6px;
    outline: 0;
    background: #303030;
    color: #f3f4f6;
    font-size: 11px;
    cursor: pointer;
}

.inline-edit-size-row option {
    background: #303030;
    color: #f3f4f6;
}

.inline-edit-color-row input {
    width: 32px;
    height: 23px;
    padding: 2px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.08);
}

.node-crop-overlay {
    position: absolute;
    inset: 0;
    z-index: 12;
    cursor: default;
}

.node-crop-box {
    position: absolute;
    border: 2px dashed #f59e0b;
    background: rgba(245, 158, 11, 0.08);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.22);
    cursor: move;
}

.crop-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #f59e0b;
    border: 2px solid #111;
}

.crop-handle.nw {
    left: -7px;
    top: -7px;
    cursor: nwse-resize;
}

.crop-handle.ne {
    right: -7px;
    top: -7px;
    cursor: nesw-resize;
}

.crop-handle.sw {
    left: -7px;
    bottom: -7px;
    cursor: nesw-resize;
}

.crop-handle.se {
    right: -7px;
    bottom: -7px;
    cursor: nwse-resize;
}

.node-draw-overlay {
    position: absolute;
    inset: 0;
    z-index: 13;
    cursor: crosshair;
}

.node-draw-rect {
    position: absolute;
    border: 2px solid #ef4444;
    background: rgba(239, 68, 68, 0.08);
    pointer-events: none;
}

.node-brush-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.node-text-editor {
    position: absolute;
    min-width: 96px;
    max-width: calc(100% - 12px);
    height: 34px;
    padding: 4px 8px;
    transform: translateY(-50%);
    border: 2px solid #ef4444;
    border-radius: 6px;
    background: rgba(17, 17, 17, 0.78);
    color: #ef4444;
    font-size: 18px;
    font-weight: 700;
    outline: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38);
    z-index: 14;
}

.inline-image-split-panel {
    position: fixed;
    width: 190px;
    padding: 10px;
    border-radius: 11px;
    background: rgba(34, 34, 34, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
    color: #f3f4f6;
    z-index: 3200;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.split-presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.split-presets button,
.split-custom-row input {
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: #e5e7eb;
    font-size: 12px;
    font-weight: 600;
}

.split-presets button {
    cursor: pointer;
}

.split-presets button:hover {
    border-color: rgba(32, 201, 151, 0.7);
    color: #8adbc3;
}

.split-custom-row {
    display: grid;
    grid-template-columns: auto 1fr auto 1fr;
    align-items: center;
    gap: 6px;
    color: #9ca3af;
    font-size: 12px;
}

.split-custom-row input {
    width: 100%;
    padding: 0 6px;
    text-align: center;
}

.split-count {
    color: #9ca3af;
    font-size: 12px;
    text-align: center;
}

.split-count strong {
    color: #f3f4f6;
}

.node-split-overlay {
    position: absolute;
    inset: 0;
    z-index: 12;
    pointer-events: none;
}

.node-split-line {
    position: absolute;
    background: #5dd6b1;
    box-shadow: 0 0 0 1px rgba(17, 24, 39, 0.55), 0 0 12px rgba(93, 214, 177, 0.55);
}

.node-split-line.vertical {
    top: 0;
    bottom: 0;
    width: 2px;
    transform: translateX(-1px);
}

.node-split-line.horizontal {
    left: 0;
    right: 0;
    height: 2px;
    transform: translateY(-1px);
}

.node-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px 6px;
    user-select: none;
    background: var(--surface);
    border-radius: 12px 12px 0 0;
}

.image-node .node-header,
.video-node .node-header {
    background: transparent;
}

.node-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Lucide 全局默认大小 */
.btm-tool-btn i[data-lucide] {
    width: 20px;
    height: 20px;
}

.context-menu svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.port-drop-menu svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.sbar-icon {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.asset-card i[data-lucide] {
    width: 32px;
    height: 32px;
    margin: 8px auto;
}

.home-logo i[data-lucide] {
    width: 24px;
    height: 24px;
    vertical-align: middle;
    margin-right: 4px;
}

.node-title {
    flex: 1;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
}

.node-close {
    width: 18px;
    height: 18px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: 0;
}

.node:hover .node-close {
    opacity: 1;
}

.node-close:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* 音频节点 */
.audio-placeholder {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.node-content {
    padding: 4px 8px 8px;
    color: var(--text);
}

.node-content label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 4px;
}

.node-textarea {
    width: 100%;
    min-height: 60px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text);
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.2s;
    background: var(--input-bg);
}

.node-textarea:focus {
    outline: none;
    border-color: var(--border);
}

.node-textarea::placeholder {
    color: var(--text-muted);
}

.node-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.node-row label {
    margin-bottom: 0;
}

.node-select {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
    color: var(--text);
    background: var(--surface);
    cursor: pointer;
    min-width: 70px;
}

.node-select:focus {
    outline: none;
    border-color: var(--border);
}

/* 参考图 */
.ref-image-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.add-ref-btn {
    width: 32px;
    height: 32px;
    border: 1px dashed var(--text-muted);
    border-radius: 6px;
    background: var(--canvas-bg);
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.add-ref-btn:hover {
    border-color: var(--border);
    color: var(--text-secondary);
    background: var(--canvas-bg);
}

.ref-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: flex-start;
    max-width: 156px;
}

.ref-img-wrap:hover .ref-thumb {
    border-color: #ef4444;
}

.ref-thumb:hover {
    border-color: var(--border) !important;
}

/* 参考音频 */
.ref-audio-box {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
}

.ref-audio-preview audio {
    height: 32px;
    max-width: 200px;
}

.ref-video-box {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
}

.ref-video-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: flex-start;
    max-width: 156px;
}

.ref-video-preview video {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid var(--border);
}

/* 节点操作按钮 */
.node-action-btn {
    width: 100%;
    padding: 8px 12px;
    margin-top: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.node-action-btn:hover {
    background: var(--text-secondary);
    color: #fff;
    filter: none;
}

.node-action-btn.veo-btn {
    background: #20c997;
}

.node-action-btn.veo-btn:hover {
    background: #16966f;
}

.node-action-btn:disabled {
    cursor: not-allowed;
    animation: btnPulse 1.2s ease-in-out infinite;
}

@keyframes btnPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* 连接端口（通用 "+" 号样式，24px热区 + 16px视觉） */
.node-port {
    position: absolute;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 20;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.node-port::after {
    content: '+';
    width: 16px;
    height: 16px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1;
    transition: all 0.2s;
    pointer-events: none;
}

.node-port:hover::after {
    background: var(--text-secondary);
    color: #fff;
    transform: scale(1.15);
}

.input-port {
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
}

.output-port {
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
}

.input-port:hover,
.output-port:hover {
    transform: translateY(-50%) scale(1);
}

.input-port:hover::after,
.output-port:hover::after {
    background: var(--text-secondary);
    color: #fff;
}

/* 磁吸目标高亮 */
.node-port.snap-target {
    transform: translateY(-50%) scale(1.8) !important;
    background: var(--text-secondary) !important;
    color: #fff !important;
    border-color: var(--border) !important;
    box-shadow: 0 0 12px rgba(26, 26, 46, 0.6);
    animation: snapPulse 0.6s ease-in-out infinite alternate;
}

@keyframes snapPulse {
    from {
        box-shadow: 0 0 8px rgba(26, 26, 46, 0.4);
    }

    to {
        box-shadow: 0 0 20px rgba(26, 26, 46, 0.8);
    }
}

/* 文本节点 */
.text-node .node-textarea {
    min-height: 56px;
}

/* 智能体引用部分 */
.agent-reference-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.agent-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.agent-select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
}

.agent-select:hover {
    border-color: var(--border);
    background: var(--canvas-bg);
}

.agent-select:focus {
    outline: none;
    border-color: var(--border);
    box-shadow: 0 0 0 3px rgba(32, 201, 151, 0.1);
}

/* 媒体节点 */

.image-preview-box {
    position: relative;
    width: 100%;
    min-height: 80px;
    border: 1px dashed var(--text-muted);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s;
}

.image-preview-box:hover {
    border-color: var(--border);
    background: var(--canvas-bg);
}

/* 已加载媒体直接贴合画布，不再显示上传容器的虚线框。 */
.image-preview-box:has(.image-preview:not([hidden])),
.video-preview-box:has(.video-preview:not([hidden])),
.audio-preview-box:has(.audio-preview:not([hidden])) {
    border: 1px solid var(--border);
    background: transparent;
}

.image-preview-box:has(.image-preview:not([hidden])):hover,
.video-preview-box:has(.video-preview:not([hidden])):hover,
.audio-preview-box:has(.audio-preview:not([hidden])):hover {
    border-color: var(--text-muted);
    background: transparent;
}

.image-placeholder {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.image-placeholder[hidden],
.video-placeholder[hidden],
.audio-placeholder[hidden],
.media-empty-state[hidden] {
    display: none !important;
}

.image-preview-box.has-media,
.video-preview-box.has-media,
.audio-preview-box.has-media {
    display: block;
}

.image-preview-box.has-media .image-placeholder,
.video-preview-box.has-media .video-placeholder,
.audio-preview-box.has-media .audio-placeholder {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.image-preview-box.has-media .image-preview,
.video-preview-box.has-media .video-preview,
.audio-preview-box.has-media .audio-preview {
    display: block;
}

.image-preview {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

/* 音频节点 */

.audio-preview-box {
    position: relative;
    width: 100%;
    min-height: 80px;
    border: 2px dashed var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s;
}

.audio-preview-box:hover {
    border-color: var(--border);
    background: var(--canvas-bg);
}

.audio-placeholder {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.audio-preview {
    width: 100%;
    max-width: 240px;
    user-select: none;
    -webkit-user-drag: none;
}

/* 视频节点 */

.video-preview-box {
    position: relative;
    width: 100%;
    min-height: 100px;
    border: 2px dashed var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s;
}

.video-preview-box:hover {
    border-color: var(--border);
    background: var(--canvas-bg);
}

.video-placeholder {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.video-generation-placeholder {
    min-width: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    color: #e4faf3;
}

.video-generation-placeholder svg {
    width: 25px;
    height: 25px;
    color: #5dd6b1;
}

.video-generation-placeholder strong {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0;
}

.video-generation-placeholder span {
    color: #7f8a99;
    font-size: 11px;
}

.video-preview-box:has(.video-generation-placeholder) {
    border-color: rgba(69, 146, 255, 0.62);
    background: rgba(44, 111, 204, 0.08);
}

.video-preview-box:has(.video-generation-placeholder):hover {
    border-color: #5dd6b1;
    background: rgba(44, 111, 204, 0.14);
}

.agent-media-draft-placeholder {
    min-width: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: #e4faf3;
    cursor: pointer;
}

.agent-media-draft-placeholder svg {
    width: 25px;
    height: 25px;
    color: #5dd6b1;
}

.agent-media-draft-placeholder strong {
    font-size: 14px;
    font-weight: 600;
}

.agent-media-draft-placeholder span {
    color: #8e98a6;
    font-size: 11px;
}

.agent-draft-actions {
    display: flex;
    gap: 7px;
    margin-top: 4px;
}

.agent-media-draft-placeholder .agent-draft-actions button {
    min-width: 92px;
    height: 32px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #dff6ee;
    background: #252a31;
    border: 1px solid #46505d;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.agent-media-draft-placeholder .agent-draft-actions button:last-child {
    color: #fff;
    background: #2f7fe6;
    border-color: #20a981;
}

.agent-media-draft-placeholder .agent-draft-actions button:hover {
    border-color: #62c9aa;
    background: #2d3834;
}

.agent-media-draft-placeholder .agent-draft-actions button:last-child:hover {
    background: #20c997;
}

.agent-media-draft-placeholder .agent-draft-actions svg {
    width: 14px;
    height: 14px;
}

.agent-media-draft-placeholder .agent-draft-actions span {
    color: inherit;
    font-size: inherit;
}

.audio-generation-placeholder {
    min-height: 82px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: #8e98a6;
    text-align: center;
}

.audio-generation-placeholder svg {
    width: 24px;
    height: 24px;
    color: #aeb7c4;
}

.audio-generation-placeholder strong {
    color: #d8dde5;
    font-size: 13px;
    font-weight: 600;
}

.audio-generation-placeholder span {
    color: #77818e;
    font-size: 11px;
}

.media-empty-state {
    width: 100%;
    min-height: 118px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: #8e98a6;
}

.media-empty-state>svg {
    width: 27px;
    height: 27px;
    color: #7f8894;
    stroke-width: 1.7;
}

.media-empty-state>strong {
    color: #c8ced7;
    font-size: 13px;
    font-weight: 600;
}

.media-empty-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 3px;
}

.media-empty-actions button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 0;
    color: #8f98a5;
    background: transparent;
    border: 0;
    border-radius: 0;
    font: inherit;
    font-size: 11px;
    cursor: pointer;
}

.media-empty-actions button:hover {
    color: #72cdb1;
}

.media-empty-actions button svg {
    width: 13px;
    height: 13px;
    color: currentColor;
}

.media-empty-actions button span,
.audio-generation-placeholder .media-empty-actions button span {
    color: currentColor;
    font-size: inherit;
}

.audio-preview-box:has(.audio-generation-placeholder) {
    border-color: #3b4654;
    background: #1b1e22;
}

.audio-preview-box:has(.audio-generation-placeholder):hover {
    border-color: #38b88f;
    background: #1d2530;
}

.image-preview-box:has(.agent-media-draft-placeholder),
.video-preview-box:has(.agent-media-draft-placeholder) {
    border-color: rgba(69, 146, 255, 0.62);
    background: rgba(44, 111, 204, 0.08);
}

.image-preview-box:has(.agent-media-draft-placeholder):hover,
.video-preview-box:has(.agent-media-draft-placeholder):hover {
    border-color: #5dd6b1;
    background: rgba(44, 111, 204, 0.14);
}

.media-asset-source.text-source svg {
    width: 24px;
    height: 24px;
    color: #72cdb1;
}

.video-preview {
    width: 100%;
    max-height: 150px;
    pointer-events: auto;
    user-select: none;
    -webkit-user-drag: none;
}

/* 原生全屏必须脱离画布节点的尺寸约束，并完整保留浏览器控制条。 */
.video-preview:fullscreen,
.video-preview:-webkit-full-screen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    background: #000;
    object-fit: contain !important;
}

body.canvas-mode .node.video-node:has(.video-preview:not([hidden])) .video-preview-box {
    overflow: hidden;
    border: 1px solid rgba(125, 134, 148, 0.28);
    border-radius: 10px;
    background: #111316;
}

body.canvas-mode .node.video-node:has(.video-preview:not([hidden])) .media-delete-btn,
body.canvas-mode .node.video-node:has(.video-preview:not([hidden])) .media-replace-btn {
    top: auto;
    bottom: 8px;
    right: 8px;
    z-index: 4;
}

body.canvas-mode .node.video-node:has(.video-preview:not([hidden])) .media-replace-btn {
    top: auto;
    right: 44px;
}

body.canvas-mode .node.video-node:has(.video-preview:not([hidden])) .video-preview {
    display: block;
    max-height: none;
    object-fit: cover;
}

body.canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])) .media-delete-btn,
body.canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])) .media-replace-btn,
body.canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])) .media-download-btn,
body.canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])) .video-frame-btn {
    opacity: 0;
    transform: translateY(3px);
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

body.canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])):hover .media-delete-btn,
body.canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])).selected .media-delete-btn,
body.canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])):hover .media-replace-btn,
body.canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])).selected .media-replace-btn,
body.canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])):hover .media-download-btn,
body.canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])).selected .media-download-btn,
body.canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])):hover .video-frame-btn,
body.canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])).selected .video-frame-btn {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

body.canvas-mode .node.video-node:not(.zoomed).compact-video-controls .video-preview {
    cursor: grab;
}

/* 智能体节点 */

.agent-node .agent-select {
    width: 100%;
}

.agent-node .agent-description {
    background: var(--canvas-bg);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
}

.agent-node .agent-desc-text {
    font-size: 12px;
    color: var(--text);
    margin: 0;
    line-height: 1.5;
}

.agent-node .user-input {
    min-height: 72px;
}

.node-action-btn.agent-btn {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.node-action-btn.agent-btn:hover {
    background: var(--text-secondary);
    color: #fff;
    filter: none;
}

/* 智能体运行进度位于运行按钮所在底栏正下方，参与正常布局，不覆盖输入内容。 */
.agent-node .agent-run-progress {
    width: 100%;
    margin-top: 8px;
    padding: 8px 10px 9px;
    color: var(--text-secondary);
    background: var(--surface);
    background: color-mix(in srgb, var(--surface) 82%, var(--canvas-bg));
    border: 1px solid var(--border);
    border-radius: 9px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.agent-node .agent-run-progress[hidden] {
    display: none !important;
}

.agent-node .agent-run-progress-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 10px;
    line-height: 1.25;
}

.agent-node .agent-run-progress-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-node .agent-run-progress-percent {
    flex: 0 0 auto;
    color: var(--text);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

.agent-node .agent-run-progress-track {
    height: 5px;
    overflow: hidden;
    background: var(--border);
    background: color-mix(in srgb, var(--border) 72%, transparent);
    border-radius: 999px;
}

.agent-node .agent-run-progress-fill {
    display: block;
    width: 0;
    height: 100%;
    background: #20c997;
    border-radius: inherit;
    box-shadow: 0 0 10px rgba(79, 143, 247, 0.34);
    transition: width 320ms ease;
}

.agent-node .agent-run-progress.is-running .agent-run-progress-fill {
    animation: agentRunProgressPulse 1.5s ease-in-out infinite;
}

.agent-node .agent-run-progress.is-complete {
    color: #23865a;
    border-color: #8acfab;
    border-color: color-mix(in srgb, #35b978 42%, var(--border));
    background: rgba(53, 185, 120, 0.09);
    background: color-mix(in srgb, #35b978 9%, var(--surface));
}

.agent-node .agent-run-progress.is-complete .agent-run-progress-fill {
    background: #35b978;
    box-shadow: 0 0 10px rgba(53, 185, 120, 0.28);
}

.agent-node .agent-run-progress.is-failed {
    color: #c33f4b;
    border-color: #e8a0a6;
    border-color: color-mix(in srgb, #e45c67 48%, var(--border));
    background: rgba(228, 92, 103, 0.09);
    background: color-mix(in srgb, #e45c67 9%, var(--surface));
}

.agent-node .agent-run-progress.is-failed .agent-run-progress-percent {
    color: #c33f4b;
}

.agent-node .agent-run-progress.is-failed .agent-run-progress-fill {
    background: #e45c67;
    box-shadow: none;
}

body.dark .agent-node .agent-run-progress.is-complete {
    color: #83d5a3;
}

body.dark .agent-node .agent-run-progress.is-failed,
body.dark .agent-node .agent-run-progress.is-failed .agent-run-progress-percent {
    color: #ff9a9a;
}

@keyframes agentRunProgressPulse {
    0%,
    100% {
        filter: brightness(0.94);
    }

    50% {
        filter: brightness(1.16);
    }
}

/* Agent 文件上传区 */
.agent-file-upload {
    display: flex;
    align-items: center;
    gap: 8px;
}

.agent-upload-btn {
    padding: 6px 12px;
    border: 1px dashed var(--text-muted);
    border-radius: 6px;
    background: var(--canvas-bg);
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.agent-upload-btn:hover {
    border-color: #20c997;
    color: #20c997;
    background: var(--canvas-bg);
}

.agent-file-name {
    font-size: 11px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 120px;
}

.agent-video-url {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--canvas-bg);
    transition: all 0.2s;
    box-sizing: border-box;
}

.agent-video-url:focus {
    outline: none;
    border-color: #20c997;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
    background: var(--surface);
}

.agent-video-url::placeholder {
    color: #cbd5e1;
}

/* 素材选择弹窗 */
.asset-picker-overlay {
    position: fixed;
    inset: 0;
    z-index: 4000;
    background: rgba(0, 0, 0, 0.68);
    display: flex;
    align-items: center;
    justify-content: center;
}

.asset-picker {
    background: #242424;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
    padding: 22px 24px 24px;
    width: min(820px, calc(100vw - 40px));
    height: min(600px, calc(100vh - 64px));
    max-width: none;
    max-height: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.asset-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.asset-picker-title {
    font-size: 18px;
    font-weight: 700;
    color: #f5f5f5;
}

.asset-picker-header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.asset-picker-upload {
    width: 38px;
    height: 38px;
    border: none;
    background: #353535;
    border-radius: 6px;
    font-size: 14px;
    color: #c7cbd3;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.asset-picker-upload[hidden] {
    display: none !important;
}

.asset-picker-upload:hover {
    background: #20c997;
    color: #fff;
}

.asset-picker-upload svg {
    width: 16px;
    height: 16px;
}

.asset-picker-close {
    width: 38px;
    height: 38px;
    border: none;
    background: #353535;
    border-radius: 6px;
    font-size: 18px;
    color: #c7cbd3;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.asset-picker-close:hover {
    background: var(--surface-hover);
    color: var(--text);
}

/* 素材分类 tabs */
.asset-picker-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.asset-tab {
    min-width: 78px;
    padding: 8px 18px;
    border: 1px solid #464646;
    border-radius: 6px;
    background: transparent;
    color: #aeb4bf;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
}

.asset-tab:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.asset-tab.active {
    background: #f3f3f3;
    color: #202020;
    border-color: #f3f3f3;
    font-weight: 650;
}

.asset-picker-toolbar {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    color: #9fa5af;
    flex-shrink: 0;
}

.asset-picker-count {
    font-size: 13px;
}

.asset-sort-control {
    height: 34px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 10px;
    border: 1px solid #454545;
    border-radius: 6px;
    background: #2d2d2d;
    color: #c9cdd5;
}

.asset-sort-control svg {
    width: 15px;
    height: 15px;
}

.asset-sort-control select {
    border: 0;
    outline: 0;
    background: transparent;
    color: #e8e8e8;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.asset-sort-control option {
    background: #2d2d2d;
    color: #f2f2f2;
}

.asset-picker-grid {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 2px 6px 10px 2px;
    scrollbar-width: thin;
    scrollbar-color: #555 transparent;
}

.asset-picker-grid.is-media-grid {
    display: block;
    column-width: 190px;
    column-gap: 14px;
    overflow-x: hidden;
}

/* 多列瀑布流中的卡片必须是不可分割的行内块，否则高图会跨列碎裂，
   点击区域也会被浏览器计算成覆盖多列的大矩形。 */
.asset-picker-grid.is-media-grid .asset-card {
    display: inline-flex;
    width: 100%;
    vertical-align: top;
    break-inside: avoid-column;
    page-break-inside: avoid;
}

.asset-picker-grid.is-audio-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-content: start;
    gap: 12px;
}

.asset-card {
    width: 100%;
    border: 1px solid #424242;
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background: #2b2b2b;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    box-sizing: border-box;
    break-inside: avoid;
    margin: 0 0 14px;
    overflow: visible;
}

.asset-card svg.lucide,
.asset-card i[data-lucide] {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: block;
    pointer-events: none;
}

.asset-card-thumb {
    display: block;
    width: 100%;
    height: auto;
    max-height: 360px;
    object-fit: contain;
    border-radius: 4px;
    pointer-events: none;
}

.asset-card-media {
    width: 100%;
    overflow: hidden;
    border-radius: 4px;
    background: #1b1b1b;
}

.asset-card-video {
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.asset-card-color,
.asset-card-name {
    pointer-events: none;
}

.asset-card-more {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 5px;
    background: rgba(16, 16, 16, 0.76);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0;
    transition: opacity 0.15s;
}

.asset-card-more svg {
    width: 16px;
    height: 16px;
}

.asset-card:hover .asset-card-more,
.asset-card-more:focus-visible {
    opacity: 1;
}

.asset-card-download {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 4;
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.92);
    background: rgba(8, 10, 14, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 7px;
    cursor: pointer;
    opacity: 0.88;
    transform: translateY(2px);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: opacity 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.asset-card-download svg {
    width: 16px;
    height: 16px;
}

.asset-card:hover .asset-card-download,
.asset-card.selected .asset-card-download,
.asset-card-download:focus-visible {
    opacity: 1;
    transform: translateY(0);
}

.asset-card-download:hover {
    color: #fff;
    background: rgba(35, 104, 255, 0.96);
}

.asset-card-menu {
    position: absolute;
    z-index: 20;
    top: 40px;
    right: 8px;
    width: 130px;
    padding: 6px;
    display: none;
    border: 1px solid #4a4a4a;
    border-radius: 6px;
    background: #202020;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.42);
}

.asset-card-menu.open {
    display: grid;
}

.asset-card-menu span {
    padding: 5px 7px;
    color: #8f96a1;
    font-size: 11px;
}

.asset-card-menu button {
    min-height: 30px;
    padding: 0 7px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #e4e4e4;
    text-align: left;
    cursor: pointer;
}

.asset-card-menu button:hover {
    background: #353535;
}

.asset-card-menu .asset-card-delete {
    color: #ff7474;
    border-top: 1px solid #3d3d3d;
    margin-top: 4px;
}

.asset-card:hover {
    border-color: #6c6c6c;
    background: #303030;
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.24);
}

.asset-card.selected {
    border-color: #20c997;
    background: rgba(139, 92, 246, 0.1);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.3);
}

.asset-card.selected .asset-card-name {
    color: #20c997;
    font-weight: 600;
}

.asset-card-emoji {
    font-size: 40px;
    display: block;
    margin-bottom: 6px;
    line-height: 1.2;
}

.asset-card-color {
    display: none;
}

.asset-card-name {
    width: 100%;
    min-height: 34px;
    padding: 0 4px 2px;
    box-sizing: border-box;
    font-size: 13px;
    line-height: 17px;
    font-weight: 550;
    color: #f1f1f1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.asset-empty {
    column-span: all;
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: #a9afb9;
}

.asset-card.dragging {
    opacity: 0.45;
}

.asset-card.drag-over {
    border-color: #20c997;
    box-shadow: 0 0 0 2px rgba(32, 201, 151, 0.32);
}

@media (max-width: 700px) {
    .asset-picker {
        width: calc(100vw - 20px);
        height: calc(100vh - 24px);
        padding: 16px;
    }

    .asset-picker-grid.is-media-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .asset-picker-tabs {
        overflow-x: auto;
    }
}

.asset-empty svg.lucide {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    opacity: 0.4;
}

.asset-empty p {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 500;
}

.asset-empty small {
    font-size: 12px;
}

/* 录音按钮（头部右上角） */
.record-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.record-btn svg {
    width: 16px;
    height: 16px;
}

.record-btn:hover {
    background: var(--surface-hover);
}

.record-btn.recording {
    background: #ef4444;
    color: #fff;
    animation: record-pulse 1.5s ease-in-out infinite;
}

.record-btn.recording:hover {
    background: #dc2626;
    color: #fff;
}

@keyframes record-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }
}

/* 素材库按钮（头部右上角） */
.asset-library-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.asset-library-btn svg {
    width: 16px;
    height: 16px;
}

.asset-library-btn:hover {
    background: var(--surface-hover);
}

.record-btn+.asset-library-btn {
    margin-left: -3px;
}

/* 用户按钮 */
.user-btn {
    background: #168c6d !important;
    color: #fff !important;
    border: none !important;
}

.user-btn:hover {
    background: #126b54 !important;
}

/* 弹窗 */
.modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

/* 设置属于全局模态层，必须压住节点创作面板，避免弹窗可见但无法操作。 */
#settingsModal {
    z-index: 23000;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    background: var(--surface);
    border-radius: 16px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--surface-hover);
    border-radius: 8px;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #fee2e2;
    color: #ef4444;
}

.modal-body {
    padding: 24px;
}

/* ===== 通用弹窗按钮（标注/分割等工具栏复用） ===== */
.btn-primary,
.btn-secondary,
.btn-plain {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-primary {
    background: #20c997;
    color: #fff;
    border-color: #20c997;
}

.btn-primary:hover {
    background: #168c6d;
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--surface-hover);
    border-color: #20c997;
    color: #20c997;
}

.btn-secondary.active {
    background: #20c997;
    color: #fff;
    border-color: #20c997;
}

.btn-plain {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}

.btn-plain:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.btn-primary i[data-lucide],
.btn-secondary i[data-lucide],
.btn-plain i[data-lucide] {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

/* 登录表单 */
.auth-modal-content {
    max-width: 400px;
    max-height: calc(100vh - 24px);
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow-x: hidden;
    overflow-y: auto;
}

.auth-modal-content .modal-header {
    padding: 18px 20px 15px;
}

.auth-modal-heading {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 12px;
}

.auth-modal-mark {
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(32, 201, 151, .28);
    border-radius: 12px;
    color: #138565;
    background: linear-gradient(145deg, rgba(32, 201, 151, .16), rgba(50, 153, 255, .08));
}

.auth-modal-mark svg { width: 21px; height: 21px; }

.auth-modal-heading h2,
.auth-modal-content .modal-header h2 {
    margin: 0;
    font-size: 16px;
    color: var(--text-primary);
}

.auth-modal-heading p {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.4;
}

.auth-modal-content .modal-close {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    font-size: 18px;
}

.auth-modal-content .modal-body {
    padding: 18px 20px 20px;
}

.auth-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
}

.auth-tab {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tab:hover {
    border-color: var(--border);
    color: var(--text-secondary);
}

.auth-tab.active {
    background: var(--primary, #20c997);
    border-color: var(--primary, #20c997);
    color: #fff;
    box-shadow: 0 2px 8px rgba(32, 201, 151, 0.2);
}

.auth-tab.active:hover {
    background: var(--primary-hover, #16966f);
    border-color: var(--primary-hover, #16966f);
    color: #fff;
}

.auth-message {
    margin-bottom: 12px;
    padding: 8px 10px;
    border: 1px solid #fecaca;
    border-radius: 7px;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 12px;
    line-height: 1.4;
}

.form-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.auth-form .form-group {
    margin-bottom: 12px;
}

.auth-form label {
    display: block;
    margin-bottom: 7px;
    color: #344054;
    font-size: 13px;
    font-weight: 600;
}

.form-input {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--border);
    box-shadow: 0 0 0 3px rgba(32, 201, 151, 0.1);
}

.auth-modal-content .form-input {
    min-height: 44px;
    border-color: #98a2b3;
    color: #101828;
    background: #f8fafc;
    caret-color: #168c6d;
    font-size: 14px;
    font-weight: 520;
}

.auth-modal-content .form-input::placeholder {
    color: #667085;
    opacity: 1;
    font-weight: 450;
}

.auth-modal-content .form-input:hover {
    border-color: #667085;
    background: #ffffff;
}

.auth-modal-content .form-input:focus {
    border-color: #168c6d;
    color: #101828;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(22, 140, 109, 0.14);
}

/* v1.16 · 密码默认隐藏，右侧按钮按需显示。 */
.password-field {
    position: relative;
}

.password-field .form-input {
    padding-right: 46px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 7px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    color: #667085;
    background: transparent;
    cursor: pointer;
}

.password-toggle:hover,
.password-toggle:focus-visible {
    color: #168c6d;
    background: rgba(22, 140, 109, .09);
    outline: none;
}

.password-toggle svg { width: 18px; height: 18px; }
body.dark .password-toggle { color: #aab2bc; }
body.dark .password-toggle:hover { color: #70e3bc; background: rgba(94, 216, 176, .1); }

.auth-consent {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;
    margin: 12px 2px 0;
    color: #667085;
    font-size: 11px;
    line-height: 1.6;
    text-align: left;
}

.auth-consent input[type="checkbox"] {
    flex: 0 0 15px;
    width: 15px;
    height: 15px;
    padding: 0;
    margin-top: 1px;
    accent-color: #168c6d;
    cursor: pointer;
}

.auth-consent a { color: #137c60; font-weight: 600; text-decoration: none; }
.auth-consent a:hover { text-decoration: underline; }
body.dark .auth-consent { color: #8f98a4; }
body.dark .auth-consent a { color: #70dfbd; }
body.dark .auth-modal-mark { color: #70dfbd; background: linear-gradient(145deg, rgba(94,216,176,.15), rgba(75,179,255,.08)); }

/* 登录页可直接阅读的平台协议与隐私政策。 */
.policy-modal { z-index: 26000; }

.policy-modal-content {
    display: flex;
    flex-direction: column;
    width: min(680px, calc(100vw - 32px));
    max-width: 680px;
    max-height: min(760px, calc(100vh - 40px));
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 18px;
}

.policy-modal-header {
    flex: 0 0 auto;
    padding: 19px 22px 16px;
    background: linear-gradient(120deg, rgba(32,201,151,.09), rgba(75,179,255,.04) 58%, transparent);
}

.policy-modal-header > div { min-width: 0; }
.policy-modal-header h2 { margin-top: 7px; color: var(--text-primary); font-size: 19px; }

.policy-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #168c6d;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
}

.policy-kicker svg { width: 14px; height: 14px; }

.policy-modal-body {
    min-height: 0;
    overflow: auto;
    padding: 20px 24px 26px;
    scrollbar-width: thin;
}

.policy-article { color: var(--text-secondary); font-size: 13px; line-height: 1.75; }
.policy-article > p { margin: 0 0 17px; }
.policy-article .policy-effective { margin-bottom: 12px; color: var(--text-muted); font-size: 11px; }
.policy-article section { padding: 15px 0; border-top: 1px solid var(--border); }
.policy-article section:first-of-type { border-top: 0; }
.policy-article h3 { margin: 0 0 6px; color: var(--text-primary); font-size: 14px; }
.policy-article section p { margin: 0; }

.policy-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 auto;
    gap: 16px;
    padding: 13px 20px;
    border-top: 0;
    background: var(--surface);
}

.policy-modal-footer span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text-muted);
    font-size: 11px;
}

.policy-modal-footer span svg { width: 14px; height: 14px; color: #168c6d; }
.policy-modal-footer button {
    min-width: 96px;
    min-height: 36px;
    padding: 0 16px;
    border: 0;
    border-radius: 9px;
    color: #fff;
    background: #168c6d;
    font-weight: 650;
    cursor: pointer;
}
.policy-modal-footer button:hover { background: #126b54; }

@media (max-width: 560px) {
    .auth-modal-content { width: calc(100% - 24px); }
    .policy-modal-content { width: calc(100vw - 20px); max-height: calc(100vh - 20px); }
    .policy-modal-header { padding-inline: 18px; }
    .policy-modal-body { padding: 17px 18px 22px; }
    .policy-modal-footer { align-items: stretch; flex-direction: column; gap: 10px; }
    .policy-modal-footer button { width: 100%; }
}

/* v1.16 · 登录工作台侧边导航 */
.project-home {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
}

.project-home-sidebar {
    position: sticky;
    top: 0;
    z-index: 35;
    align-self: start;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 18px 12px;
    border-right: 1px solid #292c2f;
    background: rgba(13, 14, 15, .96);
    backdrop-filter: blur(16px);
}

.project-home-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    margin-bottom: 26px;
    border-radius: 14px;
    color: #0a1511;
    background: linear-gradient(145deg, #9af0d2, #47d3a5);
    box-shadow: 0 10px 28px rgba(71, 211, 165, .16);
}

.project-home-brand svg { width: 23px; height: 23px; }
.project-home-sidebar nav { display: grid; gap: 12px; width: 100%; }

.project-home-sidebar nav button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 72px;
    padding: 8px 4px;
    border: 1px solid transparent;
    border-radius: 18px;
    color: #8d939b;
    background: transparent;
    cursor: pointer;
    transition: color .18s ease, background .18s ease, border-color .18s ease;
}

.project-home-sidebar nav button svg { width: 22px; height: 22px; }
.project-home-sidebar nav button span { font-size: 13px; }
.project-home-sidebar nav button:hover { color: #f4f5f6; background: #202225; }
.project-home-sidebar nav button.active {
    color: #fff;
    border-color: #34373b;
    background: linear-gradient(180deg, #292b2e, #222427);
    box-shadow: 0 10px 28px rgba(0,0,0,.22);
}

.project-home-main { min-width: 0; }
body:not(.dark) .project-home-sidebar { border-right-color: #dfe3e8; background: rgba(248,249,251,.96); }
body:not(.dark) .project-home-sidebar nav button { color: #667085; }
body:not(.dark) .project-home-sidebar nav button:hover { color: #171a1f; background: #eceff3; }
body:not(.dark) .project-home-sidebar nav button.active { color: #171a1f; border-color: #d5dae1; background: #fff; }

@media (max-width: 720px) {
    .project-home { display: block; padding-bottom: 78px; }
    .project-home-sidebar {
        position: fixed;
        inset: auto 10px 10px;
        z-index: 120;
        flex-direction: row;
        min-height: 0;
        height: 64px;
        padding: 6px 8px;
        border: 1px solid #34373b;
        border-radius: 18px;
        box-shadow: 0 18px 50px rgba(0,0,0,.36);
    }
    .project-home-brand { display: none; }
    .project-home-sidebar nav { grid-template-columns: repeat(3, 1fr); gap: 5px; }
    .project-home-sidebar nav button { flex-direction: row; min-height: 50px; border-radius: 13px; }
    .project-home-sidebar nav button svg { width: 19px; height: 19px; }
    .project-home-sidebar nav button span { font-size: 12px; }
    .home-header { padding-inline: 14px; }
    .home-logo { font-size: 14px; }
    .home-actions .action-btn:not(.user-btn):not(.theme-mode-btn) { display: none; }
    .home-actions .action-btn { padding-inline: 9px; }
    .home-content { padding: 28px 14px 40px; }
    .home-launch h1 { font-size: 22px; }
    .home-prompt-box textarea { min-height: 132px; padding: 16px 15px 8px; }
    .home-prompt-submit > span { display: none; }
    .home-skill-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .home-skill-chip { justify-content: flex-start; min-width: 0; }
    .recent-projects { margin-top: 44px; }
    .recent-projects-heading { align-items: flex-start; gap: 14px; }
    .recent-projects-actions small { display: none; }
    .projects-grid { grid-template-columns: 1fr; }
}

body.dark .auth-form label { color: #d9dee4; }
body.dark .auth-modal-content .form-input {
    border-color: #4b5561;
    color: #f4f7f9;
    background: #171b1f;
    caret-color: #6ce0ba;
}
body.dark .auth-modal-content .form-input::placeholder { color: #9099a5; }
body.dark .auth-modal-content .form-input:hover { border-color: #687380; background: #15191d; }
body.dark .auth-modal-content .form-input:focus {
    border-color: #5ed8b0;
    color: #ffffff;
    background: #101417;
    box-shadow: 0 0 0 3px rgba(94, 216, 176, 0.16);
}

.input-with-btn {
    display: flex;
    gap: 8px;
}

.input-with-btn .form-input {
    flex: 1;
}

.send-code-btn {
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.send-code-btn:hover {
    background: var(--canvas-bg);
}

.submit-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: #168c6d;
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.submit-btn:hover {
    background: #126b54;
}

.asset-card-menu .asset-card-team {
    color: #e4faf3;
}

.asset-card-menu .asset-card-team:hover {
    color: #ffffff;
    background: #334155;
}

.asset-card-menu button:disabled {
    opacity: .5;
    pointer-events: none;
}

.guest-access {
    margin-top: 14px;
    text-align: center;
}

.guest-access-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    color: var(--text-muted);
    font-size: 12px;
}

.guest-access-divider::before,
.guest-access-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.guest-access-btn {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.guest-access-btn:hover {
    border-color: var(--primary, #20c997);
    background: var(--surface-hover, #f8fafc);
    color: var(--primary, #20c997);
}

.guest-access p {
    margin: 9px 4px 0;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.5;
}

/* 设置弹窗 */
.settings-section {
    margin-bottom: 24px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--surface-hover);
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
}

.setting-item label:first-child {
    font-size: 14px;
    color: var(--text-secondary);
}

/* 开关 */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--canvas-grid);
    border-radius: 24px;
    transition: 0.3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: var(--surface);
    border-radius: 50%;
    transition: 0.3s;
}

input:checked+.slider {
    background: var(--text-secondary);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* 账户信息 */
.account-info {
    background: var(--canvas-bg);
    border-radius: 12px;
    padding: 16px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.info-row span:first-child {
    font-size: 14px;
    color: var(--text-muted);
}

.points-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
}

.recharge-btn {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.recharge-btn:hover {
    background: linear-gradient(135deg, #d97706 0%, #ea580c 100%);
}

/* 右键菜单 */
.context-menu {
    position: fixed;
    background: var(--surface);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 4px 0;
    min-width: 132px;
    z-index: 3800;
    display: none;
}

.context-menu.show {
    display: block;
}

#userDropdown {
    min-width: 188px;
}

#userDropdown .menu-item {
    min-height: 32px;
}

.menu-section-title {
    padding: 5px 12px 2px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.menu-item {
    padding: 6px 12px;
    font-size: 12px;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.compact-node-menu {
    min-width: 124px;
    max-width: 168px;
    border-radius: 7px;
    padding: 4px 0;
}

.compact-node-menu .menu-item {
    min-height: 26px;
    padding: 4px 10px;
    font-size: 11px;
    gap: 6px;
    white-space: nowrap;
}

.compact-node-menu .menu-section-title {
    padding: 4px 10px 2px;
    font-size: 10px;
}

.compact-node-menu .menu-divider {
    margin: 2px 0;
}

.compact-node-menu svg {
    width: 11px;
    height: 11px;
}

.menu-item:hover {
    background: var(--surface-hover);
}

/* 连接线临时绘制 */
.temp-connection {
    stroke: #5dd6b1;
    stroke-width: 1.35;
    stroke-linecap: round;
    filter: drop-shadow(0 0 2px rgba(75, 179, 255, 0.68));
    fill: none;
    vector-effect: non-scaling-stroke;
}

/* 版权信息 */
.footer {
    position: relative;
    flex: 0 0 40px;
    margin-top: auto;
    width: 100%;
    height: 40px;
    background: var(--surface);
    border-top: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-muted);
    z-index: 20;
}

body.canvas-mode > .footer,
body.guest-home > .footer { display: none; }

/* 登录后的首页版权只承担信息展示，不再用独立底色把页面切成两段。 */
body:has(#projectHome:not([hidden])) .footer {
    background: transparent;
    border-top: 0;
    box-shadow: none;
}

body.dark:has(#projectHome:not([hidden])) .footer {
    background-color: #111213;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.055) 0, rgba(255, 255, 255, 0.055) 0.85px, transparent 1.15px);
    background-size: 32px 32px;
}

/* v1.22 · 大画布交互降级：拖动和缩放期间关闭非必要命中层、光效和阴影。 */
.canvas-container.large-canvas-mode.canvas-interacting .conn-hit,
.canvas-container.large-canvas-mode.canvas-interacting .conn-flow,
.canvas-container.large-canvas-mode.canvas-interacting .conn-flow-glow,
.canvas-container.large-canvas-mode.canvas-interacting .conn-delete-control {
    display: none !important;
}

.canvas-container.large-canvas-mode.canvas-interacting .canvas-node-group-backdrop,
.canvas-container.large-canvas-mode.canvas-interacting .node {
    box-shadow: none !important;
    filter: none !important;
}

.footer a {
    color: var(--text-secondary);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* 滚动条样式 */
.canvas-container::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.canvas-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.canvas-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 5px;
}

.canvas-container::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* 工具栏中心 */
.toolbar-center {
    display: flex;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.tool-btn {
    padding: 8px 16px;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: var(--canvas-grid);
    border-color: var(--border);
}

.tool-btn:active {
    background: #d1d5db;
}

/* 快捷键弹窗 */
.shortcuts-modal {
    width: min(1040px, calc(100vw - 64px));
    max-width: 1040px;
    max-height: min(640px, calc(100vh - 72px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.shortcuts-modal .modal-header {
    flex: 0 0 auto;
    padding: 14px 18px;
}

.shortcuts-heading {
    min-width: 0;
}

.shortcuts-heading h2 {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 16px;
    line-height: 1.2;
}

.shortcuts-heading h2 i,
.shortcuts-heading h2 svg {
    width: 18px;
    height: 18px;
}

.shortcuts-heading p {
    margin: 5px 0 0 27px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.4;
}

.shortcuts-modal .modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.shortcuts-modal .modal-close i,
.shortcuts-modal .modal-close svg {
    width: 17px;
    height: 17px;
}

.shortcuts-modal .modal-body {
    min-height: 0;
    padding: 14px 18px 18px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

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

.shortcut-item {
    min-width: 0;
    min-height: 62px;
    padding: 10px 12px;
    background: var(--canvas-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.shortcut-item:hover {
    background: var(--surface-hover);
    border-color: var(--border);
}

.shortcut-key {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    display: block;
    white-space: normal;
    overflow-wrap: anywhere;
}

.shortcut-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.35;
    overflow-wrap: anywhere;
}

@media (max-width: 980px) {
    .shortcuts-modal {
        width: calc(100vw - 32px);
    }

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

@media (max-width: 620px) {
    .shortcuts-modal {
        width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
    }

    .shortcuts-modal .modal-header {
        padding: 14px 16px;
    }

    .shortcuts-modal .modal-body {
        padding: 12px 16px 16px;
    }

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

    .shortcut-item {
        min-height: 58px;
    }
}

@media (max-width: 420px) {
    .shortcuts-grid {
        grid-template-columns: 1fr;
    }
}

/* 菜单分隔线 */
.menu-divider {
    height: 1px;
    background: var(--canvas-grid);
    margin: 4px 0;
}

/* 复制通知 */
.copy-notification {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-secondary);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(26, 26, 46, 0.3);
    z-index: 10000;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ========== 端口拖拽松手菜单 ========== */
.port-drop-menu {
    position: fixed;
    background: var(--surface);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
    padding: 6px 0;
    min-width: 170px;
    z-index: 2500;
    display: none;
    animation: portMenuIn 0.12s ease;
}

@keyframes portMenuIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.port-drop-menu.show {
    display: block;
}

.port-drop-menu-title {
    padding: 6px 14px 4px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.port-drop-menu-item {
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.12s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.port-drop-menu-item:hover {
    background: var(--surface-hover);
    color: var(--text-secondary);
}

.port-drop-menu-item .item-icon {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

/* ========== AI助手对话框 ========== */
.text-upload-row {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    align-items: center;
}

.text-upload-btn {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.text-upload-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text);
}

.text-file-name {
    font-size: 10px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-chat-panel {
    border: 1px solid #20c997;
    border-top: none;
    border-radius: 0 0 8px 8px;
    background: var(--surface);
    overflow: hidden;
    margin-bottom: 2px;
}

.ai-chat-messages {
    max-height: 180px;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--input-bg);
}

.ai-chat-messages::-webkit-scrollbar {
    width: 4px;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

.ai-chat-msg {
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
    max-width: 95%;
    word-break: break-word;
}

.ai-chat-msg.system-msg {
    background: var(--surface-hover);
    color: var(--text-muted);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.ai-chat-msg.user-msg {
    background: #20c997;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.ai-chat-msg.assistant-msg {
    background: var(--canvas-bg);
    color: var(--text-secondary);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
    border: 1px solid #e2e8f0;
}

.ai-chat-msg .fill-btn {
    display: inline-block;
    margin-top: 6px;
    padding: 3px 10px;
    background: #20c997;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-chat-msg .fill-btn:hover {
    background: #16966f;
}

.ai-chat-msg.assistant-msg .fill-btn {
    background: var(--surface);
    color: #20c997;
    border: 1px solid #20c997;
}

.ai-chat-msg.assistant-msg .fill-btn:hover {
    background: #20c997;
    color: #fff;
}

.ai-chat-input-row {
    display: flex;
    gap: 6px;
    padding: 8px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.ai-chat-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    outline: none;
    transition: border-color 0.2s;
}

.ai-chat-input:focus {
    border-color: #20c997;
}

.ai-chat-input::placeholder {
    color: #85cdb7;
}

.ai-chat-send-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: #20c997;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ai-chat-send-btn:hover {
    background: #16966f;
}

.ai-chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* AI消息中的loading动画 */
.ai-chat-msg.loading-msg {
    background: var(--canvas-bg);
    color: var(--text-muted);
    align-self: flex-start;
}

.ai-chat-msg.loading-msg::after {
    content: '...';
    animation: dotPulse 1.5s infinite;
}

@keyframes dotPulse {

    0%,
    20% {
        content: '.';
    }

    40% {
        content: '..';
    }

    60%,
    100% {
        content: '...';
    }
}

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
    .toolbar-center {
        flex-wrap: wrap;
        gap: 4px;
    }

    .tool-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* ========== 媒体下载按钮 ========== */
.media-download-btn {
    position: absolute;
    top: 8px;
    right: 80px;
    width: 30px;
    height: 30px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0 7px;
    padding: 0 16px;
    color: rgba(245, 247, 250, 0.88);
    background: rgba(16, 18, 22, 0.78);
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 9px;
    cursor: pointer;
    z-index: 12;
    opacity: 0.9;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

/* v1.53 · 节点输出能力矩阵：不兼容类型保留展示但禁止操作。 */
.port-drop-menu-item.disabled,
.port-drop-menu-item[aria-disabled="true"] {
    color: #666c74 !important;
    opacity: .48 !important;
    cursor: not-allowed !important;
    pointer-events: auto;
}
.port-drop-menu-item.disabled:hover,
.port-drop-menu-item[aria-disabled="true"]:hover {
    color: #666c74 !important;
    background: transparent !important;
    transform: none !important;
}
.port-drop-menu-item.disabled .item-icon,
.port-drop-menu-item[aria-disabled="true"] .item-icon {
    color: inherit !important;
}

.footer > i { color: var(--border-strong, var(--border)); font-style: normal; }

.media-download-btn svg {
    width: 16px;
    height: 16px;
}

.media-download-btn:hover {
    color: #fff;
    background: rgba(35, 104, 255, 0.94);
    border-color: rgba(125, 170, 255, 0.7);
    opacity: 1;
    transform: translateY(-1px);
}

.media-download-btn[hidden] {
    display: none !important;
}

/* ========== 媒体删除按钮 ========== */
.media-delete-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    background: rgba(16, 18, 22, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 9px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease, color 0.15s ease;
    padding: 0;
    color: rgba(245, 247, 250, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.media-delete-btn svg {
    width: 16px;
    height: 16px;
}

.media-delete-btn:hover {
    background: rgba(32, 36, 44, 0.9);
    color: #fff;
}

/* ========== 媒体替换按钮 ========== */
.media-replace-btn {
    position: absolute;
    bottom: 8px;
    right: 44px;
    width: 30px;
    height: 30px;
    display: none;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 9px;
    background: rgba(16, 18, 22, 0.72);
    cursor: pointer;
    color: rgba(245, 247, 250, 0.8);
    z-index: 10;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.media-replace-btn svg {
    width: 16px;
    height: 16px;
}

.media-replace-btn:hover {
    background: rgba(32, 36, 44, 0.9);
    color: #fff;
}

.video-frame-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    display: none;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 9px;
    background: rgba(8, 10, 14, 0.72);
    color: rgba(245, 247, 250, 0.92);
    cursor: pointer;
    z-index: 4;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.video-frame-btn svg {
    width: 16px;
    height: 16px;
}

.video-frame-label {
    display: none;
    white-space: nowrap;
}

.video-frame-btn:hover {
    background: rgba(32, 36, 44, 0.9);
    color: #fff;
}

.video-frame-menu {
    position: fixed;
    z-index: 10020;
    min-width: 156px;
    padding: 8px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 14px;
    background: rgba(22, 24, 28, 0.96);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.36);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.video-frame-menu button {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: rgba(245, 247, 250, 0.9);
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.video-frame-menu button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

/* 有素材时才显示替换按钮 */
.image-preview:not([hidden])~.media-replace-btn,
.video-preview:not([hidden])~.media-replace-btn,
.audio-preview:not([hidden])~.media-replace-btn {
    display: flex;
}

.video-preview:not([hidden])~.video-frame-btn {
    display: flex;
}

body.dark .media-replace-btn {
    background: rgba(0, 0, 0, 0.5);
}

/* 媒体操作统一收纳到预览区右上角：截帧（视频）→替换→删除。 */
body.canvas-mode .node.image-node:has(.image-preview:not([hidden])) .media-delete-btn,
body.canvas-mode .node.image-node:has(.image-preview:not([hidden])) .media-replace-btn,
body.canvas-mode .node.video-node:has(.video-preview:not([hidden])) .media-delete-btn,
body.canvas-mode .node.video-node:has(.video-preview:not([hidden])) .media-replace-btn,
body.canvas-mode .node.audio-node:has(.audio-preview:not([hidden])) .media-delete-btn,
body.canvas-mode .node.audio-node:has(.audio-preview:not([hidden])) .media-replace-btn {
    top: 8px;
    bottom: auto;
}

body.canvas-mode .node.image-node:has(.image-preview:not([hidden])) .media-delete-btn,
body.canvas-mode .node.video-node:has(.video-preview:not([hidden])) .media-delete-btn,
body.canvas-mode .node.audio-node:has(.audio-preview:not([hidden])) .media-delete-btn {
    right: 8px;
}

body.canvas-mode .node.image-node:has(.image-preview:not([hidden])) .media-replace-btn,
body.canvas-mode .node.video-node:has(.video-preview:not([hidden])) .media-replace-btn,
body.canvas-mode .node.audio-node:has(.audio-preview:not([hidden])) .media-replace-btn {
    right: 44px;
}

body.canvas-mode .node.video-node:has(.video-preview:not([hidden])) .video-frame-btn {
    top: 8px;
    bottom: auto;
    right: 80px;
}

body.canvas-mode .node.image-node.zoomed .media-delete-btn,
body.canvas-mode .node.image-node.zoomed .media-replace-btn,
body.canvas-mode .node.video-node.zoomed .media-delete-btn,
body.canvas-mode .node.video-node.zoomed .media-replace-btn {
    top: calc(8px * var(--media-zoom-ui-scale));
    bottom: auto;
}

body.canvas-mode .node.image-node.zoomed .media-delete-btn,
body.canvas-mode .node.video-node.zoomed .media-delete-btn {
    right: calc(8px * var(--media-zoom-ui-scale));
}

body.canvas-mode .node.image-node.zoomed .media-replace-btn,
body.canvas-mode .node.video-node.zoomed .media-replace-btn {
    right: calc(42px * var(--media-zoom-ui-scale));
}

body.canvas-mode .node.video-node.zoomed .video-frame-btn {
    top: calc(8px * var(--media-zoom-ui-scale));
    right: calc(76px * var(--media-zoom-ui-scale));
}

/* ========== 左侧节点管理栏 ========== */
.node-sidebar {
    position: fixed;
    top: 60px;
    left: 12px;
    bottom: 88px;
    width: 180px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    z-index: 2500;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: left 0.2s ease;
    will-change: left;
}

.node-sidebar.collapsed {
    left: -140px;
}

.node-sidebar.collapsed .sidebar-header {
    padding-right: 4px;
    justify-content: flex-end;
}

.node-sidebar.collapsed .sidebar-title,
.node-sidebar.collapsed .sidebar-list,
.node-sidebar.collapsed .sbar-edit,
.node-sidebar.collapsed .sbar-eye {
    display: none;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.sidebar-toggle {
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    background: var(--surface-hover);
}

.sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 13px;
    color: var(--text);
}

.sidebar-item:hover {
    background: var(--surface-hover);
}

.sidebar-item.active {
    background: var(--canvas-bg);
}

.sidebar-item .sbar-icon {
    flex-shrink: 0;
    font-size: 14px;
}

.sidebar-item .sbar-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.sidebar-item .sbar-name.editing {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 2px 4px;
    outline: none;
    font-size: 11px;
    color: var(--text-secondary);
    box-shadow: 0 0 0 2px rgba(32, 201, 151, 0.15);
}

.sidebar-item .sbar-eye,
.sidebar-item .sbar-edit {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    opacity: 0.5;
    transition: opacity 0.15s;
}

.sidebar-item .sbar-edit {
    font-size: 10px;
}

.sidebar-item .sbar-eye svg,
.sidebar-item .sbar-edit svg {
    width: 13px;
    height: 13px;
}

.sidebar-item .sbar-eye:hover,
.sidebar-item .sbar-edit:hover {
    opacity: 1;
    background: var(--surface-hover);
}

.sidebar-item.hidden-node {
    opacity: 0.4;
}

/* ========== 底部工具栏 ========== */
.bottom-toolbar {
    position: fixed;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 28px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    z-index: 3000;
    user-select: none;
}

body.dark .bottom-toolbar {
    background: rgba(38, 38, 38, 0.85);
    border-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.30);
}

.btm-tool-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: transparent;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
    line-height: 1;
}

.btm-tool-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
    transform: scale(1.08);
}

.btm-tool-btn:active {
    background: rgba(0, 0, 0, 0.10);
    transform: scale(0.95);
}

.btm-tool-btn.active {
    background: #1a1a1a;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btm-tool-btn.active i[data-lucide] {
    stroke-width: 2.5;
}

.btm-tool-btn.active:hover {
    filter: brightness(0.85);
}

.canvas-zoom-readout {
    min-width: 42px;
    padding: 0 5px;
    color: var(--text-secondary);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    line-height: 38px;
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
}

.node-brush-canvas.is-eraser {
    opacity: 0.72;
    filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.9));
}

.btm-divider {
    width: 1px;
    height: 24px;
    background: rgba(0, 0, 0, 0.10);
    border-radius: 1px;
    align-self: center;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        height: auto;
        padding: 10px;
        gap: 10px;
    }

    .canvas-container {
        top: 120px;
    }
}


/* 暗色主题微调 */
body.dark .home-page {
    background-color: #131414;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.11) 0, rgba(255, 255, 255, 0.11) 1px, transparent 1.3px);
    background-size: 28px 28px;
}

body.dark .toolbar,
body.dark .footer,
body.dark .node-sidebar {
    background: var(--surface);
    border-color: var(--border);
}

body.dark .home-header {
    background: rgba(19, 20, 20, 0.92);
    border-color: #2d2f31;
}

body.dark .node-sidebar {
    background: rgba(38, 38, 38, 0.95);
}

body.dark .node {
    background: var(--surface);
    border-color: var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.dark .node:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

body.dark .node.image-node,
body.dark .node.video-node,
body.dark .node.image-node:hover,
body.dark .node.video-node:hover,
body.dark .node.image-node.selected,
body.dark .node.video-node.selected,
body.dark .node.image-node.zoomed,
body.dark .node.video-node.zoomed {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

body.dark .context-menu,
body.dark .port-drop-menu,
body.dark .modal-content {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

body.dark .modal-overlay {
    background: rgba(0, 0, 0, 0.7);
}

body.dark .node-textarea::placeholder,
body.dark .user-input::placeholder,
body.dark .agent-video-url::placeholder {
    color: var(--text-muted);
}

body.dark .image-placeholder,
body.dark .audio-placeholder,
body.dark .video-placeholder {
    color: var(--text-muted);
}

body.dark .media-delete-btn {
    background: rgba(0, 0, 0, 0.5);
}

body.dark .copy-notification {
    background: var(--surface-hover);
    color: var(--text);
}

body.dark .ai-chat-messages {
    background: var(--input-bg);
}

body.dark .sidebar-item .sbar-eye,
body.dark .sidebar-item .sbar-edit {
    color: var(--text);
    opacity: 0.7;
}

body.dark .sidebar-item .sbar-eye:hover,
body.dark .sidebar-item .sbar-edit:hover {
    background: var(--surface-hover);
    opacity: 1;
}

body.dark .node-action-btn,
body.dark .node-action-btn.agent-btn {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

body.dark .node-action-btn:hover,
body.dark .node-action-btn.agent-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
    filter: none;
}

body.dark .sidebar-item:hover,
body.dark .sidebar-toggle:hover,
body.dark .btm-tool-btn:hover,
body.dark .tool-btn:hover,
body.dark .back-btn:hover,
body.dark .action-btn:hover,
body.dark .menu-item:hover,
body.dark .port-drop-menu-item:hover,
body.dark .modal-close:hover,
body.dark .auth-tab:hover,
body.dark .new-project-btn:hover,
body.dark .shortcut-item:hover,
body.dark .asset-picker-close:hover {
    background: var(--surface-hover);
}

body.dark .btm-tool-btn:hover {
    color: var(--text);
}

body.dark .new-project-btn:hover {
    color: #fff;
}

body.dark .image-preview-box:hover,
body.dark .audio-preview-box:hover,
body.dark .video-preview-box:hover {
    background: var(--surface-hover);
    border-color: var(--text-muted);
}

body.dark .image-preview-box:has(.image-preview:not([hidden])):hover,
body.dark .audio-preview-box:has(.audio-preview:not([hidden])):hover,
body.dark .video-preview-box:has(.video-preview:not([hidden])):hover {
    background: transparent;
    border-color: var(--text-muted);
}

body.dark .add-ref-btn:hover {
    background: var(--surface-hover);
    border-color: var(--text-muted);
    color: var(--text);
}

body.dark .asset-card:hover {
    background: var(--surface-hover);
    border-color: var(--text-muted);
}

body.dark .agent-select:hover {
    background: var(--surface-hover);
}

/* ========== Liblib 风格画布主题：仅在编辑器内启用 ========== */
body.canvas-mode {
    --primary: #69a7ff;
    --primary-hover: #82b6ff;
    --text: #f2f3f5;
    --text-secondary: #c7cbd1;
    --text-muted: #858b95;
    --surface: #252628;
    --surface-hover: #303235;
    --border: #3d3f43;
    --canvas-bg: #111214;
    --canvas-grid: rgba(255, 255, 255, 0.058);
    --canvas-grid-size: 32px;
    --toolbar-bg: #1a1b1d;
    --input-bg: #202123;
    color-scheme: dark;
    background: #111214;
}

body.canvas-mode .toolbar {
    height: auto;
    padding: 10px 14px 0;
    background: transparent;
    border-bottom: 0;
    box-shadow: none;
    backdrop-filter: none;
    pointer-events: none;
}

body.canvas-mode .toolbar-left,
body.canvas-mode .toolbar-right {
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    pointer-events: auto;
}

body.canvas-mode .toolbar-left {
    gap: 10px;
    max-width: min(520px, calc(100vw - 360px));
}

body.canvas-mode .toolbar-right {
    gap: 6px;
}

body.canvas-mode .back-btn,
body.canvas-mode .action-btn,
body.canvas-mode .new-project-btn {
    min-height: 34px;
    padding: 6px 11px;
    border-color: #383a3e;
    border-radius: 10px;
    background: rgba(35, 36, 39, 0.9);
    color: #c8cbd0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.035);
    backdrop-filter: blur(16px);
}

body.canvas-mode .back-btn:hover,
body.canvas-mode .action-btn:hover,
body.canvas-mode .new-project-btn:hover {
    background: #303236;
    border-color: #4a4d52;
    color: #fff;
}

body.canvas-mode .project-name {
    color: #d5d7db;
    font-size: 13px;
    font-weight: 600;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-left: 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
}

body.canvas-mode .canvas-container {
    top: 0;
    left: 0 !important;
    background-color: #111214;
    background-image:
        radial-gradient(circle, var(--canvas-grid) 0, var(--canvas-grid) 0.82px, transparent 1.12px),
        radial-gradient(circle, rgba(255, 255, 255, 0.025) 0, rgba(255, 255, 255, 0.025) 0.72px, transparent 1px);
    background-size: var(--canvas-grid-size) var(--canvas-grid-size), calc(var(--canvas-grid-size) * 4) calc(var(--canvas-grid-size) * 4);
    background-position: 0 0, 16px 16px;
}

body.canvas-mode .connections-layer path.conn-line {
    stroke: #56606e;
    stroke-width: 1.05;
    opacity: 0.9;
}

body.canvas-mode .connections-layer g:hover .conn-line {
    stroke: #74869d;
    stroke-width: 1.35;
}

body.canvas-mode .node:not(.image-node):not(.video-node) {
    width: 268px;
    min-width: 248px;
    max-width: 300px;
    background: #252628;
    border: 1px solid #3b3d41;
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

body.canvas-mode .node:not(.image-node):not(.video-node):hover {
    border-color: #4b4e53;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.34);
}

body.canvas-mode .node:not(.image-node):not(.video-node).selected {
    border-color: #66707d;
    box-shadow: 0 0 0 1px rgba(157, 194, 255, 0.28), 0 12px 34px rgba(0, 0, 0, 0.34);
}

body.canvas-mode .node.image-node,
body.canvas-mode .node.video-node,
body.canvas-mode .node.image-node:hover,
body.canvas-mode .node.video-node:hover,
body.canvas-mode .node.image-node.selected,
body.canvas-mode .node.video-node.selected {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

/* 空媒体节点需要像明确的上传入口；加载媒体后再回到轻量画布展示。 */
body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))),
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) {
    width: 268px;
    min-width: 268px;
    max-width: 268px;
    min-height: 205px;
    box-sizing: border-box;
    background: #232528;
    border: 1px solid #41454b;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}

body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))):hover,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))):hover,
body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))).selected,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))).selected {
    background: #26282c;
    border-color: #68717d;
    box-shadow: 0 0 0 1px rgba(121, 177, 255, 0.16), 0 10px 28px rgba(0, 0, 0, 0.28);
}

/* 🎯 修复：图片/视频加载完成后节点会丢失明确宽度（只剩min/max-width），
   浏览器会按图片原始像素尺寸撑大节点，冲出卡片边界并与相邻节点重叠。
   媒体加载后仍固定卡片宽度，图片/视频通过 aspect-ratio + object-fit 在卡片内自适应缩放。 */
body.canvas-mode .node.image-node:has(.image-preview:not([hidden])),
body.canvas-mode .node.video-node:has(.video-preview:not([hidden])) {
    width: 268px;
    min-width: 268px;
    max-width: 268px;
    box-sizing: border-box;
}

body.canvas-mode .node.image-node:has(.image-preview:not([hidden])) .image-placeholder,
body.canvas-mode .node.video-node:has(.video-preview:not([hidden])) .video-placeholder {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .image-preview-box,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .video-preview-box {
    min-height: 160px;
    border: 1px dashed #51565e;
    background: #181a1d;
}

body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .audio-preview-box {
    min-height: 144px;
}

body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .image-placeholder,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .video-placeholder {
    color: #a9b0ba;
    font-size: 12px;
}

body.canvas-mode .node.image-node:hover .image-preview-box,
body.canvas-mode .node.video-node:hover .video-preview-box {
    border-color: #5a5e65;
}

body.canvas-mode .node.image-node.selected .image-preview-box,
body.canvas-mode .node.video-node.selected .video-preview-box {
    border-color: #8cb9f5;
    box-shadow: 0 0 0 2px rgba(105, 167, 255, 0.18);
}

body.canvas-mode .node-header {
    min-height: 42px;
    padding: 12px 14px 7px;
    gap: 7px;
    background: transparent;
    border-radius: 12px 12px 0 0;
}

body.canvas-mode .node-icon {
    width: 17px;
    height: 17px;
    color: #9299a4;
    stroke-width: 1.8;
}

body.canvas-mode .node-title {
    color: #d8dade;
    font-size: 14px;
    font-weight: 600;
}

body.canvas-mode .node.selected .node-title,
body.canvas-mode .node.selected .node-icon {
    color: #dceaff;
}

/* 媒体标题保持轻量单行，尺寸信息始终完整显示。 */
body.canvas-mode .image-node .node-header,
body.canvas-mode .video-node .node-header {
    min-width: 0;
    min-height: 30px;
    padding: 3px 2px 6px;
    gap: 5px;
    box-sizing: border-box;
}

body.canvas-mode .image-node .node-icon,
body.canvas-mode .video-node .node-icon {
    width: 14px;
    height: 14px;
    color: #858c96;
    stroke-width: 1.7;
}

body.canvas-mode .image-node .node-title,
body.canvas-mode .video-node .node-title,
body.canvas-mode .image-node.selected .node-title,
body.canvas-mode .video-node.selected .node-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #a7adb5;
    font-size: 12px;
    font-weight: 400;
    line-height: 18px;
}

body.canvas-mode .image-node .img-dim,
body.canvas-mode .video-node .img-dim,
body.canvas-mode .video-node .vid-dim {
    flex: 0 0 auto;
    margin-left: auto !important;
    margin-right: 0 !important;
    color: #777f89 !important;
    font-size: 11px !important;
    font-weight: 400 !important;
    line-height: 18px;
    white-space: nowrap;
}

body.canvas-mode .image-node .node-close,
body.canvas-mode .video-node .node-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 24px;
    margin-left: 4px;
}

body.canvas-mode .image-node .node-title,
body.canvas-mode .video-node .node-title {
    flex: 1 1 auto;
}

body.canvas-mode .node-close {
    width: 24px;
    height: 24px;
    color: #7d838d;
    border-radius: 6px;
}

body.canvas-mode .node-close:hover {
    background: rgba(239, 68, 68, 0.14);
    color: #ff7b7b;
}

body.canvas-mode .node-content {
    padding: 5px 14px 14px;
    color: #f0f1f3;
}

body.canvas-mode .image-node .node-content,
body.canvas-mode .video-node .node-content {
    padding: 4px 8px 8px;
}

body.canvas-mode .node-content>label,
body.canvas-mode .node-row>label,
body.canvas-mode .agent-label {
    color: #eef0f2;
    font-size: 12px;
    font-weight: 600;
}

body.canvas-mode .node-textarea,
body.canvas-mode .user-input {
    min-height: 92px;
    padding: 10px 11px;
    border: 1px solid #414348;
    border-radius: 8px;
    background: #202123;
    color: #f1f2f4;
    font-size: 13px;
    line-height: 1.55;
}

body.canvas-mode .node-textarea:hover,
body.canvas-mode .user-input:hover {
    border-color: #51545a;
}

body.canvas-mode .node-textarea:focus,
body.canvas-mode .user-input:focus {
    border-color: #6d7580;
    box-shadow: 0 0 0 2px rgba(130, 182, 255, 0.1);
}

body.canvas-mode .node-row {
    min-height: 38px;
    margin-top: 6px;
    gap: 10px;
}

body.canvas-mode .node-select,
body.canvas-mode .agent-select {
    min-width: 118px;
    height: 34px;
    padding: 5px 9px;
    border: 1px solid #3f4146;
    border-radius: 7px;
    background: #292a2d;
    color: #e3e5e8;
    font-size: 12px;
}

body.canvas-mode .model-select {
    min-width: 160px;
}

body.canvas-mode .node-select:hover,
body.canvas-mode .agent-select:hover {
    border-color: #55585e;
    background: #303236;
}

body.canvas-mode .add-ref-btn {
    width: 42px;
    height: 42px;
    border: 1px dashed #626873;
    border-radius: 8px;
    background: #18191b;
    color: #a7adb7;
}

body.canvas-mode .add-ref-btn:hover {
    border-color: #8da9d0;
    background: #25282c;
    color: #dceaff;
}

body.canvas-mode .node-action-btn,
body.canvas-mode .text-upload-btn {
    min-height: 38px;
    border: 1px solid #414348;
    border-radius: 8px;
    background: #292a2d;
    color: #f0f1f3;
    box-shadow: none;
}

body.canvas-mode .node-action-btn:hover,
body.canvas-mode .node-action-btn.agent-btn:hover,
body.canvas-mode .text-upload-btn:hover {
    border-color: #5a5e65;
    background: #34363a;
    color: #fff;
}

body.canvas-mode .image-preview-box,
body.canvas-mode .video-preview-box,
body.canvas-mode .audio-preview-box {
    border-color: #45484d;
    border-radius: 9px;
    background: #17181a;
}

body.canvas-mode .image-preview-box:has(.image-preview:not([hidden])),
body.canvas-mode .video-preview-box:has(.video-preview:not([hidden])),
body.canvas-mode .audio-preview-box:has(.audio-preview:not([hidden])) {
    border: 1px solid #414449;
    background: #111214;
}

body.canvas-mode .image-preview,
body.canvas-mode .video-preview {
    border-radius: 8px;
}

body.canvas-mode .node.audio-node .audio-preview-box {
    min-height: 64px;
    padding: 10px 52px 10px 12px;
    overflow: visible;
}

body.canvas-mode .node.audio-node .audio-preview-box.has-media,
body.canvas-mode .node.audio-node .audio-preview-box:has(.audio-preview:not([hidden])) {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 58px;
    background: #111214;
}

body.canvas-mode .node.audio-node .audio-preview {
    display: block;
    width: 100%;
    max-width: none;
    height: 34px;
    min-width: 160px;
    margin: 0;
    position: relative;
    z-index: 2;
}

body.canvas-mode .node.audio-node .media-replace-btn,
body.canvas-mode .node.audio-node .media-delete-btn {
    width: 26px;
    height: 26px;
    right: 8px;
    bottom: 8px;
    z-index: 4;
}

body.canvas-mode .node.audio-node .media-replace-btn {
    right: 40px;
}

body.canvas-mode .node-port::after {
    width: 18px;
    height: 18px;
    border: 1px solid #555a62;
    background: #2b2d30;
    color: #cbd0d7;
    font-size: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

body.canvas-mode .node-port:hover::after,
body.canvas-mode .node-port.snap-target::after {
    border-color: #91bfff;
    background: #3c6ca8;
    color: #fff;
}

body.canvas-mode .node-sidebar {
    top: 84px;
    background: rgba(28, 29, 31, 0.96);
    border-color: #303236;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(14px);
}

body.canvas-mode .sidebar-header {
    border-bottom-color: #303236;
}

body.canvas-mode .sidebar-title,
body.canvas-mode .sidebar-item {
    color: #cfd2d7;
}

body.canvas-mode .sidebar-item:hover {
    background: #292b2e;
}

body.canvas-mode .sidebar-item.active {
    background: #34363a;
    color: #fff;
}

body.canvas-mode .bottom-toolbar {
    bottom: 12px;
    padding: 7px 11px;
    gap: 4px;
    background: rgba(34, 35, 38, 0.94);
    border: 1px solid #3a3c40;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(16px);
}

body.canvas-mode .btm-tool-btn {
    color: #aeb3bb;
}

body.canvas-mode .btm-tool-btn:hover {
    background: #333539;
    color: #fff;
}

body.canvas-mode .btm-tool-btn.active,
body.canvas-mode .btm-tool-btn.active:hover {
    background: #f4f5f6;
    color: #17181a;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.26);
}

body.canvas-mode .btm-divider {
    background: #45484d;
}

body.canvas-mode .context-menu,
body.canvas-mode .port-drop-menu,
body.canvas-mode .modal-content,
body.canvas-mode .asset-picker,
body.canvas-mode .shortcut-panel {
    background: #242527;
    border-color: #3c3e42;
    color: #e9eaec;
    box-shadow: 0 16px 46px rgba(0, 0, 0, 0.48);
}

body.canvas-mode .menu-item,
body.canvas-mode .port-drop-menu-item {
    color: #d6d9dd;
}

body.canvas-mode .menu-item:hover,
body.canvas-mode .port-drop-menu-item:hover {
    background: #333539;
    color: #fff;
}

body.canvas-mode .port-drop-menu.port-reference-menu {
    min-width: 222px;
    padding: 16px 0;
    border-radius: 18px;
    background: #262729;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
}

body.canvas-mode .port-reference-menu .port-drop-menu-title {
    padding: 0 24px 12px;
    font-size: 16px;
    line-height: 1.35;
    font-weight: 700;
    color: #b8bdc5;
    text-transform: none;
    letter-spacing: 0;
}

body.canvas-mode .port-reference-menu .port-drop-menu-item {
    min-height: 42px;
    padding: 9px 24px;
    gap: 14px;
    font-size: 16px;
    line-height: 1.2;
    font-weight: 700;
    color: #f2f3f5;
}

body.canvas-mode .port-reference-menu .port-drop-menu-item:hover {
    background: rgba(255, 255, 255, 0.07);
}

body.canvas-mode .port-reference-menu .port-drop-menu-item .item-icon {
    width: 20px;
    height: 20px;
    color: #f5f7fb;
}

body.canvas-mode .menu-divider,
body.canvas-mode .modal-header {
    border-color: #3b3d41;
}

/* Seedance 创作节点：保留画布节点能力，用更紧凑的对话式输入组织素材。 */
body.canvas-mode .node.video-gen-node {
    width: 392px;
    min-width: 392px;
    max-width: 392px;
    border-radius: 10px;
}

body.canvas-mode .video-gen-node .node-header {
    min-height: 38px;
    padding: 9px 12px 5px;
}

body.canvas-mode .video-gen-node .node-content {
    padding: 5px 12px 12px;
}

.seedance-composer {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.seedance-ref-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.seedance-ref-item {
    min-width: 0;
    padding: 7px;
    border: 1px solid #3b3d41;
    border-radius: 8px;
    background: #202123;
}

.seedance-ref-item>label {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    margin-bottom: 6px;
    color: #e2e4e7;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.seedance-ref-item>label svg {
    width: 14px;
    height: 14px;
    color: #969da8;
}

.seedance-ref-item .ref-limit,
.seedance-ref-item .ref-count {
    margin-left: auto !important;
    color: #858b94 !important;
    font-size: 9px !important;
    font-weight: 500;
}

.seedance-ref-item .ref-image-box,
.seedance-ref-item .ref-video-box,
.seedance-ref-item .ref-audio-box {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    min-height: 34px;
    flex-wrap: nowrap;
}

body.canvas-mode .seedance-ref-item .add-ref-btn {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    padding: 0;
}

.seedance-ref-item .add-ref-btn svg {
    width: 16px;
    height: 16px;
}

.seedance-ref-item .ref-preview,
.seedance-ref-item .ref-video-preview,
.seedance-ref-item .ref-audio-preview {
    display: flex;
    flex: 1 1 auto;
    gap: 3px;
    max-width: none;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
}

.seedance-ref-item .ref-img-wrap,
.seedance-ref-item .ref-vid-wrap,
.seedance-ref-item .ref-audio-wrap {
    flex: 0 0 auto;
    margin: 0 !important;
}

.seedance-ref-item .ref-thumb,
.seedance-ref-item .ref-video-preview video {
    width: 34px !important;
    height: 34px !important;
    border: 1px solid #4b4e53 !important;
    border-radius: 6px !important;
    object-fit: cover;
}

.seedance-ref-item .ref-audio-preview audio {
    width: 72px !important;
    height: 34px;
    margin: 0 !important;
}

.seedance-prompt-label {
    margin-top: 1px;
    color: #eef0f2;
    font-size: 12px;
    font-weight: 600;
}

body.canvas-mode .seedance-prompt {
    min-height: 122px;
    margin: 0;
    resize: vertical;
}

.seedance-tpl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    min-height: 32px;
    padding: 5px 9px;
    border: 1px dashed #4d535c;
    border-radius: 7px;
    background: transparent;
    color: #aeb4bd;
    font-size: 11px;
    cursor: pointer;
}

.seedance-tpl-btn svg {
    width: 14px;
    height: 14px;
}

.seedance-tpl-btn:hover {
    border-color: #7eaeea;
    background: rgba(98, 153, 224, 0.08);
    color: #d9eaff;
}

.seedance-input-rule {
    color: #7f858e;
    font-size: 10px;
    line-height: 1.4;
}

.seedance-settings {
    display: grid;
    grid-template-columns: 1.7fr 1fr 1fr;
    gap: 6px;
}

body.canvas-mode .seedance-settings .node-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    min-height: 0;
    margin: 0;
}

body.canvas-mode .seedance-settings .node-row label {
    color: #969ca5;
    font-size: 10px;
}

body.canvas-mode .seedance-settings .node-select {
    width: 100%;
    min-width: 0;
    height: 32px;
}

body.canvas-mode .seedance-generate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 1px;
    background: #f0f1f3;
    border-color: #f0f1f3;
    color: #17181a;
}

body.canvas-mode .seedance-generate-btn:hover {
    background: #fff;
    border-color: #fff;
    color: #111214;
}

.seedance-generate-btn svg {
    width: 16px;
    height: 16px;
}

body.canvas-mode ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

body.canvas-mode ::-webkit-scrollbar-thumb {
    background: #45484d;
    border-radius: 8px;
}

body.canvas-mode ::-webkit-scrollbar-track {
    background: transparent;
}

body.canvas-mode button:focus-visible,
body.canvas-mode select:focus-visible,
body.canvas-mode input:focus-visible,
body.canvas-mode textarea:focus-visible,
body.canvas-mode [tabindex]:focus-visible {
    outline: 2px solid #82b6ff;
    outline-offset: 2px;
}

@media (max-width: 760px) {
    body.canvas-mode .toolbar {
        padding-inline: 8px;
        gap: 8px;
    }

    body.canvas-mode .toolbar-left {
        max-width: calc(100vw - 148px);
        min-height: 40px;
    }

    body.canvas-mode .toolbar-right {
        min-height: 40px;
    }

    body.canvas-mode .project-name {
        max-width: 110px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.canvas-mode .action-btn {
        width: 36px;
        padding: 6px;
        font-size: 0;
    }

    body.canvas-mode .action-btn svg {
        width: 18px;
        height: 18px;
    }

    body.canvas-mode .bottom-toolbar {
        max-width: calc(100vw - 20px);
        overflow-x: auto;
    }

    body.canvas-mode .node.video-gen-node {
        width: 340px;
        min-width: 340px;
        max-width: 340px;
    }
}

/* 统一文本与三类空素材节点的初始画布尺寸：300 × 240。 */
body.canvas-mode .node.text-node,
body.canvas-mode .node.text-node:hover,
body.canvas-mode .node.text-node.selected,
body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))),
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))),
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) {
    width: 300px !important;
    min-width: 300px !important;
    max-width: 300px !important;
    height: 240px;
    min-height: 240px;
    max-height: 240px;
    box-sizing: border-box;
}

body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .node-header,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .node-header,
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .node-header {
    min-height: 38px;
    padding: 10px 12px 5px;
}

body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .node-content,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .node-content,
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .node-content {
    height: calc(100% - 38px);
    padding: 6px 10px 10px;
    box-sizing: border-box;
}

body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .image-preview-box,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .video-preview-box,
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .audio-preview-box {
    width: 100%;
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
}

body.canvas-mode .text-node .node-header {
    min-height: 38px;
    padding: 10px 12px 5px;
}

body.canvas-mode .text-node .node-content {
    height: calc(100% - 38px);
    padding: 6px 12px 10px;
    box-sizing: border-box;
}

body.canvas-mode .text-node .node-textarea {
    height: 82px;
    min-height: 82px;
    max-height: 82px;
}

body.canvas-mode .text-prompt-starters {
    display: grid;
    grid-template-columns: auto repeat(2, minmax(0, 1fr));
    align-items: center;
    gap: 4px 6px;
    margin-top: 7px;
}

body.canvas-mode .text-prompt-starters>span {
    grid-row: 1 / span 2;
    align-self: start;
    padding-top: 5px;
    color: #7f8792;
    font-size: 10px;
}

body.canvas-mode .text-prompt-starters button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    height: 24px;
    padding: 2px 5px;
    overflow: hidden;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #aeb5bf;
    font-size: 10px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

body.canvas-mode .text-prompt-starters button:hover {
    background: #303237;
    color: #e7ebf1;
}

body.canvas-mode .text-prompt-starters button svg {
    width: 12px;
    height: 12px;
    flex: 0 0 auto;
}

body.canvas-mode .text-node .text-upload-row {
    margin-top: 7px;
}

body.canvas-mode .text-node .text-upload-btn {
    min-height: 28px;
    padding: 4px 8px;
    font-size: 10px;
}

body.canvas-mode .canvas-zoom-readout {
    color: #aeb3bb;
}

.node .node-header {
    cursor: grab;
    touch-action: none;
}

.node.dragging .node-header,
.node .node-header:active {
    cursor: grabbing;
}

/* 最终覆盖：基础节点紧凑比例（必须位于全部历史兼容规则之后）。 */
body.canvas-mode .node.text-node,
body.canvas-mode .node.text-node:hover,
body.canvas-mode .node.text-node.selected,
body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))),
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))),
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) {
    width: 284px !important;
    min-width: 284px !important;
    max-width: 284px !important;
    height: 216px;
    min-height: 216px;
    max-height: 216px;
    border-radius: 10px;
}

body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .node-header,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .node-header,
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .node-header,
body.canvas-mode .text-node .node-header {
    min-height: 34px;
    padding: 7px 9px 4px;
}

body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .node-content,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .node-content,
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .node-content,
body.canvas-mode .text-node .node-content {
    height: calc(100% - 34px);
    padding: 4px 7px 7px;
}

body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .image-preview-box,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .video-preview-box,
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .audio-preview-box {
    border-radius: 8px;
}

body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .audio-preview-box {
    min-height: 0;
    padding: 8px;
}

body.canvas-mode .media-empty-state {
    min-height: 96px;
    gap: 5px;
}

body.canvas-mode .media-empty-state > svg { width: 24px; height: 24px; }
body.canvas-mode .media-empty-state > strong { font-size: 12px; }
body.canvas-mode .media-empty-actions { gap: 10px; margin-top: 2px; }
body.canvas-mode .media-empty-actions button { gap: 4px; font-size: 10px; }
body.canvas-mode .media-empty-actions button svg { width: 13px; height: 13px; }

body.canvas-mode .text-node .node-content {
    padding-right: 9px;
    padding-left: 9px;
}

body.canvas-mode .text-node .node-textarea {
    height: 76px;
    min-height: 76px;
    max-height: 76px;
    padding: 8px 9px;
}

body.canvas-mode .text-prompt-starters { gap: 3px 5px; margin-top: 5px; }
body.canvas-mode .text-prompt-starters > span { padding-top: 4px; }
body.canvas-mode .text-prompt-starters button { height: 22px; padding: 1px 4px; }
body.canvas-mode .text-node .text-upload-row { margin-top: 5px; }
body.canvas-mode .text-node .text-upload-btn { min-height: 26px; padding: 3px 7px; }

body.canvas-mode .node.image-node:has(.image-preview:not([hidden])) .node-header,
body.canvas-mode .node.video-node:has(.video-preview:not([hidden])) .node-header,
body.canvas-mode .node.audio-node:has(.audio-preview:not([hidden])) .node-header {
    min-height: 28px;
    padding: 2px 2px 4px;
}

body.canvas-mode .node.image-node:has(.image-preview:not([hidden])) .node-content,
body.canvas-mode .node.video-node:has(.video-preview:not([hidden])) .node-content,
body.canvas-mode .node.audio-node:has(.audio-preview:not([hidden])) .node-content {
    padding: 3px 5px 5px;
}

body.canvas-mode .node.agent-node,
body.canvas-mode .node.agent-node:hover,
body.canvas-mode .node.agent-node.selected,
body.canvas-mode .node.agent-node:not(.image-node):not(.video-node) {
    width: 400px;
    min-width: 400px;
    max-width: 400px;
    border-radius: 10px;
}

body.canvas-mode .agent-node .node-header { min-height: 33px; padding: 7px 10px 3px; }
body.canvas-mode .agent-node .node-content { padding: 4px 9px 9px; }

body.canvas-mode .agent-node .creation-prompt,
body.canvas-mode .agent-node .user-input {
    min-height: 58px;
    height: 58px;
    max-height: 58px;
    padding: 8px 38px 8px 9px;
    resize: none;
    transition: height 160ms ease, min-height 160ms ease, max-height 160ms ease;
}

body.canvas-mode .agent-node .agent-prompt-shell {
    position: relative;
    width: 100%;
    min-width: 0;
}

/* 智能体对话框保持静态深色边框，输入时不显示蓝色焦点框。 */
body.canvas-mode .agent-node .agent-prompt-shell .user-input:focus,
body.canvas-mode .agent-node .agent-prompt-shell .user-input:focus-visible {
    outline: none;
    border-color: #3f4146;
    box-shadow: none;
}

body.canvas-mode .agent-node .agent-prompt-expand {
    position: absolute;
    top: 7px;
    right: 7px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    color: #8d99a8;
    background: rgba(255, 255, 255, .045);
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    opacity: .72;
    transition: color 140ms ease, background 140ms ease, border-color 140ms ease, opacity 140ms ease;
}

body.canvas-mode .agent-node .agent-prompt-expand:hover,
body.canvas-mode .agent-node .agent-prompt-expand:focus-visible {
    color: #eef2f7;
    background: rgba(255, 255, 255, .1);
    border-color: rgba(148, 163, 184, .28);
    opacity: 1;
    outline: none;
}

body.canvas-mode .agent-node .agent-prompt-expand svg {
    width: 14px;
    height: 14px;
}

body.canvas-mode .agent-node.agent-prompt-expanded .creation-prompt,
body.canvas-mode .agent-node.agent-prompt-expanded .user-input {
    min-height: 148px;
    height: 148px;
    max-height: 148px;
    overflow-y: auto;
}

body.canvas-mode .agent-node .creation-composer { gap: 6px; }
body.canvas-mode .agent-node .creation-footer { gap: 6px; padding-top: 6px; }

body.canvas-mode .agent-node .creation-control,
body.canvas-mode .agent-node .agent-picker-trigger,
body.canvas-mode .agent-node .agent-select {
    min-height: 32px;
    height: 32px;
}

body.canvas-mode .agent-node .creation-submit {
    min-width: 98px;
    min-height: 32px;
}

@media (max-width: 760px) {
    body.canvas-mode .node.agent-node,
    body.canvas-mode .node.agent-node:hover,
    body.canvas-mode .node.agent-node.selected,
    body.canvas-mode .node.agent-node:not(.image-node):not(.video-node) {
        width: 360px;
        min-width: 360px;
        max-width: 360px;
    }
}

/* 2026-08-04 · 最终优先级：紧凑视频/音频创作框的参数与提交按钮必须全部可见。 */
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: 150px 86px 64px 68px 68px 72px 32px 42px !important;
    align-items: center !important;
    column-gap: 5px !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer > * {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-control {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    padding-inline: 7px !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-credit {
    width: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    gap: 2px !important;
    justify-content: center !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-submit {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: minmax(138px, 1fr) minmax(92px, 112px) 74px 32px 42px !important;
    align-items: center !important;
    column-gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer > * {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-credit {
    width: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    justify-content: center !important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-submit {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
}

/* 2026-08-04 · FINAL composer footer layout override.
   Keep this block at the physical end of the stylesheet: several legacy canvas
   rules above force these footers back to flex and make controls overflow. */
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-footer,
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) 64px 42px !important;
    align-items: center !important;
    column-gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
    min-height: 49px !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: minmax(148px, 1fr) 70px 66px 62px 30px 42px !important;
    align-items: center !important;
    column-gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-footer > *,
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-footer > *,
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer > * {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-credit {
    width: 30px !important;
    min-width: 30px !important;
    max-width: 30px !important;
    justify-content: center !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-submit {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
}

/* 2026-08-04 · 四类创作框最终布局。
   旧规则在画布模式下把所有 footer 强制回 flex，图片、视频和音频参数因此会被
   拉到对话框外。这里明确恢复单行网格；对话框横向展开，控件只在各自网格内收缩。 */
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-footer,
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) 64px 42px !important;
    align-items: center !important;
    column-gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: minmax(148px, 1fr) 70px 66px 62px 30px 42px !important;
    align-items: center !important;
    column-gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-footer > *,
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-footer > *,
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer > * {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-credit {
    width: 30px !important;
    min-width: 30px !important;
    max-width: 30px !important;
    justify-content: center !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-submit {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
}

/* 2026-08-04 · 四类创作框最终布局。公共定位使用真实内容高度；这里负责让每个
   底栏都在自身宽度内完成排版，禁止旧版 flex/margin-left 把控件推出面板。 */
body.canvas-mode .media-composer-panel:not(.is-expanded) {
    height: auto;
    min-height: 0;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer > * {
    box-sizing: border-box !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer .media-composer-control,
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer .composer-select-trigger {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer .composer-select-value,
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer select,
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer .media-composer-mode-chip {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-footer {
    display: grid !important;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) 64px 42px !important;
    align-items: center !important;
    column-gap: 6px !important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-translate {
    width: 64px !important;
    min-width: 64px !important;
    max-width: 64px !important;
    height: 34px !important;
    padding: 0 7px !important;
    margin: 0 !important;
    white-space: nowrap !important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-apply {
    position: static !important;
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    height: 42px !important;
    margin: 0 !important;
}

body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: minmax(148px, 1fr) 70px 66px 62px 30px 42px !important;
    align-items: center !important;
    column-gap: 6px !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-credit,
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-credit,
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-credit {
    width: 30px !important;
    min-width: 30px !important;
    max-width: 30px !important;
    justify-content: center !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-submit,
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-submit,
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-submit {
    position: static !important;
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    height: 42px !important;
    margin: 0 !important;
}

/* 放大后输入区真正占用中部空间，参数栏固定在底部，不再出现“上面挤一团、
   下面大片空白”的假放大状态。 */
body.canvas-mode .media-composer-panel.is-expanded {
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}
body.canvas-mode .media-composer-panel.is-expanded .media-composer-prompt-wrap {
    display: flex !important;
    flex: 1 1 auto !important;
    min-height: 180px !important;
    overflow: hidden !important;
}
body.canvas-mode .media-composer-panel.is-expanded .media-composer-prompt-wrap > .media-composer-prompt,
body.canvas-mode .text-composer-panel.is-expanded .text-composer-content {
    flex: 1 1 auto !important;
    width: 100% !important;
    min-height: 180px !important;
    height: 100% !important;
    overflow-y: auto !important;
}
body.canvas-mode .media-composer-panel.is-expanded .media-composer-footer {
    flex: 0 0 auto !important;
    width: 100% !important;
    margin-top: auto !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
}

@media (max-width: 560px) {
    body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-footer {
        grid-template-columns: minmax(0, 1fr) minmax(0, .9fr) 42px 42px !important;
    }
    body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-translate {
        width: 42px !important;
        min-width: 42px !important;
        max-width: 42px !important;
        padding: 0 !important;
    }
    body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-translate span {
        display: none !important;
    }
    body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer,
    body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer,
    body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer {
        display: flex !important;
        overflow-x: auto !important;
        scrollbar-width: thin;
    }
}

/* 旧版对 model/mode 的高优先级最小宽度会挤压后续参数；这里按网格列重新收口。 */
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer > .media-composer-control.model,
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer > .media-composer-control.mode,
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer > .media-composer-control:not(.model):not(.mode) {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer .composer-select-trigger,
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer .composer-select-value,
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer .media-composer-mode-chip {
    min-width: 0 !important;
    max-width: none !important;
}

/* 2026-08-04 · 紧凑创作框参数栏必须完整落在面板内，不能裁掉提交按钮。 */
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer {
    grid-template-columns:
        minmax(132px, 1fr)
        84px
        56px
        58px
        66px
        64px
        32px
        42px !important;
    column-gap: 5px !important;
    overflow: visible !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-control.model,
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-control.mode,
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-control:not(.model):not(.mode) {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    padding-inline: 7px !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-credit {
    width: 32px !important;
    min-width: 32px !important;
    gap: 2px !important;
    justify-content: center !important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer {
    grid-template-columns: minmax(138px, 1fr) minmax(92px, 112px) 74px 32px 42px !important;
    column-gap: 6px !important;
    overflow: visible !important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer > * {
    min-width: 0 !important;
    max-width: none !important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-credit {
    width: 32px !important;
    min-width: 32px !important;
    justify-content: center !important;
}

/* 2026-07-23 节点精致化：收紧外框、标题、内容与空状态留白。 */
body.canvas-mode .node.text-node,
body.canvas-mode .node.text-node:hover,
body.canvas-mode .node.text-node.selected,
body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))),
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))),
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) {
    width: 284px !important;
    min-width: 284px !important;
    max-width: 284px !important;
    height: 216px;
    min-height: 216px;
    max-height: 216px;
    border-radius: 10px;
}

body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .node-header,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .node-header,
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .node-header,
body.canvas-mode .text-node .node-header {
    min-height: 34px;
    padding: 7px 9px 4px;
}

body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .node-content,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .node-content,
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .node-content,
body.canvas-mode .text-node .node-content {
    height: calc(100% - 34px);
    padding: 4px 7px 7px;
}

body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .image-preview-box,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .video-preview-box,
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .audio-preview-box {
    border-radius: 8px;
}

body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .audio-preview-box {
    min-height: 0;
    padding: 8px;
}

body.canvas-mode .media-empty-state {
    min-height: 96px;
    gap: 5px;
}

body.canvas-mode .media-empty-state > svg {
    width: 24px;
    height: 24px;
}

body.canvas-mode .media-empty-state > strong {
    font-size: 12px;
}

body.canvas-mode .media-empty-actions {
    gap: 10px;
    margin-top: 2px;
}

body.canvas-mode .media-empty-actions button {
    gap: 4px;
    font-size: 10px;
}

body.canvas-mode .media-empty-actions button svg {
    width: 13px;
    height: 13px;
}

body.canvas-mode .text-node .node-content {
    padding-right: 9px;
    padding-left: 9px;
}

body.canvas-mode .text-node .node-textarea {
    height: 76px;
    min-height: 76px;
    max-height: 76px;
    padding: 8px 9px;
}

body.canvas-mode .text-prompt-starters {
    gap: 3px 5px;
    margin-top: 5px;
}

body.canvas-mode .text-prompt-starters > span {
    padding-top: 4px;
}

body.canvas-mode .text-prompt-starters button {
    height: 22px;
    padding: 1px 4px;
}

body.canvas-mode .text-node .text-upload-row {
    margin-top: 5px;
}

body.canvas-mode .text-node .text-upload-btn {
    min-height: 26px;
    padding: 3px 7px;
}

/* 已有素材节点保持素材比例，只收紧卡片周围留白。 */
body.canvas-mode .node.image-node:has(.image-preview:not([hidden])) .node-header,
body.canvas-mode .node.video-node:has(.video-preview:not([hidden])) .node-header,
body.canvas-mode .node.audio-node:has(.audio-preview:not([hidden])) .node-header {
    min-height: 28px;
    padding: 2px 2px 4px;
}

body.canvas-mode .node.image-node:has(.image-preview:not([hidden])) .node-content,
body.canvas-mode .node.video-node:has(.video-preview:not([hidden])) .node-content,
body.canvas-mode .node.audio-node:has(.audio-preview:not([hidden])) .node-content {
    padding: 3px 5px 5px;
}

/* 智能体节点横向保留信息容量，纵向明显收紧。 */
body.canvas-mode .node.agent-node,
body.canvas-mode .node.agent-node:hover,
body.canvas-mode .node.agent-node.selected,
body.canvas-mode .node.agent-node:not(.image-node):not(.video-node) {
    width: 400px;
    min-width: 400px;
    max-width: 400px;
    border-radius: 10px;
}

body.canvas-mode .agent-node .node-header {
    min-height: 33px;
    padding: 7px 10px 3px;
}

body.canvas-mode .agent-node .node-content {
    padding: 4px 9px 9px;
}

body.canvas-mode .agent-node .creation-prompt,
body.canvas-mode .agent-node .user-input {
    min-height: 58px;
    height: 58px;
    max-height: 58px;
    padding: 8px 9px;
}

body.canvas-mode .agent-node .creation-composer {
    gap: 6px;
}

body.canvas-mode .agent-node .creation-footer {
    gap: 6px;
    padding-top: 6px;
}

body.canvas-mode .agent-node .creation-control,
body.canvas-mode .agent-node .agent-picker-trigger,
body.canvas-mode .agent-node .agent-select {
    min-height: 32px;
    height: 32px;
}

body.canvas-mode .agent-node .creation-submit {
    min-width: 98px;
    min-height: 32px;
}

@media (max-width: 760px) {
    body.canvas-mode .node.agent-node,
    body.canvas-mode .node.agent-node:hover,
    body.canvas-mode .node.agent-node.selected,
    body.canvas-mode .node.agent-node:not(.image-node):not(.video-node) {
        width: 360px;
        min-width: 360px;
        max-width: 360px;
    }
}

/* 最终位置收口：避免前面的音频/放大模式规则把工具按钮推回底部。 */
body.canvas-mode .node.image-node:has(.image-preview:not([hidden])) .media-delete-btn,
body.canvas-mode .node.video-node:has(.video-preview:not([hidden])) .media-delete-btn,
body.canvas-mode .node.audio-node:has(.audio-preview:not([hidden])) .media-delete-btn {
    top: 8px !important;
    right: 8px !important;
    bottom: auto !important;
}

body.canvas-mode .node.image-node:has(.image-preview:not([hidden])) .media-replace-btn,
body.canvas-mode .node.video-node:has(.video-preview:not([hidden])) .media-replace-btn,
body.canvas-mode .node.audio-node:has(.audio-preview:not([hidden])) .media-replace-btn {
    top: 8px !important;
    right: 44px !important;
    bottom: auto !important;
}

body.canvas-mode .node.video-node:has(.video-preview:not([hidden])) .video-frame-btn {
    top: 8px !important;
    right: 80px !important;
    bottom: auto !important;
}

body.canvas-mode .node.image-node:has(.image-preview:not([hidden])) .media-download-btn {
    top: 8px !important;
    right: 92px !important;
    bottom: auto !important;
}

body.canvas-mode .node.video-node:has(.video-preview:not([hidden])) .media-download-btn {
    top: 8px !important;
    right: 116px !important;
    bottom: auto !important;
}

body.canvas-mode .node.audio-node:has(.audio-preview:not([hidden])) .media-download-btn {
    top: 8px !important;
    right: 108px !important;
    bottom: auto !important;
    width: 26px;
    height: 26px;
}

body.canvas-mode .node.image-node.zoomed .media-delete-btn,
body.canvas-mode .node.video-node.zoomed .media-delete-btn {
    top: calc(8px * var(--media-zoom-ui-scale)) !important;
    right: calc(8px * var(--media-zoom-ui-scale)) !important;
}

body.canvas-mode .node.image-node.zoomed .media-replace-btn,
body.canvas-mode .node.video-node.zoomed .media-replace-btn {
    top: calc(8px * var(--media-zoom-ui-scale)) !important;
    right: calc(42px * var(--media-zoom-ui-scale)) !important;
}

body.canvas-mode .node.video-node.zoomed .video-frame-btn {
    top: calc(8px * var(--media-zoom-ui-scale)) !important;
    right: calc(76px * var(--media-zoom-ui-scale)) !important;
}

/* hidden 必须优先于媒体按钮的 display:flex，空节点不显示操作按钮。 */
.media-delete-btn[hidden],
.media-replace-btn[hidden],
.media-download-btn[hidden],
.video-frame-btn[hidden],
.image-preview[hidden],
.video-preview[hidden],
.audio-preview[hidden] {
    display: none !important;
}

/* 音频成品节点：显示时长并收缩为播放器所需的紧凑尺寸。 */
body.canvas-mode .node.audio-node:has(.audio-preview:not([hidden])) {
    width: 340px !important;
    min-width: 340px !important;
    max-width: 340px !important;
    height: 132px !important;
    min-height: 132px !important;
    max-height: 132px !important;
}

body.canvas-mode .node.audio-node:has(.audio-preview:not([hidden])) .node-content {
    height: 82px;
    padding: 5px 10px 10px;
}

body.canvas-mode .node.audio-node:has(.audio-preview:not([hidden])) .audio-preview-box {
    padding: 10px 112px 10px 12px;
}

/* 预设工作流中的音频成品采用波形播放器外观。 */
body.canvas-mode .node.audio-node:has(.audio-preview:not([hidden])) {
    width: 380px !important;
    min-width: 380px !important;
    max-width: 380px !important;
    height: 184px !important;
    min-height: 184px !important;
    max-height: 184px !important;
}
body.canvas-mode .node.audio-node:has(.audio-preview:not([hidden])) .node-content { height: 132px; }
body.canvas-mode .node.audio-node:has(.audio-preview:not([hidden])) .audio-preview-box {
    position: relative;
    min-height: 116px;
    padding: 70px 84px 8px 12px;
    overflow: hidden;
    background: #2e3032;
}
body.canvas-mode .node.audio-node:has(.audio-preview:not([hidden])) .audio-preview-box::before {
    content: '';
    position: absolute;
    inset: 12px 14px 46px;
    opacity: .72;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='128' height='54' viewBox='0 0 128 54'%3E%3Cg stroke='%239da1a6' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M3 21v12M11 12v30M19 5v44M27 15v24M35 9v36M43 19v16M51 23v8M59 14v26M67 7v40M75 17v20M83 11v32M91 21v12M99 16v22M107 8v38M115 18v18M123 23v8'/%3E%3C/g%3E%3C/svg%3E");
    background-repeat: repeat-x;
    background-position: center;
    background-size: 128px 54px;
}
body.canvas-mode .node.audio-node:has(.audio-preview:not([hidden])) .audio-preview { position: relative; z-index: 2; height: 34px; }

.audio-duration-badge {
    flex: 0 0 auto;
    margin-left: auto;
    margin-right: 6px;
    padding: 3px 7px;
    color: #aeb7c4;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 7px;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

.audio-duration-badge[hidden] {
    display: none !important;
}

.audio-trim-btn {
    position: absolute;
    top: 8px;
    right: 76px;
    z-index: 5;
    display: flex;
    width: 26px;
    height: 26px;
    padding: 0;
    align-items: center;
    justify-content: center;
    color: rgba(245, 247, 250, 0.82);
    background: rgba(16, 18, 22, 0.78);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 8px;
    cursor: pointer;
}

.audio-trim-btn:hover {
    color: #fff;
    background: rgba(32, 36, 44, 0.94);
}

.audio-trim-btn svg {
    width: 14px;
    height: 14px;
}

.audio-trim-btn[hidden] {
    display: none !important;
}

.audio-trim-dialog {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(6, 8, 12, 0.55);
    backdrop-filter: blur(8px);
}

.audio-trim-card {
    width: min(440px, calc(100vw - 32px));
    padding: 20px;
    color: #edf1f6;
    background: #242629;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

.audio-trim-header,
.audio-trim-header strong,
.audio-trim-times,
.audio-trim-actions {
    display: flex;
    align-items: center;
}

.audio-trim-header {
    justify-content: space-between;
}

.audio-trim-header strong {
    gap: 8px;
    font-size: 18px;
}

.audio-trim-header strong svg {
    width: 18px;
}

.audio-trim-header button {
    display: grid;
    width: 32px;
    height: 32px;
    padding: 0;
    place-items: center;
    color: #aeb5bf;
    background: rgba(255, 255, 255, 0.06);
    border: 0;
    border-radius: 9px;
    cursor: pointer;
}

.audio-trim-card>p,
.audio-trim-summary {
    color: #929aa5;
    font-size: 13px;
}

.audio-trim-times {
    gap: 12px;
    margin: 20px 0 14px;
}

.audio-trim-times label {
    flex: 1 1 0;
    color: #aeb5bf;
    font-size: 12px;
}

.audio-trim-times input {
    width: 100%;
    height: 42px;
    margin-top: 7px;
    padding: 0 12px;
    color: #fff;
    background: #17191c;
    border: 1px solid #40444a;
    border-radius: 10px;
    outline: none;
}

.audio-trim-times input:focus {
    border-color: #20c997;
}

.audio-trim-actions {
    justify-content: flex-end;
    gap: 9px;
    margin-top: 22px;
}

.audio-trim-actions button {
    height: 38px;
    padding: 0 16px;
    color: #d3d8df;
    background: #34373b;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
}

.audio-trim-actions [data-trim-confirm] {
    color: #11151b;
    background: #f2f4f7;
    font-weight: 700;
}

.audio-trim-actions button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.media-composer-generation-status {
    display: none !important;
    min-height: 36px;
    padding: 0 12px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #77b8ff;
    background: rgba(50, 126, 226, 0.09);
    border: 1px solid rgba(83, 156, 255, 0.2);
    border-radius: 11px;
    font-size: 13px;
    font-weight: 650;
}

.media-composer-generation-status[hidden] {
    display: none !important;
}

.media-composer-generation-status svg {
    width: 15px;
    height: 15px;
    animation: mediaComposerSpin 0.8s linear infinite;
}

.media-composer-generation-status.is-complete {
    color: #73d8a3;
    background: rgba(42, 164, 105, 0.09);
    border-color: rgba(71, 205, 139, 0.2);
}

.media-composer-generation-status.is-complete svg,
.media-composer-generation-status.is-error svg {
    animation: none;
}

.media-composer-generation-status.is-error {
    color: #ff9a9a;
    background: rgba(220, 70, 70, 0.09);
    border-color: rgba(255, 105, 105, 0.2);
}

/* 素材节点集成创作面板 */
.media-composer-panel {
    position: fixed;
    z-index: 3600;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 360px;
    padding: 18px 22px 20px;
    overflow: hidden;
    color: #eef1f6;
    background: #242525;
    border: 1px solid rgba(255, 255, 255, 0.055);
    border-radius: 22px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.46);
    animation: mediaComposerIn 180ms ease-out;
}

.media-composer-panel .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.media-composer-panel::before {
    content: none;
}

@keyframes mediaComposerIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes mediaComposerBorderFlow {
    from {
        background-position: 160% 0, -60% 100%;
    }

    to {
        background-position: -60% 0, 160% 100%;
    }
}

.composer-source-node {
    border-color: var(--primary, #20c997) !important;
    box-shadow: 0 0 0 1px rgba(32, 201, 151, 0.68), 0 0 22px rgba(32, 201, 151, 0.22) !important;
}

.media-composer-header,
.media-composer-title,
.media-composer-footer,
.media-composer-assets,
.media-composer-control,
.media-composer-file-chip {
    display: flex;
    align-items: center;
}

.media-composer-header {
    justify-content: space-between;
    min-height: 34px;
}

.media-composer-title {
    gap: 8px;
    font-size: 17px;
    font-weight: 700;
    color: #f4f6f8;
}

.media-composer-title svg {
    width: 17px;
    height: 17px;
    color: #aeb7c4;
}

.media-composer-title em {
    padding: 4px 9px;
    color: #8fc2ff;
    background: rgba(75, 145, 255, 0.12);
    border: 1px solid rgba(75, 145, 255, 0.24);
    border-radius: 7px;
    font-size: 11px;
    font-style: normal;
    font-weight: 500;
}

.media-composer-close {
    display: grid;
    width: 42px;
    height: 42px;
    padding: 0;
    place-items: center;
    color: #99a0aa;
    background: #343536;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
}

.media-composer-close:hover {
    color: #fff;
    background: #424445;
}

.media-composer-close svg {
    width: 16px;
    height: 16px;
}

.media-composer-assets {
    gap: 8px;
    min-height: 46px;
}

.video-composer-tools {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 42px;
}

.video-composer-tools button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 40px;
    padding: 0 14px;
    color: #b7bdc6;
    background: #303131;
    border: 1px solid transparent;
    border-radius: 22px;
    cursor: pointer;
    font-size: 11px;
}

.video-composer-tools button:hover,
.video-composer-tools button.active {
    color: #e8edf5;
    background: #3a3b3c;
    border-color: rgba(255, 255, 255, 0.06);
}

.video-composer-tools svg {
    width: 14px;
    height: 14px;
}

.media-asset-source,
.media-asset-add {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 46px;
    padding: 5px 12px;
    color: #b9bec6;
    background: #303131;
    border: 1px solid rgba(255, 255, 255, 0.055);
    border-radius: 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.media-asset-source {
    min-width: 128px;
    overflow: visible;
    border-color: rgba(94, 158, 255, 0.35);
    background: rgba(94, 158, 255, 0.12);
}

.media-asset-thumb {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    overflow: hidden;
    display: grid;
    place-items: center;
    color: #9ea8b6;
    background: rgba(8, 10, 12, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 7px;
}

.media-asset-thumb img,
.media-asset-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

img.media-asset-thumb {
    object-fit: cover;
}

.media-asset-video-thumb {
    position: relative;
}

.media-asset-video-thumb svg {
    position: absolute;
    width: 14px;
    height: 14px;
    color: #fff;
    filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.65));
}

.media-asset-source>svg,
.media-asset-add>svg {
    width: 16px;
    height: 16px;
}

.media-asset-source b {
    position: absolute;
    right: 5px;
    top: 4px;
    color: #67b4ff;
    font-size: 9px;
    font-weight: 500;
}

.media-asset-source em {
    max-width: 86px;
    min-width: 0;
    overflow: hidden;
    color: #7f8996;
    font-size: 10px;
    font-style: normal;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-asset-hover {
    pointer-events: none;
    position: absolute;
    left: 0;
    bottom: calc(100% + 10px);
    z-index: 80;
    display: none;
    width: 168px;
    min-height: 108px;
    overflow: hidden;
    padding: 4px;
    background: rgba(18, 19, 21, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
}

.media-asset-hover img,
.media-asset-hover video {
    display: block;
    width: 100%;
    max-height: 180px;
    object-fit: contain;
    border-radius: 10px;
}

.media-asset-hover-video {
    width: 220px;
}

.media-asset-hover-audio {
    align-items: center;
    gap: 8px;
    width: auto;
    min-width: 138px;
    min-height: 48px;
    padding: 10px 12px;
    color: #dce5ef;
}

.media-asset-source:hover .media-asset-hover,
.media-composer-file-chip:hover .media-asset-hover {
    display: flex;
}

.media-asset-add {
    flex: 1 1 0;
    min-width: 118px;
}

.media-asset-add:hover {
    border-color: rgba(255, 255, 255, 0.1);
    background: #38393a;
}

.media-asset-add em {
    margin-left: auto;
    color: #7e8793;
    font-size: 11px;
    font-style: normal;
    font-weight: 500;
}

.media-asset-add small {
    display: grid;
    width: 22px;
    height: 22px;
    place-items: center;
    color: #d7dce4;
    background: rgba(255, 255, 255, 0.055);
    border-radius: 8px;
    font-size: 17px;
    line-height: 1;
}

.media-asset-add.is-full,
.media-asset-add:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.media-composer-file-list {
    display: flex;
    min-height: 0;
    gap: 6px;
    flex-wrap: wrap;
}

.media-composer-file-list:empty {
    display: none;
}

.media-composer-file-chip {
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
    max-width: 238px;
    height: 38px;
    padding: 3px 6px 3px 4px;
    color: #b9c1cb;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    font-size: 11px;
    cursor: pointer;
}

.media-composer-file-chip svg {
    width: 12px;
    height: 12px;
}

.media-composer-file-chip .media-asset-thumb {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
    border-radius: 8px;
}

.media-composer-file-chip span {
    color: #d8e8ff;
    font-weight: 700;
}

.media-composer-file-chip em {
    min-width: 0;
    overflow: hidden;
    color: #7e8793;
    font-style: normal;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-composer-file-chip small {
    display: grid;
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    place-items: center;
    color: #858d98;
    border-radius: 50%;
    font-size: 13px;
    line-height: 1;
}

.media-composer-file-chip:hover {
    color: #e6edf7;
    background: rgba(94, 158, 255, 0.12);
    border-color: rgba(94, 158, 255, 0.22);
}

.media-composer-file-chip small:hover {
    color: #ff667d;
    background: rgba(255, 102, 125, 0.12);
}

.media-composer-prompt {
    width: 100%;
    min-height: 170px;
    padding: 18px 6px;
    color: #f0f2f5;
    background: transparent;
    border: 0;
    border-radius: 0;
    outline: 0;
    resize: vertical;
    font: inherit;
    font-size: 18px;
    line-height: 1.68;
}

.media-composer-prompt:focus {
    box-shadow: inset 0 -1px 0 rgba(95, 159, 255, 0.42);
}

.media-composer-prompt::placeholder {
    color: #62676e;
}

.media-composer-optimize {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    height: 34px;
    color: #989fa8;
    background: transparent;
    border: 1px dashed rgba(255, 255, 255, 0.105);
    border-radius: 9px;
    cursor: pointer;
    font-size: 11px;
}

.media-composer-optimize:hover {
    color: #b9d8ff;
    border-color: rgba(94, 158, 255, 0.35);
    background: rgba(94, 158, 255, 0.06);
}

.media-composer-optimize svg {
    width: 14px;
    height: 14px;
}

.media-composer-footer {
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.055);
}

.media-composer-control {
    gap: 7px;
    height: 40px;
    padding: 0 12px;
    background: transparent;
    border: 0;
    border-radius: 12px;
}

.media-composer-control.model {
    min-width: 198px;
}

.media-composer-control.mode {
    min-width: 116px;
}

.media-composer-control.compact {
    min-width: 78px;
}

.media-composer-control svg {
    width: 14px;
    height: 14px;
    color: #a8b1bc;
}

.media-composer-control select {
    max-width: 175px;
    height: 36px;
    padding: 0 22px 0 2px;
    color: #ebedf0;
    background-color: transparent;
    border: 0;
    outline: 0;
    font-size: 15px;
    color-scheme: dark;
}

body.canvas-mode select,
.media-composer-panel select,
.asset-picker select {
    color-scheme: dark;
}

body.canvas-mode select option,
.media-composer-panel select option,
.asset-picker select option {
    background-color: #202225;
    color: #f2f4f7;
}

body.canvas-mode select option:checked,
.media-composer-panel select option:checked,
.asset-picker select option:checked {
    background-color: #315f96;
    color: #ffffff;
}

body.canvas-mode select option:disabled,
.media-composer-panel select option:disabled,
.asset-picker select option:disabled {
    color: #858b94;
}

.media-composer-credit {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 40px;
    margin-left: auto;
    padding: 0 8px;
    color: #939aa4;
    font-size: 13px;
    white-space: nowrap;
}

.media-composer-credit svg {
    width: 14px;
    height: 14px;
    color: #9098a3;
}

.media-composer-credit b {
    color: #b3bac4;
    font-weight: 600;
}

.media-composer-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 68px;
    height: 56px;
    color: #15171a;
    background: #f2f4f6;
    border: 0;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
}

.media-composer-submit:hover {
    background: #fff;
}

.media-composer-submit:disabled {
    opacity: 0.6;
    cursor: wait;
}

.media-composer-submit svg {
    width: 22px;
    height: 22px;
}

.media-composer-submit span {
    max-width: 104px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audio-composer-panel {
    min-height: 0;
}

/* LibTV 式视频生成输入器：大面积、低边框、素材和参数都收进同一个底部对话框。 */
.video-composer-panel {
    gap: 18px;
    min-height: 430px;
    padding: 24px 28px 26px;
    color: #f1f3f5;
    background: #252626;
    border-color: rgba(255, 255, 255, 0.075);
    border-radius: 28px;
    box-shadow: 0 24px 72px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.video-composer-panel .media-composer-header {
    min-height: 48px;
}

.video-composer-panel .media-composer-title {
    gap: 12px;
    font-size: 23px;
    letter-spacing: 0;
}

.video-composer-panel .media-composer-title svg {
    width: 25px;
    height: 25px;
    color: #d7dde6;
}

.video-composer-panel .media-composer-title em {
    padding: 5px 10px;
    color: #8ec4ff;
    background: rgba(44, 117, 214, 0.18);
    border-color: rgba(74, 148, 246, 0.45);
    border-radius: 8px;
    font-size: 13px;
}

.video-composer-panel .media-composer-close {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.075);
}

.video-composer-panel .media-composer-close svg {
    width: 22px;
    height: 22px;
}

.video-composer-panel .video-composer-tools {
    gap: 10px;
    min-height: 58px;
}

.video-composer-panel .video-composer-tools button {
    height: 52px;
    padding: 0 22px;
    gap: 9px;
    color: #b8bec7;
    background: rgba(255, 255, 255, 0.055);
    border: 0;
    border-radius: 999px;
    font-size: 17px;
    font-weight: 600;
}

.video-composer-panel .video-composer-tools button:hover,
.video-composer-panel .video-composer-tools button.active {
    color: #f2f5f8;
    background: rgba(255, 255, 255, 0.095);
}

.video-composer-panel .video-composer-tools svg {
    width: 21px;
    height: 21px;
}

.video-composer-panel .media-composer-assets {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    min-height: 62px;
}

.video-composer-panel .media-asset-source,
.video-composer-panel .media-asset-add {
    min-width: 0;
    height: 64px;
    padding: 0 18px;
    gap: 12px;
    color: #bcc3cd;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(255, 255, 255, 0.075);
    border-radius: 13px;
    font-size: 20px;
    font-weight: 600;
}

.video-composer-panel .media-asset-source {
    grid-column: auto;
    color: #d9eaff;
    background: rgba(52, 120, 210, 0.16);
    border-color: rgba(70, 145, 248, 0.48);
}

.video-composer-panel .media-asset-source img {
    width: 42px;
    height: 42px;
    border-radius: 9px;
}

.video-composer-panel .media-asset-source>svg,
.video-composer-panel .media-asset-add>svg {
    width: 28px;
    height: 28px;
}

.video-composer-panel .media-asset-source b {
    right: 14px;
    top: 10px;
    font-size: 13px;
}

.video-composer-panel .media-asset-add em {
    color: #747c87;
    font-size: 14px;
}

.video-composer-panel .media-asset-add small {
    width: auto;
    height: auto;
    color: #d5dae2;
    background: transparent;
    border-radius: 0;
    font-size: 26px;
}

.video-composer-panel .media-composer-file-list {
    gap: 8px;
}

.video-composer-panel .media-composer-file-chip {
    height: 34px;
    max-width: 260px;
    padding: 4px 9px 4px 11px;
    font-size: 13px;
}

.video-composer-panel .media-composer-prompt {
    min-height: 250px;
    padding: 10px 0 4px;
    color: #f4f6f8;
    font-size: 24px;
    line-height: 1.72;
}

.video-composer-panel .media-composer-prompt::placeholder {
    color: #6d7279;
}

.video-composer-panel .media-composer-prompt:focus {
    box-shadow: none;
}

.video-composer-panel .media-composer-optimize {
    height: 42px;
    color: #9aa1aa;
    border-color: rgba(255, 255, 255, 0.095);
    border-radius: 11px;
    font-size: 14px;
}

.video-composer-panel .media-composer-footer {
    gap: 14px;
    padding-top: 18px;
    border-top-color: rgba(255, 255, 255, 0.07);
}

.video-composer-panel .media-composer-control {
    height: 48px;
    padding: 0 12px;
    border-radius: 10px;
}

.video-composer-panel .media-composer-control.model {
    min-width: 238px;
}

.video-composer-panel .media-composer-control.mode {
    min-width: 122px;
}

.video-composer-panel .media-composer-control.mode-readonly {
    gap: 8px;
    cursor: default;
}

.video-composer-panel .media-composer-mode-chip {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    color: #f2f3f5;
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
}

.video-composer-panel .media-composer-control.compact {
    min-width: 96px;
}

.video-composer-panel .media-composer-control svg {
    width: 20px;
    height: 20px;
}

.video-composer-panel .media-composer-control select {
    max-width: 214px;
    height: 44px;
    font-size: 19px;
    font-weight: 600;
}

.video-composer-panel .media-composer-credit {
    height: 48px;
    margin-left: auto;
    padding: 0 2px 0 12px;
    gap: 7px;
    color: #9da3ab;
    font-size: 18px;
}

.video-composer-panel .media-composer-credit svg {
    width: 18px;
    height: 18px;
}

.video-composer-panel .media-composer-submit {
    min-width: 70px;
    width: 70px;
    height: 70px;
    padding: 0;
    border-radius: 22px;
}

.video-composer-panel .media-composer-submit span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.video-composer-panel .media-composer-submit svg {
    width: 30px;
    height: 30px;
}

/* 更贴近 LibTV 的底部生成对话框：少边框、弱表单、强输入区。 */
.image-composer-panel,
.video-composer-panel,
.audio-composer-panel {
    color: #f2f3f5;
    background: #252626;
    border: 1px solid rgba(255, 255, 255, 0.055);
    border-radius: 28px;
    box-shadow: 0 26px 80px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.media-composer-panel[data-placement="dock"] {
    left: 50%;
    bottom: 22px;
    top: auto;
}

.video-composer-panel {
    min-height: 0;
    padding: 22px 24px 22px;
    gap: 14px;
}

.video-composer-panel .media-composer-header,
.image-composer-panel .media-composer-header,
.audio-composer-panel .media-composer-header {
    min-height: 38px;
}

.video-composer-panel .media-composer-title,
.image-composer-panel .media-composer-title,
.audio-composer-panel .media-composer-title {
    gap: 9px;
    font-size: 18px;
    font-weight: 750;
}

.video-composer-panel .media-composer-title svg,
.image-composer-panel .media-composer-title svg,
.audio-composer-panel .media-composer-title svg {
    width: 18px;
    height: 18px;
    color: #d9dee6;
}

.video-composer-panel .media-composer-title em,
.image-composer-panel .media-composer-title em,
.audio-composer-panel .media-composer-title em {
    padding: 5px 10px;
    color: #b9f6e4;
    background: rgba(32, 201, 151, 0.15);
    border-color: rgba(93, 214, 177, 0.36);
    border-radius: 8px;
    font-size: 13px;
}

.video-composer-panel .media-composer-close,
.image-composer-panel .media-composer-close,
.audio-composer-panel .media-composer-close {
    width: 38px;
    height: 38px;
    color: #a7adb6;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 16px;
}

.video-composer-panel .video-composer-tools,
.image-composer-panel .image-composer-tools {
    gap: 8px;
    min-height: 42px;
}

.video-composer-panel .video-composer-tools button,
.image-composer-panel .image-composer-tools button {
    height: 40px;
    padding: 0 16px;
    color: #b8bdc5;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.02);
    border-radius: 999px;
    font-size: 14px;
    font-weight: 650;
}

.video-composer-panel .video-composer-tools button:hover,
.video-composer-panel .video-composer-tools button.active,
.image-composer-panel .image-composer-tools button:hover,
.image-composer-panel .image-composer-tools button.active {
    color: #f2f5f8;
    background: rgba(255, 255, 255, 0.095);
}

.video-composer-panel .media-composer-assets {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.video-composer-panel .media-asset-add,
.video-composer-panel .media-asset-source {
    height: 48px;
    padding: 0 14px;
    background: rgba(255, 255, 255, 0.045);
    border-color: rgba(255, 255, 255, 0.075);
    border-radius: 14px;
    font-size: 15px;
}

.video-composer-panel .media-asset-source {
    background: rgba(46, 111, 204, 0.17);
    border-color: rgba(72, 146, 255, 0.42);
}

.video-composer-panel .media-composer-prompt,
.image-composer-panel .media-composer-prompt,
.audio-composer-panel .media-composer-prompt {
    min-height: 138px;
    padding: 12px 0;
    color: #f3f5f7;
    background: transparent;
    border: 0;
    border-radius: 0;
    font-size: 18px;
    line-height: 1.62;
    resize: none;
}

.image-composer-panel .media-composer-prompt,
.audio-composer-panel .media-composer-prompt {
    min-height: 128px;
}

.video-composer-panel .media-composer-prompt::placeholder,
.image-composer-panel .media-composer-prompt::placeholder,
.audio-composer-panel .media-composer-prompt::placeholder {
    color: #6e747c;
}

.video-composer-panel .media-composer-prompt:focus,
.image-composer-panel .media-composer-prompt:focus,
.audio-composer-panel .media-composer-prompt:focus {
    box-shadow: none;
}

.video-composer-panel .media-composer-optimize {
    height: 34px;
    color: #969ea8;
    background: transparent;
    border-color: rgba(255, 255, 255, 0.095);
    border-radius: 12px;
}

.video-composer-panel .media-composer-footer,
.image-composer-panel .media-composer-footer,
.audio-composer-panel .media-composer-footer {
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.video-composer-panel .media-composer-control,
.image-composer-panel .media-composer-control,
.audio-composer-panel .media-composer-control {
    height: 40px;
    padding: 0 11px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.065);
    border-radius: 12px;
}

.video-composer-panel .media-composer-control select,
.image-composer-panel .media-composer-control select,
.audio-composer-panel .media-composer-control select {
    height: 36px;
    color: #f0f2f4;
    font-size: 14px;
    font-weight: 650;
}

.media-composer-control .customized-select-source { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; }
.composer-select-trigger { min-width: 0; height: 36px; display: flex; flex: 1; align-items: center; justify-content: space-between; gap: 10px; padding: 0 2px; color: #f0f2f4; background: transparent; border: 0; font: inherit; font-size: 14px; font-weight: 650; cursor: pointer; }
.composer-select-trigger span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-select-trigger svg { width: 16px; height: 16px; flex: none; color: #a3aab3; transition: transform 140ms ease; }
.composer-select-trigger.open svg { transform: rotate(180deg); }
.composer-select-menu { position: fixed; z-index: 10120; max-height: 260px; overflow-y: auto; padding: 6px; color: #eef1f4; background: #242629; border: 1px solid rgba(255,255,255,.13); border-radius: 12px; box-shadow: 0 14px 42px rgba(0,0,0,.52); }
.composer-select-menu button { width: 100%; min-height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; color: #d9dde2; text-align: left; background: transparent; border: 0; border-radius: 8px; font-size: 14px; cursor: pointer; }
.composer-select-menu button:hover { color: #fff; background: rgba(255,255,255,.08); }
.composer-select-menu button.selected { color: #fff; background: rgba(55,145,235,.18); }
.composer-select-menu button > span { display: grid; min-width: 0; gap: 2px; }
.composer-select-menu button > span > small { overflow: hidden; color: #8f9aa7; font-size: 10px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.composer-select-menu button.selected > span > small { color: #91bff1; }
.composer-select-menu button svg { width: 15px; height: 15px; color: #63adf5; }

.video-composer-panel .media-composer-credit,
.image-composer-panel .media-composer-credit,
.audio-composer-panel .media-composer-credit {
    margin-left: auto;
    color: #929aa4;
    font-size: 14px;
}

.video-composer-panel .media-composer-submit,
.image-composer-panel .media-composer-submit,
.audio-composer-panel .media-composer-submit {
    min-width: 52px;
    width: 52px;
    height: 52px;
    padding: 0;
    color: #141619;
    background: #f2f3f5;
    border-radius: 16px;
}

.image-composer-panel .media-composer-submit span,
.video-composer-panel .media-composer-submit span,
.audio-composer-panel .media-composer-submit span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.image-composer-panel .media-composer-submit svg,
.video-composer-panel .media-composer-submit svg,
.audio-composer-panel .media-composer-submit svg {
    width: 22px;
    height: 22px;
}

.audio-voice-trigger { color: #eef1f4; cursor: pointer; white-space: nowrap; }
.audio-voice-trigger span { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.audio-voice-trigger svg:last-child { width: 14px; height: 14px; }
.audio-voice-picker-overlay { position: fixed; inset: 0; z-index: 10050; display: grid; place-items: center; padding: 24px; background: rgba(5, 7, 10, .68); backdrop-filter: blur(6px); }
.audio-voice-picker { width: min(920px, calc(100vw - 48px)); max-height: min(720px, calc(100vh - 48px)); display: flex; flex-direction: column; overflow: hidden; color: #eef1f4; background: #242527; border: 1px solid rgba(255,255,255,.1); border-radius: 22px; box-shadow: 0 24px 80px rgba(0,0,0,.5); }
.audio-voice-picker header { display: flex; align-items: center; justify-content: space-between; padding: 22px 26px; border-bottom: 1px solid rgba(255,255,255,.08); font-size: 20px; }
.voice-picker-close { width: 38px; height: 38px; display: grid; place-items: center; color: #aab0b7; background: transparent; border: 0; border-radius: 12px; cursor: pointer; }
.voice-picker-close:hover { background: rgba(255,255,255,.08); }
.voice-picker-tools { display: flex; gap: 18px; padding: 20px 24px 12px; }
.voice-picker-tabs { display: flex; padding: 5px; background: #303235; border-radius: 14px; }
.voice-picker-tabs button, .voice-picker-categories button { padding: 10px 16px; color: #9da3aa; background: transparent; border: 0; border-radius: 10px; cursor: pointer; }
.voice-picker-tabs button.active, .voice-picker-categories button.active { color: #fff; background: #55585d; }
.voice-picker-tools label { flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 16px; background: #343639; border-radius: 14px; }
.voice-picker-tools input { width: 100%; color: #fff; background: transparent; border: 0; outline: 0; font-size: 15px; }
.voice-picker-categories { display: flex; gap: 6px; padding: 0 24px 14px; }
.voice-picker-list { min-height: 260px; overflow-y: auto; padding: 0 24px 24px; }
.voice-picker-card { display: flex; align-items: center; gap: 16px; padding: 15px 18px; margin-bottom: 8px; background: #303234; border: 1px solid transparent; border-radius: 15px; }
.voice-picker-card:hover { border-color: rgba(68,170,255,.45); }
.voice-wave { width: 48px; height: 48px; display: grid; place-items: center; background: #474a4e; border-radius: 12px; }
.voice-picker-card div { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.voice-picker-card small { color: #9299a2; }
.voice-picker-card > button { padding: 9px 20px; color: #181a1d; background: #f2f3f5; border: 0; border-radius: 20px; font-weight: 700; cursor: pointer; }
.voice-picker-loading { padding: 70px 20px; color: #9299a2; text-align: center; }
@media (max-width: 700px) { .voice-picker-tools { flex-direction: column; } .voice-picker-tools label { min-height: 46px; } .voice-picker-categories { overflow-x: auto; } }

.audio-composer-panel .media-composer-prompt {
    min-height: 132px;
}

.audio-composer-source {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    color: #aeb7c4;
    font-size: 12px;
    border: 1px solid #3a3f47;
    border-radius: 6px;
    background: #202328;
}

.audio-composer-source svg {
    width: 16px;
    height: 16px;
    color: #6cb3ff;
}

.text-composer-panel {
    min-height: 0;
    gap: 12px;
    padding: 18px 22px 20px;
}

.text-composer-panel .media-composer-header {
    min-height: 34px;
}

.text-composer-panel .media-composer-title {
    font-size: 17px;
}

.text-composer-panel .media-composer-title em {
    padding: 3px 7px;
    font-size: 11px;
}

.text-composer-panel .media-composer-close {
    width: 30px;
    height: 30px;
}

.text-composer-tools {
    display: flex;
    gap: 8px;
    padding: 0;
}

.text-composer-tools button {
    height: 40px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #aeb5bf;
    background: #303131;
    border: 1px solid transparent;
    border-radius: 22px;
    cursor: pointer;
}

.text-composer-tools button:hover,
.text-composer-tools button.active {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.08);
    background: #3a3b3c;
}

.text-composer-tools svg,
.text-composer-copy svg,
.text-composer-apply svg {
    width: 15px;
    height: 15px;
}

.text-composer-content {
    min-height: 116px;
    height: 116px;
    padding: 14px 6px;
    line-height: 1.65;
    resize: vertical;
}

.text-composer-mode-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    margin-top: -2px;
    padding: 5px 9px;
    border: 1px solid rgba(93, 214, 177, .16);
    border-radius: 7px;
    background: rgba(32, 201, 151, .07);
    color: #a9b1ba;
    font-size: 11px;
    line-height: 1.45;
}

.text-composer-mode-hint svg {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
    color: #7eb7ff;
}

.text-composer-progress {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 24px;
    color: #aeb7c2;
    font-size: 11px;
}

.text-composer-progress[hidden] {
    display: none !important;
}

.text-composer-progress-track {
    position: relative;
    height: 3px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(148, 163, 184, .16);
}

.text-composer-progress-track i {
    position: absolute;
    inset: 0 auto 0 0;
    width: 38%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(71, 209, 168, .25), #47d1a8, rgba(71, 209, 168, .25));
    animation: text-composer-progress-slide 1.05s ease-in-out infinite;
}

@keyframes text-composer-progress-slide {
    from { transform: translateX(-105%); }
    to { transform: translateX(270%); }
}

body:not(.dark) .text-composer-progress {
    color: #52606e;
}

body:not(.dark) .text-composer-progress-track {
    background: #dce3e8;
}

.text-composer-instruction-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    gap: 8px;
    margin-top: 2px;
}

.text-composer-instruction {
    min-width: 0;
    height: 36px;
    padding: 0 13px;
    color: #e7e9ed;
    background: #202226;
    border: 1px solid #3a3d42;
    border-radius: 7px;
    outline: none;
}

.text-composer-instruction:focus {
    border-color: #3f8cff;
    box-shadow: 0 0 0 2px rgba(63, 140, 255, 0.14);
}

.text-composer-copy {
    display: grid;
    place-items: center;
    color: #aeb5bf;
    background: #292b2f;
    border: 1px solid #3a3d42;
    border-radius: 7px;
    cursor: pointer;
}

.text-composer-copy:hover {
    color: #fff;
    border-color: #575b63;
}

.text-composer-footer {
    margin-top: 0;
    padding-top: 12px;
}

.text-composer-apply {
    min-width: 124px;
    height: 36px;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #0c1118;
    font-weight: 700;
    background: #f4f6f8;
    border: 0;
    border-radius: 7px;
    cursor: pointer;
}

.text-composer-apply:hover {
    background: #fff;
}

/* 默认文本节点不在卡片内编辑；编辑与生成统一收进文本创作对话框。 */
body.canvas-mode .text-node .node-content {
    cursor: text;
}

body.canvas-mode .text-node .node-textarea {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: 0 !important;
    resize: none;
    /* 顶部栏本身必须可命中，否则主题、历史、设置等可见按钮会把点击穿透给画布。 */
    pointer-events: auto;
}

body.canvas-mode .text-node .node-textarea::placeholder {
    color: #7e8793;
    opacity: 1;
}

.text-composer-panel .text-composer-apply {
    width: 44px;
    min-width: 44px;
    height: 44px;
    margin-left: auto;
    padding: 0;
    border-radius: 14px;
}

.integrated-worker-node,
.dialog-only-node {
    display: none !important;
}

.image-composer-panel {
    min-height: 0;
}

.image-composer-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
}

.image-composer-tools>button:not(.media-asset-add) {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 14px;
    color: #b7bdc6;
    background: #303131;
    border: 1px solid transparent;
    border-radius: 22px;
    cursor: pointer;
}

.image-composer-tools>button:not(.media-asset-add):hover,
.image-composer-tools>button.active:not(.media-asset-add) {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.08);
    background: #3a3b3c;
}

.image-composer-tools svg {
    width: 15px;
    height: 15px;
}

.image-composer-tools .image-ref-add {
    min-width: 150px;
    height: 40px;
    margin-left: auto;
}

/* 最终收口：生成面板必须是一个紧凑对话框，不允许变成大画板。 */
.media-composer-panel[data-placement="dock"].image-composer-panel,
.media-composer-panel[data-placement="dock"].video-composer-panel,
.media-composer-panel[data-placement="dock"].audio-composer-panel {
    top: auto !important;
    bottom: 88px;
    min-height: 0 !important;
    max-height: min(440px, calc(100vh - 150px)) !important;
    padding: 18px 20px 18px;
    overflow-y: auto;
    border-radius: 22px;
}

.media-composer-panel[data-placement="dock"].image-composer-panel {
    width: min(var(--composer-width, 720px), calc(100vw - 32px)) !important;
}

.media-composer-panel[data-placement="dock"].video-composer-panel {
    width: min(var(--composer-width, 820px), calc(100vw - 32px)) !important;
    max-height: min(500px, calc(100vh - 118px)) !important;
}

.media-composer-panel[data-placement="dock"].audio-composer-panel {
    width: min(var(--composer-width, 660px), calc(100vw - 32px)) !important;
}

/* 节点吸附面板与画布缩放解耦；上下翻转时保持同一套尺寸和内部比例。 */
.media-composer-panel[data-placement="below"],
.media-composer-panel[data-placement="above"] {
    min-height: 0;
    max-height: min(500px, calc(100vh - 118px));
    overflow-y: auto;
}

.media-composer-panel[data-placement="below"].image-composer-panel,
.media-composer-panel[data-placement="above"].image-composer-panel,
.media-composer-panel[data-placement="below"].text-composer-panel,
.media-composer-panel[data-placement="above"].text-composer-panel {
    width: min(var(--composer-width, 720px), calc(100vw - 32px)) !important;
}

.media-composer-panel[data-placement="below"].video-composer-panel,
.media-composer-panel[data-placement="above"].video-composer-panel {
    width: min(var(--composer-width, 820px), calc(100vw - 32px)) !important;
}

.media-composer-panel[data-placement="below"].audio-composer-panel,
.media-composer-panel[data-placement="above"].audio-composer-panel {
    width: min(var(--composer-width, 660px), calc(100vw - 32px)) !important;
    max-height: min(400px, calc(100vh - 118px));
}

.image-composer-panel .image-composer-tools,
.video-composer-panel .video-composer-tools {
    justify-content: flex-start;
    min-height: 34px;
}

.image-composer-panel .image-composer-tools>button,
.video-composer-panel .video-composer-tools>button {
    flex: 0 0 auto;
    height: 34px;
    padding: 0 12px;
    font-size: 13px;
}

.image-composer-panel .image-composer-tools .image-ref-add {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    margin-left: 0;
}

.image-composer-panel .media-composer-prompt,
.video-composer-panel .media-composer-prompt,
.audio-composer-panel .media-composer-prompt {
    min-height: clamp(90px, calc(96px * var(--composer-zoom-factor, 1)), 130px) !important;
    height: clamp(100px, calc(108px * var(--composer-zoom-factor, 1)), 146px);
    padding: 8px 0;
    font-size: 16px;
}

.video-composer-panel .media-composer-assets {
    min-height: 44px;
    gap: 8px;
}

.video-composer-panel .media-composer-file-list {
    margin-top: 2px;
    padding-bottom: 4px;
}

.video-composer-panel .media-composer-assets:not(:has(.media-asset-source)) {
    display: none;
}

.video-composer-panel .media-composer-assets:has(.media-asset-source) {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
    min-height: 0;
    max-height: none;
    overflow: visible;
}

.video-composer-panel .media-composer-reference-count {
    display: flex;
    min-height: 26px;
    align-items: center;
    gap: 7px;
    color: #8fa0b5;
    font-size: 12px;
}

.video-composer-panel .media-composer-reference-count svg {
    width: 14px;
    height: 14px;
    color: #6ea9ee;
}

.video-composer-panel .media-asset-add,
.video-composer-panel .media-asset-source {
    height: 40px;
    padding: 0 11px;
    font-size: 13px;
}

.image-composer-panel .media-composer-footer,
.video-composer-panel .media-composer-footer,
.audio-composer-panel .media-composer-footer {
    gap: 8px;
    padding-top: 10px;
}

.image-composer-panel .media-composer-control,
.video-composer-panel .media-composer-control,
.audio-composer-panel .media-composer-control {
    height: 36px;
    min-width: 0;
}

.image-composer-panel .media-composer-control.model,
.video-composer-panel .media-composer-control.model,
.audio-composer-panel .media-composer-control.model {
    max-width: 190px;
}

.image-composer-panel .media-composer-submit,
.video-composer-panel .media-composer-submit,
.audio-composer-panel .media-composer-submit {
    width: 48px;
    min-width: 48px;
    height: 48px;
    border-radius: 15px;
}

.media-composer-submit.is-loading svg {
    animation: mediaComposerSpin 0.8s linear infinite;
}

.image-composer-panel .media-composer-submit.is-loading,
.video-composer-panel .media-composer-submit.is-loading,
.audio-composer-panel .media-composer-submit.is-loading {
    width: 48px;
    min-width: 48px;
    gap: 0;
    padding: 0;
    opacity: 1;
    cursor: wait;
}

/* 只有视口本身确实放不下时才压缩输入区；标题、来源说明和底部参数始终保留。 */
.media-composer-panel.is-viewport-compact .media-composer-prompt {
    min-height: 72px !important;
    height: 72px !important;
}

.media-composer-panel.is-viewport-compact .media-composer-footer {
    flex: 0 0 auto;
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: #252626;
}

.image-composer-panel .media-composer-submit.is-loading span,
.video-composer-panel .media-composer-submit.is-loading span,
.audio-composer-panel .media-composer-submit.is-loading span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

@keyframes mediaComposerSpin {
    to { transform: rotate(360deg); }
}

@media (max-width: 980px) {
    .media-composer-panel[data-placement="dock"].image-composer-panel,
    .media-composer-panel[data-placement="dock"].video-composer-panel,
    .media-composer-panel[data-placement="dock"].audio-composer-panel {
        width: calc(100vw - 32px) !important;
        bottom: 76px;
        padding: 16px;
    }

    .video-composer-panel .media-composer-footer {
        display: grid;
        grid-template-columns: minmax(180px, 2fr) minmax(120px, 1fr) repeat(4, minmax(76px, .72fr)) auto 48px;
        overflow-x: auto;
        padding-bottom: 3px;
    }

    .video-composer-panel .media-composer-control.model {
        max-width: none;
    }

    .video-composer-panel .media-composer-credit {
        margin-left: 0;
        justify-content: center;
    }
}

@media (max-width: 720px) {
    .video-composer-panel .video-composer-tools {
        flex-wrap: wrap;
    }

    .video-composer-panel .media-composer-footer {
        grid-template-columns: minmax(170px, 2fr) minmax(118px, 1fr) repeat(2, minmax(74px, .8fr));
        overflow-x: visible;
    }

    .video-composer-panel .media-composer-credit,
    .video-composer-panel .media-composer-submit {
        margin-left: 0;
    }
}

.image-composer-current {
    display: flex;
    align-items: center;
    gap: 9px;
    width: max-content;
    max-width: 100%;
    padding: 5px 10px 5px 5px;
    color: #aec8e9;
    background: rgba(94, 158, 255, 0.11);
    border: 1px solid rgba(94, 158, 255, 0.22);
    border-radius: 14px;
    font-size: 11px;
}

.image-composer-current img {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 5px;
}

.media-composer-mention-menu {
    position: fixed;
    z-index: 4200;
    width: 240px;
    max-height: 210px;
    padding: 8px;
    overflow: auto;
    color: #edf2f8;
    background: rgba(31, 32, 33, 0.98);
    border: 1px solid rgba(112, 174, 255, 0.32);
    border-radius: 14px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.48), 0 0 0 1px rgba(255, 255, 255, 0.035) inset;
}

.media-composer-mention-menu button {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
    color: #dce3ec;
    background: transparent;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    font-size: 13px;
    font-weight: 650;
}

.media-composer-mention-menu button:hover {
    color: #fff;
    background: rgba(78, 145, 255, 0.16);
}

.media-composer-mention-menu svg {
    width: 15px;
    height: 15px;
    color: #8fc2ff;
}

.media-composer-mention-empty {
    padding: 10px;
    color: #858d98;
    font-size: 12px;
}

/* Liblib 风格：一段连续蓝色光带沿输出方向流动，不使用密集光点。 */
.connections-layer path.conn-flow-glow,
.connections-layer path.conn-flow {
    fill: none;
    stroke-linecap: round;
    stroke-dasharray: 0.085 0.915;
    pointer-events: none;
    opacity: 0;
    animation: none;
    transition: opacity 140ms ease;
}

.connections-layer path.conn-flow-glow {
    stroke: rgba(45, 153, 255, 0.34);
    stroke-width: 5.5;
    filter: blur(2.2px);
}

.connections-layer path.conn-flow {
    stroke: #4bb3ff;
    stroke-width: 1.8;
    filter: drop-shadow(0 0 2px rgba(75, 179, 255, 0.85));
}

.connections-layer g.is-selected .conn-flow-glow,
.connections-layer g.is-selected .conn-flow,
.connections-layer g.is-node-active .conn-flow-glow,
.connections-layer g.is-node-active .conn-flow,
.connections-layer g.is-generating .conn-flow-glow,
.connections-layer g.is-generating .conn-flow {
    opacity: 1;
    animation: connectionBlueFlow 2.15s linear infinite;
}

.media-composer-mention-menu button>img,
.media-composer-mention-menu button>video {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    object-fit: cover;
    background: #15171a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 9px;
}

.connections-layer g.is-generating .conn-flow-glow,
.connections-layer g.is-generating .conn-flow {
    animation-duration: 1.35s;
}

.connections-layer g.is-generating .conn-flow-glow {
    stroke: rgba(60, 170, 255, 0.5);
}

.connections-layer g.is-generating .conn-flow {
    stroke: #68c2ff;
    stroke-width: 2.1;
}

.connections-layer g.is-selected .conn-line,
.connections-layer g.is-node-active .conn-line {
    stroke: rgba(93, 166, 225, 0.82);
    stroke-width: 1.35;
    opacity: 1;
}

.connections-layer g.is-generating .conn-line {
    stroke: rgba(72, 170, 239, 0.92);
    stroke-width: 1.55;
    opacity: 1;
    filter: drop-shadow(0 0 2px rgba(64, 162, 238, 0.34));
}

.connections-layer g.is-selected:hover .conn-flow-glow {
    stroke: rgba(86, 185, 255, 0.52);
}

.connections-layer g.is-selected:hover .conn-flow {
    stroke: #7ac8ff;
    stroke-width: 2.1;
}

.connections-layer .conn-delete-control {
    opacity: 0;
    pointer-events: none;
    cursor: pointer;
    transition: opacity 120ms ease, filter 120ms ease;
}

.connections-layer g.is-selected .conn-delete-control {
    opacity: 1;
    pointer-events: auto;
}

.connections-layer .conn-delete-bg {
    fill: #2b3036;
    stroke: rgba(185, 196, 210, 0.78);
    stroke-width: 1.4;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.36));
}

.connections-layer .conn-delete-x {
    stroke: #dce4ef;
    stroke-width: 1.7;
    stroke-linecap: round;
}

.connections-layer .conn-delete-control:hover {
    filter: drop-shadow(0 0 7px rgba(75, 179, 255, 0.44));
}

.connections-layer .conn-delete-control:hover .conn-delete-bg {
    fill: #313943;
    stroke: #68bdff;
}

@keyframes connectionBlueFlow {
    from {
        stroke-dashoffset: 0;
    }

    to {
        stroke-dashoffset: -1;
    }
}

@media (max-width: 820px) {
    .media-composer-panel {
        min-height: 420px;
    }

    .media-composer-panel.text-composer-panel {
        min-height: 0;
    }

    .media-composer-assets {
        flex-wrap: wrap;
    }

    .media-asset-source,
    .media-asset-add {
        min-width: calc(50% - 4px);
    }

    .media-composer-footer {
        flex-wrap: wrap;
    }

    .media-composer-submit {
        flex: 1 0 100%;
        margin-left: 0;
    }
}

@media (prefers-reduced-motion: reduce) {

    .media-composer-panel::before,
    .connections-layer path.conn-flow,
    .connections-layer path.conn-flow-glow {
        animation: none;
    }
}

@media (prefers-reduced-motion: reduce) {

    body.canvas-mode *,
    body.canvas-mode *::before,
    body.canvas-mode *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* 宽幅创作节点：提示词为主，参数收纳到底部，保留原有节点能力。 */
body.canvas-mode .node.creation-node,
body.canvas-mode .node.creation-node:hover,
body.canvas-mode .node.creation-node.selected,
body.canvas-mode .node.creation-node:not(.image-node):not(.video-node) {
    width: 720px;
    min-width: 720px;
    max-width: 720px;
    border-radius: 12px;
}

body.canvas-mode .creation-node .node-header {
    min-height: 42px;
    padding: 10px 14px 6px;
}

body.canvas-mode .creation-node .node-content {
    padding: 6px 14px 14px;
}

.creation-composer,
body.canvas-mode .creation-node .seedance-composer {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.creation-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
}

.creation-ref-tool {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 4px 6px 4px 10px;
    border: 1px solid #3d3f43;
    border-radius: 8px;
    background: #202123;
    color: #bdc1c8;
    font-size: 11px;
}

.creation-ref-tool>span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.creation-ref-tool svg {
    width: 15px;
    height: 15px;
}

.creation-ref-tool .ref-image-box {
    gap: 5px;
}

body.canvas-mode .creation-ref-tool .add-ref-btn {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
}

.creation-ref-tool .ref-preview {
    max-width: 300px;
    flex-wrap: nowrap;
    overflow-x: auto;
}

body.canvas-mode .creation-node .creation-prompt,
body.canvas-mode .creation-node .seedance-prompt {
    width: 100%;
    min-height: 152px;
    margin: 0;
    padding: 15px 16px;
    border-color: #3b3d41;
    background: #202123;
    font-size: 14px;
    line-height: 1.65;
    resize: vertical;
}

body.canvas-mode .creation-node .seedance-prompt-label {
    display: none;
}

.creation-footer,
body.canvas-mode .seedance-settings {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    padding-top: 10px;
    border-top: 1px solid #34363a;
}

.creation-control,
body.canvas-mode .seedance-settings .creation-control {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    min-width: 0;
    min-height: 36px;
    margin: 0;
    padding: 0 5px 0 8px;
    border: 1px solid #3e4045;
    border-radius: 7px;
    background: #292a2d;
}

.creation-control svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    color: #aeb4bd;
}

body.canvas-mode .creation-control>label,
body.canvas-mode .seedance-settings .creation-control>label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

body.canvas-mode .creation-control .node-select,
body.canvas-mode .creation-control .agent-select,
body.canvas-mode .seedance-settings .creation-control .node-select {
    width: auto;
    min-width: 58px;
    max-width: 105px;
    height: 34px;
    padding: 4px 20px 4px 4px;
    border: 0;
    background-color: transparent;
    color: #eceef1;
    box-shadow: none;
}

body.canvas-mode .creation-control.model-control .node-select {
    width: 164px;
    max-width: 164px;
}

body.canvas-mode .creation-control.agent-control {
    flex: 1 1 auto;
}

body.canvas-mode .creation-control.agent-control .agent-select {
    width: 100%;
    max-width: none;
}

/* 基础节点采用统一默认体量；媒体加载后仍按素材比例自适应。 */
body.canvas-mode .node.text-node,
body.canvas-mode .node.audio-node,
body.canvas-mode .node.agent-node,
body.canvas-mode .node.agent-node:hover,
body.canvas-mode .node.agent-node.selected,
body.canvas-mode .node.agent-node:not(.image-node):not(.video-node) {
    width: 268px;
    min-width: 268px;
    max-width: 268px;
    min-height: 205px;
    box-sizing: border-box;
}

body.canvas-mode .node.text-node,
body.canvas-mode .node.text-node:hover,
body.canvas-mode .node.text-node.selected {
    width: 280px;
    min-width: 280px;
    max-width: 280px;
    min-height: 190px;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
    contain: layout paint;
}

body.canvas-mode .text-node .node-header {
    min-height: 34px;
    padding: 10px 12px 6px;
}

body.canvas-mode .text-node .node-content {
    padding: 6px 12px 12px;
}

body.canvas-mode .text-node .node-textarea {
    width: 100%;
    min-height: 90px;
    height: 90px;
    max-height: 90px;
    padding: 10px 11px;
    font-size: 13px;
    line-height: 1.5;
    resize: none;
    overflow-y: auto;
    scrollbar-gutter: stable;
    box-sizing: border-box;
    backface-visibility: hidden;
    transform: translateZ(0);
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

body.canvas-mode .text-node .node-textarea::-webkit-scrollbar {
    width: 6px;
}

body.canvas-mode .text-node .node-textarea::-webkit-scrollbar-track {
    background: transparent;
}

body.canvas-mode .text-node .node-textarea::-webkit-scrollbar-thumb {
    background: #4c5058;
    border-radius: 999px;
}

body.canvas-mode .text-node .text-upload-row {
    margin-top: 10px;
}

body.canvas-mode .text-node .text-upload-btn {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 12px;
}

body.canvas-mode .node.audio-gen-node,
body.canvas-mode .node.audio-gen-node:hover,
body.canvas-mode .node.audio-gen-node.selected,
body.canvas-mode .node.audio-gen-node:not(.image-node):not(.video-node) {
    width: 520px;
    min-width: 520px;
    max-width: 520px;
}

body.canvas-mode .agent-node .creation-prompt,
body.canvas-mode .agent-node .user-input {
    min-height: 72px;
    max-height: 92px;
    padding: 10px 11px;
    line-height: 1.5;
}

body.canvas-mode .audio-gen-node .creation-prompt {
    min-height: 92px;
    max-height: 150px;
    padding: 12px 14px;
    line-height: 1.55;
}

body.canvas-mode .agent-node .creation-composer {
    gap: 8px;
}

body.canvas-mode .agent-node .creation-footer {
    padding-top: 8px;
}

body.canvas-mode .audio-gen-node .creation-composer {
    gap: 8px;
}

body.canvas-mode .audio-gen-node .creation-footer {
    padding-top: 8px;
}

body.canvas-mode .audio-gen-node .model-control {
    flex: 1 1 auto;
}

body.canvas-mode .audio-gen-node .model-control .node-select {
    width: 100%;
    max-width: none;
}

body.canvas-mode .agent-node .agent-control {
    min-width: 0;
    overflow: hidden;
}

body.canvas-mode .agent-node .agent-select {
    min-width: 0;
    height: 34px;
    padding: 4px 28px 4px 5px;
    background-color: #292a2d;
    color: #f4f5f7;
    color-scheme: dark;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.canvas-mode .agent-node .agent-select:focus {
    color: #ffffff;
    outline: none;
}

body.canvas-mode .agent-node .agent-select option {
    background: #202225;
    color: #f2f4f7;
    font-size: 13px;
    padding: 8px 10px;
}

body.canvas-mode .agent-node .agent-select option:checked {
    background: #315f96;
    color: #ffffff;
}

body.canvas-mode .agent-node .agent-select option[value=""] {
    color: #b4bac3;
}

body.canvas-mode .agent-node .agent-select[hidden] { display: none !important; }
body.canvas-mode .agent-node .agent-picker-trigger { min-width: 0; flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 34px; padding: 0 8px; color: #f4f5f7; background: transparent; border: 0; cursor: pointer; }
body.canvas-mode .agent-node .agent-picker-trigger span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.canvas-mode .agent-node .agent-picker-trigger svg { width: 15px; height: 15px; flex: none; }
body.canvas-mode .agent-node.agent-preset-locked .agent-picker-trigger {
    cursor: default;
}
body.canvas-mode .agent-node.agent-preset-locked .agent-picker-trigger svg {
    display: none;
}
.agent-picker-popover { position: fixed; z-index: 10060; max-height: min(320px, calc(100vh - 24px)); display: flex; flex-direction: column; overflow: hidden; color: #eef1f4; background: #242629; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; box-shadow: 0 14px 44px rgba(0,0,0,.45); }
.agent-picker-popover[data-placement="below"],
.agent-picker-popover[data-placement="above"] { border-radius: 12px; }
.agent-picker-popover header { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 15px 16px 10px; }
.agent-picker-popover header strong { font-size: 16px; }
.agent-picker-popover header button { width: 30px; height: 30px; display: grid; place-items: center; color: #a7adb5; background: transparent; border: 0; border-radius: 8px; cursor: pointer; }
.agent-picker-popover header button:hover { background: rgba(255,255,255,.08); }
.agent-picker-search { flex: 0 0 38px; box-sizing: border-box; display: flex; align-items: center; gap: 8px; margin: 0 16px 10px; padding: 0 11px; height: 38px; background: #303236; border: 1px solid rgba(255,255,255,.07); border-radius: 10px; }
.agent-picker-search svg { width: 16px; color: #8e959e; }
.agent-picker-search input { width: 100%; color: #fff; background: transparent; border: 0; outline: 0; }
.agent-picker-popover nav { flex: 0 0 auto; min-height: 42px; box-sizing: border-box; display: flex; align-items: flex-start; gap: 5px; overflow-x: auto; overflow-y: hidden; padding: 0 16px 10px; scrollbar-width: none; }
.agent-picker-popover nav::-webkit-scrollbar { display: none; }
.agent-picker-popover nav button { flex: none; padding: 6px 10px; color: #a5abb3; background: transparent; border: 0; border-radius: 8px; cursor: pointer; }
.agent-picker-popover nav button.active { color: #fff; background: #45484d; }
.agent-picker-list { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 82px; align-content: start; gap: 7px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 0 16px 12px; }
.agent-picker-card { min-width: 0; width: 100%; height: 82px; min-height: 82px; max-height: 82px; display: flex; flex-direction: column; gap: 5px; overflow: hidden; padding: 11px 12px; color: #eef1f4; text-align: left; background: #2d2f32; border: 1px solid transparent; border-radius: 11px; cursor: pointer; }
.agent-picker-card:hover, .agent-picker-card.selected { background: #34383d; border-color: rgba(77,164,255,.55); }
.agent-picker-card span { display: flex; min-width: 0; align-items: center; gap: 8px; }
.agent-picker-card strong { min-width: 0; overflow: hidden; font-size: 14px; white-space: nowrap; text-overflow: ellipsis; }
.agent-picker-card em { flex: 0 0 auto; padding: 2px 7px; color: #8fc7ff; background: rgba(44,137,225,.14); border-radius: 6px; font-size: 11px; font-style: normal; }
.agent-picker-card .agent-picker-description { display: -webkit-box; min-height: 0; overflow: hidden; color: #9ba2ab; font-size: 12px; line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.agent-picker-empty { grid-column: 1 / -1; padding: 44px 16px; color: #9299a2; text-align: center; }
@media (max-width: 620px) { .agent-picker-list { grid-template-columns: 1fr; } }

/* 智能体即专业工作流：在节点内直接说明输入、预期产出和下一步。 */
body.canvas-mode .agent-node .agent-workflow-guide {
    display: grid;
    gap: 6px;
    min-width: 0;
    margin-top: 2px;
    padding: 9px 10px;
    color: #9ca5b0;
    background: linear-gradient(135deg, rgba(54, 100, 160, .14), rgba(41, 43, 47, .24));
    border: 1px solid rgba(105, 167, 239, .18);
    border-radius: 10px;
}

body.canvas-mode .agent-node .agent-workflow-guide[hidden] {
    display: none;
}

body.canvas-mode .agent-node .agent-workflow-category {
    width: fit-content;
    max-width: 100%;
    padding: 2px 7px;
    overflow: hidden;
    color: #a9d3ff;
    background: rgba(66, 132, 205, .16);
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .02em;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.canvas-mode .agent-node .agent-workflow-flow {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 6px;
    min-width: 0;
    color: #dce8f5;
    font-size: 11px;
    line-height: 1.35;
}

body.canvas-mode .agent-node .agent-workflow-input,
body.canvas-mode .agent-node .agent-workflow-output {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.canvas-mode .agent-node .agent-workflow-input::before {
    content: '输入 ';
    color: #8498ac;
}

body.canvas-mode .agent-node .agent-workflow-output::before {
    content: '产出 ';
    color: #8498ac;
}

body.canvas-mode .agent-node .agent-workflow-arrow {
    color: #69adf1;
    font-size: 13px;
    font-weight: 700;
}

body.canvas-mode .agent-node .agent-workflow-next {
    overflow: hidden;
    color: #8f9aa7;
    font-size: 10px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.canvas-mode .agent-node .agent-workflow-next::before {
    content: '下一步：';
    color: #6f7b88;
}

@media (max-width: 620px) {
    body.canvas-mode .agent-node .agent-workflow-guide {
        gap: 5px;
        padding: 8px 9px;
    }

    body.canvas-mode .agent-node .agent-workflow-flow {
        gap: 5px;
        font-size: 10px;
    }
}

/* 剧本撰写师：故事脚本上传仅在选中该智能体时出现，避免干扰其它智能体。 */
body.canvas-mode .agent-node .agent-script-upload-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    min-height: 30px;
    padding: 2px 1px 0;
}

body.canvas-mode .agent-node .agent-script-upload-row[hidden] {
    display: none;
}

body.canvas-mode .agent-node .agent-script-upload-btn {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 5px;
    min-height: 28px;
    padding: 4px 8px;
    color: #b9d8ff;
    background: rgba(66, 132, 205, .12);
    border: 1px solid rgba(91, 161, 239, .24);
    border-radius: 8px;
    font-size: 11px;
    cursor: pointer;
}

body.canvas-mode .agent-node .agent-script-upload-btn:hover {
    color: #e8f3ff;
    background: rgba(66, 132, 205, .22);
    border-color: rgba(123, 187, 255, .48);
}

body.canvas-mode .agent-node .agent-script-upload-btn svg {
    width: 14px;
    height: 14px;
}

body.canvas-mode .agent-node .agent-script-file-name {
    min-width: 0;
    overflow: hidden;
    color: #89919c;
    font-size: 11px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 创作对话框采用 LibTV 式无框输入：获得焦点时只显示文字光标，不画整圈蓝框。 */
body.canvas-mode .media-composer-panel textarea:focus,
body.canvas-mode .media-composer-panel textarea:focus-visible,
body.canvas-mode .media-composer-panel input:focus,
body.canvas-mode .media-composer-panel input:focus-visible,
body.canvas-mode .media-composer-panel select:focus,
body.canvas-mode .media-composer-panel select:focus-visible,
body.canvas-mode .media-composer-panel button:focus-visible,
body.canvas-mode .media-composer-panel [tabindex]:focus-visible {
    outline: none !important;
    outline-offset: 0 !important;
    box-shadow: none !important;
}

body.canvas-mode .media-composer-panel .media-composer-prompt:focus,
body.canvas-mode .media-composer-panel .media-composer-prompt:focus-visible {
    border-color: transparent !important;
    background: transparent !important;
}

body.canvas-mode .media-composer-panel .text-composer-instruction:focus,
body.canvas-mode .media-composer-panel .text-composer-instruction:focus-visible {
    border-color: rgba(255, 255, 255, 0.12) !important;
}

/* 画布内统一取消浏览器/组件焦点蓝框，只保留文字光标和原有深色边框。 */
body.canvas-mode button:focus,
body.canvas-mode button:focus-visible,
body.canvas-mode input:focus,
body.canvas-mode input:focus-visible,
body.canvas-mode textarea:focus,
body.canvas-mode textarea:focus-visible,
body.canvas-mode select:focus,
body.canvas-mode select:focus-visible,
body.canvas-mode [tabindex]:focus,
body.canvas-mode [tabindex]:focus-visible,
body.canvas-mode [contenteditable="true"]:focus,
body.canvas-mode [contenteditable="true"]:focus-visible {
    outline: none !important;
    outline-offset: 0 !important;
    box-shadow: none !important;
}

body.canvas-mode .node-textarea:focus,
body.canvas-mode .node-textarea:focus-visible,
body.canvas-mode .user-input:focus,
body.canvas-mode .user-input:focus-visible,
body.canvas-mode .agent-video-url:focus,
body.canvas-mode .agent-video-url:focus-visible,
body.canvas-mode .ai-chat-input:focus,
body.canvas-mode .ai-chat-input:focus-visible,
body.canvas-mode .audio-trim-times input:focus,
body.canvas-mode .audio-trim-times input:focus-visible,
body.canvas-mode .text-composer-instruction:focus,
body.canvas-mode .text-composer-instruction:focus-visible {
    border-color: #3f4146 !important;
    box-shadow: none !important;
}

.media-reference-choice { position: fixed; z-index: 10140; width: 230px; max-height: calc(100vh - 20px); padding: 6px; overflow-y: auto; color: #eef1f4; background: #25272a; border: 1px solid rgba(255,255,255,.12); border-radius: 13px; box-shadow: 0 16px 46px rgba(0,0,0,.5); }
.media-reference-choice > button { width: 100%; display: flex; align-items: center; gap: 11px; padding: 10px; color: #eef1f4; text-align: left; background: transparent; border: 0; border-radius: 9px; cursor: pointer; }
.media-reference-choice > button:hover { background: rgba(255,255,255,.075); }
.media-reference-choice > button > svg { width: 18px; height: 18px; color: #aeb6c0; }
.media-reference-choice > button span { display: flex; flex-direction: column; gap: 2px; }
.media-reference-choice b { font-size: 13px; }
.media-reference-choice small { color: #8f969f; font-size: 11px; }
.media-reference-choice-label { margin: 5px 6px 3px; padding-top: 7px; color: #727a84; border-top: 1px solid rgba(255,255,255,.08); font-size: 10px; font-weight: 700; letter-spacing: .08em; }
body:not(.dark).canvas-mode .media-reference-choice { color: #27313b; background: #fff; border-color: #d5dbe2; box-shadow: 0 16px 42px rgba(31,35,40,.16); }
body:not(.dark).canvas-mode .media-reference-choice > button { color: #27313b; }
body:not(.dark).canvas-mode .media-reference-choice > button:hover { background: #f0f3f6; }
body:not(.dark).canvas-mode .media-reference-choice > button > svg { color: #637080; }
body:not(.dark).canvas-mode .media-reference-choice small { color: #6d7885; }
body:not(.dark).canvas-mode .media-reference-choice-label { color: #778391; border-top-color: #e1e5ea; }
.media-node-pick-hint { position: fixed; left: 50%; top: 22px; z-index: 10200; display: flex; align-items: center; gap: 8px; padding: 10px 14px; color: #f3f5f7; background: #292b2f; border: 1px solid rgba(255,255,255,.13); border-radius: 12px; box-shadow: 0 10px 32px rgba(0,0,0,.38); transform: translateX(-50%); }
.media-node-pick-hint svg { width: 17px; height: 17px; color: #74baff; }
.media-node-pick-hint small { margin-left: 8px; color: #8e959e; }
body.media-node-picking .canvas .node[data-type="image"], body.media-node-picking .canvas .node[data-type="video"], body.media-node-picking .canvas .node[data-type="audio"] { cursor: copy; }
body.media-node-picking .canvas .node[data-type="image"]:hover, body.media-node-picking .canvas .node[data-type="video"]:hover, body.media-node-picking .canvas .node[data-type="audio"]:hover { box-shadow: 0 0 0 2px rgba(91,169,255,.72); }
.media-node-ref-chip em { display: none !important; }

body.canvas-mode .creation-submit,
body.canvas-mode .seedance-generate-btn.creation-submit,
body.canvas-mode .node-action-btn.agent-btn.creation-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: auto;
    min-width: 112px;
    min-height: 38px;
    margin: 0 0 0 auto;
    padding: 7px 12px;
    border-color: #eef0f2;
    border-radius: 8px;
    background: #eef0f2;
    color: #17181a;
}

body.canvas-mode .creation-submit:hover,
body.canvas-mode .seedance-generate-btn.creation-submit:hover,
body.canvas-mode .node-action-btn.agent-btn.creation-submit:hover {
    border-color: #fff;
    background: #fff;
    color: #111214;
}

.creation-submit svg {
    width: 17px;
    height: 17px;
}

body.canvas-mode .creation-node .seedance-ref-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.canvas-mode .creation-node .seedance-ref-item {
    min-height: 68px;
}

body.canvas-mode .creation-node .seedance-input-rule {
    padding: 0 2px;
    font-size: 10px;
}

@media (max-width: 760px) {

    body.canvas-mode .node.creation-node,
    body.canvas-mode .node.creation-node:hover,
    body.canvas-mode .node.creation-node.selected,
    body.canvas-mode .node.creation-node:not(.image-node):not(.video-node) {
        width: 480px;
        min-width: 480px;
        max-width: 480px;
    }

    body.canvas-mode .node.agent-node,
    body.canvas-mode .node.agent-node:hover,
    body.canvas-mode .node.agent-node.selected,
    body.canvas-mode .node.agent-node:not(.image-node):not(.video-node) {
        width: 268px;
        min-width: 268px;
        max-width: 268px;
    }

    body.canvas-mode .node.audio-gen-node,
    body.canvas-mode .node.audio-gen-node:hover,
    body.canvas-mode .node.audio-gen-node.selected,
    body.canvas-mode .node.audio-gen-node:not(.image-node):not(.video-node) {
        width: 420px;
        min-width: 420px;
        max-width: 420px;
    }

    .creation-footer,
    body.canvas-mode .seedance-settings {
        flex-wrap: wrap;
    }

    body.canvas-mode .creation-submit,
    body.canvas-mode .seedance-generate-btn.creation-submit,
    body.canvas-mode .node-action-btn.agent-btn.creation-submit {
        flex: 1 0 100%;
        margin-left: 0;
    }
}

/* 最终覆盖：统一基础节点端口、音频空状态和精致智能体。 */
body.canvas-mode .node.text-node,
body.canvas-mode .node.text-node:hover,
body.canvas-mode .node.text-node.selected {
    width: 268px;
    min-width: 268px;
    max-width: 268px;
    contain: layout style;
    overflow: visible;
}

body.canvas-mode .text-node .node-port,
body.canvas-mode .image-node .node-port,
body.canvas-mode .video-node .node-port,
body.canvas-mode .audio-node .node-port,
body.canvas-mode .agent-node .node-port {
    width: 24px;
    height: 24px;
    overflow: visible;
}

body.canvas-mode .node.audio-node .audio-preview[hidden] {
    display: none !important;
}

body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .audio-preview-box {
    min-height: 0;
    padding: 8px;
    overflow: hidden;
}

body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .audio-placeholder {
    width: 100%;
}

body.canvas-mode .node.audio-node .media-empty-actions {
    justify-content: center;
    flex-wrap: nowrap;
    gap: 10px;
}

body.canvas-mode .node.audio-node .media-empty-actions button {
    white-space: nowrap;
}

body.canvas-mode .node.agent-node,
body.canvas-mode .node.agent-node:hover,
body.canvas-mode .node.agent-node.selected,
body.canvas-mode .node.agent-node:not(.image-node):not(.video-node) {
    width: 400px;
    min-width: 400px;
    max-width: 400px;
    min-height: 0;
    border-radius: 10px;
}

body.canvas-mode .agent-node .node-header {
    min-height: 33px;
    padding: 7px 10px 3px;
}

body.canvas-mode .agent-node .node-content {
    padding: 4px 9px 9px;
}

body.canvas-mode .agent-node .creation-prompt,
body.canvas-mode .agent-node .user-input {
    min-height: 58px;
    height: 58px;
    max-height: 58px;
    padding: 8px 9px;
}

body.canvas-mode .agent-node .creation-footer {
    flex-wrap: nowrap;
    gap: 6px;
    padding-top: 6px;
}

body.canvas-mode .agent-node .creation-composer { gap: 6px; }

body.canvas-mode .agent-node .creation-control,
body.canvas-mode .agent-node .agent-picker-trigger,
body.canvas-mode .agent-node .agent-select {
    min-height: 32px;
    height: 32px;
}

body.canvas-mode .agent-node .agent-control {
    flex: 1 1 auto;
}

body.canvas-mode .agent-node .creation-submit {
    flex: 0 0 auto;
    min-width: 98px;
    min-height: 32px;
}

@media (max-width: 760px) {
    body.canvas-mode .node.agent-node,
    body.canvas-mode .node.agent-node:hover,
    body.canvas-mode .node.agent-node.selected,
    body.canvas-mode .node.agent-node:not(.image-node):not(.video-node) {
        width: 360px;
        min-width: 360px;
        max-width: 360px;
    }

    body.canvas-mode .agent-node .creation-footer {
        flex-wrap: nowrap;
    }

    body.canvas-mode .agent-node .creation-submit {
        flex: 0 0 auto;
        margin-left: auto;
    }
}

/* 最终覆盖：文本、图片、视频、音频空节点统一为紧凑的 284 × 216。 */
body.canvas-mode .node.text-node,
body.canvas-mode .node.text-node:hover,
body.canvas-mode .node.text-node.selected,
body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))),
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))),
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) {
    width: 284px !important;
    min-width: 284px !important;
    max-width: 284px !important;
    height: 216px;
    min-height: 216px;
    max-height: 216px;
    box-sizing: border-box;
    border-radius: 10px;
}

body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .node-header,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .node-header,
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .node-header,
body.canvas-mode .text-node .node-header {
    min-height: 34px;
    padding: 7px 9px 4px;
}

body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .node-content,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .node-content,
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .node-content,
body.canvas-mode .text-node .node-content {
    height: calc(100% - 34px);
    padding: 4px 7px 7px;
    box-sizing: border-box;
}

body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .image-preview-box,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .video-preview-box,
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .audio-preview-box {
    width: 100%;
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
}

body.canvas-mode .text-node .node-content {
    padding-right: 9px;
    padding-left: 9px;
}

body.canvas-mode .text-node .node-textarea {
    height: 76px;
    min-height: 76px;
    max-height: 76px;
    padding: 8px 9px;
}

body.canvas-mode .text-prompt-starters {
    display: grid;
    grid-template-columns: auto repeat(2, minmax(0, 1fr));
    align-items: center;
    gap: 3px 5px;
    margin-top: 5px;
}

body.canvas-mode .text-prompt-starters>span {
    grid-row: 1 / span 2;
    align-self: start;
    padding-top: 4px;
    color: #7f8792;
    font-size: 10px;
}

body.canvas-mode .text-prompt-starters button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    height: 22px;
    padding: 1px 4px;
    overflow: hidden;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #aeb5bf;
    font-size: 10px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

body.canvas-mode .text-prompt-starters button:hover {
    background: #303237;
    color: #e7ebf1;
}

body.canvas-mode .text-prompt-starters button svg {
    width: 12px;
    height: 12px;
    flex: 0 0 auto;
}

body.canvas-mode .text-node .text-upload-row {
    margin-top: 5px;
}

body.canvas-mode .text-node .text-upload-btn {
    min-height: 26px;
    padding: 3px 7px;
    font-size: 10px;
}

/* 智能体提示词：用明确的展开按钮代替浏览器原生拖拽手柄。 */
body.canvas-mode .agent-node .creation-prompt,
body.canvas-mode .agent-node .user-input {
    min-height: 58px;
    height: 58px;
    max-height: 58px;
    padding: 8px 38px 8px 9px;
    resize: none;
    overflow-y: auto;
}

body.canvas-mode .agent-node.agent-prompt-expanded .creation-prompt,
body.canvas-mode .agent-node.agent-prompt-expanded .user-input {
    min-height: 148px;
    height: 148px;
    max-height: 148px;
}

/* 防止画布拖选或 Ctrl+A 误把所有节点文字染成浏览器选择色。 */
body.canvas-mode .canvas,
body.canvas-mode .canvas * {
    -webkit-user-select: none;
    user-select: none;
}

body.canvas-mode .canvas textarea,
body.canvas-mode .canvas input,
body.canvas-mode .canvas select,
body.canvas-mode .canvas [contenteditable="true"] {
    -webkit-user-select: text;
    user-select: text;
}

/* 智能体保持完整对话节点体量；选择器继续严格跟随节点宽度。 */
body.canvas-mode .node.agent-node,
body.canvas-mode .node.agent-node:hover,
body.canvas-mode .node.agent-node.selected,
body.canvas-mode .node.agent-node:not(.image-node):not(.video-node) {
    width: 460px;
    min-width: 460px;
    max-width: 460px;
}

@media (max-width: 520px) {
    body.canvas-mode .node.agent-node,
    body.canvas-mode .node.agent-node:hover,
    body.canvas-mode .node.agent-node.selected,
    body.canvas-mode .node.agent-node:not(.image-node):not(.video-node) {
        width: 360px;
        min-width: 360px;
        max-width: 360px;
    }
}



/* 视频创作参数栏：固定每个下拉的可读宽度，避免模型名称挤掉时长与比例。 */
.video-composer-panel .media-composer-footer {
    display: grid;
    grid-template-columns:
        minmax(170px, 1fr)
        120px
        84px
        84px
        82px
        84px
        44px
        48px;
    align-items: center;
    gap: 8px;
    overflow: visible;
    padding-bottom: 0;
}

.video-composer-panel .media-composer-footer > * {
    min-width: 0;
    box-sizing: border-box;
}

.video-composer-panel .media-composer-control,
.video-composer-panel .media-composer-control.model,
.video-composer-panel .media-composer-control.mode,
.video-composer-panel .media-composer-control.compact {
    width: 100%;
    min-width: 0 !important;
    max-width: none !important;
    gap: 4px;
    padding: 0 8px;
}

.video-composer-panel .media-composer-mode-chip {
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
}

.video-composer-panel .composer-select-trigger {
    width: 100%;
    min-width: 0;
    gap: 4px;
    padding: 0;
    overflow: hidden;
    font-size: 13px;
}

.video-composer-panel .composer-select-trigger span {
    flex: 1 1 auto;
    min-width: 0;
}

.video-composer-panel .composer-select-trigger svg,
.video-composer-panel .media-composer-control > svg {
    width: 14px;
    height: 14px;
}

.video-composer-panel .media-composer-credit {
    width: 44px;
    min-width: 44px;
    margin-left: 0;
    padding: 0;
    justify-content: center;
}

.video-composer-panel .media-composer-submit {
    width: 48px;
    min-width: 48px;
}

@media (max-width: 720px) {
    .video-composer-panel .media-composer-footer {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .video-composer-panel .media-composer-control.model,
    .video-composer-panel .media-composer-control.mode {
        grid-column: span 2;
    }

    .video-composer-panel .media-composer-credit {
        margin-left: 0;
    }
}

/* LibTV 式紧凑创作框：空内容不再强留大块区域，输入增多时再按需长高。 */
.media-composer-panel.image-composer-panel,
.media-composer-panel.video-composer-panel,
.media-composer-panel.audio-composer-panel,
.media-composer-panel.text-composer-panel {
    gap: 9px;
    padding: 15px 18px 16px;
}

.image-composer-panel .media-composer-header,
.video-composer-panel .media-composer-header,
.audio-composer-panel .media-composer-header,
.text-composer-panel .media-composer-header {
    min-height: 32px;
}

.image-composer-panel .media-composer-close,
.video-composer-panel .media-composer-close,
.audio-composer-panel .media-composer-close {
    width: 34px;
    height: 34px;
    border-radius: 13px;
}

.image-composer-panel .image-composer-tools,
.video-composer-panel .video-composer-tools {
    min-height: 36px;
    gap: 7px;
}

.image-composer-panel .image-composer-tools > button:not(.media-asset-add),
.video-composer-panel .video-composer-tools button,
.image-composer-panel .image-ref-add {
    height: 34px;
    padding: 0 12px;
    font-size: 13px;
}

.image-composer-panel .media-composer-prompt,
.video-composer-panel .media-composer-prompt,
.audio-composer-panel .media-composer-prompt {
    min-height: 64px !important;
    height: 68px;
    padding: 5px 0;
    line-height: 1.55;
}

.text-composer-panel .text-composer-content {
    min-height: 96px !important;
    height: 96px;
    padding: 8px 4px;
}

.video-composer-panel .media-composer-optimize {
    height: 30px;
}

.image-composer-panel .media-composer-footer,
.video-composer-panel .media-composer-footer,
.audio-composer-panel .media-composer-footer,
.text-composer-panel .media-composer-footer {
    gap: 7px;
    padding-top: 8px;
}

.image-composer-panel .media-composer-control,
.video-composer-panel .media-composer-control,
.audio-composer-panel .media-composer-control,
.text-composer-panel .media-composer-control {
    height: 34px;
    padding: 0 9px;
}

.image-composer-panel .media-composer-submit,
.video-composer-panel .media-composer-submit,
.audio-composer-panel .media-composer-submit {
    width: 44px;
    min-width: 44px;
    height: 44px;
    border-radius: 14px;
}

.image-composer-panel .media-composer-footer {
    display: grid;
    grid-template-columns: minmax(154px, 1fr) 96px 84px 84px 40px 44px;
    align-items: center;
}

.audio-composer-panel .media-composer-footer {
    display: grid;
    grid-template-columns: minmax(154px, 1fr) minmax(104px, 132px) minmax(68px, 84px) 40px 44px;
    align-items: center;
}

.image-composer-panel .media-composer-footer > *,
.audio-composer-panel .media-composer-footer > * {
    min-width: 0;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

.image-composer-panel .media-composer-credit,
.audio-composer-panel .media-composer-credit {
    width: 40px;
    min-width: 40px;
    margin-left: 0;
    padding: 0;
    justify-content: center;
}

.image-composer-panel .composer-select-trigger,
.audio-composer-panel .composer-select-trigger {
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

.image-composer-panel .media-composer-control {
    gap: 4px;
    padding-inline: 7px;
}

.image-composer-panel .media-composer-control > svg {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
}

.image-composer-panel .composer-select-trigger {
    gap: 4px;
    padding: 0;
    font-size: 13px;
}

.image-composer-panel .composer-select-trigger span {
    flex: 1 1 auto;
    min-width: 0;
}

.image-composer-panel .media-composer-control.ratio .composer-select-trigger span,
.image-composer-panel .media-composer-control.resolution .composer-select-trigger span,
.image-composer-panel .media-composer-control.count .composer-select-trigger span {
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}

@media (max-width: 720px) {
    .media-composer-panel.image-composer-panel,
    .media-composer-panel.video-composer-panel,
    .media-composer-panel.audio-composer-panel,
    .media-composer-panel.text-composer-panel {
        padding: 14px 15px 15px;
    }

    .image-composer-panel .media-composer-footer {
        grid-template-columns: minmax(138px, 1fr) 90px 78px 78px 36px 44px;
    }

    .audio-composer-panel .media-composer-footer {
        grid-template-columns: minmax(132px, 1.3fr) minmax(96px, 1fr) minmax(62px, .65fr) 36px 44px;
    }
}

@media (max-width: 820px) {
    .media-composer-panel.image-composer-panel {
        min-height: 0;
    }

    .image-composer-panel .media-composer-submit {
        flex: 0 0 44px;
        margin-left: 0;
    }
}

/* 2026-08-04 · V56 — empty media actions use the whole visual row as a hit target.
   Icon/label children never steal the click, so upload/create/library work from
   either side of the row and on touch screens. */
body.canvas-mode .media-empty-actions {
    width: min(280px, calc(100% - 28px)) !important;
}
body.canvas-mode .media-empty-actions button {
    position: relative !important;
    width: 100% !important;
    min-height: 28px !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
}
body.canvas-mode .media-empty-actions button > * {
    pointer-events: none !important;
}

@media (max-width: 820px) {
    body.canvas-mode .media-empty-actions {
        width: min(300px, calc(100% - 20px)) !important;
    }
    body.canvas-mode .media-empty-actions button {
        min-height: 34px !important;
    }
}

/* 2026-08-04 · V54 — composer size contract.
   The dialogs are editing docks: horizontally useful, vertically compact.
   Keep this block physically last so legacy experiments above cannot restore
   the square/tall layouts or make the footer wrap and clip. */
body.canvas-mode .media-composer-panel:not(.is-expanded) {
    box-sizing: border-box !important;
    min-height: 0 !important;
    height: auto !important;
    max-width: calc(100vw - 24px) !important;
    padding: 11px 16px 13px !important;
    gap: 7px !important;
    border-radius: 18px !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-tools {
    min-height: 30px !important;
    gap: 6px !important;
    margin: 0 !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-tool,
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-close,
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-expand {
    height: 30px !important;
    min-height: 30px !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-prompt-wrap,
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-prompt {
    min-height: 0 !important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-prompt,
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-input,
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-content {
    height: 82px !important;
    min-height: 82px !important;
    max-height: 82px !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-prompt,
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-prompt {
    height: 78px !important;
    min-height: 78px !important;
    max-height: 78px !important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-prompt {
    height: 66px !important;
    min-height: 66px !important;
    max-height: 66px !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer {
    min-height: 36px !important;
    padding-top: 7px !important;
    margin-top: 0 !important;
    border-top-color: rgba(148, 163, 184, .16) !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-control,
body.canvas-mode .media-composer-panel:not(.is-expanded) .composer-select-trigger,
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-translate {
    height: 36px !important;
    min-height: 36px !important;
    white-space: nowrap !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-submit {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-footer,
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: minmax(235px, 1.18fr) minmax(180px, 1fr) 82px 42px !important;
    column-gap: 7px !important;
    align-items: center !important;
    overflow: visible !important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-translate {
    width: 82px !important;
    min-width: 82px !important;
    max-width: 82px !important;
    height: 36px !important;
    min-height: 36px !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: minmax(250px, 1fr) 82px 78px 72px 32px 42px !important;
    column-gap: 7px !important;
    align-items: center !important;
    overflow: visible !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: minmax(200px, 1fr) minmax(120px, .72fr) 70px 72px 78px 72px 32px 42px !important;
    column-gap: 6px !important;
    align-items: center !important;
    overflow: visible !important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: minmax(240px, 1fr) minmax(150px, .72fr) 88px 32px 42px !important;
    column-gap: 7px !important;
    align-items: center !important;
    overflow: visible !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer > * {
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-credit,
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-credit,
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-credit {
    width: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    justify-content: center !important;
}

/* Expanded means a real editing surface, not a large shell around a compact
   textarea. The prompt owns the free space and the footer remains reachable. */
body.canvas-mode .media-composer-panel.is-expanded {
    display: flex !important;
    flex-direction: column !important;
    padding: 16px 18px !important;
    gap: 10px !important;
    overflow: hidden !important;
}
body.canvas-mode .media-composer-panel.is-expanded .media-composer-prompt-wrap,
body.canvas-mode .text-composer-panel.is-expanded .text-composer-content {
    display: flex !important;
    flex: 1 1 auto !important;
    min-height: 180px !important;
    height: auto !important;
    max-height: none !important;
}
body.canvas-mode .media-composer-panel.is-expanded .media-composer-prompt,
body.canvas-mode .text-composer-panel.is-expanded .text-composer-input {
    flex: 1 1 auto !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 180px !important;
    max-height: none !important;
    overflow-y: auto !important;
}
body.canvas-mode .media-composer-panel.is-expanded .media-composer-footer {
    flex: 0 0 auto !important;
    width: 100% !important;
    margin-top: 0 !important;
}

@media (max-width: 820px) {
    body.canvas-mode .media-composer-panel:not(.is-expanded) {
        width: calc(100vw - 16px) !important;
        max-width: calc(100vw - 16px) !important;
        padding: 10px 12px 12px !important;
    }
    body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer {
        display: flex !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scrollbar-width: thin;
    }
    body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer > * {
        flex: 0 0 auto !important;
    }
}

/* 2026-08-04 · V56 physical-end interaction contract. */
body.canvas-mode .media-empty-actions {
    width: min(280px, calc(100% - 28px)) !important;
}
body.canvas-mode .media-empty-actions button {
    position: relative !important;
    width: 100% !important;
    min-height: 28px !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
}
body.canvas-mode .media-empty-actions button > * {
    pointer-events: none !important;
}
@media (max-width: 820px) {
    body.canvas-mode .media-empty-actions {
        width: min(300px, calc(100% - 20px)) !important;
    }
    body.canvas-mode .media-empty-actions button {
        min-height: 34px !important;
    }
}

@media (max-width: 720px) {
    .image-composer-panel .media-composer-control:not(.model) > svg {
        display: none;
    }
}

@media (max-width: 560px) {
    .image-composer-panel .media-composer-footer {
        grid-template-columns: minmax(126px, 1fr) 86px 74px 74px 34px 42px;
        gap: 5px;
    }

    .image-composer-panel .media-composer-control {
        padding-inline: 5px;
    }

}

/* 图片操作按钮：加深底色，并在普通/放大状态下都保留清晰间距。 */
body.canvas-mode .node.image-node:has(.image-preview:not([hidden])) .media-delete-btn,
body.canvas-mode .node.image-node:has(.image-preview:not([hidden])) .media-replace-btn {
    background: rgba(6, 8, 12, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

body.canvas-mode .node.image-node:has(.image-preview:not([hidden])) .media-delete-btn {
    right: 8px !important;
}

body.canvas-mode .node.image-node:has(.image-preview:not([hidden])) .media-replace-btn {
    right: 50px !important;
}

body.canvas-mode .node.image-node:has(.image-preview:not([hidden])) .media-delete-btn:hover,
body.canvas-mode .node.image-node:has(.image-preview:not([hidden])) .media-replace-btn:hover {
    background: rgba(24, 28, 35, 0.98) !important;
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}

/* ========== 手机端画布适配（2026-07-26） ========== */
@media (max-width: 760px) {
    html,
    body {
        width: 100%;
        min-height: 100%;
        overflow-x: hidden;
        overscroll-behavior: none;
    }

    body.canvas-mode {
        position: fixed;
        inset: 0;
        min-height: 100dvh;
        touch-action: none;
    }

    body.canvas-mode .toolbar {
        box-sizing: border-box;
        width: 100%;
        height: calc(56px + env(safe-area-inset-top));
        min-height: calc(56px + env(safe-area-inset-top));
        padding: env(safe-area-inset-top) 8px 0;
        flex-direction: row;
        gap: 6px;
    }

    body.canvas-mode .toolbar-left {
        flex: 1 1 auto;
        min-width: 0;
        max-width: none;
        gap: 7px;
    }

    body.canvas-mode .toolbar-right {
        flex: 0 0 auto;
        gap: 4px;
    }

    body.canvas-mode .back-btn {
        width: 40px;
        height: 40px;
        padding: 0;
        overflow: hidden;
        white-space: nowrap;
        font-size: 0;
        border-radius: 12px;
    }

    body.canvas-mode .back-btn::before {
        content: "←";
        font-size: 22px;
        line-height: 1;
    }

    body.canvas-mode .project-name {
        flex: 1 1 auto;
        min-width: 0;
        max-width: none;
        margin-left: 0;
        font-size: 13px;
    }

    body.canvas-mode .save-status {
        min-width: 0;
        padding: 5px 7px;
        font-size: 0;
    }

    body.canvas-mode .save-status::before {
        width: 8px;
        height: 8px;
    }

    body.canvas-mode #toolbarAdminBtn,
    body.canvas-mode #settingsBtn {
        display: none !important;
    }

    body.canvas-mode .toolbar-right .action-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        padding: 0;
        border-radius: 12px;
    }

    body.canvas-mode .canvas-container {
        top: calc(56px + env(safe-area-inset-top)) !important;
        right: 0;
        bottom: 0;
        left: 0 !important;
        width: 100vw;
        height: auto;
        overflow: hidden;
        touch-action: none;
    }

    body.canvas-mode .node-sidebar {
        top: calc(64px + env(safe-area-inset-top));
        bottom: calc(76px + env(safe-area-inset-bottom));
        left: 8px;
        width: min(78vw, 280px);
        border-radius: 16px;
        z-index: 3100;
        transition: transform .22s ease, box-shadow .22s ease;
    }

    body.canvas-mode .node-sidebar.collapsed {
        left: 8px;
        transform: translateX(calc(-100% + 42px));
        box-shadow: none;
    }

    body.canvas-mode .node-sidebar.collapsed .sidebar-header {
        padding: 9px 4px;
        justify-content: flex-end;
        border-bottom-color: transparent;
    }

    body.canvas-mode .sidebar-header {
        min-height: 48px;
        padding: 9px 10px 9px 14px;
        box-sizing: border-box;
    }

    body.canvas-mode .sidebar-toggle {
        width: 36px;
        height: 36px;
        flex: 0 0 36px;
        border-radius: 10px;
        background: rgba(255, 255, 255, .08);
        font-size: 16px;
    }

    body.canvas-mode .sidebar-item {
        min-height: 44px;
        padding: 6px 9px;
    }

    body.canvas-mode .sidebar-item .sbar-eye,
    body.canvas-mode .sidebar-item .sbar-edit {
        width: 36px;
        height: 36px;
    }

    body.canvas-mode .bottom-toolbar {
        right: 8px;
        bottom: calc(8px + env(safe-area-inset-bottom));
        left: 8px;
        width: auto;
        max-width: none;
        height: 54px;
        padding: 6px;
        gap: 2px;
        transform: none;
        overflow-x: auto;
        overflow-y: hidden;
        justify-content: space-around;
        scrollbar-width: none;
        border-radius: 18px;
    }

    body.canvas-mode .bottom-toolbar::-webkit-scrollbar {
        display: none;
    }

    body.canvas-mode .btm-tool-btn {
        width: 42px;
        height: 42px;
        min-width: 42px;
        border-radius: 13px;
    }

    body.canvas-mode .btm-divider {
        display: none;
    }

    body.canvas-mode #btmShortcuts,
    body.canvas-mode #btmHideToolbar {
        display: none;
    }

    body.canvas-mode .agent-composer-bar {
        bottom: calc(74px + env(safe-area-inset-bottom));
        width: calc(100vw - 16px);
        max-height: min(46dvh, 340px);
        padding: 12px;
        overflow-y: auto;
        border-radius: 18px;
    }

    body.canvas-mode .context-menu,
    body.canvas-mode .port-drop-menu {
        max-width: calc(100vw - 16px);
        max-height: min(64dvh, 480px);
        overflow-y: auto;
    }

    body.canvas-mode .menu-item,
    body.canvas-mode .port-drop-menu-item {
        min-height: 44px;
    }

    body.canvas-mode .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    body.canvas-mode .modal-content,
    body.canvas-mode .asset-picker,
    body.canvas-mode .shortcut-panel {
        width: 100% !important;
        max-width: none !important;
        max-height: calc(92dvh - env(safe-area-inset-top));
        margin: 0;
        padding-bottom: env(safe-area-inset-bottom);
        border-radius: 20px 20px 0 0;
    }

    body.canvas-mode .media-composer-panel[data-placement],
    body.canvas-mode .media-composer-panel[data-placement="dock"],
    body.canvas-mode .media-composer-panel[data-placement="below"],
    body.canvas-mode .media-composer-panel[data-placement="above"] {
        position: fixed !important;
        inset: auto 8px calc(72px + env(safe-area-inset-bottom)) 8px !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        max-height: calc(100dvh - 144px - env(safe-area-inset-top)) !important;
        transform: none !important;
        overflow-y: auto;
        border-radius: 18px;
    }

    body.canvas-mode .image-composer-panel .media-composer-footer,
    body.canvas-mode .audio-composer-panel .media-composer-footer,
    body.canvas-mode .video-composer-panel .media-composer-footer {
        display: flex;
        flex-wrap: nowrap;
        gap: 6px;
        padding-bottom: 3px;
        overflow-x: auto;
    }

    body.canvas-mode .media-composer-footer > * {
        flex: 0 0 auto;
        min-width: 76px;
    }

    body.canvas-mode .media-composer-footer .media-composer-control.model {
        min-width: 150px !important;
    }

    body.canvas-mode .media-composer-credit {
        min-width: 40px !important;
    }

    body.canvas-mode .media-composer-submit {
        min-width: 44px !important;
    }

    body.canvas-mode .creation-node {
        max-width: min(720px, calc(100vw - 24px));
    }

    @media (hover: none) and (pointer: coarse) {
        body.canvas-mode button,
        body.canvas-mode a,
        body.canvas-mode select,
        body.canvas-mode .node-port {
            touch-action: manipulation;
        }

        body.canvas-mode .node-port::after {
            width: 24px;
            height: 24px;
        }
    }
}

@media (max-width: 420px) {
    body.canvas-mode .toolbar-right .action-btn {
        width: 38px;
        height: 38px;
    }

    body.canvas-mode .project-name {
        max-width: 132px;
    }

    body.canvas-mode .bottom-toolbar {
        justify-content: flex-start;
    }

    body.canvas-mode .media-composer-panel[data-placement] {
        right: 6px !important;
        left: 6px !important;
        padding: 12px !important;
    }
}

/* 2026-08-03 · 交互收尾：即时连线菜单、文本展开与轻剪辑时间指针 */
body.canvas-mode #canvasContextMenu {
    width: 208px;
    min-width: 208px;
    max-height: min(76vh, 600px);
    padding: 6px;
    overflow-y: auto;
    border-radius: 13px;
}
body.canvas-mode #canvasContextMenu.toolbar-anchor {
    transform: none;
}
body.canvas-mode #canvasContextMenu .menu-section-title {
    min-height: 27px;
    padding: 5px 9px 4px;
    font-size: 11px;
    font-weight: 550;
}
body.canvas-mode #canvasContextMenu .menu-item {
    min-height: 32px;
    padding: 0 9px;
    gap: 9px;
    font-size: 13px;
    font-weight: 450;
    border-radius: 7px;
}
body.canvas-mode #canvasContextMenu .menu-item svg { width: 15px; height: 15px; }
body.canvas-mode #canvasContextMenu .menu-divider { margin: 4px 0; }

body.canvas-mode .port-drop-menu {
    z-index: 22000;
    transform: translate(10px, -10px);
}
body.canvas-mode .temp-connection,
body.canvas-mode .pending-connection {
    stroke: #20c997 !important;
    stroke-width: 1.35px !important;
    filter: drop-shadow(0 0 2px rgba(32, 201, 151, .28));
}

.media-composer-expand {
    position: absolute;
    top: 12px;
    right: 52px;
    z-index: 7;
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    color: #aeb7c2;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
}
.media-composer-expand:hover { color: #e8ecef; background: #34383d; }
.media-composer-expand svg { width: 17px; height: 17px; }
.text-composer-panel .text-composer-tools { padding-right: 90px; }
.text-composer-translate {
    min-width: 72px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 11px;
    margin-left: auto;
    color: #c7ced6;
    background: #303338;
    border: 1px solid #40454c;
    border-radius: 10px;
    cursor: pointer;
}
.text-composer-translate:hover { color: #dffff3; border-color: #2d8f73; background: rgba(32, 201, 151, .12); }
.text-composer-translate.active {
    color: #eafff8;
    border-color: #20c997;
    background: rgba(32, 201, 151, .2);
}
.text-composer-translate svg { width: 16px; height: 16px; }
.text-composer-panel.is-expanded {
    display: flex;
    flex-direction: column;
    padding: 18px 22px 20px;
}
.text-composer-panel.is-expanded .text-composer-tools { flex: 0 0 auto; }
.text-composer-panel.is-expanded .text-composer-content {
    flex: 1 1 auto;
    width: 100%;
    min-height: 260px !important;
    height: auto !important;
    margin: 12px 0;
    resize: none;
}
.text-composer-panel.is-expanded .text-composer-mode-hint,
.text-composer-panel.is-expanded .text-composer-footer { flex: 0 0 auto; }
body:not(.dark) .media-composer-expand,
body:not(.dark) .text-composer-translate {
    color: #485462;
    background: #edf0f3;
    border-color: #d3d9e0;
}
body:not(.dark) .media-composer-expand:hover,
body:not(.dark) .text-composer-translate:hover {
    color: #155c49;
    background: #e2eee9;
    border-color: #8fc4b3;
}
body:not(.dark) .text-composer-translate.active {
    color: #0f5d48;
    border-color: #20a67f;
    background: #dff4ec;
}

/* 轻剪辑采用“素材 / 大型 16:9 播放器 / 窄参数栏 / 多轨时间线”的稳定布局。 */
.edit-studio-body {
    grid-template-columns: 220px minmax(480px, 1fr) 190px !important;
    grid-template-rows: minmax(360px, 1fr) 238px !important;
}
.edit-studio-main { min-width: 0; padding: 10px 12px !important; }
.edit-studio-preview-shell {
    align-self: center !important;
    justify-self: center !important;
    width: min(100%, calc((100vh - 390px) * 16 / 9)) !important;
    height: auto !important;
    max-height: 100% !important;
    aspect-ratio: 16 / 9 !important;
    background: #090b0d !important;
    border: 1px solid #343a40 !important;
    border-radius: 7px !important;
    overflow: hidden;
}
.edit-studio-preview-shell video {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}
.edit-studio-timeline {
    position: relative;
    padding-top: 11px !important;
    overflow: auto;
}
.edit-studio-playhead {
    --timeline-label-width: 104px;
    position: absolute;
    z-index: 16;
    top: 0;
    bottom: 6px;
    left: var(--playhead-left, calc(var(--timeline-label-width) + (100% - var(--timeline-label-width) - 12px) * var(--playhead-progress, 0)));
    width: 2px;
    display: none;
    background: #20c997;
    box-shadow: 0 0 0 1px rgba(32, 201, 151, .14);
    pointer-events: none;
}
.edit-studio-timeline.has-playhead .edit-studio-playhead { display: block; }
.edit-studio-playhead::before {
    content: "";
    position: absolute;
    top: -8px;
    left: -5px;
    width: 12px;
    height: 12px;
    background: #20c997;
    border-radius: 3px 3px 7px 7px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}
.edit-studio-timeline.drag-over,
.edit-studio-clip:hover,
.edit-studio-clip.active {
    border-color: #20c997 !important;
    box-shadow: inset 0 0 0 1px rgba(32, 201, 151, .45) !important;
}
.edit-studio-trim-handle,
.edit-studio-clip-grip { background-color: #20c997 !important; }

@media (max-width: 1180px) {
    .edit-studio-body {
        grid-template-columns: 190px minmax(420px, 1fr) 174px !important;
        grid-template-rows: minmax(330px, 1fr) 220px !important;
    }
}

@media (max-width: 760px) {
    body.canvas-mode #canvasContextMenu {
        width: min(208px, calc(100vw - 20px));
        max-height: min(70dvh, 520px);
    }
    .media-composer-expand { display: none; }
    .text-composer-panel .text-composer-tools { padding-right: 48px; }
    .text-composer-translate { min-width: 42px; width: 42px; padding: 0; }
    .text-composer-translate span { display: none; }
    .edit-studio-workbench { width: 100vw !important; height: 100dvh !important; border-radius: 0 !important; }
    .edit-studio-body {
        grid-template-columns: 1fr !important;
        grid-template-rows: 138px minmax(240px, 1fr) 204px !important;
    }
    .edit-studio-sources { grid-row: 1; }
    .edit-studio-main { grid-row: 2; }
    .edit-studio-inspector { display: none !important; }
    .edit-studio-timeline-panel { grid-row: 3 !important; }
    .edit-studio-preview-shell { width: 100% !important; }
}

/* 2026-08-04 · 连接反馈统一为中性灰 + 绿色。拖线期间、菜单待选期间、
   已选中和运行中的连接都保持可见，浅色画布不再出现黑色端口或蓝色光带。 */
body.canvas-mode .temp-connection,
body.canvas-mode .pending-connection {
    stroke: #20a981 !important;
    stroke-width: 1.6px !important;
    filter: drop-shadow(0 0 2px rgba(32, 169, 129, .32)) !important;
    opacity: 1 !important;
}
body:not(.dark).canvas-mode .temp-connection,
body:not(.dark).canvas-mode .pending-connection {
    stroke: #137a5f !important;
    stroke-width: 1.75px !important;
    filter: drop-shadow(0 0 1px rgba(19, 122, 95, .22)) !important;
}
body.canvas-mode .connections-layer path.conn-flow-glow {
    stroke: rgba(32, 201, 151, .28) !important;
    filter: blur(1.8px) !important;
}
body.canvas-mode .connections-layer path.conn-flow {
    stroke: #20c997 !important;
    filter: drop-shadow(0 0 2px rgba(32, 201, 151, .55)) !important;
}
body.canvas-mode .connections-layer g.is-selected .conn-line,
body.canvas-mode .connections-layer g.is-node-active .conn-line,
body.canvas-mode .connections-layer g.is-generating .conn-line {
    stroke: #20a981 !important;
    filter: drop-shadow(0 0 2px rgba(32, 169, 129, .38)) !important;
}
body:not(.dark).canvas-mode .connections-layer .conn-line {
    stroke: #7d8995 !important;
}
body:not(.dark).canvas-mode .connections-layer g.is-selected .conn-line,
body:not(.dark).canvas-mode .connections-layer g.is-node-active .conn-line,
body:not(.dark).canvas-mode .connections-layer g.is-generating .conn-line {
    stroke: #137a5f !important;
}

/* 2026-08-03 · 最终密度校准：创作框采用一行参数栏，避免旧规则叠加后再次膨胀。 */
body.canvas-mode .media-composer-panel[data-placement].video-composer-panel {
    width: min(var(--composer-width, 700px), calc(100vw - 24px)) !important;
}
body.canvas-mode .media-composer-panel[data-placement].text-composer-panel,
body.canvas-mode .media-composer-panel[data-placement].audio-composer-panel {
    width: min(var(--composer-width, 540px), calc(100vw - 24px)) !important;
}
body.canvas-mode .media-composer-panel[data-placement].image-composer-panel {
    width: min(var(--composer-width, 560px), calc(100vw - 24px)) !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) {
    padding: 12px 14px 12px !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .video-composer-tools,
body.canvas-mode .image-composer-panel:not(.is-expanded) .image-composer-tools,
body.canvas-mode .audio-composer-panel:not(.is-expanded) .audio-composer-tools,
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-tools {
    min-height: 32px !important;
    height: 32px !important;
    margin-bottom: 7px !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .video-composer-tools > button,
body.canvas-mode .image-composer-panel:not(.is-expanded) .image-composer-tools > button,
body.canvas-mode .audio-composer-panel:not(.is-expanded) .audio-composer-tools > button,
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-tools > button {
    height: 30px !important;
    min-height: 30px !important;
    padding-inline: 9px !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-assets:has(.media-asset-source) {
    height: 52px !important;
    min-height: 52px !important;
    max-height: 52px !important;
    margin-bottom: 6px !important;
    gap: 6px !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-assets .media-asset-source {
    flex: 0 0 52px !important;
    width: 52px !important;
    min-width: 52px !important;
    max-width: 52px !important;
    height: 52px !important;
    min-height: 52px !important;
    max-height: 52px !important;
    aspect-ratio: 1 / 1 !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-prompt-wrap > .media-composer-prompt,
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-prompt-wrap > .media-composer-prompt {
    min-height: 64px !important;
    height: 64px !important;
    padding: 9px 72px 27px 10px !important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-prompt {
    min-height: 58px !important;
    height: 58px !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer,
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer,
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer,
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-footer,
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-footer {
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    min-height: 38px !important;
    height: 47px !important;
    margin-top: 7px !important;
    padding-top: 7px !important;
    gap: 5px !important;
    overflow: visible !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer > *,
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer > *,
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer > * {
    flex: 0 0 auto !important;
    min-width: 0;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-control {
    height: 32px !important;
    min-height: 32px !important;
    min-width: 54px !important;
    max-width: 72px !important;
    padding-inline: 7px !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-control.model {
    width: 158px !important;
    min-width: 158px !important;
    max-width: 158px !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-control.mode {
    width: 92px !important;
    min-width: 92px !important;
    max-width: 92px !important;
}
body.canvas-mode .video-composer-panel .media-composer-mode-chip {
    display: inline-flex !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    color: inherit !important;
    overflow: visible !important;
    white-space: nowrap !important;
}
body.canvas-mode .media-composer-panel .composer-select-trigger > span,
body.canvas-mode .media-composer-panel .composer-select-value {
    display: block !important;
    min-width: 0 !important;
    color: inherit !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-control:has(.media-composer-duration) {
    width: 76px !important;
    min-width: 76px !important;
    max-width: 76px !important;
}
body.canvas-mode .audio-composer-panel .media-composer-control:has(.media-composer-duration) .composer-select-trigger > span {
    overflow: visible !important;
    text-overflow: clip !important;
}

/* 风格/特效选中态：空态彻底退出布局，方卡固定留在节点内部。 */
body.canvas-mode .node.style-node.has-library-selection .style-node-open,
body.canvas-mode .node.effect-node.has-library-selection .effect-node-open {
    display: none !important;
}
body.canvas-mode .node.style-node.has-library-selection .style-node-selection,
body.canvas-mode .node.effect-node.has-library-selection .effect-node-selection {
    display: grid !important;
}
body.canvas-mode .style-node-selection[data-selection-count="1"] .style-node-preview-grid,
body.canvas-mode .effect-node-selection[data-selection-count="1"] .style-node-preview-grid {
    grid-template-columns: 142px !important;
    grid-template-rows: 142px !important;
    place-content: center !important;
}
body.canvas-mode .style-node-selection[data-selection-count="2"] .style-node-preview-grid,
body.canvas-mode .effect-node-selection[data-selection-count="2"] .style-node-preview-grid {
    grid-template-columns: repeat(2, 88px) !important;
    grid-template-rows: 88px !important;
    place-content: center !important;
}
body.canvas-mode .style-node-selection[data-selection-count="3"] .style-node-preview-grid,
body.canvas-mode .style-node-selection[data-selection-count="4"] .style-node-preview-grid {
    grid-template-columns: repeat(2, 76px) !important;
    grid-auto-rows: 76px !important;
    place-content: center !important;
}
body.canvas-mode .style-node-preview-card {
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: 1 / 1 !important;
    box-sizing: border-box !important;
}

/* 浅色创作框使用灰阶和绿色状态色，不再残留蓝色信息条。 */
body:not(.dark).canvas-mode .media-composer-panel {
    color: #26313a !important;
    background: #ffffff !important;
    border-color: #cbd3db !important;
}
body:not(.dark).canvas-mode .media-composer-panel .media-composer-prompt,
body:not(.dark).canvas-mode .media-composer-panel .text-composer-content {
    color: #222a31 !important;
    background: #f2f4f6 !important;
    border-color: #cfd6dc !important;
}
body:not(.dark).canvas-mode .media-composer-panel .text-composer-mode-hint,
body:not(.dark).canvas-mode .media-composer-panel .media-composer-reference-count {
    color: #52605a !important;
    background: #eef4f1 !important;
    border-color: #bdcec7 !important;
}
body:not(.dark).canvas-mode .media-composer-panel .media-composer-control,
body:not(.dark).canvas-mode .media-composer-panel .composer-select-trigger {
    color: #2c3740 !important;
    background: #f1f3f5 !important;
    border-color: #cfd6dc !important;
}

@media (max-width: 760px) {
    body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer {
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scrollbar-width: thin;
    }
}

body.canvas-mode .node.image-node.zoomed:has(.image-preview:not([hidden])) .media-delete-btn {
    right: calc(8px * var(--media-zoom-ui-scale)) !important;
}

body.canvas-mode .node.image-node.zoomed:has(.image-preview:not([hidden])) .media-replace-btn {
    right: calc(50px * var(--media-zoom-ui-scale)) !important;
}

body.canvas-mode .node.image-node.zoomed:has(.image-preview:not([hidden])) .media-download-btn {
    top: calc(8px * var(--media-zoom-ui-scale)) !important;
    right: calc(92px * var(--media-zoom-ui-scale)) !important;
    width: var(--media-zoom-button-size) !important;
    height: var(--media-zoom-button-size) !important;
    border-radius: calc(7px * var(--media-zoom-ui-scale));
}

/* 连线带入的风格/特效直接显示在创作框工具栏，保持一行且不增加面板高度。 */
body.canvas-mode .linked-preset-indicator {
    display: inline-flex;
    align-items: center;
    max-width: 132px;
    color: #c9f5e5 !important;
    background: rgba(32, 201, 151, .12) !important;
    border-color: rgba(32, 201, 151, .36) !important;
}
body.canvas-mode .linked-preset-indicator[hidden] { display: none !important; }
body.canvas-mode .linked-preset-indicator em {
    min-width: 0;
    overflow: hidden;
    color: inherit;
    font-size: 11px;
    font-style: normal;
    text-overflow: ellipsis;
    white-space: nowrap;
}
body:not(.dark).canvas-mode .linked-preset-indicator {
    color: #176a50 !important;
    background: #e4f4ed !important;
    border-color: #9bcab9 !important;
}

body.canvas-mode .node.image-node.zoomed:has(.image-preview:not([hidden])) .media-download-btn svg {
    width: var(--media-zoom-button-icon-size);
    height: var(--media-zoom-button-icon-size);
}

/* 放大视频操作统一为纯图标方形按钮：下载 → 截帧 → 替换 → 删除。 */
body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) .video-frame-btn {
    display: flex !important;
    width: var(--media-zoom-button-size) !important;
    height: var(--media-zoom-button-size) !important;
    top: calc(8px * var(--media-zoom-ui-scale)) !important;
    right: calc(76px * var(--media-zoom-ui-scale)) !important;
    gap: 0;
    padding: 0;
    border-radius: calc(7px * var(--media-zoom-ui-scale));
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    z-index: 12 !important;
}

body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) .video-frame-btn svg {
    width: var(--media-zoom-button-icon-size);
    height: var(--media-zoom-button-icon-size);
    flex: none;
}

body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) .video-frame-label {
    display: none !important;
}

body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) .media-download-btn {
    top: calc(8px * var(--media-zoom-ui-scale)) !important;
    right: calc(110px * var(--media-zoom-ui-scale)) !important;
    width: var(--media-zoom-button-size) !important;
    height: var(--media-zoom-button-size) !important;
    border-radius: calc(7px * var(--media-zoom-ui-scale));
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) .media-download-btn svg {
    width: var(--media-zoom-button-icon-size);
    height: var(--media-zoom-button-icon-size);
}

body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) .media-download-btn,
body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) .video-frame-btn,
body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) .media-replace-btn,
body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) .media-delete-btn {
    width: var(--media-zoom-button-size) !important;
    height: var(--media-zoom-button-size) !important;
    padding: 0 !important;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(18, 21, 25, 0.76) !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: calc(7px * var(--media-zoom-ui-scale));
    box-shadow: 0 calc(2px * var(--media-zoom-ui-scale)) calc(8px * var(--media-zoom-ui-scale)) rgba(0, 0, 0, 0.3);
    opacity: 0.88 !important;
}

body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) .media-download-btn:hover,
body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) .video-frame-btn:hover,
body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) .media-replace-btn:hover,
body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) .media-delete-btn:hover {
    color: #fff;
    background: rgba(34, 39, 47, 0.94) !important;
    border-color: rgba(255, 255, 255, 0.34);
    opacity: 1 !important;
}

/* 引用素材采用 LibTV 式固定方块；单个视频不再被网格拉伸成整行蓝框。 */
body.canvas-mode .video-composer-panel .media-composer-assets:has(.media-asset-source) {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
    min-height: 0;
    overflow: visible;
}

body.canvas-mode .video-composer-panel .media-composer-assets .media-asset-source {
    position: relative;
    flex: 0 0 76px;
    width: 76px;
    min-width: 76px;
    max-width: 76px;
    height: 76px;
    padding: 0;
    gap: 0;
    overflow: hidden;
    color: #f1f4f8;
    background: #303236;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    box-shadow: none;
}

body.canvas-mode .video-composer-panel .media-composer-assets .media-asset-source:hover {
    border-color: rgba(130, 187, 255, 0.72);
    background: #35383d;
}

body.canvas-mode .video-composer-panel .media-asset-source[data-ref-index]:not([data-ref-index=""])::before,
body.canvas-mode .video-composer-panel .media-composer-file-chip[data-ref-index]:not([data-ref-index=""])::before {
    content: attr(data-ref-index);
    position: absolute;
    top: 5px;
    left: 5px;
    z-index: 5;
    width: 23px;
    height: 23px;
    display: grid;
    place-items: center;
    box-sizing: border-box;
    color: #fff;
    background: rgba(8, 11, 15, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.34);
    font-size: 11px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    pointer-events: none;
}

body.canvas-mode .video-composer-panel .media-composer-file-chip[data-ref-index]:not([data-ref-index=""])::before {
    top: 50%;
    left: 5px;
    width: 20px;
    height: 20px;
    transform: translateY(-50%);
    font-size: 10px;
}

body.canvas-mode .video-composer-panel .media-composer-file-chip[data-ref-index]:not([data-ref-index=""]) {
    padding-left: 29px;
}

body.canvas-mode .video-composer-panel .media-composer-assets .media-asset-source .media-asset-thumb {
    width: 100%;
    height: 100%;
    flex: 0 0 100%;
    border: 0;
    border-radius: 11px;
    background: #202225;
}

body.canvas-mode .video-composer-panel .media-composer-assets .media-square-reference {
    aspect-ratio: 1;
}

/* v1.97 · Seedance 真人隐私审核直接定位到具体参考图。 */
body.canvas-mode .video-composer-panel .media-composer-assets .media-square-reference.is-reference-error {
    border-color: #ff756d !important;
    box-shadow: 0 0 0 2px rgba(255, 91, 83, .28), 0 8px 22px rgba(83, 20, 16, .28) !important;
}

body.canvas-mode .video-composer-panel .media-composer-assets .media-square-reference.is-reference-error::after {
    content: attr(data-reference-error-label);
    position: absolute;
    right: 5px;
    bottom: 5px;
    left: 5px;
    z-index: 8;
    display: grid;
    min-height: 18px;
    place-items: center;
    box-sizing: border-box;
    color: #fff;
    background: rgba(189, 43, 36, .94);
    border: 1px solid rgba(255, 255, 255, .24);
    border-radius: 6px;
    font-size: 10px;
    font-weight: 750;
    line-height: 1;
    pointer-events: none;
}

body:not(.dark).canvas-mode .video-composer-panel .media-composer-assets .media-square-reference.is-reference-error {
    border-color: #d92d20 !important;
    box-shadow: 0 0 0 2px rgba(217, 45, 32, .18), 0 8px 22px rgba(152, 27, 19, .16) !important;
}

body.canvas-mode .image-composer-references {
    display: flex;
    gap: 10px;
    min-height: 0;
    margin: 2px 0 10px;
}

body.canvas-mode .image-composer-references[hidden] {
    display: none;
}

body.canvas-mode .image-composer-references .media-square-reference {
    position: relative;
    width: 76px;
    height: 76px;
    min-width: 76px;
    padding: 0;
    overflow: visible;
    border-radius: 13px;
}

body.canvas-mode .image-composer-references .media-square-reference .media-asset-thumb {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    object-fit: cover;
}

body.canvas-mode .image-composer-references .media-square-reference .media-asset-token {
    display: none;
}

body.canvas-mode .media-square-reference.is-previewing .media-asset-hover {
    display: flex;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* v1.10 · 引用素材单击预览需要越过缩略图和创作面板边界。
   旧版视频引用卡与创作面板都使用 overflow:hidden，导致预览虽然已打开，
   实际却被 76px 缩略图裁掉。仅在预览态放开面板，避免影响常规圆角裁切。 */
body.canvas-mode .video-composer-panel .media-composer-assets .media-square-reference,
body.canvas-mode .image-composer-references .media-square-reference {
    overflow: visible !important;
}

body.canvas-mode .media-square-reference.is-previewing {
    z-index: 90;
}

body.canvas-mode .media-composer-panel:has(.media-square-reference:hover),
body.canvas-mode .media-composer-panel:has(.media-square-reference.is-previewing) {
    overflow: visible !important;
}

/* 悬停预览与单击预览使用同一套越界规则。素材横条本身也不能继续裁切，
   否则预览虽然已显示，仍只会露出缩略图上方的一小块。 */
body.canvas-mode .media-composer-assets:has(.media-square-reference:hover),
body.canvas-mode .media-composer-assets:has(.media-square-reference.is-previewing),
body.canvas-mode .image-composer-references:has(.media-square-reference:hover),
body.canvas-mode .image-composer-references:has(.media-square-reference.is-previewing) {
    overflow: visible !important;
}

body.canvas-mode .media-square-reference .media-asset-hover {
    left: 50%;
    bottom: calc(100% + 12px);
    width: min(320px, 42vw);
    min-width: 220px;
    min-height: 132px;
    padding: 6px;
    transform: translateX(-50%);
    background: rgba(31, 32, 35, 0.98);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 20px 52px rgba(0, 0, 0, 0.58);
}

body.canvas-mode .media-square-reference:hover .media-asset-hover,
body.canvas-mode .media-square-reference.is-previewing .media-asset-hover {
    display: flex;
    transform: translateX(-50%);
}

body.canvas-mode .media-square-reference .media-asset-hover img,
body.canvas-mode .media-square-reference .media-asset-hover video {
    width: 100%;
    height: auto;
    max-height: min(320px, 42vh);
    object-fit: contain;
    background: #111315;
}

body.canvas-mode .media-square-reference .media-asset-hover-video {
    width: min(360px, 48vw);
}

body.canvas-mode .media-square-reference.is-audio-playing {
    border-color: #5ba7ff;
    box-shadow: 0 0 0 2px rgba(73, 151, 255, 0.28), 0 0 18px rgba(73, 151, 255, 0.22);
}

body.canvas-mode .media-square-reference.is-audio-playing .media-asset-icon-thumb::after {
    content: "❚❚";
    position: absolute;
    inset: auto 5px 5px auto;
    display: grid;
    width: 22px;
    height: 22px;
    place-items: center;
    color: #fff;
    background: rgba(24, 119, 242, 0.9);
    border-radius: 50%;
    font-size: 8px;
}

body.canvas-mode .video-composer-panel .media-composer-assets .media-square-reference .media-asset-token {
    display: none;
}

body.canvas-mode .video-composer-panel .media-composer-assets .media-reference-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 7;
    display: grid;
    width: 20px;
    height: 20px;
    padding: 0;
    place-items: center;
    color: #fff;
    background: rgba(18, 21, 26, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

body.canvas-mode .video-composer-panel .media-composer-assets .media-reference-remove:hover {
    background: rgba(219, 68, 68, 0.92);
}

body.canvas-mode .video-composer-panel .media-composer-assets .media-asset-source .media-asset-token {
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: 5px;
    z-index: 2;
    overflow: hidden;
    padding: 3px 5px;
    color: #f4f7fb;
    background: rgba(10, 12, 15, 0.74);
    border-radius: 6px;
    font-size: 10px;
    font-weight: 650;
    line-height: 1.2;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.canvas-mode .video-composer-panel .media-composer-assets .media-asset-source.text-source {
    display: block;
    color: #d8e9ff;
}

body.canvas-mode .video-composer-panel .media-composer-assets .text-source .media-text-reference-icon {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding-bottom: 10px;
    color: #8fc3ff;
}

body.canvas-mode .video-composer-panel .media-composer-assets .text-source .media-text-reference-icon svg {
    width: 27px;
    height: 27px;
}

body.canvas-mode .video-composer-panel .media-composer-assets .text-source .media-asset-status {
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 3;
    max-width: 64px;
    overflow: hidden;
    padding: 2px 4px;
    color: #80bdff;
    background: rgba(18, 54, 92, 0.9);
    border-radius: 5px;
    font-size: 8px;
    font-weight: 650;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.canvas-mode .video-composer-panel .media-composer-assets .media-asset-source[data-ref-index]:not([data-ref-index=""])::before {
    content: attr(data-ref-index);
    position: absolute;
    top: 5px;
    left: 5px;
    z-index: 3;
    display: grid;
    width: 18px;
    height: 18px;
    place-items: center;
    color: #f7f9fc;
    background: rgba(10, 12, 15, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
}

/* 视频结果历史：成品视频点击后查看版本，播放操作留在原生播放器内。 */
.video-history-panel {
    gap: 16px;
    min-height: 390px;
    padding: 20px 22px 22px;
    background: #202225;
}

.video-history-header .media-composer-title {
    gap: 10px;
    font-size: 19px;
}

.video-history-header .media-composer-title em {
    color: #b9f6e4;
    background: rgba(32, 201, 151, 0.14);
}

.video-history-actions,
.video-history-viewer-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}

.video-history-create,
.video-history-use-current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 36px;
    padding: 0 13px;
    color: #e8fff8;
    background: rgba(32, 201, 151, 0.16);
    border: 1px solid rgba(93, 214, 177, 0.42);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
}

.video-history-create:hover,
.video-history-use-current:hover {
    color: #fff;
    background: rgba(32, 201, 151, 0.28);
}

.video-history-create svg,
.video-history-use-current svg {
    width: 16px;
    height: 16px;
}

.video-history-body {
    display: grid;
    grid-template-columns: minmax(154px, 0.42fr) minmax(0, 1fr);
    gap: 16px;
    min-height: 0;
    flex: 1;
}

.video-history-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    max-height: 416px;
    padding-right: 4px;
    overflow: auto;
}

.video-history-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
    padding: 11px 12px;
    color: #c8ced6;
    background: #2a2c2f;
    border: 1px solid transparent;
    border-radius: 11px;
    cursor: pointer;
    text-align: left;
}

.video-history-item:hover {
    color: #edf4ff;
    background: #303338;
}

.video-history-item.active {
    color: #effff9;
    background: rgba(32, 201, 151, 0.16);
    border-color: rgba(93, 214, 177, 0.52);
}

.video-history-item-title {
    overflow: hidden;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-history-item small {
    color: #8f98a5;
    font-size: 11px;
}

.video-history-viewer {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 10px;
}

.video-history-player {
    width: 100%;
    max-height: 292px;
    min-height: 188px;
    background: #101113;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 12px;
    object-fit: contain;
}

.video-history-detail {
    display: grid;
    gap: 7px;
}

.video-history-meta {
    color: #ced6e1;
    font-size: 13px;
    font-weight: 650;
}

.video-history-snapshot-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.video-history-snapshot-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #d7e7ff;
    font-size: 12px;
    font-weight: 650;
}

.video-history-snapshot-label svg {
    width: 14px;
    height: 14px;
    color: #78adff;
}

.video-history-copy-prompt {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 28px;
    padding: 0 9px;
    color: #c9d7ea;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    font-size: 11px;
    cursor: pointer;
}

.video-history-copy-prompt:hover {
    color: #fff;
    background: rgba(76, 145, 255, 0.2);
    border-color: rgba(102, 165, 255, 0.45);
}

.video-history-copy-prompt svg {
    width: 13px;
    height: 13px;
}

.video-history-prompt {
    box-sizing: border-box;
    width: 100%;
    min-height: 102px;
    max-height: 214px;
    margin: 0;
    padding: 10px 11px;
    overflow: auto;
    color: #d0d6df;
    background: #181a1e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9px;
    outline: none;
    font-size: 12px;
    line-height: 1.65;
    resize: vertical;
    white-space: pre-wrap;
}

.video-history-prompt:focus {
    border-color: rgba(93, 214, 177, 0.65);
    box-shadow: 0 0 0 2px rgba(32, 201, 151, 0.12);
}

.video-history-snapshot-note,
.video-history-reference-summary {
    margin: 0;
    font-size: 11px;
    line-height: 1.55;
}

.video-history-snapshot-note {
    color: #e4b66f;
}

.video-history-reference-summary {
    color: #8f98a5;
}

.video-history-play-hint {
    color: #87909c;
    font-size: 11px;
}

@media (max-width: 700px) {
    .video-history-panel {
        padding: 16px;
        border-radius: 18px;
    }

    .video-history-header {
        align-items: flex-start;
    }

    .video-history-actions .video-history-create span {
        display: none;
    }

    .video-history-body {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .video-history-list {
        flex-direction: row;
        max-height: none;
        padding: 0 0 3px;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .video-history-item {
        min-width: 136px;
    }

    .video-history-player {
        min-height: 160px;
    }

    .video-history-viewer-actions {
        flex-wrap: wrap;
    }
}

/* 音频结果历史：保留原始文本与音色参数，便于直接修改后重新生成。 */
.audio-history-panel {
    gap: 16px;
    min-height: 350px;
    padding: 20px 22px 22px;
    background: #202225;
}

.audio-history-header .media-composer-title {
    gap: 10px;
    font-size: 19px;
}

.audio-history-header .media-composer-title em {
    color: #b9f6e4;
    background: rgba(32, 201, 151, 0.14);
}

.audio-history-actions,
.audio-history-viewer-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}

.audio-history-create,
.audio-history-use-current,
.audio-history-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 36px;
    padding: 0 13px;
    color: #e8fff8;
    background: rgba(32, 201, 151, 0.16);
    border: 1px solid rgba(93, 214, 177, 0.42);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
}

.audio-history-create:hover,
.audio-history-use-current:hover,
.audio-history-edit:hover {
    color: #fff;
    background: rgba(32, 201, 151, 0.28);
}

.audio-history-create:disabled,
.audio-history-use-current:disabled,
.audio-history-edit:disabled {
    opacity: 0.56;
    cursor: wait;
}

.audio-history-create svg,
.audio-history-use-current svg,
.audio-history-edit svg { width: 16px; height: 16px; }

.audio-history-body {
    display: grid;
    grid-template-columns: minmax(154px, 0.42fr) minmax(0, 1fr);
    gap: 16px;
    min-height: 0;
    flex: 1;
}

.audio-history-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    max-height: 360px;
    padding-right: 4px;
    overflow: auto;
}

.audio-history-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
    padding: 11px 12px;
    color: #c8ced6;
    background: #2a2c2f;
    border: 1px solid transparent;
    border-radius: 11px;
    cursor: pointer;
    text-align: left;
}

.audio-history-item:hover { color: #edf4ff; background: #303338; }

.audio-history-item.active {
    color: #effff9;
    background: rgba(32, 201, 151, 0.16);
    border-color: rgba(93, 214, 177, 0.52);
}

.audio-history-item-title {
    overflow: hidden;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audio-history-item small { color: #8f98a5; font-size: 11px; }

.audio-history-viewer {
    display: flex;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
    padding: 18px;
    background: #17191c;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 13px;
}

.audio-history-player { width: 100%; min-height: 48px; }

.audio-history-detail { display: grid; gap: 8px; }

.audio-history-meta {
    color: #ced6e1;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.55;
}

.audio-history-prompt {
    display: -webkit-box;
    max-height: 60px;
    margin: 0;
    overflow: hidden;
    color: #979faa;
    font-size: 12px;
    line-height: 1.65;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

@media (max-width: 700px) {
    .audio-history-panel { padding: 16px; border-radius: 18px; }
    .audio-history-header { align-items: flex-start; }
    .audio-history-actions .audio-history-create span { display: none; }
    .audio-history-body { grid-template-columns: 1fr; gap: 12px; }
    .audio-history-list { flex-direction: row; max-height: none; padding: 0 0 3px; overflow-x: auto; overflow-y: hidden; }
    .audio-history-item { min-width: 136px; }
    .audio-history-viewer { padding: 14px; }
    .audio-history-viewer-actions { flex-wrap: wrap; }
}

/* 智能体生成的文本结果：保留标题、端口与可编辑正文，移除输入专用的快捷模板和上传工具。 */
body.canvas-mode .node.text-node[data-generated-by-agent] .text-prompt-starters,
body.canvas-mode .node.text-node[data-generated-text-result="true"] .text-prompt-starters,
body.canvas-mode .node.text-node[data-generated-by-agent] .text-upload-row,
body.canvas-mode .node.text-node[data-generated-text-result="true"] .text-upload-row {
    display: none;
}

/* 结果节点已有标题栏“展开”按钮，正文里的输入态装饰图标不再重复显示。 */
body.canvas-mode .node.text-node[data-generated-by-agent] .text-node-hero,
body.canvas-mode .node.text-node[data-generated-text-result="true"] .text-node-hero {
    display: none !important;
}

body.canvas-mode .node.text-node[data-generated-by-agent] .node-content,
body.canvas-mode .node.text-node[data-generated-text-result="true"] .node-content {
    display: flex;
}

body.canvas-mode .node.text-node[data-generated-by-agent] .node-textarea,
body.canvas-mode .node.text-node[data-generated-text-result="true"] .node-textarea {
    flex: 1;
    height: 100%;
    min-height: 0;
    max-height: none;
    padding: 4px 2px;
    resize: none;
    border: 0;
    background: transparent;
}

/* 输入型文本节点不显示正文或占位字，只保留数据字段供连线、保存和智能体读取。
   智能体/DeepSeek 生成的结果节点仍保留正文预览。 */
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .node-textarea {
    display: none !important;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]),
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):hover,
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]).selected {
    height: auto !important;
    min-height: 132px !important;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .node-content {
    height: auto !important;
    min-height: 0;
}

/* DeepSeek 创作结果：脱离普通文本节点的固定 284×216 尺寸。 */
body.canvas-mode .node.text-node[data-generated-text-result="true"],
body.canvas-mode .node.text-node[data-generated-text-result="true"]:hover,
body.canvas-mode .node.text-node[data-generated-text-result="true"].selected {
    width: var(--text-result-width, 440px) !important;
    min-width: var(--text-result-width, 440px) !important;
    max-width: var(--text-result-width, 440px) !important;
    height: var(--text-result-height, 320px) !important;
    min-height: var(--text-result-height, 320px) !important;
    max-height: var(--text-result-height, 320px) !important;
    overflow: visible;
    contain: layout style;
}

body.canvas-mode .node.text-node[data-generated-text-result="true"] .node-content {
    display: flex;
    height: calc(100% - 36px);
    min-height: 0;
    padding: 7px 11px 13px;
}

body.canvas-mode .node.text-node[data-generated-text-result="true"] .node-textarea {
    display: block !important;
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    padding: 10px 12px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    resize: none;
    user-select: text;
    cursor: text;
    border: 1px solid rgba(148, 163, 184, .14);
    border-radius: 9px;
    background: rgba(12, 14, 17, .18);
    color: var(--text-primary);
    caret-color: #8adbc3;
    line-height: 1.68;
}

body.canvas-mode .node.text-node[data-generated-text-result="true"] .node-textarea:focus {
    border-color: rgba(93, 214, 177, .46);
    background: rgba(12, 14, 17, .28);
    box-shadow: 0 0 0 2px rgba(32, 201, 151, .1);
}

body.canvas-mode .node.text-node[data-generated-text-result="true"] .node-textarea::-webkit-scrollbar {
    width: 7px;
}

body.canvas-mode .node.text-node[data-generated-text-result="true"] .node-textarea::-webkit-scrollbar-track {
    background: rgba(15, 17, 20, .22);
    border-radius: 999px;
}

body.canvas-mode .node.text-node[data-generated-text-result="true"] .node-textarea::-webkit-scrollbar-thumb {
    min-height: 34px;
    border: 2px solid transparent;
    border-radius: 999px;
    background: rgba(148, 163, 184, .62);
    background-clip: padding-box;
}

body.canvas-mode .node.text-node[data-generated-text-result="true"] .node-textarea::-webkit-scrollbar-thumb:hover {
    background: rgba(191, 201, 214, .76);
    background-clip: padding-box;
}

.text-result-expand,
.text-result-continue {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 24px;
    padding: 0 8px;
    border: 1px solid rgba(148, 163, 184, .2);
    border-radius: 7px;
    background: rgba(148, 163, 184, .09);
    color: #cbd5e1;
    font-size: 11px;
    cursor: pointer;
}

.text-result-expand {
    margin-left: auto;
}

.text-result-expand:hover,
.text-result-continue:hover {
    border-color: rgba(93, 214, 177, .48);
    background: rgba(32, 201, 151, .16);
    color: #e4faf3;
}

.text-result-expand svg,
.text-result-continue svg {
    width: 13px;
    height: 13px;
}

.text-result-resize-handle {
    position: absolute;
    right: -1px;
    bottom: -1px;
    z-index: 18;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 8px 0 10px 0;
    background: linear-gradient(135deg, transparent 38%, rgba(148, 163, 184, .2) 39%);
    color: #aab4c2;
    cursor: nwse-resize;
    opacity: .72;
    touch-action: none;
}

.text-result-resize-handle:hover,
.node.is-text-result-resizing .text-result-resize-handle {
    color: #dbeafe;
    opacity: 1;
}

.text-result-resize-handle svg {
    width: 14px;
    height: 14px;
    transform: translate(4px, 4px);
}

/* 图片创作 · 电影风格库 -------------------------------------------------- */
/* 与画布内的图片节点解耦：只用本地配色预览，不依赖外部缩略图或第三方页面。 */
.image-composer-panel .image-style-trigger {
    min-width: 0;
    max-width: min(270px, 42vw);
}

.image-composer-panel .image-style-trigger.has-style-selection {
    color: #dcecff;
    border-color: rgba(92, 159, 255, 0.55);
    background: rgba(48, 114, 220, 0.2);
}

.image-composer-panel .image-style-trigger-value {
    display: inline-block;
    min-width: 0;
    max-width: 150px;
    margin-left: 1px;
    overflow: hidden;
    color: #9fc8ff;
    font-size: 12px;
    font-style: normal;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cinematic-style-library-overlay {
    position: fixed;
    z-index: 5200;
    inset: 0;
    display: grid;
    place-items: center;
    box-sizing: border-box;
    padding: max(22px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
    background: rgba(7, 8, 10, 0.72);
    backdrop-filter: blur(14px) saturate(0.9);
    -webkit-backdrop-filter: blur(14px) saturate(0.9);
    animation: cinematicStyleOverlayIn 160ms ease-out;
}

@keyframes cinematicStyleOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.cinematic-style-library {
    width: min(1320px, calc(100vw - 48px));
    height: min(760px, calc(100dvh - 54px));
    max-height: calc(100vh - 54px);
    display: grid;
    grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
    overflow: hidden;
    color: #eef2f7;
    background: linear-gradient(180deg, #292a2c 0%, #212224 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    box-shadow: 0 32px 100px rgba(0, 0, 0, 0.58), inset 0 1px 0 rgba(255, 255, 255, 0.055);
    transition: width 160ms ease, height 160ms ease, border-radius 160ms ease;
}

.cinematic-style-library.is-expanded {
    width: calc(100vw - 22px);
    height: calc(100dvh - 22px);
    max-height: calc(100vh - 22px);
    border-radius: 16px;
}

.cinematic-style-library button,
.cinematic-style-library input {
    font: inherit;
}

.cinematic-style-library button {
    border: 0;
    cursor: pointer;
}

.cinematic-style-library-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 64px;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.075);
}

.cinematic-style-library-title,
.cinematic-style-library-header-actions,
.cinematic-style-library-toolbar,
.cinematic-style-library-views,
.cinematic-style-library-filters,
.cinematic-style-library-footer,
.cinematic-style-library-actions,
.cinematic-style-selection-summary {
    display: flex;
    align-items: center;
}

.cinematic-style-library-title {
    min-width: 0;
    gap: 9px;
    color: #f6f8fb;
    font-size: 18px;
    font-weight: 760;
    letter-spacing: 0.01em;
}

.cinematic-style-library-title svg {
    width: 20px;
    height: 20px;
    color: #8cbfff;
}

.cinematic-style-library-title em {
    margin-left: 5px;
    color: #9aa2ac;
    font-size: 12px;
    font-style: normal;
    font-weight: 520;
}

.cinematic-style-library-header-actions {
    flex: 0 0 auto;
    gap: 6px;
}

.cinematic-style-library-header-actions button {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    color: #bcc4cd;
    background: transparent;
    border-radius: 10px;
}

.cinematic-style-library-header-actions button:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.09);
}

.cinematic-style-library-header-actions svg {
    width: 19px;
    height: 19px;
}

.cinematic-style-library-toolbar {
    justify-content: space-between;
    gap: 18px;
    padding: 16px 24px 12px;
}

.cinematic-style-library-views {
    flex: 0 1 auto;
    gap: 4px;
    padding: 4px;
    overflow-x: auto;
    background: rgba(255, 255, 255, 0.055);
    border-radius: 11px;
    scrollbar-width: none;
}

.cinematic-style-library-views::-webkit-scrollbar {
    display: none;
}

.cinematic-style-library-views button {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 0 13px;
    color: #aeb5be;
    background: transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 650;
    white-space: nowrap;
}

.cinematic-style-library-views button:hover {
    color: #eff3f8;
}

.cinematic-style-library-views button.active {
    color: #fff;
    background: #4a4c50;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.cinematic-style-search {
    display: flex;
    flex: 0 1 420px;
    align-items: center;
    gap: 9px;
    min-width: 180px;
    height: 42px;
    padding: 0 13px;
    color: #9099a4;
    background: #1d1e20;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 11px;
}

.cinematic-style-search:focus-within {
    border-color: rgba(101, 161, 255, 0.65);
    box-shadow: 0 0 0 3px rgba(64, 132, 236, 0.13);
}

.cinematic-style-search svg {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
}

.cinematic-style-search input {
    min-width: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    color: #f0f3f7;
    background: transparent;
    border: 0;
    outline: 0;
    font-size: 14px;
}

.cinematic-style-search input::placeholder {
    color: #747b85;
}

.cinematic-style-library-medium-filters {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 48px;
    padding: 10px 24px 8px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.cinematic-style-library-medium-filters button {
    flex: 0 0 auto;
    min-width: 76px;
    height: 32px;
    padding: 0 18px;
    color: #b7bdc6;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 680;
    white-space: nowrap;
}

.cinematic-style-library-medium-filters button:hover {
    color: #f4f7fa;
    background: rgba(255, 255, 255, 0.075);
}

.cinematic-style-library-medium-filters button.active {
    color: #12171a;
    background: #e9f8f3;
    border-color: #e9f8f3;
    box-shadow: 0 5px 16px rgba(76, 220, 177, 0.12);
}

.cinematic-style-library-filters {
    gap: 8px;
    min-height: 45px;
    padding: 0 24px 11px;
    overflow-x: auto;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    scrollbar-width: thin;
}

.cinematic-style-library-filters button {
    flex: 0 0 auto;
    height: 30px;
    padding: 0 12px;
    color: #adb4bd;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 630;
    white-space: nowrap;
}

.cinematic-style-library-filters button:hover {
    color: #e9edf2;
    background: rgba(255, 255, 255, 0.06);
}

.cinematic-style-library-filters button.active {
    color: #effbf7;
    background: rgba(32, 201, 151, 0.18);
    border-color: rgba(93, 214, 177, 0.36);
}

.cinematic-style-result-count {
    flex: 0 0 auto;
    margin-left: auto;
    color: #7f8792;
    font-size: 12px;
    white-space: nowrap;
}

.cinematic-style-library-tip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    color: #9ea7b2;
    background: rgba(29, 71, 119, 0.17);
    border-bottom: 1px solid rgba(82, 151, 239, 0.1);
    font-size: 12px;
    line-height: 1.45;
}

.cinematic-style-library-tip svg {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    color: #8ec0ff;
}

.cinematic-style-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(188px, 1fr));
    align-content: start;
    gap: 12px;
    min-height: 0;
    padding: 16px 24px 20px;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-color: rgba(163, 173, 186, 0.5) transparent;
    scrollbar-width: thin;
}

.cinematic-style-card {
    position: relative;
    min-width: 0;
    min-height: 203px;
    overflow: hidden;
    background: #292b2e;
    border: 1px solid rgba(255, 255, 255, 0.075);
    border-radius: 13px;
    transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.cinematic-style-card:hover {
    z-index: 1;
    background: #303236;
    border-color: rgba(181, 204, 235, 0.38);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
    transform: translateY(-2px);
}

.cinematic-style-card.is-selected {
    border-color: #5b9bff;
    box-shadow: 0 0 0 1px rgba(89, 156, 255, 0.33), 0 10px 26px rgba(22, 82, 166, 0.16);
}

.cinematic-style-card-select {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 201px;
    padding: 0;
    overflow: hidden;
    color: inherit;
    text-align: left;
    background: transparent;
}

.cinematic-style-card-preview {
    position: relative;
    display: flex;
    flex: 0 0 92px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.94);
    background:
        radial-gradient(circle at 74% 23%, color-mix(in srgb, var(--cinematic-style-c) 62%, transparent) 0 4%, transparent 20%),
        linear-gradient(135deg, var(--cinematic-style-a), var(--cinematic-style-b) 56%, var(--cinematic-style-c));
}

.cinematic-style-card-preview > img {
    position: absolute;
    z-index: 0;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.01);
    transition: transform 180ms ease, filter 180ms ease;
}

.cinematic-style-card:hover .cinematic-style-card-preview > img {
    filter: saturate(1.08) contrast(1.04);
    transform: scale(1.045);
}

.cinematic-style-card-preview::before {
    position: absolute;
    inset: 0;
    content: '';
    opacity: 0.24;
    background:
        linear-gradient(118deg, transparent 0 37%, rgba(255, 255, 255, 0.33) 37.5% 38%, transparent 38.5% 100%),
        linear-gradient(34deg, transparent 0 58%, rgba(5, 8, 12, 0.34) 58.5% 100%);
}

.cinematic-style-card-preview::after {
    position: absolute;
    inset: 0;
    content: '';
    opacity: 0.17;
    background-image: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.32) 0 1px, transparent 1px 4px);
    mix-blend-mode: soft-light;
}

.cinematic-style-card-preview svg,
.cinematic-style-card-preview small {
    position: relative;
    z-index: 1;
}

.cinematic-style-card-preview svg {
    width: 30px;
    height: 30px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.26));
}

.cinematic-style-card-preview.has-local-preview > svg {
    opacity: 0;
}

.cinematic-style-card-preview small {
    position: absolute;
    right: 9px;
    bottom: 8px;
    max-width: calc(100% - 18px);
    overflow: hidden;
    padding: 3px 6px;
    color: #f8fbff;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: rgba(8, 12, 18, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 5px;
    font-size: 10px;
    font-weight: 650;
}

.cinematic-style-card-content {
    display: grid;
    gap: 5px;
    padding: 11px 12px 13px;
}

.cinematic-style-card-content strong {
    overflow: hidden;
    color: #f0f3f6;
    font-size: 14px;
    font-weight: 760;
    letter-spacing: 0.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cinematic-style-card-content small {
    display: -webkit-box;
    min-height: 34px;
    overflow: hidden;
    color: #9fa8b3;
    font-size: 11px;
    line-height: 1.52;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.cinematic-style-card-content em {
    display: block;
    overflow: hidden;
    color: #78aef5;
    font-size: 10px;
    font-style: normal;
    font-weight: 570;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cinematic-style-favorite {
    position: absolute;
    z-index: 2;
    top: 8px;
    right: 8px;
    display: inline-grid;
    width: 29px;
    height: 29px;
    place-items: center;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(10, 12, 15, 0.44);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

.cinematic-style-favorite:hover,
.cinematic-style-favorite.active {
    color: #ffd978;
    background: rgba(68, 53, 20, 0.62);
    border-color: rgba(255, 213, 105, 0.55);
}

.cinematic-style-favorite svg {
    width: 15px;
    height: 15px;
}

.cinematic-style-favorite.active svg {
    fill: currentColor;
}

.cinematic-style-empty {
    display: grid;
    grid-column: 1 / -1;
    min-height: 230px;
    place-content: center;
    justify-items: center;
    gap: 9px;
    color: #a9b1ba;
    text-align: center;
}

.cinematic-style-empty svg {
    width: 32px;
    height: 32px;
    color: #647180;
}

.cinematic-style-empty strong {
    color: #d8dee6;
    font-size: 15px;
}

.cinematic-style-empty span {
    color: #838c96;
    font-size: 12px;
}

.cinematic-style-library-footer {
    justify-content: space-between;
    gap: 16px;
    min-height: 70px;
    padding: 12px 24px;
    background: rgba(8, 10, 12, 0.22);
    border-top: 1px solid rgba(255, 255, 255, 0.075);
}

.cinematic-style-selection-summary {
    flex: 1 1 auto;
    flex-wrap: wrap;
    gap: 7px;
    min-width: 0;
}

.cinematic-style-selection-summary > span {
    flex: 0 0 auto;
    color: #8f99a4;
    font-size: 12px;
}

.cinematic-style-selection-summary > span.empty {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cinematic-style-selection-summary button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 190px;
    height: 29px;
    padding: 0 8px;
    overflow: hidden;
    color: #d7e8ff;
    background: rgba(61, 125, 218, 0.2);
    border: 1px solid rgba(83, 147, 238, 0.36);
    border-radius: 7px;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cinematic-style-selection-summary button:hover {
    color: #fff;
    background: rgba(72, 141, 239, 0.34);
}

.cinematic-style-selection-summary button svg {
    flex: 0 0 auto;
    width: 13px;
    height: 13px;
}

.cinematic-style-library-actions {
    flex: 0 0 auto;
    gap: 8px;
}

.cinematic-style-library-actions button {
    height: 36px;
    padding: 0 13px;
    color: #aeb6c0;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 9px;
    font-size: 13px;
    font-weight: 680;
    white-space: nowrap;
}

.cinematic-style-library-actions .cinematic-style-reset:hover {
    color: #eef2f6;
    background: rgba(255, 255, 255, 0.07);
}

.cinematic-style-library-actions .cinematic-style-apply {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #10213a;
    background: #d9eaff;
    border-color: #d9eaff;
}

.cinematic-style-library-actions .cinematic-style-apply:hover:not(:disabled) {
    background: #fff;
    border-color: #fff;
}

.cinematic-style-library-actions .cinematic-style-apply:disabled {
    color: #777f89;
    background: #474b50;
    border-color: #474b50;
    cursor: not-allowed;
}

.cinematic-style-library-actions .cinematic-style-apply.clear-mode {
    color: #d7e8ff;
    background: rgba(59, 121, 214, 0.26);
    border-color: rgba(82, 149, 245, 0.54);
}

.cinematic-style-library-actions svg {
    width: 16px;
    height: 16px;
}

.cinematic-style-library button:focus-visible,
.cinematic-style-library input:focus-visible {
    outline: 2px solid #78afff;
    outline-offset: 2px;
}

@media (max-width: 820px) {
    .cinematic-style-library {
        width: min(100%, calc(100vw - 24px));
        height: min(760px, calc(100dvh - 28px));
        max-height: calc(100vh - 28px);
    }

    .cinematic-style-library-toolbar {
        align-items: stretch;
        flex-direction: column;
        gap: 11px;
    }

    .cinematic-style-search {
        flex-basis: 42px;
        width: auto;
    }

    .cinematic-style-grid {
        grid-template-columns: repeat(auto-fill, minmax(166px, 1fr));
    }
}

@media (max-width: 620px) {
    .cinematic-style-library-overlay {
        align-items: end;
        padding: 8px;
    }

    .cinematic-style-library,
    .cinematic-style-library.is-expanded {
        width: 100%;
        height: min(840px, calc(100dvh - 16px));
        max-height: calc(100vh - 16px);
        border-radius: 18px;
    }

    .cinematic-style-library-header {
        min-height: 56px;
        padding: 0 14px;
    }

    .cinematic-style-library-title {
        gap: 7px;
        font-size: 16px;
    }

    .cinematic-style-library-title em {
        display: none;
    }

    .cinematic-style-library-header-actions .cinematic-style-library-expand {
        display: none;
    }

    .cinematic-style-library-toolbar {
        padding: 12px 14px 10px;
    }

    .cinematic-style-library-views {
        width: 100%;
    }

    .cinematic-style-library-views button {
        flex: 1 0 auto;
        padding: 0 10px;
        text-align: center;
    }

    .cinematic-style-library-filters {
        gap: 6px;
        padding: 0 14px 9px;
    }

    .cinematic-style-library-filters button {
        height: 29px;
        padding: 0 10px;
    }

    .cinematic-style-result-count {
        display: none;
    }

    .cinematic-style-library-tip {
        align-items: flex-start;
        padding: 8px 14px;
        font-size: 11px;
    }

    .cinematic-style-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
        padding: 12px 14px 16px;
    }

    .cinematic-style-card,
    .cinematic-style-card-select {
        min-height: 184px;
    }

    .cinematic-style-card-preview {
        flex-basis: 76px;
    }

    .cinematic-style-card-content {
        gap: 4px;
        padding: 9px 10px 11px;
    }

    .cinematic-style-card-content strong {
        font-size: 13px;
    }

    .cinematic-style-card-content small {
        min-height: 31px;
        font-size: 10px;
    }

    .cinematic-style-library-footer {
        align-items: stretch;
        flex-direction: column;
        gap: 9px;
        min-height: 0;
        padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    }

    .cinematic-style-selection-summary {
        max-height: 60px;
        overflow: auto;
    }

    .cinematic-style-library-actions {
        width: 100%;
    }

    .cinematic-style-library-actions button {
        flex: 1;
    }

    .image-composer-panel .image-style-trigger {
        max-width: 52vw;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cinematic-style-library-overlay,
    .cinematic-style-card,
    .cinematic-style-library {
        animation: none;
        transition: none;
    }
}

/* 画布细节：媒体编号、轻选中态与精简视频浮层工具。 */
body.canvas-mode .image-node .media-node-number,
body.canvas-mode .video-node .media-node-number {
    flex: 0 0 auto;
    padding: 1px 5px;
    color: #8f98a5;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    font-size: 9px;
    font-weight: 650;
    line-height: 16px;
    white-space: nowrap;
}

body.canvas-mode .image-node.selected .media-node-number,
body.canvas-mode .video-node.selected .media-node-number {
    color: #b9f6e4;
    background: rgba(32, 201, 151, 0.08);
    border-color: rgba(93, 214, 177, 0.16);
}

body.canvas-mode .node.image-node.selected .image-preview-box,
body.canvas-mode .node.video-node.selected .video-preview-box {
    border-color: rgba(93, 214, 177, 0.62);
    box-shadow: 0 0 0 1px rgba(32, 201, 151, 0.1);
}

body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) {
    --media-zoom-button-size: calc(22px * var(--media-zoom-ui-scale));
    --media-zoom-button-icon-size: calc(12px * var(--media-zoom-ui-scale));
}

body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) .media-delete-btn {
    right: calc(7px * var(--media-zoom-ui-scale)) !important;
}

body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) .media-replace-btn {
    right: calc(34px * var(--media-zoom-ui-scale)) !important;
}

body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) .video-frame-btn {
    right: calc(61px * var(--media-zoom-ui-scale)) !important;
}

body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) .media-download-btn {
    right: calc(88px * var(--media-zoom-ui-scale)) !important;
}

body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) .media-download-btn,
body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) .video-frame-btn,
body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) .media-replace-btn,
body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) .media-delete-btn {
    top: calc(7px * var(--media-zoom-ui-scale)) !important;
    color: rgba(255, 255, 255, 0.82);
    background: rgba(12, 15, 19, 0.54) !important;
    border: 0;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
    opacity: 0.82 !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) .media-download-btn:hover,
body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) .video-frame-btn:hover,
body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) .media-replace-btn:hover,
body.canvas-mode .node.video-node.zoomed:has(.video-preview:not([hidden])) .media-delete-btn:hover {
    color: #fff;
    background: rgba(15, 18, 23, 0.82) !important;
    border-color: transparent;
    opacity: 1 !important;
}

/* 引用编号已经直接显示在素材缩略图上，不再占一行提示文字。 */
body.canvas-mode .media-composer-reference-count {
    display: none !important;
}

/* ========== 剪辑台节点与固定工作台 ========== */
body.canvas-mode .node.edit-studio-node {
    width: 286px;
    min-height: 0;
    border-color: color-mix(in srgb, #5f9fff 48%, var(--border));
    background: color-mix(in srgb, #5f9fff 5%, var(--surface));
}

body.canvas-mode .node.edit-studio-node.selected {
    border-color: #5f9fff;
    box-shadow: 0 0 0 2px rgba(95, 159, 255, 0.16), 0 18px 38px rgba(0, 0, 0, 0.24);
}

.edit-studio-node .node-content {
    padding: 10px;
}

.edit-studio-node-open {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 72px;
    padding: 10px;
    border: 1px solid color-mix(in srgb, #5f9fff 24%, var(--border));
    border-radius: 12px;
    background: color-mix(in srgb, #5f9fff 7%, var(--surface));
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.edit-studio-node-open:hover {
    border-color: color-mix(in srgb, #5f9fff 58%, var(--border));
    background: color-mix(in srgb, #5f9fff 11%, var(--surface));
}

.edit-studio-node-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: linear-gradient(145deg, #6ca8ff, #447de6);
    color: #fff;
    box-shadow: 0 8px 18px rgba(68, 125, 230, 0.28);
}

.edit-studio-node-icon svg {
    width: 21px;
    height: 21px;
}

.edit-studio-node-copy {
    min-width: 0;
}

.edit-studio-node-copy strong,
.edit-studio-node-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.edit-studio-node-copy strong {
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 650;
}

.edit-studio-node-copy small {
    color: var(--text-muted);
    font-size: 10px;
}

.edit-studio-node-arrow {
    width: 16px;
    color: var(--text-muted);
}

.edit-studio-node-result {
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 6px 9px;
    border-radius: 8px;
    background: rgba(52, 199, 117, 0.1);
    color: #34b36d;
    font-size: 10px;
    font-weight: 600;
}

.edit-studio-node-result:not([hidden]) {
    display: flex;
}

.edit-studio-node-result svg {
    width: 13px;
    height: 13px;
}

.edit-studio-overlay {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 72px 18px 76px;
    background: rgba(5, 7, 10, 0.34);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.edit-studio-overlay[hidden] {
    display: none;
}

.edit-studio-workbench {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(1180px, calc(100vw - 36px));
    height: min(720px, calc(100vh - 160px));
    min-height: 500px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 20px;
    background: color-mix(in srgb, var(--surface) 96%, #111827);
    color: var(--text);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.5);
}

.edit-studio-header {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(230px, 360px) 40px;
    align-items: center;
    gap: 18px;
    min-height: 72px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 92%, #5f9fff);
}

.edit-studio-heading {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.edit-studio-heading-icon {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: #4e8eea;
    color: #fff;
}

.edit-studio-heading-icon svg {
    width: 19px;
}

.edit-studio-heading strong,
.edit-studio-heading small {
    display: block;
}

.edit-studio-heading strong {
    font-size: 17px;
    letter-spacing: -0.01em;
}

.edit-studio-heading small {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 11px;
}

.edit-studio-name-field {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    color: var(--text-muted);
    font-size: 11px;
}

.edit-studio-name-field input,
.edit-studio-clip input,
.edit-studio-export-settings select {
    height: 34px;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 9px;
    outline: 0;
    background: var(--input-bg);
    color: var(--text);
    font: inherit;
}

.edit-studio-name-field input {
    width: 100%;
    padding: 0 10px;
    font-size: 12px;
}

.edit-studio-name-field input:focus,
.edit-studio-clip input:focus {
    border-color: #5f9fff;
    box-shadow: 0 0 0 2px rgba(95, 159, 255, 0.13);
}

.edit-studio-close {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: var(--surface-hover);
    color: var(--text-secondary);
    cursor: pointer;
}

.edit-studio-close:hover {
    color: var(--text);
}

.edit-studio-close svg {
    width: 18px;
}

.edit-studio-body {
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
    min-height: 0;
}

.edit-studio-sources {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    min-width: 0;
    min-height: 0;
    border-right: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 93%, var(--canvas-bg));
}

.edit-studio-library-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-right: 10px;
}

.edit-studio-library-head .edit-studio-section-title {
    flex: 1;
    gap: 8px;
    padding-right: 0;
}

.edit-studio-import {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 5px;
    height: 29px;
    padding: 0 9px;
    border: 1px solid color-mix(in srgb, #5f9fff 38%, var(--border));
    border-radius: 8px;
    background: color-mix(in srgb, #5f9fff 9%, var(--surface));
    color: #69a8ff;
    font-size: 10px;
    cursor: pointer;
}

.edit-studio-import:hover {
    background: color-mix(in srgb, #5f9fff 16%, var(--surface));
}

.edit-studio-import svg {
    width: 13px;
    height: 13px;
}

.edit-studio-source-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 0 10px 9px;
}

.edit-studio-source-tabs button {
    min-width: 0;
    height: 28px;
    padding: 0 5px;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.edit-studio-source-tabs button:hover {
    color: var(--text-secondary);
    background: var(--surface-hover);
}

.edit-studio-source-tabs button.active {
    border-color: color-mix(in srgb, #5f9fff 34%, var(--border));
    background: color-mix(in srgb, #5f9fff 12%, var(--surface));
    color: #72adff;
}

.edit-studio-source-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 34px;
    border-top: 0;
    color: var(--text-muted);
    font-size: 9px;
}

.edit-studio-source-hint svg {
    width: 12px;
    height: 12px;
}

.edit-studio-section-title,
.edit-studio-timeline-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 47px;
    padding: 0 14px;
}

.edit-studio-section-title span,
.edit-studio-timeline-head strong {
    font-size: 12px;
    font-weight: 650;
}

.edit-studio-section-title small,
.edit-studio-timeline-head span {
    color: var(--text-muted);
    font-size: 10px;
}

.edit-studio-source-list {
    min-height: 0;
    overflow: auto;
    padding: 0 10px 12px;
}

.edit-studio-source-item {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    margin-bottom: 7px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    cursor: grab;
    transition: border-color 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}

.edit-studio-source-item:hover {
    border-color: color-mix(in srgb, #5f9fff 34%, var(--border));
}

.edit-studio-source-item.dragging {
    opacity: 0.5;
    transform: scale(0.98);
    cursor: grabbing;
}

.edit-studio-source-thumb {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: color-mix(in srgb, #5f9fff 12%, var(--surface-hover));
    color: #65a4ff;
}

.edit-studio-source-thumb svg {
    width: 17px;
}

.edit-studio-source-copy {
    min-width: 0;
}

.edit-studio-source-copy strong,
.edit-studio-source-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.edit-studio-source-copy strong {
    font-size: 11px;
    font-weight: 600;
}

.edit-studio-source-copy small {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 9px;
}

.edit-studio-source-item button {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 28px;
    padding: 0 8px;
    border: 1px solid color-mix(in srgb, #5f9fff 40%, var(--border));
    border-radius: 8px;
    background: color-mix(in srgb, #5f9fff 8%, var(--surface));
    color: #69a8ff;
    font-size: 10px;
    cursor: pointer;
}

.edit-studio-source-item button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.edit-studio-source-item button svg {
    width: 12px;
}

.edit-studio-empty-list,
.edit-studio-empty-timeline {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    min-height: 150px;
    padding: 20px;
    color: var(--text-muted);
    text-align: center;
}

.edit-studio-empty-list svg,
.edit-studio-empty-timeline svg {
    width: 25px;
    height: 25px;
    margin-bottom: 9px;
    opacity: 0.72;
}

.edit-studio-empty-list span,
.edit-studio-empty-timeline strong {
    color: var(--text-secondary);
    font-size: 11px;
}

.edit-studio-empty-list small,
.edit-studio-empty-timeline span {
    margin-top: 5px;
    font-size: 9px;
}

.edit-studio-main {
    display: grid;
    grid-template-rows: minmax(160px, 42%) auto minmax(0, 1fr);
    min-width: 0;
    min-height: 0;
    padding: 14px;
}

.edit-studio-preview-shell {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 0;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 14px;
    background:
        radial-gradient(circle at 50% 40%, rgba(95, 159, 255, 0.11), transparent 44%),
        #0d1015;
}

.edit-studio-preview-shell video {
    width: 100%;
    height: 100%;
    background: #07090c;
    object-fit: contain;
}

.edit-studio-preview-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: rgba(255, 255, 255, 0.46);
}

.edit-studio-preview-empty[hidden] {
    display: none;
}

.edit-studio-preview-empty svg {
    width: 30px;
    height: 30px;
    margin-bottom: 9px;
}

.edit-studio-preview-empty strong {
    color: rgba(255, 255, 255, 0.78);
    font-size: 12px;
}

.edit-studio-preview-empty span {
    margin-top: 5px;
    font-size: 10px;
}

.edit-studio-timeline-head {
    padding-right: 2px;
    padding-left: 2px;
}

.edit-studio-timeline-head>div {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.edit-studio-timeline {
    min-height: 0;
    overflow: auto;
    padding-right: 3px;
    border: 1px solid transparent;
    border-radius: 12px;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.edit-studio-timeline.drag-over {
    border-color: #5f9fff;
    background: rgba(95, 159, 255, 0.08);
    box-shadow: inset 0 0 0 1px rgba(95, 159, 255, 0.14);
}

.edit-studio-clip {
    display: grid;
    grid-template-columns: 25px 32px minmax(110px, 1fr) 102px 102px 94px;
    align-items: center;
    gap: 7px;
    min-height: 58px;
    margin-bottom: 7px;
    padding: 7px 8px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: color-mix(in srgb, var(--surface) 96%, var(--canvas-bg));
}

.edit-studio-clip.active {
    border-color: #5f9fff;
    box-shadow: inset 0 0 0 1px rgba(95, 159, 255, 0.16);
}

.edit-studio-clip-index {
    color: var(--text-muted);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.edit-studio-clip-preview,
.edit-studio-clip-actions button {
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: var(--surface-hover);
    color: var(--text-secondary);
    cursor: pointer;
}

.edit-studio-clip-preview {
    width: 32px;
    height: 32px;
    background: color-mix(in srgb, #5f9fff 13%, var(--surface-hover));
    color: #6ba9ff;
}

.edit-studio-clip-preview svg,
.edit-studio-clip-actions svg {
    width: 13px;
    height: 13px;
}

.edit-studio-clip-copy {
    min-width: 0;
}

.edit-studio-clip-copy strong,
.edit-studio-clip-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.edit-studio-clip-copy strong {
    font-size: 11px;
    font-weight: 600;
}

.edit-studio-clip-copy small {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 9px;
}

.edit-studio-clip label {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
    color: var(--text-muted);
    font-size: 8px;
}

.edit-studio-clip input {
    width: 100%;
    height: 31px;
    padding: 0 20px 0 7px;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

.edit-studio-clip label em {
    position: absolute;
    right: 7px;
    bottom: 8px;
    color: var(--text-muted);
    font-size: 9px;
    font-style: normal;
    pointer-events: none;
}

.edit-studio-clip-actions {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
}

.edit-studio-clip-actions button {
    width: 27px;
    height: 27px;
}

.edit-studio-clip-actions button:disabled {
    opacity: 0.28;
    cursor: not-allowed;
}

.edit-studio-clip-actions button.danger:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #ef6262;
}

.edit-studio-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 69px;
    padding: 10px 18px;
    border-top: none;
    background: color-mix(in srgb, var(--surface) 94%, var(--canvas-bg));
}

.edit-studio-export-settings,
.edit-studio-footer-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}

.edit-studio-export-settings label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 9px;
}

.edit-studio-export-settings select {
    height: 31px;
    padding: 0 26px 0 9px;
    opacity: 1;
    font-size: 10px;
}

.edit-studio-export-note {
    color: var(--text-muted);
    font-size: 9px;
}

.edit-studio-status {
    max-width: 310px;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.edit-studio-status[data-tone="success"] {
    color: #34b36d;
}

.edit-studio-status[data-tone="error"] {
    color: #ef6262;
}

.edit-studio-secondary,
.edit-studio-export {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 38px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 650;
    cursor: pointer;
}

.edit-studio-secondary {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
}

.edit-studio-export {
    min-width: 116px;
    border: 0;
    background: linear-gradient(135deg, #66a6ff, #447de6);
    color: #fff;
    box-shadow: 0 8px 20px rgba(68, 125, 230, 0.26);
}

.edit-studio-export:disabled {
    opacity: 0.45;
    box-shadow: none;
    cursor: not-allowed;
}

.edit-studio-secondary svg,
.edit-studio-export svg {
    width: 14px;
    height: 14px;
}

.edit-studio-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.34);
    border-top-color: #fff;
    border-radius: 50%;
    animation: edit-studio-spin 0.75s linear infinite;
}

@keyframes edit-studio-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 900px) {
    .edit-studio-overlay {
        padding: 56px 8px 68px;
    }

    .edit-studio-workbench {
        width: calc(100vw - 16px);
        height: calc(100vh - 124px);
        min-height: 0;
        border-radius: 16px;
    }

    .edit-studio-header {
        grid-template-columns: minmax(0, 1fr) 36px;
    }

    .edit-studio-name-field {
        display: none;
    }

    .edit-studio-body {
        grid-template-columns: 1fr;
        grid-template-rows: 164px minmax(0, 1fr);
    }

    .edit-studio-sources {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .edit-studio-section-title {
        min-height: 36px;
    }

    .edit-studio-source-list {
        display: flex;
        gap: 7px;
        overflow-x: auto;
        padding: 0 10px 9px;
    }

    .edit-studio-source-hint {
        display: none;
    }

    .edit-studio-source-item {
        flex: 0 0 230px;
        margin: 0;
    }

    .edit-studio-main {
        grid-template-rows: minmax(130px, 40%) auto minmax(0, 1fr);
        padding: 10px;
    }

    .edit-studio-clip {
        grid-template-columns: 22px 30px minmax(90px, 1fr) 88px 88px 31px;
    }

    .edit-studio-clip-actions button:not(.danger) {
        display: none;
    }

    .edit-studio-footer {
        align-items: stretch;
        flex-direction: column;
        gap: 7px;
        padding: 8px 12px;
    }

    .edit-studio-export-settings,
    .edit-studio-footer-actions {
        justify-content: space-between;
    }

    .edit-studio-export-note {
        display: none;
    }

    .edit-studio-status {
        flex: 1;
    }
}

/* 2026-08-06 · 浅色主题完全中性化：仅白色与 GitHub 灰阶，不使用品牌绿色。 */
body:not(.dark) {
    --primary: #57606a !important;
    --primary-hover: #24292f !important;
}
body:not(.dark).canvas-mode .user-btn,
body:not(.dark) .home-actions .user-btn {
    color: #ffffff !important;
    background: #24292f !important;
    border-color: #24292f !important;
}
body:not(.dark).canvas-mode .user-btn:hover,
body:not(.dark) .home-actions .user-btn:hover {
    background: #424a53 !important;
    border-color: #424a53 !important;
}
body:not(.dark).canvas-mode .save-status {
    color: #424a53 !important;
    background: #eaeef2 !important;
    border-color: #afb8c1 !important;
}
body:not(.dark).canvas-mode .save-status::before {
    background: #57606a !important;
    box-shadow: none !important;
}
body:not(.dark).canvas-mode .node.selected,
body:not(.dark).canvas-mode .node.image-node.selected,
body:not(.dark).canvas-mode .node.video-node.selected,
body:not(.dark).canvas-mode .node.audio-node.selected,
body:not(.dark).canvas-mode .node.text-node.selected,
body:not(.dark).canvas-mode .node.agent-node.selected,
body:not(.dark).canvas-mode .node.skill-node.selected,
body:not(.dark).canvas-mode .node.edit-studio-node.selected {
    border-color: #57606a !important;
    box-shadow: 0 0 0 1px rgba(87, 96, 106, .24), 0 8px 24px rgba(31, 35, 40, .16) !important;
}
body:not(.dark).canvas-mode .node.selected :is(.node-title, .node-icon),
body:not(.dark).canvas-mode .node.selected .node-header svg {
    color: #24292f !important;
}
body:not(.dark).canvas-mode .node-port:hover::after,
body:not(.dark).canvas-mode .node-port.snap-target::after {
    color: #ffffff !important;
    background: #57606a !important;
    border-color: #424a53 !important;
}
body:not(.dark).canvas-mode .canvas-node-group.is-selected,
body:not(.dark).canvas-mode .canvas-node-group-backdrop.is-selected {
    background: rgba(140, 149, 159, .18) !important;
    border-color: #57606a !important;
}
body:not(.dark).canvas-mode .canvas-node-group.is-selected .canvas-node-group-title {
    color: #24292f !important;
    background: #eaeef2 !important;
    border-color: #8c959f !important;
}
body:not(.dark).canvas-mode .connections-layer g.is-selected .conn-line,
body:not(.dark).canvas-mode .connections-layer g.is-selected .conn-flow {
    stroke: #57606a !important;
}
body:not(.dark) .text-composer-mode-switch button.active,
body:not(.dark) .composer-mode-switch button.active,
body:not(.dark) .agent-picker-popover nav button.active,
body:not(.dark) .cinematic-style-card.is-selected,
body:not(.dark) .video-creative-card.is-selected {
    color: #ffffff !important;
    background: #57606a !important;
    border-color: #57606a !important;
}
body:not(.dark) .media-composer-submit:hover,
body:not(.dark) .media-composer-submit:focus-visible {
    color: #ffffff !important;
    background: #424a53 !important;
    border-color: #424a53 !important;
}
body:not(.dark) :is(input, textarea, select, button):focus-visible {
    outline-color: #8c959f !important;
}

/* 2026-08-05 · 文本节点上传入口与安全点击区域。Keep physically last. */
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown) .text-upload-row {
    display: flex !important;
    width: 206px !important;
    min-height: 26px !important;
    margin: 0 auto !important;
    padding: 0 !important;
    overflow: visible !important;
}
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-upload-btn {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    height: 26px !important;
    min-height: 26px !important;
    padding: 0 9px !important;
}
body.canvas-mode .text-prompt-starters [data-text-prompt] {
    cursor: default !important;
}
body.canvas-mode .text-prompt-starters [data-text-prompt] .text-prompt-label {
    cursor: pointer;
}

/* 文本模式选择只包裹三个选项，不占据整条剩余空间。 */
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-footer {
    grid-template-columns: minmax(128px, 188px) max-content 36px 42px !important;
    justify-content: start !important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-mode-switch {
    flex: 0 0 auto !important;
    width: max-content !important;
    max-width: 100% !important;
}

/* 风格/特效选中后直接变成成品方块；双击方块重新选择。 */
body.canvas-mode .node.style-node.has-library-selection {
    width: 184px !important;
    height: 184px !important;
    min-width: 184px !important;
    min-height: 184px !important;
    overflow: visible !important;
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}
body.canvas-mode .node.style-node.has-library-selection .node-header,
body.canvas-mode .node.style-node.has-library-selection .style-node-open { display: none !important; }
body.canvas-mode .node.style-node.has-library-selection .node-content {
    position: absolute !important;
    inset: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
}
body.canvas-mode .node.style-node.has-library-selection .style-node-selection {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    cursor: pointer;
}
body.canvas-mode .node.style-node.has-library-selection .style-node-preview-grid {
    width: 100% !important;
    height: 100% !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-template-rows: 1fr !important;
    gap: 0 !important;
}
body.canvas-mode .node.style-node.has-library-selection .style-node-preview-card {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: 1 / 1;
    border-radius: 14px !important;
}
body.canvas-mode .node.style-node.has-library-selection .style-node-preview-card:not(:first-child) { display: none !important; }

.canvas-project-name-box { display: none; }
body.canvas-mode .canvas-project-name-box {
    display: block;
    position: fixed;
    left: 18px;
    bottom: 18px;
    z-index: 32;
    max-width: min(320px, 42vw);
    min-height: 38px;
    padding: 0 13px;
    overflow: hidden;
    color: #e8edf3;
    background: rgba(28, 31, 35, .92);
    border: 1px solid #3c424a;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .24);
    font-size: 14px;
    font-weight: 650;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: text;
}
.project-name-inline-editor {
    width: 220px;
    height: 38px;
    padding: 0 10px;
    color: #20262e;
    background: #fff;
    border: 1px solid #28a985;
    border-radius: 8px;
    outline: none;
    font-size: 14px;
    font-weight: 600;
}

/* 轻剪辑：每层轨道底部提供清晰的上下拉伸手柄。 */
.edit-studio-track {
    position: relative;
    min-height: var(--edit-track-height, 92px) !important;
    height: var(--edit-track-height, 92px) !important;
    padding-bottom: 7px !important;
}
.edit-studio-track-label,
.edit-studio-track-clips { min-height: 0 !important; height: 100% !important; }
.edit-studio-track-resize {
    position: absolute;
    z-index: 5;
    left: 0;
    right: 0;
    bottom: -3px;
    width: 100%;
    height: 10px;
    padding: 0;
    background: transparent;
    border: 0;
    cursor: ns-resize;
    touch-action: none;
}
.edit-studio-track-resize span {
    display: block;
    width: 42px;
    height: 3px;
    margin: auto;
    background: #515862;
    border-radius: 999px;
    transition: width .15s ease, background .15s ease;
}
.edit-studio-track-resize:hover span,
.edit-studio-track.resizing .edit-studio-track-resize span { width: 72px; background: #20c997; }
.edit-studio-clip { cursor: grab; }
.edit-studio-clip:active { cursor: grabbing; }
.edit-studio-clip-grip {
    opacity: .8 !important;
    cursor: grab !important;
}

.media-capability-groups {
    max-height: min(62vh, 620px);
    padding: 2px 4px 8px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px 22px;
    overflow: auto;
}
.media-capability-group { min-width: 0; }
.media-capability-group h4 {
    margin: 0 0 9px;
    color: #929ba6;
    font-size: 12px;
    font-weight: 500;
}
.media-capability-group .media-capability-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}
.media-capability-group .media-capability-card { min-height: 56px; }
@media (max-width: 860px) {
    .media-capability-groups { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .edit-studio-spinner {
        animation: none;
    }
}

/* 轻剪辑工作台：媒体 / 播放器 / 片段属性 / 横向时间线 */
.edit-studio-overlay {
    align-items: center;
    padding: 24px;
    background: rgba(5, 7, 10, 0.58);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
}

.edit-studio-workbench {
    width: min(1360px, calc(100vw - 48px));
    height: min(860px, calc(100vh - 48px));
    min-height: 600px;
    border-radius: 16px;
    background: #202226;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.62);
}

.edit-studio-header {
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 340px) 36px;
    min-height: 62px;
    padding: 9px 15px;
    background: #292c32;
}

.edit-studio-heading-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
}

.edit-studio-heading small {
    margin-top: 1px;
}

.edit-studio-body {
    display: grid;
    grid-template-columns: 238px minmax(300px, 1fr) 224px;
    grid-template-rows: minmax(0, 1fr) 218px;
    min-width: 0;
    min-height: 0;
    background: #181a1e;
}

.edit-studio-sources {
    grid-column: 1;
    grid-row: 1;
    border-right: 1px solid rgba(148, 163, 184, 0.16);
    border-bottom: 0;
    background: #202226;
}

.edit-studio-library-head {
    min-height: 44px;
}

.edit-studio-library-head .edit-studio-section-title {
    min-height: 44px;
}

.edit-studio-source-tabs {
    gap: 2px;
    padding: 0 8px 9px;
}

.edit-studio-source-tabs button {
    height: 28px;
    padding: 0 3px;
    border-radius: 6px;
}

.edit-studio-source-list {
    padding: 0 8px 10px;
}

.edit-studio-source-item {
    grid-template-columns: 44px minmax(0, 1fr) 28px;
    gap: 8px;
    min-height: 60px;
    margin-bottom: 6px;
    padding: 7px;
    border-color: rgba(148, 163, 184, 0.14);
    border-radius: 8px;
    background: #26292f;
}

.edit-studio-source-thumb {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    background: #121419;
}

.edit-studio-source-item button {
    width: 28px;
    height: 28px;
    padding: 0;
    justify-content: center;
    border-radius: 7px;
}

.edit-studio-source-item button span {
    display: none;
}

.edit-studio-source-hint {
    min-height: 32px;
}

.edit-studio-main {
    grid-column: 2;
    grid-row: 1;
    display: grid;
    grid-template-rows: 34px minmax(0, 1fr) 42px;
    min-width: 0;
    min-height: 0;
    padding: 10px 12px;
    background: #17191d;
}

.edit-studio-viewer-head,
.edit-studio-inspector-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 650;
}

.edit-studio-viewer-head small,
.edit-studio-inspector-head small {
    min-width: 0;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 400;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.edit-studio-preview-shell {
    align-self: stretch;
    justify-self: stretch;
    border: 0;
    border-radius: 4px;
    background:
        radial-gradient(circle at 50% 42%, rgba(95, 159, 255, 0.08), transparent 46%),
        #090b0e;
}

.edit-studio-preview-shell video {
    border-radius: 3px;
}

.edit-studio-transport {
    display: grid;
    grid-template-columns: minmax(96px, 1fr) auto minmax(96px, 1fr);
    align-items: center;
    gap: 10px;
    padding-top: 7px;
}

.edit-studio-transport>div {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.edit-studio-transport button {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #b9bec8;
    cursor: pointer;
}

.edit-studio-transport button:hover {
    background: #2a2d33;
    color: #fff;
}

.edit-studio-transport button.primary {
    width: 31px;
    height: 31px;
    border-radius: 50%;
    background: #f2f4f8;
    color: #17191d;
}

.edit-studio-transport button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.edit-studio-transport svg {
    width: 14px;
    height: 14px;
}

.edit-studio-preview-time,
.edit-studio-viewer-ratio {
    color: #858b96;
    font-size: 9px;
    font-variant-numeric: tabular-nums;
}

.edit-studio-viewer-ratio {
    justify-self: end;
    padding: 4px 7px;
    border-radius: 5px;
    background: #24272c;
}

.edit-studio-inspector {
    grid-column: 3;
    grid-row: 1;
    display: grid;
    grid-template-rows: 44px minmax(0, 1fr);
    min-width: 0;
    min-height: 0;
    border-left: 1px solid rgba(148, 163, 184, 0.16);
    background: #202226;
}

.edit-studio-inspector-head {
    min-height: 44px;
    padding: 0 13px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.edit-studio-inspector-body {
    min-height: 0;
    overflow: auto;
    padding: 13px;
}

.edit-studio-inspector-empty {
    display: flex;
    height: 100%;
    min-height: 150px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: #747a84;
    text-align: center;
}

.edit-studio-inspector-empty svg {
    width: 24px;
    height: 24px;
    margin-bottom: 9px;
}

.edit-studio-inspector-empty span {
    font-size: 10px;
}

.edit-studio-inspector-card {
    display: grid;
    gap: 13px;
}

.edit-studio-inspector-source {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.edit-studio-inspector-source>span {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: rgba(95, 159, 255, 0.12);
    color: #69a8ff;
}

.edit-studio-inspector-source svg {
    width: 17px;
    height: 17px;
}

.edit-studio-inspector-source strong,
.edit-studio-inspector-source small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.edit-studio-inspector-source strong {
    font-size: 11px;
}

.edit-studio-inspector-source small {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 9px;
}

.edit-studio-trim-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.edit-studio-trim-group label {
    display: grid;
    gap: 5px;
    color: var(--text-muted);
    font-size: 9px;
}

.edit-studio-trim-group input {
    width: 100%;
    height: 32px;
    padding: 0 8px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 7px;
    outline: 0;
    background: #17191d;
    color: var(--text);
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

.edit-studio-trim-group input:focus {
    border-color: #5f9fff;
}

.edit-studio-inspector-duration {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 9px;
}

.edit-studio-inspector-duration strong {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.edit-studio-inspector-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 34px;
    gap: 6px;
}

.edit-studio-inspector-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 32px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 7px;
    background: #282b31;
    color: #aab0ba;
    font-size: 9px;
    cursor: pointer;
}

.edit-studio-inspector-actions button.danger {
    color: #e87070;
}

.edit-studio-inspector-actions button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.edit-studio-inspector-actions svg {
    width: 12px;
    height: 12px;
}

.edit-studio-timeline-panel {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-rows: 42px 22px minmax(0, 1fr);
    min-width: 0;
    min-height: 0;
    border-top: 1px solid rgba(148, 163, 184, 0.16);
    background: #1e2024;
}

.edit-studio-timeline-head {
    min-height: 42px;
    padding: 0 13px;
}

.edit-studio-timeline-actions,
.edit-studio-timeline-actions button {
    display: inline-flex;
    align-items: center;
}

.edit-studio-timeline-actions {
    gap: 12px;
}

.edit-studio-timeline-actions button {
    gap: 5px;
    height: 28px;
    padding: 0 10px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 7px;
    background: #282b31;
    color: #b8bec8;
    font-size: 9px;
    cursor: pointer;
}

.edit-studio-timeline-actions button:hover {
    border-color: rgba(95, 159, 255, 0.55);
    color: #fff;
}

.edit-studio-timeline-actions button svg {
    width: 12px;
    height: 12px;
}

.edit-studio-ruler {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px 0 46px;
    border-top: 1px solid rgba(148, 163, 184, 0.08);
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    color: #626873;
    font-size: 8px;
    font-variant-numeric: tabular-nums;
}

.edit-studio-timeline {
    display: grid;
    align-content: start;
    gap: 7px;
    min-width: 0;
    min-height: 0;
    overflow-x: auto;
    overflow-y: auto;
    padding: 10px 12px 12px;
    border: 0;
    border-radius: 0;
    background:
        linear-gradient(90deg, rgba(95, 159, 255, 0.11) 0 2px, transparent 2px) 94px 10px / 8px calc(100% - 22px) no-repeat;
}

.edit-studio-track {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    min-height: 76px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 8px;
    background: rgba(12, 14, 18, 0.34);
}

.edit-studio-track-label {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding: 0 9px;
    border-right: 1px solid rgba(148, 163, 184, 0.12);
    color: #9299a5;
    font-size: 9px;
}

.edit-studio-track-label>span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.edit-studio-track-label svg {
    flex: 0 0 auto;
    width: 13px;
    height: 13px;
}

.edit-studio-track-label button {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    margin-left: auto;
    padding: 0;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #717782;
    cursor: pointer;
}

.edit-studio-track-label button:hover {
    background: rgba(239, 105, 105, 0.12);
    color: #ef7777;
}

.edit-studio-track-clips {
    display: flex;
    gap: 5px;
    min-width: 0;
    overflow-x: auto;
    padding: 6px;
}

.edit-studio-track-empty {
    display: flex;
    flex: 1 0 240px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 60px;
    border: 1px dashed rgba(148, 163, 184, 0.16);
    border-radius: 6px;
    color: #656c77;
    font-size: 9px;
}

.edit-studio-track-empty svg {
    width: 14px;
    height: 14px;
}

.edit-studio-track.overlay .edit-studio-clip {
    border-color: rgba(128, 155, 197, 0.28);
    background: #252a31;
}

.edit-studio-track-select {
    display: grid;
    gap: 5px;
    color: var(--text-muted);
    font-size: 9px;
}

.edit-studio-track-select select {
    width: 100%;
    height: 32px;
    padding: 0 8px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 7px;
    outline: 0;
    background: #17191d;
    color: var(--text);
    font-size: 10px;
}

.edit-studio-timeline.drag-over {
    border-color: transparent;
    background-color: rgba(95, 159, 255, 0.07);
    box-shadow: inset 0 0 0 1px rgba(95, 159, 255, 0.5);
}

.edit-studio-clip {
    position: relative;
    display: grid;
    grid-template-columns: 30px minmax(70px, 1fr) 24px;
    grid-template-rows: 1fr 18px;
    flex: 0 0 clamp(135px, calc(var(--clip-duration, 5) * 22px), 280px);
    align-items: center;
    gap: 5px;
    min-height: 0;
    margin: 0;
    padding: 7px;
    overflow: hidden;
    border: 1px solid rgba(95, 159, 255, 0.28);
    border-radius: 7px;
    background:
        linear-gradient(135deg, rgba(95, 159, 255, 0.19), rgba(67, 111, 189, 0.08)),
        #252a31;
    cursor: pointer;
}

.edit-studio-clip:hover {
    border-color: rgba(95, 159, 255, 0.56);
}

.edit-studio-clip.active {
    border-color: #69a8ff;
    box-shadow: inset 0 0 0 1px #69a8ff, 0 0 0 1px rgba(95, 159, 255, 0.18);
}

.edit-studio-clip.dragging {
    opacity: 0.5;
}

.edit-studio-clip-index {
    position: absolute;
    top: 5px;
    left: 6px;
    z-index: 1;
    padding: 1px 4px;
    border-radius: 4px;
    background: rgba(9, 11, 14, 0.66);
    color: rgba(255, 255, 255, 0.72);
    font-size: 8px;
}

.edit-studio-clip-preview {
    grid-column: 1;
    grid-row: 1;
    align-self: end;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(9, 11, 14, 0.72);
    color: #fff;
}

.edit-studio-clip-copy {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: end;
}

.edit-studio-clip-copy strong {
    font-size: 10px;
}

.edit-studio-clip-copy small {
    color: rgba(226, 232, 240, 0.62);
    font-size: 8px;
}

.edit-studio-clip-remove {
    grid-column: 3;
    grid-row: 1;
    align-self: start;
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 5px;
    background: rgba(9, 11, 14, 0.42);
    color: rgba(255, 255, 255, 0.56);
    cursor: pointer;
}

.edit-studio-clip-remove:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ff8d8d;
}

.edit-studio-clip-remove svg {
    width: 11px;
    height: 11px;
}

.edit-studio-clip-grip {
    grid-column: 1 / -1;
    grid-row: 2;
    height: 3px;
    align-self: end;
    border-radius: 999px;
    background: rgba(105, 168, 255, 0.42);
}

.edit-studio-trim-handle {
    position: absolute;
    z-index: 3;
    top: 7px;
    bottom: 7px;
    width: 8px;
    opacity: 0;
    border-radius: 4px;
    background: #e9f2ff;
    cursor: ew-resize;
    transition: opacity 0.12s ease;
}

.edit-studio-trim-handle::after {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 18px;
    border-radius: 99px;
    background: #4987df;
    content: "";
    transform: translate(-50%, -50%);
}

.edit-studio-trim-handle.start {
    left: 2px;
}

.edit-studio-trim-handle.end {
    right: 2px;
}

.edit-studio-clip:hover .edit-studio-trim-handle,
.edit-studio-clip.active .edit-studio-trim-handle,
.edit-studio-clip.trimming .edit-studio-trim-handle {
    opacity: 1;
}

.edit-studio-clip.trimming {
    cursor: ew-resize;
    user-select: none;
}

.edit-studio-empty-timeline {
    flex: 1 0 100%;
    min-height: 0;
    padding: 8px;
    border: 1px dashed rgba(148, 163, 184, 0.2);
    border-radius: 8px;
}

.edit-studio-footer {
    min-height: 58px;
    padding: 8px 14px;
    background: #292c32;
}

@media (max-width: 980px) {
    .edit-studio-overlay {
        padding: 12px;
    }

    .edit-studio-workbench {
        width: calc(100vw - 24px);
        height: calc(100vh - 24px);
        min-height: 560px;
    }

    .edit-studio-header {
        grid-template-columns: minmax(0, 1fr) 36px;
    }

    .edit-studio-name-field {
        display: none;
    }

    .edit-studio-body {
        grid-template-columns: 210px minmax(280px, 1fr) 200px;
        grid-template-rows: minmax(0, 1fr) 200px;
    }

    .edit-studio-source-item {
        grid-template-columns: 38px minmax(0, 1fr) 27px;
    }

    .edit-studio-source-thumb {
        width: 38px;
        height: 38px;
    }
}

@media (max-width: 760px) {
    .edit-studio-workbench {
        min-height: 520px;
    }

    .edit-studio-body {
        grid-template-columns: 190px minmax(260px, 1fr);
    }

    .edit-studio-inspector {
        display: none;
    }

    .edit-studio-main {
        grid-column: 2;
    }

    .edit-studio-source-tabs button {
        padding: 0 2px;
        font-size: 8px;
    }
}

/* 文本转脚本默认入口：只保留“输入想法 → 确认并生成”的轻量两步流程。 */
.text-to-script-overlay .tts-simple-wizard {
    width: min(760px, calc(100vw - 32px));
    max-height: min(760px, calc(100dvh - 32px));
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    overflow: hidden;
    color: var(--text);
    background:
        radial-gradient(circle at 86% -12%, color-mix(in srgb, var(--primary) 14%, transparent), transparent 38%),
        var(--surface);
    border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
    border-radius: 24px;
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.36);
}

.text-to-script-overlay .tts-simple-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 24px 26px 18px;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
}

.text-to-script-overlay .tts-simple-header h2,
.text-to-script-overlay .tts-simple-header p {
    margin: 0;
}

.text-to-script-overlay .tts-simple-header h2 {
    margin-top: 5px;
    font-size: 24px;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.text-to-script-overlay .tts-simple-header p {
    margin-top: 7px;
    color: var(--text-secondary);
    font-size: 13px;
}

.text-to-script-overlay .tts-simple-kicker {
    color: var(--primary);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.14em;
}

.text-to-script-overlay .tts-simple-header > button {
    width: 38px;
    height: 38px;
    display: grid;
    flex: none;
    place-items: center;
    padding: 0;
    color: var(--text-secondary);
    background: color-mix(in srgb, var(--input-bg) 88%, transparent);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
}

.text-to-script-overlay .tts-simple-header > button:hover {
    color: var(--text);
    border-color: color-mix(in srgb, var(--primary) 54%, var(--border));
}

.text-to-script-overlay .tts-simple-header > button svg {
    width: 19px;
    height: 19px;
}

.text-to-script-overlay .tts-simple-steps {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 16px 26px;
    color: var(--text-secondary);
    background: color-mix(in srgb, var(--input-bg) 42%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--border) 62%, transparent);
}

.text-to-script-overlay .tts-simple-steps > span {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    font-size: 13px;
    font-weight: 650;
}

.text-to-script-overlay .tts-simple-steps > span:last-child {
    justify-self: end;
}

.text-to-script-overlay .tts-simple-steps b {
    width: 25px;
    height: 25px;
    display: grid;
    flex: none;
    place-items: center;
    color: var(--text-secondary);
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 50%;
    font-size: 11px;
}

.text-to-script-overlay .tts-simple-steps span.is-active {
    color: var(--text);
}

.text-to-script-overlay .tts-simple-steps span.is-active b {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent);
}

.text-to-script-overlay .tts-simple-steps span.is-done b {
    color: #fff;
    background: #28a66d;
    border-color: #28a66d;
    box-shadow: none;
}

.text-to-script-overlay .tts-simple-steps > i {
    height: 1px;
    background: var(--border);
}

.text-to-script-overlay .tts-simple-body {
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: auto;
    padding: 24px 26px;
}

.text-to-script-overlay .tts-simple-copy h3,
.text-to-script-overlay .tts-simple-copy p,
.text-to-script-overlay .tts-simple-result h3,
.text-to-script-overlay .tts-simple-result p {
    margin: 0;
}

.text-to-script-overlay .tts-simple-copy h3,
.text-to-script-overlay .tts-simple-result h3 {
    font-size: 18px;
    line-height: 1.35;
}

.text-to-script-overlay .tts-simple-copy p,
.text-to-script-overlay .tts-simple-result p {
    margin-top: 7px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.65;
}

.text-to-script-overlay .tts-simple-input {
    width: 100%;
    min-height: 250px;
    max-height: 46vh;
    box-sizing: border-box;
    resize: vertical;
    overflow: auto;
    padding: 17px 18px;
    color: var(--text);
    caret-color: var(--primary);
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    outline: none;
    font: inherit;
    font-size: 15px;
    line-height: 1.75;
}

.text-to-script-overlay .tts-simple-input:focus {
    border-color: color-mix(in srgb, var(--primary) 72%, var(--border));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 13%, transparent);
}

.text-to-script-overlay .tts-simple-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.text-to-script-overlay .tts-simple-input-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 12px;
}

.text-to-script-overlay .tts-simple-input-meta b {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.text-to-script-overlay .tts-simple-confirm-text {
    min-height: 230px;
    max-height: 44vh;
    overflow: auto;
    padding: 18px 20px;
    color: var(--text);
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.78;
    white-space: normal;
    word-break: break-word;
}

.text-to-script-overlay .tts-simple-confirm-note,
.text-to-script-overlay .tts-simple-warning {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 11px 13px;
    border-radius: 12px;
    font-size: 12px;
    line-height: 1.55;
}

.text-to-script-overlay .tts-simple-confirm-note {
    color: color-mix(in srgb, #28a66d 78%, var(--text));
    background: color-mix(in srgb, #28a66d 12%, transparent);
    border: 1px solid color-mix(in srgb, #28a66d 28%, transparent);
}

.text-to-script-overlay .tts-simple-warning {
    margin-top: 15px;
    color: color-mix(in srgb, #e4a03a 82%, var(--text));
    background: color-mix(in srgb, #e4a03a 12%, transparent);
    border: 1px solid color-mix(in srgb, #e4a03a 28%, transparent);
}

.text-to-script-overlay .tts-simple-confirm-note svg,
.text-to-script-overlay .tts-simple-warning svg {
    width: 17px;
    height: 17px;
    flex: none;
    margin-top: 1px;
}

.text-to-script-overlay .tts-simple-result {
    min-height: 280px;
    display: grid;
    place-items: center;
    align-content: center;
    padding: 34px 26px;
    text-align: center;
}

.text-to-script-overlay .tts-simple-result-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    margin-bottom: 16px;
    color: #fff;
    background: #28a66d;
    border-radius: 18px;
    box-shadow: 0 14px 34px color-mix(in srgb, #28a66d 28%, transparent);
}

.text-to-script-overlay .tts-simple-result-icon svg {
    width: 29px;
    height: 29px;
}

.text-to-script-overlay .tts-simple-footer {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 26px;
    background: color-mix(in srgb, var(--input-bg) 42%, transparent);
    border-top: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
}

.text-to-script-overlay .tts-simple-primary,
.text-to-script-overlay .tts-simple-secondary {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 17px;
    border-radius: 12px;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.text-to-script-overlay .tts-simple-primary {
    color: #fff;
    background: var(--primary);
    border: 1px solid var(--primary);
    box-shadow: 0 8px 22px color-mix(in srgb, var(--primary) 22%, transparent);
}

.text-to-script-overlay .tts-simple-primary:hover:not(:disabled) {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.text-to-script-overlay .tts-simple-secondary {
    color: var(--text);
    background: var(--input-bg);
    border: 1px solid var(--border);
}

.text-to-script-overlay .tts-simple-secondary:hover {
    border-color: color-mix(in srgb, var(--primary) 54%, var(--border));
    background: color-mix(in srgb, var(--primary) 8%, var(--input-bg));
}

.text-to-script-overlay .tts-simple-primary:disabled {
    cursor: not-allowed;
    filter: grayscale(0.25);
    opacity: 0.5;
    transform: none;
}

.text-to-script-overlay .tts-simple-primary svg,
.text-to-script-overlay .tts-simple-secondary svg {
    width: 17px;
    height: 17px;
}

.text-to-script-overlay .tts-simple-primary .lucide-loader-circle {
    animation: spin 0.9s linear infinite;
}

@media (max-width: 640px) {
    .text-to-script-overlay .tts-simple-wizard {
        width: calc(100vw - 20px);
        max-height: calc(100dvh - 20px);
        border-radius: 18px;
    }

    .text-to-script-overlay .tts-simple-header,
    .text-to-script-overlay .tts-simple-body,
    .text-to-script-overlay .tts-simple-footer {
        padding-right: 16px;
        padding-left: 16px;
    }

    .text-to-script-overlay .tts-simple-steps {
        grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr);
        gap: 7px;
        padding: 13px 16px;
    }

    .text-to-script-overlay .tts-simple-steps > span {
        font-size: 11px;
    }

    .text-to-script-overlay .tts-simple-input {
        min-height: 220px;
    }

    .text-to-script-overlay .tts-simple-footer > button {
        flex: 1 1 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .text-to-script-overlay .tts-simple-primary,
    .text-to-script-overlay .tts-simple-secondary {
        transition: none;
    }

    .text-to-script-overlay .tts-simple-primary .lucide-loader-circle {
        animation: none;
    }
}

/* 文本转脚本工作台的字段细节：与上方通用容器隔离，便于长文本逐镜编辑。 */
.text-to-script-studio .tts-sidebar-copy,
.text-to-script-studio .tts-source-summary p,
.text-to-script-studio .tts-asset-intro p,
.text-to-script-studio .tts-panel-description {
    margin: 0;
    color: var(--tts-text-secondary);
    font-size: 12px;
    line-height: 1.65;
}

.text-to-script-studio .tts-source-editor {
    width: 100%;
    min-height: 116px;
    resize: vertical;
}

.text-to-script-studio .tts-inline-warning {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 10px;
    padding: 9px 10px;
    color: #f7cf91;
    background: rgba(225, 159, 52, .09);
    border: 1px solid rgba(244, 189, 99, .20);
    border-radius: 9px;
    font-size: 11px;
    line-height: 1.5;
}

.text-to-script-studio .tts-inline-warning svg {
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
    margin-top: 1px;
}

.text-to-script-studio .tts-shot-table input,
.text-to-script-studio .tts-shot-table textarea {
    box-sizing: border-box;
    width: 100%;
    min-width: 82px;
    padding: 7px 8px;
    color: #eaf2f9;
    background: rgba(0, 0, 0, .18);
    border: 1px solid rgba(255, 255, 255, .085);
    border-radius: 7px;
    font: inherit;
    line-height: 1.45;
    resize: vertical;
}

.text-to-script-studio .tts-shot-table input:focus,
.text-to-script-studio .tts-shot-table textarea:focus {
    border-color: rgba(116, 185, 255, .70);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(72, 151, 237, .12);
}

.text-to-script-studio .tts-small-input {
    min-width: 58px !important;
}

.text-to-script-studio .tts-panel-actions,
.text-to-script-studio .tts-prompt-foot,
.text-to-script-studio .tts-asset-head,
.text-to-script-studio .tts-asset-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.text-to-script-studio .tts-panel-actions {
    justify-content: space-between;
    margin-top: 12px;
    color: var(--tts-text-muted);
    font-size: 11px;
}

.text-to-script-studio .tts-asset-body {
    display: grid;
    gap: 8px;
    padding: 10px;
}

.text-to-script-studio .tts-asset-head {
    justify-content: space-between;
    color: var(--tts-text-secondary);
    font-size: 11px;
}

.text-to-script-studio .tts-asset-head label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.text-to-script-studio .tts-asset-head button {
    display: grid;
    width: 23px;
    height: 23px;
    padding: 0;
    place-items: center;
    color: #95a3b1;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 7px;
}

.text-to-script-studio .tts-asset-head button:hover {
    color: #ffd0d0;
    background: rgba(221, 80, 80, .11);
}

.text-to-script-studio .tts-asset-head button svg {
    width: 13px;
    height: 13px;
}

.text-to-script-studio .tts-asset-description,
.text-to-script-studio .tts-asset-prompt {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.text-to-script-studio .tts-asset-meta {
    justify-content: space-between;
}

.text-to-script-studio .tts-prompt-foot {
    justify-content: space-between;
    margin-top: 9px;
    color: var(--tts-text-muted);
    font-size: 11px;
}

.text-to-script-studio .tts-prompt-foot>span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-to-script-studio .tts-check-list {
    display: grid;
    gap: 8px;
    margin: 0;
}

.text-to-script-studio .tts-check-list div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--tts-border-soft);
    font-size: 12px;
}

.text-to-script-studio .tts-check-list div:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.text-to-script-studio .tts-check-list dt {
    color: var(--tts-text-muted);
}

.text-to-script-studio .tts-check-list dd {
    margin: 0;
    color: #dde6ef;
    font-weight: 680;
}

.text-to-script-studio .tts-check-list dd.is-good {
    color: #9ce4b6;
}

.text-to-script-studio .tts-check-list dd.is-warning {
    color: #f4c57f;
}

@media (max-width: 620px) {
    .text-to-script-studio .tts-panel-actions,
    .text-to-script-studio .tts-prompt-foot {
        align-items: flex-start;
        flex-direction: column;
    }

    .text-to-script-studio .tts-asset-grid {
        grid-template-columns: 1fr;
    }
}

/* 视频创作 · 角色库 / 特效库 / 运镜库 -------------------------------------- */
/* 预览仅由本地配色和画布已有角色图组成，避免引用第三方图库或外链缩略图。 */
.video-composer-panel .video-preset-trigger {
    min-width: 0;
    max-width: min(178px, 26vw);
}

.video-composer-panel .video-preset-trigger.has-video-preset-selection {
    color: #dcecff;
    background: rgba(48, 114, 220, 0.2);
    border-color: rgba(92, 159, 255, 0.55);
}

.video-composer-panel .video-preset-trigger-value {
    display: inline-block;
    min-width: 0;
    max-width: 74px;
    margin-left: 1px;
    overflow: hidden;
    color: #9fc8ff;
    font-size: 11px;
    font-style: normal;
    font-weight: 680;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-creative-library-overlay {
    position: fixed;
    z-index: 5300;
    inset: 0;
    display: grid;
    place-items: center;
    box-sizing: border-box;
    padding: max(22px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
    background: rgba(7, 8, 10, 0.75);
    backdrop-filter: blur(14px) saturate(0.9);
    -webkit-backdrop-filter: blur(14px) saturate(0.9);
    animation: videoCreativeOverlayIn 160ms ease-out;
}

@keyframes videoCreativeOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.video-creative-library {
    width: min(1280px, calc(100vw - 48px));
    height: min(740px, calc(100dvh - 54px));
    max-height: calc(100vh - 54px);
    display: grid;
    grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
    overflow: hidden;
    color: #eef2f7;
    background: linear-gradient(180deg, #292a2d 0%, #202225 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    box-shadow: 0 32px 100px rgba(0, 0, 0, 0.58), inset 0 1px 0 rgba(255, 255, 255, 0.055);
    transition: width 160ms ease, height 160ms ease, border-radius 160ms ease;
}

.video-creative-library.is-expanded {
    width: calc(100vw - 22px);
    height: calc(100dvh - 22px);
    max-height: calc(100vh - 22px);
    border-radius: 16px;
}

.video-creative-library button,
.video-creative-library input {
    font: inherit;
}

.video-creative-library button {
    border: 0;
    cursor: pointer;
}

.video-creative-library-header,
.video-creative-library-toolbar,
.video-creative-library-views,
.video-creative-library-filters,
.video-creative-library-footer,
.video-creative-library-title,
.video-creative-library-header-actions,
.video-creative-library-actions,
.video-creative-selection-summary {
    display: flex;
    align-items: center;
}

.video-creative-library-header {
    justify-content: space-between;
    gap: 18px;
    min-height: 64px;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.075);
}

.video-creative-library-title {
    min-width: 0;
    gap: 9px;
    color: #f6f8fb;
    font-size: 18px;
    font-weight: 760;
    letter-spacing: 0.01em;
}

.video-creative-library-title svg {
    width: 20px;
    height: 20px;
    color: #8cbfff;
}

.video-creative-library-title em {
    margin-left: 5px;
    color: #9aa2ac;
    font-size: 12px;
    font-style: normal;
    font-weight: 520;
}

.video-creative-library-header-actions {
    flex: 0 0 auto;
    gap: 6px;
}

.video-creative-library-header-actions button {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    color: #bcc4cd;
    background: transparent;
    border-radius: 10px;
}

.video-creative-library-header-actions button:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.09);
}

.video-creative-library-header-actions svg { width: 19px; height: 19px; }

.video-creative-library-toolbar {
    justify-content: space-between;
    gap: 18px;
    padding: 16px 24px 12px;
}

.video-creative-library-views {
    flex: 0 1 auto;
    gap: 4px;
    padding: 4px;
    overflow-x: auto;
    background: rgba(255, 255, 255, 0.055);
    border-radius: 11px;
    scrollbar-width: none;
}

.video-creative-library-views::-webkit-scrollbar { display: none; }

.video-creative-library-views button {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 0 13px;
    color: #aeb5be;
    background: transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 650;
    white-space: nowrap;
}

.video-creative-library-views button:hover { color: #eff3f8; }

.video-creative-library-views button.active {
    color: #fff;
    background: #4a4c50;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.video-creative-search {
    display: flex;
    flex: 0 1 420px;
    align-items: center;
    gap: 9px;
    min-width: 180px;
    height: 42px;
    padding: 0 13px;
    color: #9099a4;
    background: #1d1e20;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 11px;
}

.video-creative-search:focus-within {
    border-color: rgba(101, 161, 255, 0.65);
    box-shadow: 0 0 0 3px rgba(64, 132, 236, 0.13);
}

.video-creative-search svg { flex: 0 0 auto; width: 17px; height: 17px; }

.video-creative-search input {
    min-width: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    color: #f0f3f7;
    background: transparent;
    border: 0;
    outline: 0;
    font-size: 14px;
}

.video-creative-search input::placeholder { color: #747b85; }

.video-creative-library-filters {
    gap: 8px;
    min-height: 45px;
    padding: 0 24px 11px;
    overflow-x: auto;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    scrollbar-width: thin;
}

.video-creative-library-filters button {
    flex: 0 0 auto;
    height: 30px;
    padding: 0 12px;
    color: #adb4bd;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 630;
    white-space: nowrap;
}

.video-creative-library-filters button:hover {
    color: #e9edf2;
    background: rgba(255, 255, 255, 0.06);
}

.video-creative-library-filters button.active {
    color: #effbf7;
    background: rgba(32, 201, 151, 0.18);
    border-color: rgba(93, 214, 177, 0.36);
}

.video-creative-result-count {
    flex: 0 0 auto;
    margin-left: auto;
    color: #7f8792;
    font-size: 12px;
    white-space: nowrap;
}

.video-creative-library-tip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    color: #9ea7b2;
    background: rgba(29, 71, 119, 0.17);
    border-bottom: 1px solid rgba(82, 151, 239, 0.1);
    font-size: 12px;
    line-height: 1.45;
}

.video-creative-library-tip svg { flex: 0 0 auto; width: 16px; height: 16px; color: #8ec0ff; }

.video-creative-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(188px, 1fr));
    align-content: start;
    gap: 12px;
    min-height: 0;
    padding: 16px 24px 20px;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-color: rgba(163, 173, 186, 0.5) transparent;
    scrollbar-width: thin;
}

.video-creative-card {
    position: relative;
    min-width: 0;
    min-height: 203px;
    overflow: hidden;
    background: #292b2e;
    border: 1px solid rgba(255, 255, 255, 0.075);
    border-radius: 13px;
    transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.video-creative-card:hover {
    z-index: 1;
    background: #303236;
    border-color: rgba(181, 204, 235, 0.38);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
    transform: translateY(-2px);
}

.video-creative-card.is-selected {
    border-color: #5b9bff;
    box-shadow: 0 0 0 1px rgba(89, 156, 255, 0.33), 0 10px 26px rgba(22, 82, 166, 0.16);
}

.video-creative-card-select {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 201px;
    padding: 0;
    overflow: hidden;
    color: inherit;
    text-align: left;
    background: transparent;
}

.video-creative-card-preview,
.video-creative-canvas-preview {
    position: relative;
    display: flex;
    flex: 0 0 92px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.video-creative-card-preview {
    color: rgba(255, 255, 255, 0.94);
    background:
        radial-gradient(circle at 74% 23%, color-mix(in srgb, var(--video-preset-c) 62%, transparent) 0 4%, transparent 20%),
        linear-gradient(135deg, var(--video-preset-a), var(--video-preset-b) 56%, var(--video-preset-c));
}

.video-creative-card-preview > img {
    position: absolute;
    z-index: 0;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.01);
    transition: transform 180ms ease, filter 180ms ease;
}

/* 特效预览为轻量循环 GIF，保持横版铺满且不受旧方图尺寸影响。 */
body.canvas-mode .video-creative-card[data-video-preset-card^="effect_"] .video-creative-card-preview,
body.canvas-mode .video-creative-card[data-video-preset-card^="effect_"] .video-creative-card-preview > img {
    width: 100% !important;
    aspect-ratio: 16 / 9 !important;
    object-fit: cover !important;
}

/* v1.37 · 浅色图片生成底栏：模型、比例、分辨率、张数使用同一扁平参数栏。 */
body:not(.dark).canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer {
    min-height: 56px !important;
    padding: 9px 0 0 !important;
    column-gap: 0 !important;
    border-top: 1px solid #d8dee6 !important;
    background: transparent !important;
}

body:not(.dark).canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control {
    box-sizing: border-box !important;
    height: 38px !important;
    min-height: 38px !important;
    margin: 0 !important;
    padding: 0 10px !important;
    gap: 7px !important;
    color: #34404d !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 8px !important;
    box-shadow: none !important;
}

body:not(.dark).canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control:not(.model) {
    border-left: 1px solid #d4dae2 !important;
    border-radius: 0 !important;
}

body:not(.dark).canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control:hover {
    background: #eef2f6 !important;
}

body:not(.dark).canvas-mode .image-composer-panel:not(.is-expanded)
    .media-composer-control :is(.composer-select-trigger,.composer-select-value,select) {
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
    color: #34404d !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

body:not(.dark).canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control > svg {
    flex: 0 0 15px !important;
    width: 15px !important;
    height: 15px !important;
    color: #718092 !important;
}

body:not(.dark).canvas-mode .image-composer-panel:not(.is-expanded) .composer-select-trigger svg {
    color: #84909e !important;
}

.video-creative-card:hover .video-creative-card-preview > img {
    filter: saturate(1.08) contrast(1.04);
    transform: scale(1.045);
}

.video-creative-card-preview.has-local-preview > svg {
    opacity: 0;
}

.video-creative-card-preview::before,
.video-creative-card-preview::after {
    position: absolute;
    inset: 0;
    content: '';
}

.video-creative-card-preview::before {
    opacity: 0.24;
    background:
        linear-gradient(118deg, transparent 0 37%, rgba(255, 255, 255, 0.33) 37.5% 38%, transparent 38.5% 100%),
        linear-gradient(34deg, transparent 0 58%, rgba(5, 8, 12, 0.34) 58.5% 100%);
}

.video-creative-card-preview::after {
    opacity: 0.17;
    background-image: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.32) 0 1px, transparent 1px 4px);
    mix-blend-mode: soft-light;
}

.video-creative-card-preview svg,
.video-creative-card-preview small { position: relative; z-index: 1; }
.video-creative-card-preview svg { width: 30px; height: 30px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.26)); }

.video-creative-card-preview small {
    position: absolute;
    right: 9px;
    bottom: 8px;
    max-width: calc(100% - 18px);
    overflow: hidden;
    padding: 3px 6px;
    color: #f8fbff;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: rgba(8, 12, 18, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 5px;
    font-size: 10px;
    font-weight: 650;
}

.video-creative-canvas-preview { background: #141619; }
.video-creative-canvas-preview img { width: 100%; height: 100%; object-fit: cover; }

.video-creative-card-content {
    display: grid;
    gap: 5px;
    padding: 11px 12px 13px;
}

.video-creative-card-content strong {
    overflow: hidden;
    color: #f0f3f6;
    font-size: 14px;
    font-weight: 760;
    letter-spacing: 0.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-creative-card-content small {
    display: -webkit-box;
    min-height: 34px;
    overflow: hidden;
    color: #9fa8b3;
    font-size: 11px;
    line-height: 1.52;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.video-creative-card-content em {
    display: block;
    overflow: hidden;
    color: #78aef5;
    font-size: 10px;
    font-style: normal;
    font-weight: 570;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-creative-favorite {
    position: absolute;
    z-index: 2;
    top: 8px;
    right: 8px;
    display: inline-grid;
    width: 29px;
    height: 29px;
    place-items: center;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(10, 12, 15, 0.44);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

.video-creative-favorite:hover,
.video-creative-favorite.active {
    color: #ffd978;
    background: rgba(68, 53, 20, 0.62);
    border-color: rgba(255, 213, 105, 0.55);
}

.video-creative-favorite svg { width: 15px; height: 15px; }
.video-creative-favorite.active svg { fill: currentColor; }

.video-creative-empty {
    display: grid;
    grid-column: 1 / -1;
    min-height: 230px;
    place-content: center;
    justify-items: center;
    gap: 9px;
    color: #a9b1ba;
    text-align: center;
}

.video-creative-empty svg { width: 32px; height: 32px; color: #647180; }
.video-creative-empty strong { color: #d8dee6; font-size: 15px; }
.video-creative-empty span { color: #838c96; font-size: 12px; }

.video-creative-library-footer {
    justify-content: space-between;
    gap: 16px;
    min-height: 70px;
    padding: 12px 24px;
    background: rgba(8, 10, 12, 0.22);
    border-top: 1px solid rgba(255, 255, 255, 0.075);
}

.video-creative-selection-summary {
    flex: 1 1 auto;
    flex-wrap: wrap;
    gap: 7px;
    min-width: 0;
}

.video-creative-selection-summary > span.empty {
    overflow: hidden;
    color: #8f99a4;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-creative-selection-summary button,
.video-creative-role-ref {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 190px;
    height: 29px;
    padding: 0 8px;
    overflow: hidden;
    color: #d7e8ff;
    background: rgba(61, 125, 218, 0.2);
    border: 1px solid rgba(83, 147, 238, 0.36);
    border-radius: 7px;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-creative-selection-summary button:hover { color: #fff; background: rgba(72, 141, 239, 0.34); }
.video-creative-selection-summary svg { flex: 0 0 auto; width: 13px; height: 13px; }
.video-creative-role-ref { color: #d7e8ff; background: rgba(65, 104, 140, 0.23); }

.video-creative-library-actions { flex: 0 0 auto; gap: 8px; }

.video-creative-library-actions button {
    height: 36px;
    padding: 0 13px;
    color: #aeb6c0;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 9px;
    font-size: 13px;
    font-weight: 680;
    white-space: nowrap;
}

.video-creative-library-actions .video-creative-reset:hover { color: #eef2f6; background: rgba(255, 255, 255, 0.07); }

.video-creative-library-actions .video-creative-apply {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #10213a;
    background: #d9eaff;
    border-color: #d9eaff;
}

.video-creative-library-actions .video-creative-apply:hover:not(:disabled) { background: #fff; border-color: #fff; }

.video-creative-library-actions .video-creative-apply:disabled {
    color: #777f89;
    background: #474b50;
    border-color: #474b50;
    cursor: not-allowed;
}

.video-creative-library-actions .video-creative-apply.clear-mode {
    color: #d7e8ff;
    background: rgba(59, 121, 214, 0.26);
    border-color: rgba(82, 149, 245, 0.54);
}

.video-creative-library-actions svg { width: 16px; height: 16px; }

.video-creative-library button:focus-visible,
.video-creative-library input:focus-visible {
    outline: 2px solid #78afff;
    outline-offset: 2px;
}

@media (max-width: 820px) {
    .video-creative-library { width: min(100%, calc(100vw - 24px)); height: min(760px, calc(100dvh - 28px)); max-height: calc(100vh - 28px); }
    .video-creative-library-toolbar { align-items: stretch; flex-direction: column; gap: 11px; }
    .video-creative-search { flex-basis: 42px; width: auto; }
    .video-creative-grid { grid-template-columns: repeat(auto-fill, minmax(166px, 1fr)); }
}

@media (max-width: 620px) {
    .video-creative-library-overlay { align-items: end; padding: 8px; }
    .video-creative-library,
    .video-creative-library.is-expanded { width: 100%; height: min(840px, calc(100dvh - 16px)); max-height: calc(100vh - 16px); border-radius: 18px; }
    .video-creative-library-header { min-height: 56px; padding: 0 14px; }
    .video-creative-library-title { gap: 7px; font-size: 16px; }
    .video-creative-library-title em,
    .video-creative-library-header-actions .video-creative-library-expand { display: none; }
    .video-creative-library-toolbar { padding: 12px 14px 10px; }
    .video-creative-library-views { width: 100%; }
    .video-creative-library-views button { flex: 1 0 auto; padding: 0 10px; text-align: center; }
    .video-creative-library-filters { gap: 6px; padding: 0 14px 9px; }
    .video-creative-library-filters button { height: 29px; padding: 0 10px; }
    .video-creative-result-count { display: none; }
    .video-creative-library-tip { align-items: flex-start; padding: 8px 14px; font-size: 11px; }
    .video-creative-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 12px 14px 16px; }
    .video-creative-card,
    .video-creative-card-select { min-height: 184px; }
    .video-creative-card-preview,
    .video-creative-canvas-preview { flex-basis: 76px; }
    .video-creative-card-content { gap: 4px; padding: 9px 10px 11px; }
    .video-creative-card-content strong { font-size: 13px; }
    .video-creative-card-content small { min-height: 31px; font-size: 10px; }
    .video-creative-library-footer { align-items: stretch; flex-direction: column; gap: 9px; min-height: 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
    .video-creative-selection-summary { max-height: 60px; overflow: auto; }
    .video-creative-library-actions { width: 100%; }
    .video-creative-library-actions button { flex: 1; }
    .video-composer-panel .video-preset-trigger { max-width: 45vw; }
}

@media (prefers-reduced-motion: reduce) {
    .video-creative-library-overlay,
    .video-creative-card,
    .video-creative-library { animation: none; transition: none; }
}

/* 视频创作 · 预设库 -------------------------------------------------------- */
/* 预览完全由渐变、画布素材缩略图和图标组成，不依赖外链图片资源。 */
.video-composer-panel .video-preset-trigger {
    min-width: 0;
    max-width: min(232px, 36vw);
}

.video-composer-panel .video-preset-trigger-value {
    display: inline-block;
    min-width: 0;
    max-width: 126px;
    margin-left: 1px;
    overflow: hidden;
    color: #a9d5ff;
    font-size: 12px;
    font-style: normal;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-composer-panel .video-preset-trigger.has-video-preset-selection,
.video-composer-panel .has-video-preset-selection {
    color: #e1f3ff;
    background: rgba(30, 128, 190, 0.22);
    border-color: rgba(90, 191, 255, 0.56);
    box-shadow: inset 0 1px 0 rgba(211, 244, 255, 0.08);
}

.video-composer-panel .video-preset-trigger.has-video-preset-selection .video-preset-trigger-value,
.video-composer-panel .has-video-preset-selection .video-preset-trigger-value {
    color: #a9dcff;
}

.video-creative-library-overlay {
    position: fixed;
    z-index: 5250;
    inset: 0;
    display: grid;
    place-items: center;
    box-sizing: border-box;
    padding: max(22px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
    background: rgba(5, 9, 14, 0.76);
    backdrop-filter: blur(16px) saturate(0.92);
    -webkit-backdrop-filter: blur(16px) saturate(0.92);
    animation: videoCreativeOverlayIn 160ms ease-out;
}

@keyframes videoCreativeOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.video-creative-library {
    width: min(1360px, calc(100vw - 48px));
    height: min(780px, calc(100dvh - 54px));
    max-height: calc(100vh - 54px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #eef5f8;
    background:
        radial-gradient(circle at 86% -18%, rgba(32, 123, 181, 0.17), transparent 38%),
        linear-gradient(180deg, #292d31 0%, #202326 100%);
    border: 1px solid rgba(179, 224, 247, 0.14);
    border-radius: 20px;
    box-shadow: 0 32px 100px rgba(0, 0, 0, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.055);
    transition: width 160ms ease, height 160ms ease, border-radius 160ms ease;
}

.video-creative-library.is-expanded {
    width: calc(100vw - 22px);
    height: calc(100dvh - 22px);
    max-height: calc(100vh - 22px);
    border-radius: 16px;
}

.video-creative-library button,
.video-creative-library input {
    font: inherit;
}

.video-creative-library button {
    border: 0;
    cursor: pointer;
}

.video-creative-library-header {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 64px;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.075);
}

.video-creative-library-title,
.video-creative-library-header-actions,
.video-creative-library-toolbar,
.video-creative-library-views,
.video-creative-library-filters,
.video-creative-library-footer,
.video-creative-library-actions,
.video-creative-selection-summary {
    display: flex;
    align-items: center;
}

.video-creative-library-title {
    min-width: 0;
    gap: 9px;
    color: #f5fafc;
    font-size: 18px;
    font-weight: 760;
    letter-spacing: 0.01em;
}

.video-creative-library-title svg {
    width: 20px;
    height: 20px;
    color: #7fd5ff;
}

.video-creative-library-title em {
    margin-left: 5px;
    color: #9ba8b3;
    font-size: 12px;
    font-style: normal;
    font-weight: 520;
}

.video-creative-library-header-actions {
    flex: 0 0 auto;
    gap: 6px;
}

.video-creative-library-header-actions button {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    color: #bcc8d0;
    background: transparent;
    border-radius: 10px;
}

.video-creative-library-header-actions button:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.09);
}

.video-creative-library-header-actions svg {
    width: 19px;
    height: 19px;
}

.video-creative-library-toolbar {
    flex: 0 0 auto;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 24px 12px;
}

.video-creative-library-views {
    flex: 0 1 auto;
    gap: 4px;
    padding: 4px;
    overflow-x: auto;
    background: rgba(255, 255, 255, 0.055);
    border-radius: 11px;
    scrollbar-width: none;
}

.video-creative-library-views::-webkit-scrollbar {
    display: none;
}

.video-creative-library-views button {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 0 13px;
    color: #aebac2;
    background: transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 650;
    white-space: nowrap;
}

.video-creative-library-views button:hover {
    color: #eef7fb;
}

.video-creative-library-views button.active {
    color: #f6fbff;
    background: #46535c;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
}

.video-creative-search,
.video-creative-library-search {
    display: flex;
    flex: 0 1 430px;
    align-items: center;
    gap: 9px;
    min-width: 180px;
    height: 42px;
    padding: 0 13px;
    color: #93a3ad;
    background: #1b2024;
    border: 1px solid rgba(184, 224, 243, 0.11);
    border-radius: 11px;
}

.video-creative-search:focus-within,
.video-creative-library-search:focus-within {
    border-color: rgba(89, 192, 255, 0.68);
    box-shadow: 0 0 0 3px rgba(38, 145, 209, 0.15);
}

.video-creative-search svg,
.video-creative-library-search svg {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
}

.video-creative-search input,
.video-creative-library-search input {
    min-width: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    color: #f1f7fb;
    background: transparent;
    border: 0;
    outline: 0;
    font-size: 14px;
}

.video-creative-search input::placeholder,
.video-creative-library-search input::placeholder {
    color: #74818a;
}

.video-creative-library-filters {
    flex: 0 0 auto;
    gap: 8px;
    min-height: 45px;
    padding: 0 24px 11px;
    overflow-x: auto;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    scrollbar-width: thin;
}

.video-creative-library-filters button {
    flex: 0 0 auto;
    height: 30px;
    padding: 0 12px;
    color: #aebbc3;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 630;
    white-space: nowrap;
}

.video-creative-library-filters button:hover {
    color: #edf7fc;
    background: rgba(255, 255, 255, 0.065);
}

.video-creative-library-filters button.active {
    color: #ecf9ff;
    background: rgba(32, 139, 202, 0.25);
    border-color: rgba(82, 191, 255, 0.42);
}

.video-creative-result-count {
    flex: 0 0 auto;
    margin-left: auto;
    color: #8796a0;
    font-size: 12px;
    white-space: nowrap;
}

.video-creative-library-tip {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    color: #a9b8c1;
    background: rgba(20, 88, 126, 0.17);
    border-bottom: 1px solid rgba(80, 179, 231, 0.11);
    font-size: 12px;
    line-height: 1.45;
}

.video-creative-library-tip svg {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    color: #80d4ff;
}

.video-creative-canvas-cards,
.video-creative-canvas-grid {
    display: grid;
    flex: 0 0 auto;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 9px;
    max-height: 168px;
    padding: 12px 24px;
    overflow: auto;
    background: rgba(4, 9, 12, 0.12);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    scrollbar-width: thin;
}

.video-creative-canvas-card {
    position: relative;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    min-width: 0;
    min-height: 64px;
    padding: 7px;
    overflow: hidden;
    color: #d8e7ed;
    text-align: left;
    background: #262d32;
    border: 1px solid rgba(188, 224, 241, 0.1);
    border-radius: 11px;
    transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

button.video-creative-canvas-card {
    width: 100%;
}

.video-creative-canvas-card:hover {
    z-index: 1;
    background: #2c383e;
    border-color: rgba(105, 204, 255, 0.44);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.video-creative-canvas-card.is-selected,
.video-creative-canvas-card.active {
    color: #effaff;
    background: rgba(25, 105, 153, 0.25);
    border-color: #5ec6ff;
    box-shadow: 0 0 0 1px rgba(81, 192, 255, 0.28);
}

.video-creative-canvas-card img,
.video-creative-canvas-card video,
.video-creative-canvas-card .video-creative-canvas-card-preview,
.video-creative-canvas-card .video-creative-canvas-card-thumb {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    overflow: hidden;
    color: #a9d9ef;
    object-fit: cover;
    background:
        linear-gradient(135deg, rgba(98, 211, 255, 0.26), rgba(42, 80, 110, 0.4)),
        #1a2228;
    border: 1px solid rgba(188, 232, 255, 0.16);
    border-radius: 8px;
}

.video-creative-canvas-card svg {
    width: 20px;
    height: 20px;
}

.video-creative-canvas-card-content,
.video-creative-canvas-card > span:not(.video-creative-canvas-card-preview):not(.video-creative-canvas-card-thumb) {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.video-creative-canvas-card strong,
.video-creative-canvas-card-title {
    overflow: hidden;
    color: #eef7fb;
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-creative-canvas-card small,
.video-creative-canvas-card-meta {
    overflow: hidden;
    color: #91a4af;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-creative-grid {
    display: grid;
    flex: 1 1 auto;
    grid-template-columns: repeat(auto-fill, minmax(194px, 1fr));
    align-content: start;
    gap: 12px;
    min-height: 0;
    padding: 16px 24px 20px;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-color: rgba(152, 182, 196, 0.55) transparent;
    scrollbar-width: thin;
}

.video-creative-card {
    position: relative;
    min-width: 0;
    min-height: 208px;
    overflow: hidden;
    background: #282e33;
    border: 1px solid rgba(192, 225, 239, 0.085);
    border-radius: 13px;
    transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.video-creative-card:hover {
    z-index: 1;
    background: #2d373d;
    border-color: rgba(130, 213, 255, 0.4);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
    transform: translateY(-2px);
}

.video-creative-card.is-selected,
.video-creative-card.active {
    border-color: #5dc9ff;
    box-shadow: 0 0 0 1px rgba(81, 194, 255, 0.34), 0 10px 26px rgba(12, 93, 143, 0.18);
}

.video-creative-card-select {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 206px;
    padding: 0;
    overflow: hidden;
    color: inherit;
    text-align: left;
    background: transparent;
}

.video-creative-card-preview {
    position: relative;
    display: flex;
    flex: 0 0 94px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.96);
    background:
        radial-gradient(circle at 74% 23%, var(--video-creative-c, rgba(148, 238, 255, 0.62)) 0 4%, transparent 20%),
        linear-gradient(135deg, var(--video-creative-a, #16304a), var(--video-creative-b, #315d7a) 56%, var(--video-creative-c, #86d7ec));
}

.video-creative-card-preview::before {
    position: absolute;
    inset: 0;
    content: '';
    opacity: 0.24;
    background:
        linear-gradient(120deg, transparent 0 38%, rgba(255, 255, 255, 0.33) 38.5% 39%, transparent 39.5% 100%),
        linear-gradient(26deg, transparent 0 59%, rgba(3, 9, 14, 0.42) 59.5% 100%);
}

.video-creative-card-preview::after {
    position: absolute;
    inset: 0;
    content: '';
    opacity: 0.18;
    background-image:
        linear-gradient(90deg, transparent 0 47%, rgba(255, 255, 255, 0.1) 48% 52%, transparent 53%),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.26) 0 1px, transparent 1px 4px);
    mix-blend-mode: soft-light;
}

.video-creative-card-preview svg,
.video-creative-card-preview small {
    position: relative;
    z-index: 1;
}

.video-creative-card-preview svg {
    width: 30px;
    height: 30px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.28));
}

.video-creative-card-preview small {
    position: absolute;
    right: 9px;
    bottom: 8px;
    max-width: calc(100% - 18px);
    overflow: hidden;
    padding: 3px 6px;
    color: #f5fcff;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: rgba(5, 12, 17, 0.48);
    border: 1px solid rgba(218, 246, 255, 0.18);
    border-radius: 5px;
    font-size: 10px;
    font-weight: 650;
}

.video-creative-card-content {
    display: grid;
    gap: 5px;
    padding: 11px 12px 13px;
}

.video-creative-card-content strong {
    overflow: hidden;
    color: #eff8fc;
    font-size: 14px;
    font-weight: 760;
    letter-spacing: 0.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-creative-card-content small {
    display: -webkit-box;
    min-height: 34px;
    overflow: hidden;
    color: #9eafb9;
    font-size: 11px;
    line-height: 1.52;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.video-creative-card-content em {
    display: block;
    overflow: hidden;
    color: #7dcfff;
    font-size: 10px;
    font-style: normal;
    font-weight: 570;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-creative-favorite {
    position: absolute;
    z-index: 2;
    top: 8px;
    right: 8px;
    display: inline-grid;
    width: 29px;
    height: 29px;
    place-items: center;
    color: rgba(255, 255, 255, 0.88);
    background: rgba(5, 12, 17, 0.48);
    border: 1px solid rgba(218, 246, 255, 0.2);
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

.video-creative-favorite:hover,
.video-creative-favorite.active {
    color: #ffe28a;
    background: rgba(75, 59, 18, 0.64);
    border-color: rgba(255, 218, 105, 0.58);
}

.video-creative-favorite svg {
    width: 15px;
    height: 15px;
}

.video-creative-favorite.active svg {
    fill: currentColor;
}

.video-creative-empty {
    display: grid;
    grid-column: 1 / -1;
    min-height: 230px;
    place-content: center;
    justify-items: center;
    gap: 9px;
    color: #a8b7c0;
    text-align: center;
}

.video-creative-empty svg {
    width: 32px;
    height: 32px;
    color: #62808f;
}

.video-creative-empty strong {
    color: #d9e8ef;
    font-size: 15px;
}

.video-creative-empty span {
    color: #85949d;
    font-size: 12px;
}

.video-creative-library-footer {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 70px;
    padding: 12px 24px;
    background: rgba(4, 9, 13, 0.25);
    border-top: 1px solid rgba(255, 255, 255, 0.075);
}

.video-creative-selection-summary {
    flex: 1 1 auto;
    flex-wrap: wrap;
    gap: 7px;
    min-width: 0;
}

.video-creative-selection-summary > span {
    flex: 0 0 auto;
    color: #91a2ac;
    font-size: 12px;
}

.video-creative-selection-summary > span.empty {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-creative-selection-summary button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 190px;
    height: 29px;
    padding: 0 8px;
    overflow: hidden;
    color: #d9f1ff;
    background: rgba(35, 124, 177, 0.22);
    border: 1px solid rgba(87, 190, 245, 0.38);
    border-radius: 7px;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-creative-selection-summary button:hover {
    color: #fff;
    background: rgba(48, 147, 205, 0.34);
}

.video-creative-selection-summary button svg {
    flex: 0 0 auto;
    width: 13px;
    height: 13px;
}

.video-creative-library-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
}

.video-creative-library-actions button {
    height: 36px;
    padding: 0 13px;
    color: #afbec7;
    background: transparent;
    border: 1px solid rgba(207, 236, 249, 0.14);
    border-radius: 9px;
    font-size: 13px;
    font-weight: 680;
    white-space: nowrap;
}

.video-creative-library-actions .video-creative-reset:hover {
    color: #f1f9fc;
    background: rgba(255, 255, 255, 0.07);
}

.video-creative-library-actions .video-creative-apply {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #082335;
    background: #c6efff;
    border-color: #c6efff;
}

.video-creative-library-actions .video-creative-apply:hover:not(:disabled) {
    background: #f1fbff;
    border-color: #f1fbff;
}

.video-creative-library-actions .video-creative-apply:disabled {
    color: #78858c;
    background: #455057;
    border-color: #455057;
    cursor: not-allowed;
}

.video-creative-library-actions .video-creative-apply.clear-mode {
    color: #d8f4ff;
    background: rgba(32, 132, 190, 0.28);
    border-color: rgba(78, 191, 249, 0.54);
}

.video-creative-library-actions svg {
    width: 16px;
    height: 16px;
}

.video-creative-library button:focus-visible,
.video-creative-library input:focus-visible {
    outline: 2px solid #79d7ff;
    outline-offset: 2px;
}

@media (max-width: 760px) {
    .video-creative-library {
        width: min(100%, calc(100vw - 24px));
        height: min(780px, calc(100dvh - 28px));
        max-height: calc(100vh - 28px);
    }

    .video-creative-library-toolbar {
        align-items: stretch;
        flex-direction: column;
        gap: 11px;
    }

    .video-creative-search,
    .video-creative-library-search {
        flex-basis: 42px;
        width: auto;
    }

    .video-creative-grid {
        grid-template-columns: repeat(auto-fill, minmax(166px, 1fr));
    }

    .video-creative-canvas-cards,
    .video-creative-canvas-grid {
        grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
    }
}

@media (max-width: 560px) {
    .video-creative-library-overlay {
        align-items: end;
        padding: 8px;
    }

    .video-creative-library,
    .video-creative-library.is-expanded {
        width: 100%;
        height: min(840px, calc(100dvh - 16px));
        max-height: calc(100vh - 16px);
        border-radius: 18px;
    }

    .video-creative-library-header {
        min-height: 56px;
        padding: 0 14px;
    }

    .video-creative-library-title {
        gap: 7px;
        font-size: 16px;
    }

    .video-creative-library-title em {
        display: none;
    }

    .video-creative-library-header-actions .video-creative-library-expand {
        display: none;
    }

    .video-creative-library-toolbar {
        padding: 12px 14px 10px;
    }

    .video-creative-library-views {
        width: 100%;
    }

    .video-creative-library-views button {
        flex: 1 0 auto;
        padding: 0 10px;
        text-align: center;
    }

    .video-creative-library-filters {
        gap: 6px;
        padding: 0 14px 9px;
    }

    .video-creative-library-filters button {
        height: 29px;
        padding: 0 10px;
    }

    .video-creative-result-count {
        display: none;
    }

    .video-creative-library-tip {
        align-items: flex-start;
        padding: 8px 14px;
        font-size: 11px;
    }

    .video-creative-canvas-cards,
    .video-creative-canvas-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-height: 154px;
        padding: 9px 14px;
    }

    .video-creative-canvas-card {
        grid-template-columns: 40px minmax(0, 1fr);
        min-height: 56px;
        gap: 7px;
        padding: 6px;
    }

    .video-creative-canvas-card img,
    .video-creative-canvas-card video,
    .video-creative-canvas-card .video-creative-canvas-card-preview,
    .video-creative-canvas-card .video-creative-canvas-card-thumb {
        width: 40px;
        height: 40px;
    }

    .video-creative-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
        padding: 12px 14px 16px;
    }

    .video-creative-card,
    .video-creative-card-select {
        min-height: 184px;
    }

    .video-creative-card-preview {
        flex-basis: 76px;
    }

    .video-creative-card-content {
        gap: 4px;
        padding: 9px 10px 11px;
    }

    .video-creative-card-content strong {
        font-size: 13px;
    }

    .video-creative-card-content small {
        min-height: 31px;
        font-size: 10px;
    }

    .video-creative-library-footer {
        align-items: stretch;
        flex-direction: column;
        gap: 9px;
        min-height: 0;
        padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    }

    .video-creative-selection-summary {
        max-height: 60px;
        overflow: auto;
    }

    .video-creative-library-actions {
        width: 100%;
    }

    .video-creative-library-actions button {
        flex: 1;
    }

    .video-composer-panel .video-preset-trigger {
        max-width: 48vw;
    }
}

@media (prefers-reduced-motion: reduce) {
    .video-creative-library-overlay,
    .video-creative-card,
    .video-creative-canvas-card,
    .video-creative-library {
        animation: none;
        transition: none;
    }
}

/* 文本转脚本工作台：独立覆盖层，避免影响画布和既有创作面板。 */
.text-to-script-overlay {
    position: fixed;
    z-index: 5600;
    inset: 0;
    display: grid;
    place-items: center;
    box-sizing: border-box;
    padding: max(18px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
    overflow: auto;
    overscroll-behavior: contain;
    background:
        radial-gradient(circle at 18% 0%, rgba(62, 137, 255, 0.16), transparent 32%),
        radial-gradient(circle at 90% 100%, rgba(111, 83, 255, 0.13), transparent 31%),
        rgba(5, 7, 11, 0.78);
    backdrop-filter: blur(16px) saturate(0.88);
    -webkit-backdrop-filter: blur(16px) saturate(0.88);
    animation: textToScriptOverlayIn 180ms ease-out;
}

.text-to-script-overlay[hidden] {
    display: none !important;
}

@keyframes textToScriptOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.text-to-script-studio {
    --tts-bg: #202226;
    --tts-surface: #292b2f;
    --tts-surface-raised: #303238;
    --tts-surface-input: #1a1c20;
    --tts-border: rgba(255, 255, 255, 0.10);
    --tts-border-soft: rgba(255, 255, 255, 0.065);
    --tts-text: #f3f6fa;
    --tts-text-secondary: #aeb7c2;
    --tts-text-muted: #7f8995;
    --tts-accent: #8fc9ff;
    --tts-accent-strong: #4b99ee;
    --tts-accent-soft: rgba(68, 149, 239, 0.16);
    --tts-success: #83d5a3;
    --tts-warning: #f5c276;
    --tts-danger: #ff9a9a;
    width: min(1480px, calc(100vw - 44px));
    height: min(900px, calc(100dvh - 44px));
    max-height: calc(100vh - 44px);
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    overflow: hidden;
    color: var(--tts-text);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.028), transparent 170px),
        linear-gradient(180deg, #292b30 0%, var(--tts-bg) 72%, #1d1f23 100%);
    border: 1px solid var(--tts-border);
    border-radius: 22px;
    box-shadow: 0 34px 110px rgba(0, 0, 0, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.055);
    isolation: isolate;
}

.text-to-script-studio.is-expanded {
    width: calc(100vw - 20px);
    height: calc(100dvh - 20px);
    max-height: calc(100vh - 20px);
    border-radius: 17px;
}

.text-to-script-studio button,
.text-to-script-studio input,
.text-to-script-studio textarea,
.text-to-script-studio select {
    font: inherit;
}

.text-to-script-studio button {
    border: 0;
    cursor: pointer;
}

.text-to-script-studio button:disabled {
    cursor: not-allowed;
}

.text-to-script-studio ::selection {
    color: #f7fbff;
    background: rgba(93, 171, 255, 0.42);
}

/* 顶栏 */
.text-to-script-studio .tts-header,
.text-to-script-studio .tts-studio-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 66px;
    padding: 0 24px;
    border-bottom: 1px solid var(--tts-border-soft);
}

.text-to-script-studio .tts-title,
.text-to-script-studio .tts-title-group,
.text-to-script-studio .tts-header-title {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 10px;
}

.text-to-script-studio .tts-title > svg,
.text-to-script-studio .tts-title-group > svg,
.text-to-script-studio .tts-header-title > svg {
    flex: 0 0 auto;
    width: 21px;
    height: 21px;
    color: var(--tts-accent);
}

.text-to-script-studio .tts-title strong,
.text-to-script-studio .tts-title-group strong,
.text-to-script-studio .tts-header-title strong {
    overflow: hidden;
    color: #f6f8fb;
    font-size: 18px;
    font-weight: 760;
    letter-spacing: 0.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-to-script-studio .tts-title small,
.text-to-script-studio .tts-title em,
.text-to-script-studio .tts-title-group small,
.text-to-script-studio .tts-header-title small,
.text-to-script-studio .tts-subtitle {
    overflow: hidden;
    color: var(--tts-text-muted);
    font-size: 12px;
    font-style: normal;
    font-weight: 540;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-to-script-studio .tts-header-actions,
.text-to-script-studio .tts-actions,
.text-to-script-studio .tts-toolbar-actions,
.text-to-script-studio .tts-footer-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
}

.text-to-script-studio .tts-icon-btn,
.text-to-script-studio .tts-header-actions > button:not(.tts-btn),
.text-to-script-studio .tts-header-actions > [role="button"] {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    color: #b7c0ca;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    transition: color 140ms ease, background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.text-to-script-studio .tts-icon-btn:hover:not(:disabled),
.text-to-script-studio .tts-header-actions > button:not(.tts-btn):hover:not(:disabled),
.text-to-script-studio .tts-header-actions > [role="button"]:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.085);
    border-color: rgba(255, 255, 255, 0.07);
}

.text-to-script-studio .tts-icon-btn:active:not(:disabled),
.text-to-script-studio .tts-header-actions > button:not(.tts-btn):active:not(:disabled) {
    transform: translateY(1px);
}

.text-to-script-studio .tts-icon-btn svg,
.text-to-script-studio .tts-header-actions svg {
    width: 18px;
    height: 18px;
}

/* 阶段栏 */
.text-to-script-studio .tts-stagebar,
.text-to-script-studio .tts-stage-bar,
.text-to-script-studio .tts-stage-nav,
.text-to-script-studio .tts-stages {
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 56px;
    padding: 9px 24px;
    overflow-x: auto;
    scrollbar-width: thin;
    border-bottom: 1px solid var(--tts-border-soft);
}

.text-to-script-studio .tts-stagebar::-webkit-scrollbar,
.text-to-script-studio .tts-stage-bar::-webkit-scrollbar,
.text-to-script-studio .tts-stage-nav::-webkit-scrollbar,
.text-to-script-studio .tts-stages::-webkit-scrollbar {
    height: 5px;
}

.text-to-script-studio .tts-stagebar::-webkit-scrollbar-thumb,
.text-to-script-studio .tts-stage-bar::-webkit-scrollbar-thumb,
.text-to-script-studio .tts-stage-nav::-webkit-scrollbar-thumb,
.text-to-script-studio .tts-stages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
}

.text-to-script-studio .tts-stage,
.text-to-script-studio .tts-stage-btn,
.text-to-script-studio .tts-stage-item {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 12px 0 8px;
    color: var(--tts-text-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 680;
    white-space: nowrap;
    transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.text-to-script-studio .tts-stage-index,
.text-to-script-studio .tts-stage-number,
.text-to-script-studio .tts-stage > b,
.text-to-script-studio .tts-stage-btn > b,
.text-to-script-studio .tts-stage-item > b {
    display: inline-grid;
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    place-items: center;
    color: #8994a1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.065);
    border-radius: 50%;
    font-size: 10px;
    font-weight: 760;
}

.text-to-script-studio .tts-stage:hover:not(:disabled),
.text-to-script-studio .tts-stage-btn:hover:not(:disabled),
.text-to-script-studio .tts-stage-item:hover:not(:disabled) {
    color: #e8eef5;
    background: rgba(255, 255, 255, 0.055);
}

.text-to-script-studio .tts-stage.is-active,
.text-to-script-studio .tts-stage.active,
.text-to-script-studio .tts-stage[aria-current="step"],
.text-to-script-studio .tts-stage-btn.is-active,
.text-to-script-studio .tts-stage-btn.active,
.text-to-script-studio .tts-stage-item.is-active,
.text-to-script-studio .tts-stage-item.active {
    color: #f3f8ff;
    background: var(--tts-accent-soft);
    border-color: rgba(115, 184, 255, 0.30);
}

.text-to-script-studio .tts-stage.is-active .tts-stage-index,
.text-to-script-studio .tts-stage.active .tts-stage-index,
.text-to-script-studio .tts-stage[aria-current="step"] .tts-stage-index,
.text-to-script-studio .tts-stage-btn.is-active .tts-stage-index,
.text-to-script-studio .tts-stage-btn.active .tts-stage-index,
.text-to-script-studio .tts-stage-item.is-active .tts-stage-index,
.text-to-script-studio .tts-stage-item.active .tts-stage-index {
    color: #0e2941;
    background: #9cd2ff;
    border-color: #9cd2ff;
}

.text-to-script-studio .tts-stage.is-complete .tts-stage-index,
.text-to-script-studio .tts-stage.completed .tts-stage-index,
.text-to-script-studio .tts-stage-btn.is-complete .tts-stage-index,
.text-to-script-studio .tts-stage-item.is-complete .tts-stage-index {
    color: #123526;
    background: #8ad3a8;
    border-color: #8ad3a8;
}

/* 工具栏与内容框架 */
.text-to-script-studio .tts-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 64px;
    padding: 11px 24px;
    background: rgba(8, 10, 14, 0.16);
    border-bottom: 1px solid var(--tts-border-soft);
}

.text-to-script-studio .tts-toolbar-group,
.text-to-script-studio .tts-toolbar-left,
.text-to-script-studio .tts-toolbar-right,
.text-to-script-studio .tts-filter-group {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 8px;
}

.text-to-script-studio .tts-toolbar-label,
.text-to-script-studio .tts-toolbar strong {
    color: #eaf0f6;
    font-size: 13px;
    font-weight: 730;
    white-space: nowrap;
}

.text-to-script-studio .tts-search,
.text-to-script-studio .tts-search-box,
.text-to-script-studio .tts-field {
    display: flex;
    flex: 0 1 340px;
    align-items: center;
    gap: 8px;
    min-width: 150px;
    height: 38px;
    padding: 0 11px;
    color: #8d99a6;
    background: var(--tts-surface-input);
    border: 1px solid var(--tts-border);
    border-radius: 10px;
    transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.text-to-script-studio .tts-search:focus-within,
.text-to-script-studio .tts-search-box:focus-within,
.text-to-script-studio .tts-field:focus-within {
    background: #1c1f24;
    border-color: rgba(111, 183, 255, 0.64);
    box-shadow: 0 0 0 3px rgba(72, 151, 237, 0.13);
}

.text-to-script-studio .tts-search svg,
.text-to-script-studio .tts-search-box svg,
.text-to-script-studio .tts-field svg {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
}

.text-to-script-studio .tts-search input,
.text-to-script-studio .tts-search-box input,
.text-to-script-studio .tts-field input,
.text-to-script-studio .tts-field select {
    min-width: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    color: #edf3f9;
    background: transparent;
    border: 0;
    outline: 0;
    font-size: 13px;
}

.text-to-script-studio .tts-search input::placeholder,
.text-to-script-studio .tts-search-box input::placeholder,
.text-to-script-studio .tts-field input::placeholder {
    color: #707b88;
}

.text-to-script-studio .tts-filter,
.text-to-script-studio .tts-filter-btn,
.text-to-script-studio .tts-chip {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 10px;
    color: #abb5c0;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.075);
    border-radius: 9px;
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
    transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}

.text-to-script-studio .tts-filter:hover:not(:disabled),
.text-to-script-studio .tts-filter-btn:hover:not(:disabled),
.text-to-script-studio .tts-chip:hover:not(:disabled) {
    color: #eef5fc;
    background: rgba(255, 255, 255, 0.075);
    border-color: rgba(255, 255, 255, 0.13);
}

.text-to-script-studio .tts-filter.is-active,
.text-to-script-studio .tts-filter.active,
.text-to-script-studio .tts-filter-btn.is-active,
.text-to-script-studio .tts-filter-btn.active,
.text-to-script-studio .tts-chip.is-active,
.text-to-script-studio .tts-chip.active {
    color: #e7f4ff;
    background: var(--tts-accent-soft);
    border-color: rgba(113, 185, 255, 0.34);
}

.text-to-script-studio .tts-workspace,
.text-to-script-studio .tts-content,
.text-to-script-studio .tts-workbench {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
    overflow: hidden;
}

.text-to-script-studio .tts-main,
.text-to-script-studio .tts-main-panel,
.text-to-script-studio .tts-editor-area {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.text-to-script-studio .tts-sidebar,
.text-to-script-studio .tts-side-panel,
.text-to-script-studio .tts-inspector {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    background: rgba(8, 10, 14, 0.19);
    border-left: 1px solid var(--tts-border-soft);
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.text-to-script-studio .tts-main::-webkit-scrollbar,
.text-to-script-studio .tts-main-panel::-webkit-scrollbar,
.text-to-script-studio .tts-editor-area::-webkit-scrollbar,
.text-to-script-studio .tts-sidebar::-webkit-scrollbar,
.text-to-script-studio .tts-side-panel::-webkit-scrollbar,
.text-to-script-studio .tts-inspector::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.text-to-script-studio .tts-main::-webkit-scrollbar-thumb,
.text-to-script-studio .tts-main-panel::-webkit-scrollbar-thumb,
.text-to-script-studio .tts-editor-area::-webkit-scrollbar-thumb,
.text-to-script-studio .tts-sidebar::-webkit-scrollbar-thumb,
.text-to-script-studio .tts-side-panel::-webkit-scrollbar-thumb,
.text-to-script-studio .tts-inspector::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.16);
    border: 2px solid transparent;
    border-radius: 999px;
    background-clip: padding-box;
}

.text-to-script-studio .tts-panel,
.text-to-script-studio .tts-section,
.text-to-script-studio .tts-sidebar-section {
    padding: 18px 20px;
}

.text-to-script-studio .tts-panel + .tts-panel,
.text-to-script-studio .tts-section + .tts-section,
.text-to-script-studio .tts-sidebar-section + .tts-sidebar-section {
    border-top: 1px solid var(--tts-border-soft);
}

.text-to-script-studio .tts-panel-header,
.text-to-script-studio .tts-section-header,
.text-to-script-studio .tts-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 26px;
    margin-bottom: 13px;
}

.text-to-script-studio .tts-panel-header h2,
.text-to-script-studio .tts-panel-header h3,
.text-to-script-studio .tts-section-header h2,
.text-to-script-studio .tts-section-header h3,
.text-to-script-studio .tts-section-title {
    margin: 0;
    color: #eaf0f7;
    font-size: 14px;
    font-weight: 740;
    letter-spacing: 0.01em;
}

.text-to-script-studio .tts-count,
.text-to-script-studio .tts-badge,
.text-to-script-studio .tts-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 22px;
    padding: 0 7px;
    color: #95bfe6;
    background: rgba(76, 155, 242, 0.12);
    border: 1px solid rgba(114, 183, 251, 0.18);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.text-to-script-studio .tts-status.is-ready,
.text-to-script-studio .tts-status.success {
    color: #a0e6ba;
    background: rgba(80, 181, 116, 0.13);
    border-color: rgba(111, 212, 145, 0.20);
}

.text-to-script-studio .tts-status.is-pending,
.text-to-script-studio .tts-status.warning {
    color: #f8cf8e;
    background: rgba(231, 163, 62, 0.12);
    border-color: rgba(245, 190, 110, 0.18);
}

/* 镜头表格 */
.text-to-script-studio .tts-shot-table-wrap,
.text-to-script-studio .tts-shot-table-scroll {
    overflow: auto;
    border: 1px solid var(--tts-border);
    border-radius: 13px;
    background: rgba(7, 9, 12, 0.16);
    scrollbar-color: rgba(255, 255, 255, 0.17) transparent;
}

.text-to-script-studio .tts-shot-table {
    width: 100%;
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0;
    color: #dbe3eb;
    font-size: 12px;
    text-align: left;
}

.text-to-script-studio .tts-shot-table th {
    position: sticky;
    z-index: 1;
    top: 0;
    padding: 11px 12px;
    color: #909ba8;
    background: #24262a;
    border-bottom: 1px solid var(--tts-border);
    font-size: 10px;
    font-weight: 740;
    letter-spacing: 0.055em;
    text-transform: uppercase;
    white-space: nowrap;
}

.text-to-script-studio .tts-shot-table td {
    padding: 11px 12px;
    vertical-align: top;
    border-bottom: 1px solid var(--tts-border-soft);
    line-height: 1.45;
}

.text-to-script-studio .tts-shot-table tbody tr {
    transition: background 130ms ease;
}

.text-to-script-studio .tts-shot-table tbody tr:hover {
    background: rgba(104, 170, 245, 0.055);
}

.text-to-script-studio .tts-shot-table tbody tr:last-child td {
    border-bottom: 0;
}

.text-to-script-studio .tts-shot-table td:first-child,
.text-to-script-studio .tts-shot-number,
.text-to-script-studio .tts-shot-index {
    color: #9dc8ef;
    font-weight: 760;
}

.text-to-script-studio .tts-shot-title,
.text-to-script-studio .tts-shot-table td strong {
    display: block;
    margin-bottom: 3px;
    color: #eef4fa;
    font-size: 12px;
    font-weight: 700;
}

.text-to-script-studio .tts-shot-summary,
.text-to-script-studio .tts-shot-note,
.text-to-script-studio .tts-shot-table td small {
    display: block;
    color: var(--tts-text-secondary);
    font-size: 11px;
    line-height: 1.48;
}

.text-to-script-studio .tts-shot-actions,
.text-to-script-studio .tts-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
}

.text-to-script-studio .tts-shot-actions button,
.text-to-script-studio .tts-row-actions button {
    display: inline-grid;
    width: 27px;
    height: 27px;
    place-items: center;
    color: #aeb9c4;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 8px;
    transition: color 130ms ease, background 130ms ease, border-color 130ms ease;
}

.text-to-script-studio .tts-shot-actions button:hover:not(:disabled),
.text-to-script-studio .tts-row-actions button:hover:not(:disabled) {
    color: #ecf7ff;
    background: rgba(91, 166, 240, 0.16);
    border-color: rgba(115, 184, 252, 0.28);
}

.text-to-script-studio .tts-shot-actions svg,
.text-to-script-studio .tts-row-actions svg {
    width: 14px;
    height: 14px;
}

.text-to-script-studio .tts-shot-list {
    display: grid;
    gap: 9px;
}

.text-to-script-studio .tts-shot-card,
.text-to-script-studio .tts-shot-row {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    align-items: start;
    gap: 11px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.028);
    border: 1px solid var(--tts-border-soft);
    border-radius: 12px;
    transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.text-to-script-studio .tts-shot-card:hover,
.text-to-script-studio .tts-shot-row:hover {
    background: rgba(94, 166, 239, 0.07);
    border-color: rgba(116, 185, 254, 0.21);
}

.text-to-script-studio .tts-shot-card.is-selected,
.text-to-script-studio .tts-shot-row.is-selected {
    background: rgba(77, 158, 241, 0.12);
    border-color: rgba(117, 188, 255, 0.38);
}

/* 资产卡 */
.text-to-script-studio .tts-asset-grid,
.text-to-script-studio .tts-assets,
.text-to-script-studio .tts-asset-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
    gap: 10px;
}

.text-to-script-studio .tts-asset-card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    color: #dce6ee;
    background: rgba(255, 255, 255, 0.032);
    border: 1px solid var(--tts-border-soft);
    border-radius: 13px;
    transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.text-to-script-studio .tts-asset-card:hover {
    background: rgba(255, 255, 255, 0.058);
    border-color: rgba(126, 191, 255, 0.28);
    box-shadow: 0 8px 23px rgba(0, 0, 0, 0.18);
    transform: translateY(-1px);
}

.text-to-script-studio .tts-asset-card.is-selected,
.text-to-script-studio .tts-asset-card.active {
    border-color: rgba(130, 199, 255, 0.60);
    box-shadow: 0 0 0 2px rgba(76, 158, 244, 0.14);
}

.text-to-script-studio .tts-asset-thumb,
.text-to-script-studio .tts-asset-preview {
    position: relative;
    display: grid;
    min-height: 92px;
    place-items: center;
    overflow: hidden;
    color: #85bdea;
    background: linear-gradient(135deg, #292d34, #1e2025);
    border-bottom: 1px solid var(--tts-border-soft);
}

.text-to-script-studio .tts-asset-thumb img,
.text-to-script-studio .tts-asset-thumb video,
.text-to-script-studio .tts-asset-preview img,
.text-to-script-studio .tts-asset-preview video {
    width: 100%;
    height: 100%;
    min-height: 92px;
    object-fit: cover;
}

.text-to-script-studio .tts-asset-thumb svg,
.text-to-script-studio .tts-asset-preview svg {
    width: 25px;
    height: 25px;
}

.text-to-script-studio .tts-asset-body,
.text-to-script-studio .tts-asset-content {
    display: grid;
    gap: 4px;
    padding: 10px 11px 11px;
}

.text-to-script-studio .tts-asset-name,
.text-to-script-studio .tts-asset-body strong,
.text-to-script-studio .tts-asset-content strong {
    overflow: hidden;
    color: #edf3f8;
    font-size: 12px;
    font-weight: 690;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-to-script-studio .tts-asset-meta,
.text-to-script-studio .tts-asset-body small,
.text-to-script-studio .tts-asset-content small {
    overflow: hidden;
    color: var(--tts-text-muted);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-to-script-studio .tts-asset-card .tts-badge,
.text-to-script-studio .tts-asset-card .tts-status {
    position: absolute;
    z-index: 1;
    top: 8px;
    right: 8px;
    box-shadow: 0 2px 9px rgba(0, 0, 0, 0.23);
}

/* 提示词卡 */
.text-to-script-studio .tts-prompt-list,
.text-to-script-studio .tts-prompts {
    display: grid;
    gap: 10px;
}

.text-to-script-studio .tts-prompt-card {
    display: grid;
    gap: 9px;
    padding: 13px;
    color: #dce5ee;
    background: linear-gradient(135deg, rgba(71, 125, 184, 0.115), rgba(255, 255, 255, 0.028));
    border: 1px solid rgba(112, 178, 248, 0.17);
    border-radius: 13px;
}

.text-to-script-studio .tts-prompt-card.is-selected,
.text-to-script-studio .tts-prompt-card.active {
    background: linear-gradient(135deg, rgba(73, 154, 238, 0.19), rgba(255, 255, 255, 0.04));
    border-color: rgba(126, 195, 255, 0.39);
}

.text-to-script-studio .tts-prompt-head,
.text-to-script-studio .tts-prompt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 9px;
}

.text-to-script-studio .tts-prompt-label,
.text-to-script-studio .tts-prompt-head strong,
.text-to-script-studio .tts-prompt-header strong {
    color: #d7ebff;
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.035em;
}

.text-to-script-studio .tts-prompt-copy,
.text-to-script-studio .tts-copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 26px;
    padding: 0 8px;
    color: #aab9c8;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 7px;
    font-size: 10px;
    font-weight: 680;
    transition: color 130ms ease, background 130ms ease, border-color 130ms ease;
}

.text-to-script-studio .tts-prompt-copy:hover:not(:disabled),
.text-to-script-studio .tts-copy-btn:hover:not(:disabled) {
    color: #f2f8ff;
    background: rgba(93, 167, 238, 0.16);
    border-color: rgba(122, 190, 255, 0.29);
}

.text-to-script-studio .tts-prompt-copy svg,
.text-to-script-studio .tts-copy-btn svg {
    width: 13px;
    height: 13px;
}

.text-to-script-studio .tts-prompt-text,
.text-to-script-studio .tts-prompt-card textarea,
.text-to-script-studio .tts-prompt-card pre {
    width: 100%;
    min-height: 76px;
    margin: 0;
    padding: 10px;
    overflow: auto;
    color: #bcc9d7;
    background: rgba(7, 10, 14, 0.30);
    border: 1px solid rgba(255, 255, 255, 0.055);
    border-radius: 9px;
    outline: 0;
    font-family: inherit;
    font-size: 11px;
    line-height: 1.56;
    white-space: pre-wrap;
}

.text-to-script-studio .tts-prompt-card textarea:focus {
    color: #e9f2fa;
    border-color: rgba(118, 188, 255, 0.54);
    box-shadow: 0 0 0 3px rgba(74, 158, 243, 0.12);
}

/* 通用输入、按钮与空状态 */
.text-to-script-studio .tts-textarea,
.text-to-script-studio .tts-input,
.text-to-script-studio .tts-panel textarea:not(.tts-prompt-text),
.text-to-script-studio .tts-panel input:not([type="checkbox"]):not([type="radio"]) {
    width: 100%;
    color: #e9f0f7;
    background: var(--tts-surface-input);
    border: 1px solid var(--tts-border);
    border-radius: 10px;
    outline: 0;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.text-to-script-studio .tts-textarea,
.text-to-script-studio .tts-panel textarea:not(.tts-prompt-text) {
    min-height: 112px;
    padding: 11px 12px;
    resize: vertical;
    font-size: 12px;
    line-height: 1.55;
}

.text-to-script-studio .tts-input,
.text-to-script-studio .tts-panel input:not([type="checkbox"]):not([type="radio"]) {
    height: 38px;
    padding: 0 11px;
    font-size: 12px;
}

.text-to-script-studio .tts-textarea:focus,
.text-to-script-studio .tts-input:focus,
.text-to-script-studio .tts-panel textarea:not(.tts-prompt-text):focus,
.text-to-script-studio .tts-panel input:not([type="checkbox"]):not([type="radio"]):focus {
    border-color: rgba(116, 188, 255, 0.62);
    box-shadow: 0 0 0 3px rgba(73, 156, 240, 0.13);
}

.text-to-script-studio .tts-btn,
.text-to-script-studio .tts-primary-btn,
.text-to-script-studio .tts-secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    transition: color 140ms ease, background 140ms ease, border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.text-to-script-studio .tts-primary-btn,
.text-to-script-studio .tts-btn.is-primary,
.text-to-script-studio .tts-btn.primary {
    color: #082238;
    background: #a5d7ff;
    border-color: #a5d7ff;
    box-shadow: 0 5px 15px rgba(39, 143, 233, 0.19);
}

.text-to-script-studio .tts-primary-btn:hover:not(:disabled),
.text-to-script-studio .tts-btn.is-primary:hover:not(:disabled),
.text-to-script-studio .tts-btn.primary:hover:not(:disabled) {
    color: #041c30;
    background: #d1ecff;
    border-color: #d1ecff;
    box-shadow: 0 7px 19px rgba(48, 155, 249, 0.27);
}

.text-to-script-studio .tts-secondary-btn,
.text-to-script-studio .tts-btn:not(.is-primary):not(.primary) {
    color: #c4d0dc;
    background: rgba(255, 255, 255, 0.052);
    border-color: rgba(255, 255, 255, 0.105);
}

.text-to-script-studio .tts-secondary-btn:hover:not(:disabled),
.text-to-script-studio .tts-btn:not(.is-primary):not(.primary):hover:not(:disabled) {
    color: #f0f6fb;
    background: rgba(255, 255, 255, 0.092);
    border-color: rgba(255, 255, 255, 0.18);
}

.text-to-script-studio .tts-btn:active:not(:disabled),
.text-to-script-studio .tts-primary-btn:active:not(:disabled),
.text-to-script-studio .tts-secondary-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.text-to-script-studio .tts-btn:disabled,
.text-to-script-studio .tts-primary-btn:disabled,
.text-to-script-studio .tts-secondary-btn:disabled {
    color: #7e8994;
    background: #3a3d42;
    border-color: #3a3d42;
    box-shadow: none;
}

.text-to-script-studio .tts-btn svg,
.text-to-script-studio .tts-primary-btn svg,
.text-to-script-studio .tts-secondary-btn svg {
    width: 15px;
    height: 15px;
}

.text-to-script-studio .tts-empty,
.text-to-script-studio .tts-empty-state {
    display: grid;
    min-height: 180px;
    place-items: center;
    align-content: center;
    gap: 8px;
    padding: 24px;
    color: var(--tts-text-muted);
    text-align: center;
    background: rgba(255, 255, 255, 0.018);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: 14px;
}

.text-to-script-studio .tts-empty svg,
.text-to-script-studio .tts-empty-state svg {
    width: 27px;
    height: 27px;
    color: #83bcea;
}

.text-to-script-studio .tts-empty strong,
.text-to-script-studio .tts-empty-state strong {
    color: #d9e5ef;
    font-size: 13px;
    font-weight: 700;
}

.text-to-script-studio .tts-empty small,
.text-to-script-studio .tts-empty-state small {
    max-width: 300px;
    font-size: 11px;
    line-height: 1.5;
}

/* 底栏 */
.text-to-script-studio .tts-footer,
.text-to-script-studio .tts-studio-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    min-height: 62px;
    padding: 11px 24px;
    background: rgba(10, 12, 16, 0.42);
    border-top: 1px solid var(--tts-border);
}

.text-to-script-studio .tts-footer-meta,
.text-to-script-studio .tts-save-state,
.text-to-script-studio .tts-footer-note {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 7px;
    color: var(--tts-text-muted);
    font-size: 11px;
}

.text-to-script-studio .tts-footer-meta svg,
.text-to-script-studio .tts-save-state svg,
.text-to-script-studio .tts-footer-note svg {
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
    color: #89c7f6;
}

.text-to-script-studio .tts-footer-meta.is-saved,
.text-to-script-studio .tts-save-state.is-saved {
    color: #a4dbb8;
}

.text-to-script-studio .tts-footer-meta.is-saved svg,
.text-to-script-studio .tts-save-state.is-saved svg {
    color: var(--tts-success);
}

.text-to-script-studio button:focus-visible,
.text-to-script-studio input:focus-visible,
.text-to-script-studio textarea:focus-visible,
.text-to-script-studio select:focus-visible,
.text-to-script-studio [role="button"]:focus-visible {
    outline: 2px solid #8fcaff;
    outline-offset: 2px;
}

@media (max-width: 1080px) {
    .text-to-script-studio {
        width: min(1120px, calc(100vw - 32px));
        height: min(900px, calc(100dvh - 32px));
        max-height: calc(100vh - 32px);
    }

    .text-to-script-studio .tts-workspace,
    .text-to-script-studio .tts-content,
    .text-to-script-studio .tts-workbench {
        grid-template-columns: minmax(0, 1fr) minmax(250px, 300px);
    }

    .text-to-script-studio .tts-header,
    .text-to-script-studio .tts-studio-header,
    .text-to-script-studio .tts-stagebar,
    .text-to-script-studio .tts-stage-bar,
    .text-to-script-studio .tts-stage-nav,
    .text-to-script-studio .tts-stages,
    .text-to-script-studio .tts-toolbar,
    .text-to-script-studio .tts-footer,
    .text-to-script-studio .tts-studio-footer {
        padding-right: 18px;
        padding-left: 18px;
    }

    .text-to-script-studio .tts-panel,
    .text-to-script-studio .tts-section,
    .text-to-script-studio .tts-sidebar-section {
        padding: 16px;
    }
}

@media (max-width: 820px) {
    .text-to-script-studio {
        grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    }

    .text-to-script-studio .tts-workspace,
    .text-to-script-studio .tts-content,
    .text-to-script-studio .tts-workbench {
        grid-template-columns: minmax(0, 1fr);
        overflow: auto;
    }

    .text-to-script-studio .tts-main,
    .text-to-script-studio .tts-main-panel,
    .text-to-script-studio .tts-editor-area,
    .text-to-script-studio .tts-sidebar,
    .text-to-script-studio .tts-side-panel,
    .text-to-script-studio .tts-inspector {
        overflow: visible;
    }

    .text-to-script-studio .tts-sidebar,
    .text-to-script-studio .tts-side-panel,
    .text-to-script-studio .tts-inspector {
        border-top: 1px solid var(--tts-border-soft);
        border-left: 0;
    }

    .text-to-script-studio .tts-toolbar {
        align-items: stretch;
        flex-wrap: wrap;
    }

    .text-to-script-studio .tts-toolbar-left,
    .text-to-script-studio .tts-toolbar-right {
        min-height: 36px;
    }

    .text-to-script-studio .tts-search,
    .text-to-script-studio .tts-search-box {
        flex: 1 1 210px;
    }
}

@media (max-width: 620px) {
    .text-to-script-overlay {
        align-items: end;
        padding: 8px;
    }

    .text-to-script-studio,
    .text-to-script-studio.is-expanded {
        width: 100%;
        height: min(880px, calc(100dvh - 16px));
        max-height: calc(100vh - 16px);
        border-radius: 18px;
    }

    .text-to-script-studio .tts-header,
    .text-to-script-studio .tts-studio-header {
        min-height: 56px;
        gap: 10px;
        padding: 0 14px;
    }

    .text-to-script-studio .tts-title strong,
    .text-to-script-studio .tts-title-group strong,
    .text-to-script-studio .tts-header-title strong {
        font-size: 16px;
    }

    .text-to-script-studio .tts-title small,
    .text-to-script-studio .tts-title em,
    .text-to-script-studio .tts-title-group small,
    .text-to-script-studio .tts-header-title small,
    .text-to-script-studio .tts-subtitle {
        display: none;
    }

    .text-to-script-studio .tts-stagebar,
    .text-to-script-studio .tts-stage-bar,
    .text-to-script-studio .tts-stage-nav,
    .text-to-script-studio .tts-stages {
        min-height: 51px;
        gap: 4px;
        padding: 7px 12px;
    }

    .text-to-script-studio .tts-stage,
    .text-to-script-studio .tts-stage-btn,
    .text-to-script-studio .tts-stage-item {
        min-height: 33px;
        padding-right: 9px;
        font-size: 11px;
    }

    .text-to-script-studio .tts-toolbar {
        gap: 9px;
        min-height: 0;
        padding: 10px 14px;
    }

    .text-to-script-studio .tts-toolbar-left,
    .text-to-script-studio .tts-toolbar-right,
    .text-to-script-studio .tts-toolbar-group {
        flex: 1 1 100%;
    }

    .text-to-script-studio .tts-toolbar-right,
    .text-to-script-studio .tts-toolbar-actions {
        justify-content: space-between;
    }

    .text-to-script-studio .tts-search,
    .text-to-script-studio .tts-search-box {
        flex: 1 1 100%;
        min-width: 0;
    }

    .text-to-script-studio .tts-panel,
    .text-to-script-studio .tts-section,
    .text-to-script-studio .tts-sidebar-section {
        padding: 14px;
    }

    .text-to-script-studio .tts-asset-grid,
    .text-to-script-studio .tts-assets,
    .text-to-script-studio .tts-asset-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .text-to-script-studio .tts-asset-thumb,
    .text-to-script-studio .tts-asset-preview,
    .text-to-script-studio .tts-asset-thumb img,
    .text-to-script-studio .tts-asset-thumb video,
    .text-to-script-studio .tts-asset-preview img,
    .text-to-script-studio .tts-asset-preview video {
        min-height: 74px;
    }

    .text-to-script-studio .tts-shot-card,
    .text-to-script-studio .tts-shot-row {
        grid-template-columns: 26px minmax(0, 1fr);
        gap: 9px;
        padding: 10px;
    }

    .text-to-script-studio .tts-shot-card .tts-shot-actions,
    .text-to-script-studio .tts-shot-card .tts-row-actions,
    .text-to-script-studio .tts-shot-row .tts-shot-actions,
    .text-to-script-studio .tts-shot-row .tts-row-actions {
        grid-column: 2;
        justify-content: flex-start;
    }

    .text-to-script-studio .tts-footer,
    .text-to-script-studio .tts-studio-footer {
        align-items: stretch;
        flex-direction: column;
        gap: 9px;
        min-height: 0;
        padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    }

    .text-to-script-studio .tts-footer-actions {
        width: 100%;
    }

    .text-to-script-studio .tts-footer-actions .tts-btn,
    .text-to-script-studio .tts-footer-actions .tts-primary-btn,
    .text-to-script-studio .tts-footer-actions .tts-secondary-btn {
        flex: 1;
    }
}

@media (max-width: 410px) {
    .text-to-script-studio .tts-header-actions > button:not(.tts-btn):not(.tts-icon-btn) {
        display: none;
    }

    .text-to-script-studio .tts-stage,
    .text-to-script-studio .tts-stage-btn,
    .text-to-script-studio .tts-stage-item {
        gap: 5px;
        padding-right: 7px;
        padding-left: 6px;
    }

    .text-to-script-studio .tts-stage-index,
    .text-to-script-studio .tts-stage-number,
    .text-to-script-studio .tts-stage > b,
    .text-to-script-studio .tts-stage-btn > b,
    .text-to-script-studio .tts-stage-item > b {
        width: 18px;
        height: 18px;
    }

    .text-to-script-studio .tts-filter-group {
        max-width: 100%;
        overflow-x: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .text-to-script-overlay,
    .text-to-script-studio,
    .text-to-script-studio .tts-stage,
    .text-to-script-studio .tts-stage-btn,
    .text-to-script-studio .tts-stage-item,
    .text-to-script-studio .tts-asset-card,
    .text-to-script-studio .tts-btn,
    .text-to-script-studio .tts-primary-btn,
    .text-to-script-studio .tts-secondary-btn {
        animation: none;
        transition: none;
    }
}

/* ==========================================================================
   画布节点视觉体系 V1
   目标：统一标题、编号和空状态层级，同时保留现有节点的紧凑操作效率。
   ========================================================================== */
body.canvas-mode .node {
    --node-accent: #9aa7b6;
    --node-accent-soft: color-mix(in srgb, var(--node-accent) 13%, transparent);
}

body.canvas-mode .node[data-node-kind="action"] {
    --node-accent: #78aef8;
}

body.canvas-mode .node.agent-node {
    --node-accent: #a993f5;
}

body.canvas-mode .node.edit-studio-node {
    --node-accent: #59c7b4;
    width: 284px;
    min-width: 284px;
    max-width: 284px;
}

body.canvas-mode .node .node-header,
body.canvas-mode .node.image-node:has(.image-preview:not([hidden])) .node-header,
body.canvas-mode .node.video-node:has(.video-preview:not([hidden])) .node-header,
body.canvas-mode .node.audio-node:has(.audio-preview:not([hidden])) .node-header,
body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .node-header,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .node-header,
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .node-header,
body.canvas-mode .text-node .node-header,
body.canvas-mode .agent-node .node-header {
    min-height: 38px;
    padding: 7px 10px;
    gap: 7px;
    box-sizing: border-box;
    background: #27292c;
    border-bottom: 1px solid rgba(255, 255, 255, 0.055);
    border-radius: 10px 10px 0 0;
}

body.canvas-mode .node .node-icon,
body.canvas-mode .node.image-node .node-icon,
body.canvas-mode .node.video-node .node-icon {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    color: var(--node-accent);
    stroke-width: 1.9;
}

body.canvas-mode .node .node-title,
body.canvas-mode .node.image-node .node-title,
body.canvas-mode .node.video-node .node-title,
body.canvas-mode .node.image-node.selected .node-title,
body.canvas-mode .node.video-node.selected .node-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    color: #e1e5eb;
    font-size: 13px;
    font-weight: 650;
    line-height: 20px;
    letter-spacing: 0.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.canvas-mode .node .node-sequence-badge,
body.canvas-mode .image-node .media-node-number,
body.canvas-mode .video-node .media-node-number {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    height: 20px;
    padding: 0 6px;
    color: color-mix(in srgb, var(--node-accent) 82%, #dbeafe);
    background: color-mix(in srgb, var(--node-accent) 10%, rgba(255, 255, 255, 0.025));
    border: 1px solid color-mix(in srgb, var(--node-accent) 20%, rgba(255, 255, 255, 0.06));
    border-radius: 6px;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.025em;
    white-space: nowrap;
}

body.canvas-mode .node.selected .node-sequence-badge,
body.canvas-mode .image-node.selected .media-node-number,
body.canvas-mode .video-node.selected .media-node-number {
    color: color-mix(in srgb, var(--node-accent) 72%, #fff);
    background: color-mix(in srgb, var(--node-accent) 16%, transparent);
    border-color: color-mix(in srgb, var(--node-accent) 34%, transparent);
}

body.canvas-mode .node .node-close {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    margin-left: 1px;
    opacity: 0.38;
    transition: opacity 140ms ease, color 140ms ease, background 140ms ease;
}

body.canvas-mode .node:hover .node-close,
body.canvas-mode .node.selected .node-close,
body.canvas-mode .node .node-close:focus-visible {
    opacity: 1;
}

body.canvas-mode .node:not(.image-node):not(.video-node).selected {
    border-color: color-mix(in srgb, var(--node-accent) 52%, #3f4248);
    box-shadow:
        0 0 0 1px color-mix(in srgb, var(--node-accent) 16%, transparent),
        0 12px 32px rgba(0, 0, 0, 0.3);
}

body.canvas-mode .node.image-node.selected .image-preview-box,
body.canvas-mode .node.video-node.selected .video-preview-box {
    border-color: color-mix(in srgb, var(--node-accent) 58%, #4c5159);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--node-accent) 12%, transparent);
}

/* 统一空素材节点：主操作优先，其余能力按列表清晰呈现。 */
body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .node-content,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .node-content,
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .node-content,
body.canvas-mode .text-node .node-content {
    height: calc(100% - 38px);
}

body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .image-preview-box,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .video-preview-box,
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .audio-preview-box {
    border-color: rgba(148, 163, 184, 0.28);
    background: #181a1d;
}

body.canvas-mode .media-empty-state {
    min-height: 0;
    gap: 4px;
}

body.canvas-mode .media-empty-state > svg {
    width: 22px;
    height: 22px;
    color: color-mix(in srgb, var(--node-accent) 70%, #8b949f);
}

body.canvas-mode .media-empty-state > strong {
    color: #dce1e8;
    font-size: 12px;
    font-weight: 650;
}

body.canvas-mode .media-empty-actions {
    display: grid;
    width: min(206px, calc(100% - 20px));
    grid-template-columns: 1fr;
    gap: 4px;
    margin-top: 3px;
}

body.canvas-mode .media-empty-actions button {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: 25px;
    padding: 0 9px;
    gap: 7px;
    color: #9ea8b5;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.055);
    border-radius: 6px;
    font-size: 10px;
    line-height: 1;
}

body.canvas-mode .media-empty-actions button:first-child {
    color: color-mix(in srgb, var(--node-accent) 68%, #eef6ff);
    background: color-mix(in srgb, var(--node-accent) 11%, rgba(255, 255, 255, 0.025));
    border-color: color-mix(in srgb, var(--node-accent) 22%, rgba(255, 255, 255, 0.055));
}

body.canvas-mode .media-empty-actions button:hover,
body.canvas-mode .media-empty-actions button:first-child:hover {
    color: #f0f5fb;
    background: color-mix(in srgb, var(--node-accent) 17%, rgba(255, 255, 255, 0.035));
    border-color: color-mix(in srgb, var(--node-accent) 34%, rgba(255, 255, 255, 0.08));
}

body.canvas-mode .media-empty-actions button svg {
    flex: 0 0 auto;
    width: 13px;
    height: 13px;
}

/* 文本节点沿用同一信息顺序：输入区 → 可尝试能力 → 文件入口。 */
body.canvas-mode .text-prompt-starters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    margin-top: 5px;
}

body.canvas-mode .text-prompt-starters > span {
    grid-column: 1 / -1;
    grid-row: auto;
    padding: 0 1px;
    color: #7f8997;
    font-size: 9px;
    line-height: 12px;
}

body.canvas-mode .text-prompt-starters button {
    justify-content: flex-start;
    height: 23px;
    padding: 0 6px;
    color: #a9b2bf;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.045);
    border-radius: 6px;
}

body.canvas-mode .text-prompt-starters button:hover {
    color: #e7eef8;
    background: rgba(255, 255, 255, 0.055);
    border-color: rgba(255, 255, 255, 0.08);
}

body.canvas-mode .text-node .text-upload-row {
    margin-top: 5px;
}

body.canvas-mode .text-node .text-upload-btn {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.025);
}

/* Lib 风格的方形基础节点：文本、轻剪辑、音频统一为 284 × 284。 */
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]),
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):hover,
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]).selected,
body.canvas-mode .node.audio-node,
body.canvas-mode .node.audio-node:hover,
body.canvas-mode .node.audio-node.selected,
body.canvas-mode .node.edit-studio-node,
body.canvas-mode .node.edit-studio-node:hover,
body.canvas-mode .node.edit-studio-node.selected {
    width: 284px !important;
    min-width: 284px !important;
    max-width: 284px !important;
    height: 284px !important;
    min-height: 284px !important;
    max-height: 284px !important;
    box-sizing: border-box;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .node-content,
body.canvas-mode .node.audio-node .node-content,
body.canvas-mode .node.edit-studio-node .node-content {
    height: calc(100% - 38px) !important;
    min-height: 0;
    padding: 10px;
    box-sizing: border-box;
}

body.canvas-mode .node.audio-node .audio-preview-box {
    width: 100%;
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
    background: #181a1d;
}

body.canvas-mode .node.audio-node .audio-preview-box.has-media,
body.canvas-mode .node.audio-node .audio-preview-box:has(.audio-preview:not([hidden])) {
    min-height: 0;
    background: #181a1d;
}

body.canvas-mode .node.edit-studio-node {
    background: #252628;
}

body.canvas-mode .node.edit-studio-node .node-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

body.canvas-mode .node.edit-studio-node .edit-studio-node-open {
    position: relative;
    flex: 1 1 auto;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    align-content: center;
    justify-items: center;
    min-height: 0;
    padding: 18px;
    gap: 14px;
    border-color: rgba(148, 163, 184, 0.24);
    border-radius: 8px;
    background: #181a1d;
    text-align: center;
}

body.canvas-mode .node.edit-studio-node .edit-studio-node-open:hover {
    border-color: rgba(148, 163, 184, 0.42);
    background: #1c1e21;
}

body.canvas-mode .node.edit-studio-node .edit-studio-node-icon {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    color: #d8dee8;
    background: #303337;
    border: 1px solid #494e55;
    box-shadow: none;
}

body.canvas-mode .node.edit-studio-node .edit-studio-node-icon svg {
    width: 25px;
    height: 25px;
}

body.canvas-mode .node.edit-studio-node .edit-studio-node-copy {
    text-align: center;
}

body.canvas-mode .node.edit-studio-node .edit-studio-node-arrow {
    position: absolute;
    right: 12px;
    bottom: 12px;
}

/* 选中态减重：统一为一根细绿色线，只给极弱的外层光感。 */
body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))).selected,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))).selected {
    border-width: 1px;
    border-color: rgba(32, 201, 151, 0.68);
    box-shadow:
        0 0 0 0.5px rgba(32, 201, 151, 0.16),
        0 0 7px rgba(32, 201, 151, 0.07),
        0 10px 24px rgba(0, 0, 0, 0.24);
}

body.canvas-mode .node.image-node.selected .image-preview-box,
body.canvas-mode .node.video-node.selected .video-preview-box,
body.canvas-mode .node.image-node.zoomed.selected .image-preview-box,
body.canvas-mode .node.video-node.zoomed.selected .video-preview-box {
    border-color: rgba(93, 214, 177, 0.42);
    box-shadow: none;
}

body.canvas-mode .node:not(.image-node):not(.video-node).selected,
body.canvas-mode .node.edit-studio-node.selected {
    border-width: 1px;
    border-color: rgba(32, 201, 151, 0.58);
    box-shadow:
        0 0 0 0.5px rgba(32, 201, 151, 0.12),
        0 9px 24px rgba(0, 0, 0, 0.26);
}

body.canvas-mode .node.composer-source-node {
    border-width: 1px;
    border-color: rgba(32, 201, 151, 0.68) !important;
    box-shadow:
        0 0 0 0.5px rgba(32, 201, 151, 0.14),
        0 0 6px rgba(32, 201, 151, 0.07) !important;
}

/* LibTV 比例：方形节点同高，图片 / 视频为同高的 16:9 长方形。 */
body.canvas-mode .node.image-node:not(.zoomed):not(:has(.image-preview:not([hidden]))),
body.canvas-mode .node.image-node:not(.zoomed):not(:has(.image-preview:not([hidden]))):hover,
body.canvas-mode .node.image-node:not(.zoomed):not(:has(.image-preview:not([hidden]))).selected,
body.canvas-mode .node.video-node:not(.zoomed):not(:has(.video-preview:not([hidden]))),
body.canvas-mode .node.video-node:not(.zoomed):not(:has(.video-preview:not([hidden]))):hover,
body.canvas-mode .node.video-node:not(.zoomed):not(:has(.video-preview:not([hidden]))).selected {
    width: 505px !important;
    min-width: 505px !important;
    max-width: 505px !important;
    height: 284px !important;
    min-height: 284px !important;
    max-height: 284px !important;
    box-sizing: border-box;
}

body.canvas-mode .node.image-node:not(.zoomed):not(:has(.image-preview:not([hidden]))) .node-content,
body.canvas-mode .node.video-node:not(.zoomed):not(:has(.video-preview:not([hidden]))) .node-content {
    height: calc(100% - 38px) !important;
    min-height: 0;
    padding: 10px;
    box-sizing: border-box;
}

body.canvas-mode .node.image-node:not(.zoomed):not(:has(.image-preview:not([hidden]))) .image-preview-box,
body.canvas-mode .node.video-node:not(.zoomed):not(:has(.video-preview:not([hidden]))) .video-preview-box {
    width: 100%;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    box-sizing: border-box;
}

body.canvas-mode .node.image-node.zoomed .image-preview,
body.canvas-mode .node.video-node.zoomed .video-preview {
    object-fit: contain;
    background: #0f1114;
}

/* 空素材入口只保留图标与文字，不给三个操作再套小卡片。 */
body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .media-empty-actions button,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .media-empty-actions button {
    height: 25px;
    padding: 0 8px;
    color: #a8b1bc;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    transition: color 0.15s ease, transform 0.15s ease;
}

body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .media-empty-actions button:first-child,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .media-empty-actions button:first-child {
    color: #c4d6ec;
    background: transparent;
    border: 0;
}

body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .media-empty-actions button:hover,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .media-empty-actions button:hover,
body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .media-empty-actions button:first-child:hover,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .media-empty-actions button:first-child:hover {
    color: #f1f5f9;
    background: transparent;
    border: 0;
    transform: translateX(2px);
}

/* LibTV 文本节点：大图形提示 + 单列能力列表，缩放后仍然能读清。 */
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .node-content {
    display: flex;
    flex-direction: column;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .node-textarea {
    flex: 0 0 auto;
    width: 100%;
    height: 62px;
    min-height: 62px;
    max-height: 62px;
    font-size: 12px;
    line-height: 1.55;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .node-textarea:placeholder-shown {
    display: none;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-node-hero {
    display: flex;
    flex: 0 0 48px;
    align-items: center;
    justify-content: center;
    color: #686e77;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .node-textarea:not(:placeholder-shown) + .text-node-hero {
    display: none;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-node-hero svg {
    width: 38px;
    height: 38px;
    stroke-width: 1.55;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-prompt-starters {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 2px;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-prompt-starters > span {
    padding: 0 3px;
    color: #8b939e;
    font-size: 11px;
    line-height: 15px;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-prompt-starters button {
    flex: 0 0 26px;
    width: 100%;
    height: 26px;
    padding: 0 9px;
    gap: 8px;
    color: #d0d5dc;
    background: transparent;
    border-color: transparent;
    border-radius: 6px;
    font-size: 11px;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-prompt-starters button:hover {
    color: #f0f3f7;
    background: #2d3034;
    border-color: #3b3f45;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-prompt-starters button svg {
    width: 14px;
    height: 14px;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-upload-row {
    margin-top: auto;
}

/* 基础节点使用一套中性灰蓝，不再按节点类型分绿、紫等品牌色。 */
body.canvas-mode .node,
body.canvas-mode .node[data-node-kind="action"],
body.canvas-mode .node.agent-node,
body.canvas-mode .node.edit-studio-node {
    --node-accent: #9aa8b8;
    --node-accent-soft: rgba(154, 168, 184, 0.12);
}

body.canvas-mode .node.agent-node .node-icon,
body.canvas-mode .node.edit-studio-node .node-icon,
body.canvas-mode .node.agent-node .media-node-number,
body.canvas-mode .node.edit-studio-node .media-node-number {
    color: #aeb9c6;
}

/* 标题栏已经说明节点类型，空态内部只保留图标。 */
body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .media-empty-state > strong,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .media-empty-state > strong,
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .media-empty-state > strong,
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-prompt-starters > span {
    display: none;
}

/* 图片、视频、音频和文本的能力入口统一为无框列表。 */
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .media-empty-actions button,
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-prompt-starters button,
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-upload-btn {
    color: #c4cbd4;
    background: transparent;
    border: 0;
    box-shadow: none;
}

body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .media-empty-actions button:hover,
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-prompt-starters button:hover,
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-upload-btn:hover {
    color: #f1f5f9;
    background: transparent;
    border: 0;
    transform: translateX(2px);
}

body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .media-empty-actions {
    width: min(206px, calc(100% - 20px));
    grid-template-columns: 1fr;
    gap: 4px;
}

body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .media-empty-actions button {
    justify-content: flex-start;
    width: 100%;
    height: 25px;
    padding: 0 8px;
    gap: 7px;
}

body.canvas-mode .node.edit-studio-node .edit-studio-node-icon {
    color: #aeb9c6;
    background: #303337;
    border-color: #494e55;
}

/* 素材库使用紧凑密度，同一屏展示更多卡片。 */
.asset-picker {
    padding: 18px 20px 20px;
}

.asset-picker-grid.is-media-grid {
    column-width: 140px;
    column-gap: 10px;
}

.asset-picker-grid.is-audio-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.asset-card {
    padding: 4px;
    gap: 5px;
    margin-bottom: 10px;
}

.asset-card-thumb {
    max-height: 260px;
}

.asset-card-name {
    width: 100%;
    min-height: 18px;
    padding: 0 2px 2px;
    font-size: 11px;
    line-height: 16px;
    -webkit-line-clamp: 1;
}

.asset-picker-upload:hover {
    background: #536477;
}

/* 2026-07-31：基础节点统一排版。标题、图标和能力入口使用同一视觉节奏。 */
body.canvas-mode .node .node-title,
body.canvas-mode .node.image-node .node-title,
body.canvas-mode .node.video-node .node-title,
body.canvas-mode .node.selected .node-title {
    font-weight: 500 !important;
    letter-spacing: 0;
}

body.canvas-mode .node .media-node-number {
    font-weight: 500;
}

body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .image-preview-box,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .video-preview-box,
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .audio-preview-box {
    border: 0;
    background: #181a1d;
}

body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .media-empty-state,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .media-empty-state,
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .media-empty-state {
    justify-content: center;
    gap: 10px;
}

body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .media-empty-state > svg,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .media-empty-state > svg,
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .media-empty-state > svg {
    width: 38px;
    height: 38px;
    stroke-width: 1.45;
    color: #7f8b99;
}

body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .media-empty-actions,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .media-empty-actions,
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .media-empty-actions {
    width: 206px;
    margin-top: 0;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown) .node-content {
    justify-content: center;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown) .text-node-hero {
    flex-basis: 54px;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown) .text-node-hero svg {
    width: 38px;
    height: 38px;
    color: #7f8b99;
    stroke-width: 1.45;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown) .text-prompt-starters,
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown) .text-upload-row {
    width: 206px;
    margin-right: auto;
    margin-left: auto;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown) .text-upload-row {
    margin-top: 4px;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-upload-btn {
    justify-content: flex-start;
    width: 100%;
    height: 26px;
    padding: 0 9px;
    gap: 8px;
    font-size: 11px;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-upload-btn svg {
    width: 14px;
    height: 14px;
}

/* 已加载媒体和标题栏合为一个卡片，消除上下两块拼接的割裂感。 */
body.canvas-mode .node.image-node:not(.zoomed):has(.image-preview:not([hidden])),
body.canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])) {
    overflow: visible;
    background: #242629;
    border: 1px solid #41464d;
    border-radius: 10px;
    box-shadow: 0 9px 26px rgba(0, 0, 0, 0.27);
}

body.canvas-mode .node.image-node:not(.zoomed):has(.image-preview:not([hidden])) .node-header,
body.canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])) .node-header {
    min-height: 38px;
    padding: 7px 10px;
    background: #242629;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 9px 9px 0 0;
}

body.canvas-mode .node.image-node:not(.zoomed):has(.image-preview:not([hidden])) .node-content,
body.canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])) .node-content {
    padding: 0;
    background: transparent;
}

body.canvas-mode .node.image-node:not(.zoomed):has(.image-preview:not([hidden])) .image-preview-box,
body.canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])) .video-preview-box {
    border: 0;
    border-radius: 0 0 9px 9px;
    box-shadow: none;
    overflow: hidden;
}

body.canvas-mode .node.image-node:not(.zoomed):has(.image-preview:not([hidden])) .image-preview,
body.canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])) .video-preview {
    border-radius: 0 0 8px 8px;
}

/* 视频清空后所有视频专属控制必须彻底消失。 */
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .video-frame-btn,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .video-zoom-play-btn,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .media-replace-btn,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .video-frame-menu {
    display: none !important;
}

/* 文本节点和轻剪辑、音频使用相同的“标题栏 + 内嵌工作区”结构。 */
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .node-content {
    width: calc(100% - 20px);
    height: calc(100% - 58px) !important;
    margin: 10px;
    padding: 12px 16px;
    background: #181a1d;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 8px;
}

/* 素材库改为自适应网格，视频卡片会自动补齐整行而不是只占左半边。 */
.asset-picker-grid.is-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    align-content: start;
    gap: 10px;
    column-width: auto;
}

.asset-picker-grid.is-media-grid .asset-card {
    display: flex;
    width: auto;
    min-width: 0;
    margin-bottom: 0;
}

.asset-picker-grid.is-media-grid .asset-card-media,
.asset-picker-grid.is-media-grid .asset-card-video {
    width: 100%;
}

.asset-picker-grid.is-media-grid .asset-card-video {
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

/* 2026-07-31：主题快捷切换位于后台入口前，图标显示当前主题。 */
.theme-mode-btn {
    width: 34px;
    min-width: 34px;
    padding: 0 !important;
    justify-content: center;
}

.theme-mode-btn svg {
    width: 16px;
    height: 16px;
}

/* 独立风格节点：选择结果可以像素材节点一样连到图片或视频。 */
body.canvas-mode .node.style-node,
body.canvas-mode .node.effect-node {
    width: 284px;
    height: 284px;
}

body.canvas-mode .node.style-node .node-content,
body.canvas-mode .node.effect-node .node-content {
    width: calc(100% - 20px);
    height: calc(100% - 58px);
    margin: 10px;
    padding: 12px;
    background: #181a1d;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 8px;
}

.style-node-open {
    width: 100%;
    height: 100%;
    border: 0;
    color: #dce3ec;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;
    cursor: pointer;
}

.style-node-open .style-node-hero {
    width: 54px;
    height: 54px;
    border: 1px solid #424850;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: #91a0b2;
    background: #25282d;
}

.style-node-open .style-node-hero svg { width: 28px; height: 28px; }
.style-node-open strong { font-size: 14px; font-weight: 500; }
.style-node-open small { max-width: 190px; color: #788392; font-size: 10px; line-height: 1.6; }

.style-node-selection {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-content: start;
    gap: 8px;
}

.style-node-selection[hidden] { display: none; }

.style-node-chip {
    min-height: 72px;
    padding: 8px;
    border: 1px solid #414852;
    border-radius: 8px;
    background: var(--style-a, #2c3440);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    overflow: hidden;
}

.style-node-chip svg { width: 16px; height: 16px; opacity: .85; }
.style-node-chip strong { font-size: 11px; font-weight: 500; line-height: 1.35; }
.style-node-change { grid-column: 1 / -1; height: 30px; border: 0; border-radius: 7px; background: #2b2f34; color: #bac4d0; display: flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; }

/* 图片面板已选风格/姿势使用可视卡，不再把长名称塞进工具按钮。 */
.image-composer-style-selection,
.image-composer-pose-selection,
.video-composer-preset-selection {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-height: 0;
    overflow-x: auto;
}

.image-composer-style-selection[hidden],
.image-composer-pose-selection[hidden],
.video-composer-preset-selection[hidden] { display: none; }

.image-composer-selected-style {
    position: relative;
    width: 76px;
    min-width: 76px;
    height: 82px;
    padding: 7px;
    border: 1px solid #495362;
    border-radius: 9px;
    background: var(--style-a, #29313b);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    cursor: pointer;
}

.image-composer-selected-style span { width: 28px; height: 28px; border-radius: 7px; background: rgba(0,0,0,.24); display: grid; place-items: center; }
.image-composer-selected-style span svg { width: 15px; height: 15px; }
.image-composer-selected-style strong { max-width: 100%; font-size: 10px; font-weight: 500; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-composer-selected-style .remove,
.image-composer-selected-pose .remove { position: absolute; top: 5px; right: 5px; width: 13px; height: 13px; }

.image-composer-selected-pose {
    position: relative;
    min-width: 150px;
    height: 58px;
    padding: 8px 28px 8px 9px;
    border: 1px solid #424a54;
    border-radius: 9px;
    background: #25282d;
    color: #e4e9ef;
    display: grid;
    grid-template-columns: 34px 1fr;
    grid-template-rows: 1fr 1fr;
    text-align: left;
    cursor: pointer;
}

.image-composer-selected-pose > span { grid-row: 1 / 3; width: 28px; height: 40px; display: grid; place-items: center; color: #9eabba; }
.image-composer-selected-pose strong { font-size: 11px; font-weight: 500; }
.image-composer-selected-pose small { color: #7e8996; font-size: 9px; }

/* 姿势库：用结构化 3D 人体参考分类，单人和双人统一检索。 */
.pose-library-overlay {
    position: fixed;
    inset: 0;
    z-index: 10070;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(5, 7, 10, .72);
    backdrop-filter: blur(8px);
}

.pose-library {
    width: min(1180px, calc(100vw - 48px));
    height: min(760px, calc(100vh - 48px));
    border: 1px solid #3b4149;
    border-radius: 18px;
    background: #232528;
    color: #e9edf2;
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    overflow: hidden;
    box-shadow: 0 28px 80px rgba(0, 0, 0, .5);
}

.pose-library > header,
.pose-library > footer { min-height: 66px; padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid #353a41; }
.pose-library > header > div { display: flex; align-items: center; gap: 10px; }
.pose-library > header strong { font-size: 18px; font-weight: 600; }
.pose-library > header small { color: #818b98; }
.pose-library > header button { width: 36px; height: 36px; border: 0; border-radius: 9px; background: #32353a; color: #c8d0da; }
.pose-library-toolbar { padding: 14px 20px; display: grid; grid-template-columns: auto auto minmax(220px, 1fr); gap: 14px; border-bottom: 1px solid #34383e; }
.pose-library-toolbar nav { display: flex; gap: 6px; }
.pose-library-toolbar button { height: 34px; padding: 0 14px; border: 1px solid #41464d; border-radius: 8px; background: transparent; color: #aeb7c3; }
.pose-library-toolbar button.active { border-color: #6e7d90; background: #e8edf3; color: #181a1d; }
.pose-library-toolbar label { justify-self: end; width: min(360px, 100%); height: 36px; border: 1px solid #3d4249; border-radius: 9px; background: #191b1e; display: flex; align-items: center; gap: 8px; padding: 0 12px; }
.pose-library-toolbar input { width: 100%; border: 0; outline: 0; background: transparent; color: #e5e9ef; }
.pose-library-grid { padding: 18px 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); align-content: start; gap: 12px; overflow: auto; }
.pose-card { min-height: 190px; padding: 8px; border: 1px solid #3b4148; border-radius: 12px; background: #292c30; color: #e7ebef; display: flex; flex-direction: column; align-items: stretch; text-align: left; gap: 8px; cursor: pointer; }
.pose-card:hover { border-color: #687587; transform: translateY(-1px); }
.pose-card.active { border-color: #8aa1bd; box-shadow: 0 0 0 1px rgba(138, 161, 189, .38); }
.pose-card-preview {
    height: 130px;
    border-radius: 9px;
    background-color: #1b1e22;
    background-image: url('assets/presets/pose-red-white-v152.png');
    background-repeat: no-repeat;
    background-size: 400% 400%;
    background-position: var(--pose-preview-x, 0%) var(--pose-preview-y, 0%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04);
}
.pose-card strong { padding: 0 4px; font-size: 12px; font-weight: 500; }
.pose-card small { padding: 0 4px 3px; color: #7d8793; font-size: 10px; }
.pose-library > footer { border-top: 1px solid #353a41; border-bottom: 0; justify-content: flex-end; }
.pose-library > footer span { margin-right: auto; color: #9da7b3; }
.pose-library > footer button { height: 38px; padding: 0 16px; border: 1px solid #424850; border-radius: 9px; background: transparent; color: #cbd2da; }
.pose-library > footer button.primary { border-color: #dde5ee; background: #eef2f6; color: #17191c; }

/* 文本创作去除标题条，只保留右上关闭，形成更细长的输入面板。 */
.media-composer-panel.text-composer-panel {
    width: min(1040px, calc(100vw - 40px));
    padding-top: 18px;
}

.text-composer-panel .media-composer-header { min-height: 0; height: 0; padding: 0; border: 0; }
.text-composer-panel .media-composer-title { display: none; }
.text-composer-panel .media-composer-close { position: absolute; top: 14px; right: 14px; z-index: 3; }
.text-composer-panel .text-composer-tools { padding-right: 50px; }
.text-composer-panel .text-composer-content { min-height: 92px; height: 92px; }

/* 素材范围使用个人/团队二级切换。 */
.asset-picker-scopes { display: flex; gap: 6px; margin: 10px 0 4px; }
.asset-picker-scopes button { height: 30px; padding: 0 13px; border: 1px solid #41464d; border-radius: 8px; color: #9da7b3; background: transparent; }
.asset-picker-scopes button.active { border-color: #7c8da2; color: #edf2f7; background: #343a42; }

.asset-picker-categories {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    margin: 6px 0 2px;
    padding-bottom: 2px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.asset-picker-categories button {
    flex: 0 0 auto;
    height: 28px;
    padding: 0 11px;
    border: 1px solid #3d4249;
    border-radius: 999px;
    color: #aab2bd;
    background: #25282c;
    font-size: 12px;
    cursor: pointer;
}

.asset-picker-categories button:hover,
.asset-picker-categories button.active {
    color: #e9fff8;
    border-color: #20a985;
    background: #173b33;
}

.asset-picker-categories .asset-category-add {
    color: #8fe0c8;
    border-style: dashed;
    background: transparent;
}

.asset-card-menu .asset-card-category { color: #d5dbe3; }
.asset-card-menu .asset-card-category:hover { color: #e9fff8; background: #24423a; }

body:not(.dark) .asset-picker-categories button {
    color: #4b5563;
    border-color: #cfd6de;
    background: #fff;
}

body:not(.dark) .asset-picker-categories button:hover,
body:not(.dark) .asset-picker-categories button.active {
    color: #0e5f4b;
    border-color: #35a889;
    background: #e8f7f1;
}

body:not(.dark) .asset-picker-categories .asset-category-add { color: #17775e; }
body:not(.dark) .asset-card-menu .asset-card-category { color: #303740; }

/* 2026-07-31 回归：文本节点使用与媒体节点一致的空态层级。 */
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown) .node-content {
    justify-content: center;
    gap: 7px;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown) .text-node-hero {
    display: flex !important;
    flex: 0 0 58px;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown) .text-prompt-starters > span {
    display: block !important;
    padding: 0 9px 2px;
    color: #8c96a2;
    font-size: 11px;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown) .text-prompt-starters {
    width: 206px;
    gap: 3px;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown) .text-prompt-starters button {
    height: 27px;
    padding: 0 9px;
    font-size: 11px;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown) .text-upload-row {
    display: none;
}

.node-title-editor {
    width: auto;
    min-width: 44px;
    max-width: min(210px, 100%);
    field-sizing: content;
    height: 24px;
    padding: 1px 6px;
    color: inherit;
    font: inherit;
    font-weight: 500;
    background: #17191c;
    border: 1px solid #73849a;
    border-radius: 5px;
    outline: 0;
    box-shadow: 0 0 0 2px rgba(115, 132, 154, .16);
}

body.canvas-mode .node .node-title {
    cursor: text;
    user-select: none;
}
body.canvas-mode .node .node-title:has(.node-title-editor) {
    overflow: visible !important;
}

/* 引用菜单减小体积；保留足够命中区域但不再像独立面板。 */
body.canvas-mode .port-drop-menu.port-reference-menu {
    width: 202px;
    min-width: 202px;
    padding: 7px;
    border-radius: 13px;
}

body.canvas-mode .port-reference-menu .port-drop-menu-title {
    min-height: 30px;
    padding: 5px 9px 7px;
    font-size: 12px;
    font-weight: 500;
}

body.canvas-mode .port-reference-menu .port-drop-menu-item {
    min-height: 32px;
    padding: 0 9px;
    gap: 9px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 450;
}

body.canvas-mode .port-reference-menu .port-drop-menu-item .item-icon {
    width: 15px;
    height: 15px;
}

/* 文本创作进一步压缩上下留白。 */
.media-composer-panel.text-composer-panel {
    width: min(900px, calc(100vw - 40px));
    gap: 7px;
    padding: 12px 20px 12px;
}

.text-composer-panel .media-composer-close { top: 10px; right: 12px; }
.text-composer-panel .text-composer-tools { gap: 6px; padding-right: 46px; }
.text-composer-panel .text-composer-tools button { height: 34px; padding: 0 12px; }
.text-composer-panel .text-composer-content { min-height: 74px; height: 74px; padding: 7px 5px; line-height: 1.55; }
.text-composer-panel .text-composer-mode-hint { min-height: 24px; padding: 3px 8px; }
.text-composer-panel .media-composer-footer { min-height: 46px; padding-top: 7px; }

/* 预设组底板在暗色下为不透明中性灰；浅色下为白色。 */
body.dark.canvas-mode .canvas-node-group-backdrop {
    background: #25282d;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.035), 0 14px 42px rgba(0,0,0,.24);
}
body.dark.canvas-mode .canvas-node-group-backdrop.is-composite { background: #292c31; }
body.dark.canvas-mode .canvas-node-group-backdrop.is-selected { background: #29313b; }

body:not(.dark).canvas-mode .canvas-node-group-backdrop,
body:not(.dark).canvas-mode .canvas-node-group-backdrop.is-composite,
body:not(.dark).canvas-mode .canvas-node-group-backdrop.is-selected {
    background: #fff;
    box-shadow: inset 0 0 0 1px #d9dee5, 0 12px 34px rgba(29, 41, 57, .10);
}

/* 浅色主题：画布、节点与浮层全部改为白底黑字，而非只切换图标。 */
body:not(.dark).canvas-mode {
    --bg: #f3f5f7;
    --surface: #ffffff;
    --surface-hover: #eef1f4;
    --text: #171a1f;
    --text-secondary: #303640;
    --text-muted: #66717f;
    --border: #d6dce3;
}

body:not(.dark).canvas-mode .canvas-container,
body:not(.dark).canvas-mode .canvas {
    background-color: #f5f6f8;
}

body:not(.dark).canvas-mode .node,
body:not(.dark).canvas-mode .node .node-header,
body:not(.dark).canvas-mode .node .node-content {
    color: #1f252d;
    background: #fff;
    border-color: #d7dde4;
}

body:not(.dark).canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .image-preview-box,
body:not(.dark).canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .video-preview-box,
body:not(.dark).canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .audio-preview-box,
body:not(.dark).canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .node-content {
    color: #26303a;
    background: #f8f9fa;
}

body:not(.dark).canvas-mode .node-title,
body:not(.dark).canvas-mode .text-prompt-starters button,
body:not(.dark).canvas-mode .media-empty-actions button { color: #242a32 !important; }
body:not(.dark).canvas-mode .node-title-editor { color: #171a1f; background: #fff; }
body:not(.dark).canvas-mode .port-drop-menu,
body:not(.dark).canvas-mode .media-composer-panel { color: #20262e; background: #fff; border-color: #d7dde4; }

/* 图片创作不再占用单独标题行：顶部工具就是第一层信息。 */
.media-composer-panel.image-composer-panel { padding-top: 14px; }
.image-composer-panel .media-composer-header { min-height: 0; height: 0; padding: 0; border: 0; }
.image-composer-panel .media-composer-title { display: none; }
.image-composer-panel .media-composer-close { position: absolute; top: 12px; right: 12px; z-index: 4; }
.image-composer-panel .image-composer-tools { padding-right: 46px; }

.audio-composer-tools {
    display: flex;
    align-items: center;
    gap: 6px;
}
.audio-composer-tools button {
    height: 32px;
    padding: 0 11px;
    border: 0;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #bdc6d0;
    background: #303337;
    cursor: pointer;
}
.audio-composer-tools button:disabled { opacity: .35; cursor: not-allowed; }
.audio-composer-tools button:not(:disabled):hover { color: #fff; background: #3a3e43; }
.audio-composer-tools svg { width: 14px; height: 14px; }

.media-capability-overlay {
    position: fixed;
    inset: 0;
    z-index: 10080;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(4, 6, 9, .72);
    backdrop-filter: blur(7px);
}
.media-capability-library {
    width: min(720px, calc(100vw - 48px));
    max-height: min(720px, calc(100vh - 48px));
    overflow: hidden;
    color: #edf1f5;
    background: #202226;
    border: 1px solid #3d4249;
    border-radius: 18px;
    box-shadow: 0 28px 82px rgba(0,0,0,.52);
}
.media-capability-library > header {
    min-height: 66px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #353a40;
}
.media-capability-library > header > div { display: grid; grid-template-columns: 22px auto; align-items: center; column-gap: 9px; }
.media-capability-library > header > div > svg { grid-row: 1 / 3; width: 20px; height: 20px; }
.media-capability-library > header strong { font-size: 17px; font-weight: 600; }
.media-capability-library > header small { color: #7f8995; font-size: 10px; }
.media-capability-library > header button { width: 34px; height: 34px; border: 0; border-radius: 9px; color: #b9c2cc; background: #303338; }
.media-capability-grid { max-height: calc(min(720px, 100vh - 48px) - 66px); padding: 14px; display: grid; gap: 7px; overflow: auto; }
.media-capability-card {
    min-height: 66px;
    padding: 8px 12px;
    display: grid;
    grid-template-columns: 42px minmax(0,1fr) auto;
    align-items: center;
    gap: 11px;
    color: #d7dce2;
    text-align: left;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 11px;
    cursor: pointer;
}
.media-capability-card:hover { background: #292c31; border-color: #3a4047; }
.media-capability-card.is-ready { background: #292c31; }
.media-capability-logo { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; color: #0d1717; background: #18d6af; }
.media-capability-logo svg { width: 20px; height: 20px; }
.media-capability-card > span:nth-child(2) { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.media-capability-card strong { overflow: hidden; font-size: 14px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.media-capability-card small { overflow: hidden; color: #858e99; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.media-capability-card em { padding: 4px 9px; color: #e3bd21; border: 1px solid #68570a; border-radius: 14px; font-size: 10px; font-style: normal; white-space: nowrap; }
.media-capability-card.is-ready em { color: #78dcbf; border-color: #276853; }

body:not(.dark).canvas-mode .media-capability-overlay { background: rgba(224, 228, 233, .72); }
body:not(.dark).canvas-mode .media-capability-library { color: #20252c; background: #fff; border-color: #d5dbe2; }
body:not(.dark).canvas-mode .media-capability-library > header { border-color: #e0e4e9; }
body:not(.dark).canvas-mode .media-capability-card { color: #242a31; }
body:not(.dark).canvas-mode .media-capability-card:hover,
body:not(.dark).canvas-mode .media-capability-card.is-ready { background: #f2f4f6; }

/* 2026-08-01：真正的浅色主题。此前仅切换了太阳图标，画布大量规则仍写死暗色。 */
html[data-theme="light"],
html[data-theme="light"] body {
    color-scheme: light;
    background: #f6f7f8;
}

body:not(.dark) {
    --primary: #168c6d;
    --primary-hover: #126b54;
    --text: #15181d;
    --text-secondary: #343a43;
    --text-muted: #687383;
    --surface: #ffffff;
    --surface-hover: #f0f2f5;
    --border: #d8dde4;
    --canvas-bg: #f7f8f9;
    --canvas-grid: rgba(31, 41, 55, .10);
    --toolbar-bg: #ffffff;
    --input-bg: #f5f6f8;
    color: #15181d;
}

body:not(.dark) .home-page {
    color: #171a1f;
    background: #f7f8fa;
    background-image: radial-gradient(circle, rgba(32, 39, 48, .10) 0, rgba(32, 39, 48, .10) .75px, transparent 1px);
    background-size: 30px 30px;
}

body:not(.dark) .home-header {
    color: #171a1f;
    background: rgba(255, 255, 255, .94);
    border-color: #dde1e7;
}

body:not(.dark) .home-logo,
body:not(.dark) .home-launch-heading h1,
body:not(.dark) .recent-projects h2,
body:not(.dark) .card-title { color: #171a1f; }

/* v1.37 · 浅色首页标题使用高对比彩色渐变，避免右侧紫色文字融入背景。 */
body:not(.dark) .home-launch h1 em {
    background-image: linear-gradient(100deg, #087f68 0%, #167eaa 52%, #5146c8 100%);
    text-shadow: 0 2px 14px rgba(41, 86, 145, .10);
}

body:not(.dark) .home-launch-kicker,
body:not(.dark) .recent-projects-heading span,
body:not(.dark) .recent-projects-heading small,
body:not(.dark) .card-desc { color: #697382; }
body:not(.dark) .home-prompt-box,
body:not(.dark) .home-skill-chip,
body:not(.dark) .project-card,
body:not(.dark) .project-batch-toolbar {
    color: #242a31;
    background: #ffffff;
    border-color: #d9dee5;
    box-shadow: 0 10px 28px rgba(37, 46, 59, .08);
}
body:not(.dark) .home-prompt-box textarea { color: #171a1f; }

/* 浅色首页只保留一个绿色主操作，其余入口使用轻量灰白按钮，避免黑色块过多。 */
body:not(.dark) .home-actions .action-btn {
    color: #4c5663;
    background: rgba(255, 255, 255, .92);
    border-color: #d8dee6;
    box-shadow: 0 4px 14px rgba(35, 45, 58, .06);
}

body:not(.dark) .home-actions .action-btn:hover {
    color: #18202a;
    background: #f4f6f8;
    border-color: #c6ced8;
}

body:not(.dark) .home-actions .user-btn {
    color: #ffffff !important;
    background: #168c6d !important;
    border-color: #168c6d !important;
    box-shadow: 0 6px 18px rgba(22, 140, 109, .16) !important;
}

body:not(.dark) .home-actions .user-btn:hover {
    background: #126b54 !important;
    border-color: #126b54 !important;
}

body:not(.dark) .home-node-entry {
    color: #4f5966;
    background: #f7f8fa;
    border-color: #d9dfe6;
    box-shadow: none;
}

body:not(.dark) .home-node-entry:hover {
    color: #1e2732;
    background: #ffffff;
    border-color: #bfc8d2;
}

body:not(.dark) .home-node-entry.home-blank-btn {
    color: #14785f;
    background: #edf9f5;
    border-color: #bfe9da;
}

body:not(.dark) .home-node-entry.home-blank-btn:hover {
    color: #0f604b;
    background: #e3f6ef;
    border-color: #8fd7bf;
}

body:not(.dark) .home-submit-btn:disabled {
    color: #98a1ab;
    background: #edf0f3;
    border: 1px solid #e0e4e8;
    opacity: 1;
}

body:not(.dark).canvas-mode {
    --canvas-bg: #f7f8f9;
    --canvas-grid: rgba(30, 41, 55, .10);
    --surface: #ffffff;
    --surface-hover: #eff2f5;
    --input-bg: #f5f7f9;
    color-scheme: light;
    color: #171a1f;
    background: #f7f8f9;
}

body:not(.dark).canvas-mode .canvas-container {
    background-color: #f7f8f9;
    background-image: radial-gradient(circle, rgba(31, 41, 55, .13) 0, rgba(31, 41, 55, .13) .78px, transparent 1.05px);
    background-size: var(--canvas-grid-size) var(--canvas-grid-size);
}

body:not(.dark).canvas-mode .back-btn,
body:not(.dark).canvas-mode .action-btn,
body:not(.dark).canvas-mode .new-project-btn {
    color: #313844;
    background: rgba(255, 255, 255, .95);
    border-color: #d7dce3;
    box-shadow: 0 6px 20px rgba(29, 38, 51, .09);
}
body:not(.dark).canvas-mode .back-btn:hover,
body:not(.dark).canvas-mode .action-btn:hover,
body:not(.dark).canvas-mode .new-project-btn:hover { color: #111827; background: #f1f3f5; border-color: #c7ced7; }
body:not(.dark).canvas-mode .project-name { color: #252a32; text-shadow: none; }

body:not(.dark).canvas-mode .node,
body:not(.dark).canvas-mode .node:not(.image-node):not(.video-node),
body:not(.dark).canvas-mode .node.image-node,
body:not(.dark).canvas-mode .node.video-node,
body:not(.dark).canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))),
body:not(.dark).canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) {
    color: #1c222a;
    background: #ffffff;
    border-color: #ccd3dc;
    box-shadow: 0 9px 26px rgba(35, 45, 58, .10);
}
body:not(.dark).canvas-mode .node:hover,
body:not(.dark).canvas-mode .node:not(.image-node):not(.video-node):hover,
body:not(.dark).canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))):hover,
body:not(.dark).canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))):hover {
    color: #14181d;
    background: #ffffff;
    border-color: #aeb8c4;
    box-shadow: 0 12px 30px rgba(35, 45, 58, .13);
}
body:not(.dark).canvas-mode .node.selected,
body:not(.dark).canvas-mode .node:not(.image-node):not(.video-node).selected {
    border-color: #5f86b2;
    box-shadow: 0 0 0 1px rgba(58, 102, 151, .18), 0 10px 28px rgba(35, 45, 58, .12);
}
body:not(.dark).canvas-mode .node-header,
body:not(.dark).canvas-mode .node-content,
body:not(.dark).canvas-mode .image-preview-box,
body:not(.dark).canvas-mode .video-preview-box,
body:not(.dark).canvas-mode .audio-preview-box,
body:not(.dark).canvas-mode .edit-studio-summary,
body:not(.dark).canvas-mode .agent-node .user-input,
body:not(.dark).canvas-mode .agent-node .creation-footer {
    color: #1d232b;
    background: #ffffff;
    border-color: #d9dee5;
}
body:not(.dark).canvas-mode .node-content,
body:not(.dark).canvas-mode .image-preview-box,
body:not(.dark).canvas-mode .video-preview-box,
body:not(.dark).canvas-mode .audio-preview-box { background: #f7f8fa; }
body:not(.dark).canvas-mode .node-title,
body:not(.dark).canvas-mode .node-header svg,
body:not(.dark).canvas-mode .media-placeholder-title,
body:not(.dark).canvas-mode .media-empty-actions button,
body:not(.dark).canvas-mode .text-prompt-starters button { color: #1e252e !important; }
body:not(.dark).canvas-mode .media-node-number { color: #4b5563; background: #eef1f4; border-color: #ccd3db; }
body:not(.dark).canvas-mode .node-close { color: #687382; }

body:not(.dark).canvas-mode .node-sidebar,
body:not(.dark).canvas-mode .bottom-toolbar {
    color: #222831;
    background: rgba(255, 255, 255, .94);
    border-color: #d5dbe2;
    box-shadow: 0 8px 26px rgba(37, 46, 59, .10);
}
body:not(.dark).canvas-mode .sidebar-title {
    color: #3d4652 !important;
}
body:not(.dark).canvas-mode .sidebar-item,
body:not(.dark).canvas-mode .sidebar-item .sbar-name,
body:not(.dark).canvas-mode .sidebar-item .sbar-icon {
    color: #3f4956 !important;
}
body:not(.dark).canvas-mode .sidebar-item .sbar-eye,
body:not(.dark).canvas-mode .sidebar-item .sbar-edit {
    color: #556170 !important;
    opacity: .82;
}
body:not(.dark).canvas-mode .sidebar-item.hidden-node {
    opacity: .66;
}
body:not(.dark).canvas-mode .sidebar-header {
    border-bottom-color: #d5dbe2;
}
body:not(.dark).canvas-mode .sidebar-toggle {
    color: #596574;
}
body:not(.dark).canvas-mode .btm-tool-btn,
body:not(.dark).canvas-mode .canvas-zoom-readout {
    color: #596574;
}
body:not(.dark).canvas-mode .btm-tool-btn:hover {
    color: #1f2933;
    background: #e9edf1;
}
body:not(.dark).canvas-mode .btm-tool-btn.active { color: #ffffff; background: #252a31; }
body:not(.dark).canvas-mode .btm-divider { background: #d7dce2; }

/* 媒体节点标题栏不能继续继承暗色画布的深灰背景。 */
body:not(.dark).canvas-mode .node.image-node .node-header,
body:not(.dark).canvas-mode .node.video-node .node-header,
body:not(.dark).canvas-mode .node.audio-node .node-header,
body:not(.dark).canvas-mode .node.text-node .node-header,
body:not(.dark).canvas-mode .node.edit-studio-node .node-header,
body:not(.dark).canvas-mode .node.agent-node .node-header,
body:not(.dark).canvas-mode .node.style-node .node-header {
    color: #1e252e !important;
    background: #ffffff !important;
    border-bottom-color: #d9dee5 !important;
}
body:not(.dark).canvas-mode .node .node-header .node-title,
body:not(.dark).canvas-mode .node .node-header svg {
    color: #1e252e !important;
}
body:not(.dark).canvas-mode .text-node-hero + .text-prompt-starters > span,
body:not(.dark).canvas-mode .text-prompt-starters > span {
    color: #5f6b79 !important;
}

body:not(.dark) .context-menu,
body:not(.dark) .canvas-context-menu,
body:not(.dark) .connection-context-menu,
body:not(.dark) .port-drop-menu,
body:not(.dark) .modal-content,
body:not(.dark) .asset-picker,
body:not(.dark) .media-composer-panel,
body:not(.dark) .cinematic-style-library,
body:not(.dark) .video-creative-library,
body:not(.dark) .pose-library,
body:not(.dark) .media-capability-library {
    color: #20262e;
    background: #ffffff;
    border-color: #d4dae2;
    box-shadow: 0 24px 70px rgba(28, 38, 52, .16);
}
body:not(.dark) .asset-picker-overlay,
body:not(.dark) .modal-overlay,
body:not(.dark) .pose-library-overlay,
body:not(.dark) .media-capability-overlay,
body:not(.dark) .cinematic-style-library-overlay,
body:not(.dark) .video-creative-library-overlay { background: rgba(222, 226, 232, .72); }
body:not(.dark) .asset-picker-title,
body:not(.dark) .media-composer-title,
body:not(.dark) .port-drop-menu-title { color: #1b2027; }
body:not(.dark) .asset-picker-upload,
body:not(.dark) .asset-picker-close,
body:not(.dark) .media-composer-close,
body:not(.dark) .modal-close { color: #4b5563; background: #eef1f4; }
body:not(.dark) .asset-tab,
body:not(.dark) .asset-picker-scopes button { color: #4b5563; border-color: #cfd6de; }
body:not(.dark) .asset-tab.active,
body:not(.dark) .asset-picker-scopes button.active { color: #ffffff; background: #252a31; border-color: #252a31; }
body:not(.dark) .asset-sort-control,
body:not(.dark) .asset-card,
body:not(.dark) .media-composer-control,
body:not(.dark) .media-composer-file-chip,
body:not(.dark) .media-composer-prompt,
body:not(.dark) .text-composer-content,
body:not(.dark) .text-composer-mode-hint {
    color: #242a32;
    background: #f5f7f9;
    border-color: #d4dae2;
}

/* 2026-08-03：素材管理菜单改为紧凑的单行操作，不再出现巨型图标弹层。 */
.asset-card-menu {
    top: 38px;
    right: 7px;
    width: 156px;
    padding: 5px;
    gap: 2px;
    border-radius: 10px;
    background: #252729;
    border-color: #41454a;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .38);
}
.asset-card-menu span {
    min-height: 22px;
    padding: 3px 8px 5px;
    display: flex;
    align-items: center;
    color: #8f98a3;
    font-size: 10px;
    line-height: 1.2;
}
.asset-card-menu button {
    width: 100%;
    min-height: 32px;
    padding: 0 9px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 7px;
    color: #d8dde3;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
}
.asset-card-menu button svg {
    width: 15px !important;
    height: 15px !important;
    flex: 0 0 15px;
    stroke-width: 1.8;
}
.asset-card-menu .asset-card-team { color: #bfeedd; }
.asset-card-menu .asset-card-team:hover {
    color: #effff9;
    background: rgba(32, 201, 151, .13);
}
.asset-card-menu .asset-card-delete {
    min-height: 30px;
    margin-top: 3px;
    color: #d98a8a;
    border-top-color: #3b3f43;
}
.asset-card-menu .asset-card-delete:hover {
    color: #ff9c9c;
    background: rgba(239, 105, 105, .10);
}
body:not(.dark) .asset-card-menu {
    background: #fff;
    border-color: #d5dbe2;
    box-shadow: 0 14px 34px rgba(31, 41, 55, .16);
}
body:not(.dark) .asset-card-menu span { color: #77818d; }
body:not(.dark) .asset-card-menu .asset-card-team { color: #17775e; }
body:not(.dark) .asset-card-menu .asset-card-team:hover { color: #0f5b49; background: #e6f5ef; }
body:not(.dark) .asset-card-menu .asset-card-delete { color: #b14f54; border-top-color: #e1e5ea; }

/* 创作框默认保持中等宽度；只有主动放大时才进入大编辑视图。 */
body.canvas-mode .media-composer-panel[data-placement].text-composer-panel,
body.canvas-mode .media-composer-panel[data-placement].image-composer-panel,
body.canvas-mode .media-composer-panel[data-placement].audio-composer-panel {
    width: min(var(--composer-width, 600px), calc(100vw - 32px)) !important;
}
.image-composer-panel .image-composer-tools,
.video-composer-panel .video-composer-tools,
.audio-composer-panel .audio-composer-tools,
.text-composer-panel .text-composer-tools { padding-right: 90px; }
.media-composer-panel.is-expanded {
    display: flex;
    flex-direction: column;
}
.media-composer-panel.is-expanded .media-composer-prompt-wrap {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}
.media-composer-panel.is-expanded .media-composer-prompt {
    flex: 1 1 auto;
    width: 100%;
    min-height: 220px !important;
    height: 100% !important;
    resize: none;
}
.media-composer-panel.is-expanded .media-composer-footer,
.media-composer-panel.is-expanded .image-composer-tools,
.media-composer-panel.is-expanded .video-composer-tools,
.media-composer-panel.is-expanded .audio-composer-tools,
.media-composer-panel.is-expanded .text-composer-tools { flex: 0 0 auto; }

/* 素材空态的整行都是热区，图标、文字与留白均可点击。 */
body.canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .media-empty-actions button,
body.canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .media-empty-actions button,
body.canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .media-empty-actions button {
    width: min(190px, 86%);
    min-height: 30px;
    padding: 0 10px;
    justify-content: flex-start;
    border-radius: 7px;
}

/* 轻剪辑时间指针可抓取拖动。 */
.edit-studio-playhead {
    width: 3px;
    pointer-events: auto;
    cursor: ew-resize;
    touch-action: none;
}
.edit-studio-playhead::after {
    content: "";
    position: absolute;
    inset: -8px -9px;
}
.edit-studio-playhead:hover,
.edit-studio-playhead.dragging {
    box-shadow: 0 0 0 1px rgba(32, 201, 151, .32), 0 0 12px rgba(32, 201, 151, .35);
}

@media (max-width: 700px) {
    body.canvas-mode .media-composer-panel[data-placement].text-composer-panel,
    body.canvas-mode .media-composer-panel[data-placement].image-composer-panel,
    body.canvas-mode .media-composer-panel[data-placement].audio-composer-panel {
        width: auto !important;
    }
}
body:not(.dark) .asset-sort-control select,
body:not(.dark) .media-composer-control select,
body:not(.dark) .media-composer-prompt,
body:not(.dark) .text-composer-content { color: #20262e; }
body:not(.dark) .asset-card-name,
body:not(.dark) .media-capability-card strong { color: #232931; }
body:not(.dark) .asset-card-menu { color: #242a32; background: #ffffff; border-color: #d3d9e1; }
body:not(.dark) .asset-card-menu button { color: #303740; }
body:not(.dark) .asset-card-menu button:hover { background: #eef1f4; }
body:not(.dark) .style-node-open,
body:not(.dark) .style-node-change { color: #303844; background: #f0f2f5; }
body:not(.dark) .style-node-open .style-node-hero { color: #5f6b7a; background: #eef1f4; border-color: #d2d8df; }

/* 暗色模式文字兜底：主信息偏白，辅助信息用中灰，避免新面板继承浏览器黑字。 */
body.dark.canvas-mode .node-sidebar,
body.dark.canvas-mode .node-title,
body.dark.canvas-mode .sidebar-item,
body.dark.canvas-mode .context-menu,
body.dark.canvas-mode .canvas-context-menu,
body.dark.canvas-mode .port-drop-menu,
body.dark.canvas-mode .modal-content,
body.dark.canvas-mode .asset-picker,
body.dark.canvas-mode .media-composer-panel,
body.dark.canvas-mode .cinematic-style-library,
body.dark.canvas-mode .video-creative-library,
body.dark.canvas-mode .pose-library,
body.dark.canvas-mode .media-capability-library {
    color: #e7e9ed;
}

body.dark.canvas-mode input,
body.dark.canvas-mode textarea,
body.dark.canvas-mode select,
body.dark.canvas-mode .asset-card-name,
body.dark.canvas-mode .media-empty-actions button,
body.dark.canvas-mode .text-prompt-starters button {
    color: #dfe3e8;
}

body.dark.canvas-mode input::placeholder,
body.dark.canvas-mode textarea::placeholder,
body.dark.canvas-mode .asset-empty small,
body.dark.canvas-mode .media-composer-hint,
body.dark.canvas-mode .media-placeholder-subtitle {
    color: #939ba7;
}

/* 画板节点：在无限画布内提供一块固定 16:9 的轻量标注/草图区域。 */
.node.whiteboard-node { width: 720px !important; min-width: 720px !important; max-width: 720px !important; }
.whiteboard-node .node-content.whiteboard-content {
    padding: 10px;
    background: var(--node-content-bg, #171a1f);
}
.whiteboard-toolbar {
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 42px;
    padding: 5px 7px;
    margin-bottom: 8px;
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 10px;
    background: rgba(255, 255, 255, .035);
}
.whiteboard-toolbar button,
.whiteboard-import {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #aeb8c5;
    cursor: pointer;
}
.whiteboard-toolbar button:hover,
.whiteboard-import:hover,
.whiteboard-toolbar button.active {
    color: #effbf7;
    border-color: rgba(93, 214, 177, .42);
    background: rgba(32, 201, 151, .16);
}
.whiteboard-toolbar svg { width: 17px; height: 17px; stroke-width: 1.7; }
.whiteboard-toolbar-divider {
    width: 1px;
    height: 22px;
    margin: 0 2px;
    background: rgba(148, 163, 184, .2);
}
.whiteboard-toolbar-spacer { flex: 1 1 auto; }
.whiteboard-color {
    width: 26px;
    height: 26px;
    padding: 2px;
    border: 1px solid rgba(148, 163, 184, .28);
    border-radius: 7px;
    overflow: hidden;
}
.whiteboard-color input { width: 100%; height: 100%; padding: 0; border: 0; background: transparent; cursor: pointer; }
.whiteboard-size { width: 74px; display: inline-flex; align-items: center; }
.whiteboard-size input { width: 100%; accent-color: #20c997; }
.whiteboard-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, .3);
    border-radius: 10px;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .04);
}
.whiteboard-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
    background: #fff;
}
.whiteboard-node[data-whiteboard-tool="eraser"] .whiteboard-canvas { cursor: cell; }
.whiteboard-node[data-whiteboard-tool="text"] .whiteboard-canvas { cursor: text; }
body:not(.dark).canvas-mode .whiteboard-node .node-header { background: #fff; color: #1e252e; }
body:not(.dark).canvas-mode .whiteboard-node .node-content.whiteboard-content { background: #f7f9fc; }
body:not(.dark).canvas-mode .whiteboard-toolbar { border-color: #dce2ea; background: #fff; }
body:not(.dark).canvas-mode .whiteboard-toolbar button,
body:not(.dark).canvas-mode .whiteboard-import { color: #596574; }
body:not(.dark).canvas-mode .whiteboard-toolbar button:hover,
body:not(.dark).canvas-mode .whiteboard-import:hover,
body:not(.dark).canvas-mode .whiteboard-toolbar button.active {
    color: #126b54;
    border-color: #a9d9cb;
    background: #effbf7;
}

/* 轻剪辑浅色主题：工作台不能保留暗色底后再继承黑字。 */
body:not(.dark) .edit-studio-overlay {
    background: rgba(225, 229, 234, .78);
}

body:not(.dark) .edit-studio-workbench {
    color: #20262e;
    background: #ffffff;
    border: 1px solid #cfd6de;
    box-shadow: 0 28px 80px rgba(36, 46, 60, .22);
}

body:not(.dark) .edit-studio-header,
body:not(.dark) .edit-studio-footer {
    color: #20262e;
    background: #f7f8fa;
    border-color: #d8dee6;
}

body:not(.dark) .edit-studio-heading strong,
body:not(.dark) .edit-studio-library-head,
body:not(.dark) .edit-studio-viewer-head,
body:not(.dark) .edit-studio-inspector-head,
body:not(.dark) .edit-studio-timeline-head,
body:not(.dark) .edit-studio-section-title span,
body:not(.dark) .edit-studio-timeline-head strong {
    color: #252b33;
}

body:not(.dark) .edit-studio-heading small,
body:not(.dark) .edit-studio-viewer-head small,
body:not(.dark) .edit-studio-inspector-head small,
body:not(.dark) .edit-studio-section-title small,
body:not(.dark) .edit-studio-timeline-head span,
body:not(.dark) .edit-studio-preview-time,
body:not(.dark) .edit-studio-name-field,
body:not(.dark) .edit-studio-export-note {
    color: #66717f;
}

body:not(.dark) .edit-studio-body {
    background: #eef1f4;
}

body:not(.dark) .edit-studio-sources,
body:not(.dark) .edit-studio-inspector {
    color: #27303a;
    background: #ffffff;
    border-color: #d9dfe6;
}

body:not(.dark) .edit-studio-main {
    color: #26303a;
    background: #f5f7f9;
}

body:not(.dark) .edit-studio-source-tabs button {
    color: #596574;
    background: transparent;
}

body:not(.dark) .edit-studio-source-tabs button:hover {
    color: #27303a;
    background: #eef1f4;
}

body:not(.dark) .edit-studio-source-tabs button.active {
    color: #ffffff;
    background: #303740;
}

body:not(.dark) .edit-studio-source-item,
body:not(.dark) .edit-studio-inspector-actions button,
body:not(.dark) .edit-studio-timeline-actions button {
    color: #303944;
    background: #f4f6f8;
    border-color: #d5dce4;
}

body:not(.dark) .edit-studio-source-item:hover,
body:not(.dark) .edit-studio-inspector-actions button:hover,
body:not(.dark) .edit-studio-timeline-actions button:hover {
    color: #171c22;
    background: #e9edf1;
    border-color: #bcc6d1;
}

body:not(.dark) .edit-studio-source-thumb {
    color: #5c6877;
    background: #e8ecf0;
}

body:not(.dark) .edit-studio-source-copy strong,
body:not(.dark) .edit-studio-inspector-source strong,
body:not(.dark) .edit-studio-clip-copy strong {
    color: #252c35;
}

body:not(.dark) .edit-studio-source-copy small,
body:not(.dark) .edit-studio-inspector-source small,
body:not(.dark) .edit-studio-clip-copy small,
body:not(.dark) .edit-studio-empty-list,
body:not(.dark) .edit-studio-inspector-empty,
body:not(.dark) .edit-studio-track-empty {
    color: #667280;
}

body:not(.dark) .edit-studio-name-field input,
body:not(.dark) .edit-studio-trim-group input,
body:not(.dark) .edit-studio-track-select select,
body:not(.dark) .edit-studio-export-settings select {
    color: #1d242c;
    background: #ffffff;
    border-color: #cdd5de;
}

body:not(.dark) .edit-studio-import,
body:not(.dark) .edit-studio-secondary,
body:not(.dark) .edit-studio-close {
    color: #34404c;
    background: #ffffff;
    border-color: #cdd5de;
}

body:not(.dark) .edit-studio-import:hover,
body:not(.dark) .edit-studio-secondary:hover,
body:not(.dark) .edit-studio-close:hover {
    color: #111827;
    background: #edf1f5;
}

body:not(.dark) .edit-studio-preview-shell {
    background: #111419;
    border-color: #222a33;
}

body:not(.dark) .edit-studio-preview-empty {
    color: #d7dde5;
}

body:not(.dark) .edit-studio-preview-empty strong {
    color: #eef2f6;
}

body:not(.dark) .edit-studio-preview-empty span {
    color: #9ca7b4;
}

body:not(.dark) .edit-studio-transport button {
    color: #586575;
}

body:not(.dark) .edit-studio-transport button:hover {
    color: #1f2933;
    background: #e5e9ee;
}

body:not(.dark) .edit-studio-transport button.primary {
    color: #ffffff;
    background: #252b33;
}

body:not(.dark) .edit-studio-viewer-ratio {
    color: #586574;
    background: #e8ecf0;
}

body:not(.dark) .edit-studio-timeline-panel {
    color: #28313b;
    background: #f7f8fa;
    border-color: #d8dee6;
}

body:not(.dark) .edit-studio-ruler {
    color: #707c8a;
    border-color: #e0e5eb;
}

body:not(.dark) .edit-studio-timeline {
    background: #f1f3f6;
}

body:not(.dark) .edit-studio-track {
    color: #394552;
    background: #ffffff;
    border-color: #d6dde5;
}

body:not(.dark) .edit-studio-track-label {
    color: #596676;
    border-color: #d9dfe6;
}

body:not(.dark) .edit-studio-track-empty {
    background: #f8f9fb;
    border-color: #cbd4de;
}

body:not(.dark) .edit-studio-clip,
body:not(.dark) .edit-studio-track.overlay .edit-studio-clip {
    color: #27313c;
    background: #e8eef6;
    border-color: #9db4d1;
}

body:not(.dark) .edit-studio-clip.active {
    border-color: #159b75;
    box-shadow: inset 0 0 0 1px #159b75;
}

/* 浅色主题的资源选择面板不能只切换外壳：内部卡片、工具栏和文字也要同步。 */
body:not(.dark).canvas-mode .pose-library > header,
body:not(.dark).canvas-mode .pose-library > footer,
body:not(.dark).canvas-mode .pose-library-toolbar {
    border-color: #dfe4ea;
}
body:not(.dark).canvas-mode .pose-library > header small,
body:not(.dark).canvas-mode .pose-library > footer span,
body:not(.dark).canvas-mode .pose-card small { color: #667281; }
body:not(.dark).canvas-mode .pose-library > header button {
    color: #4b5664;
    background: #eef1f4;
}
body:not(.dark).canvas-mode .pose-library-toolbar button,
body:not(.dark).canvas-mode .pose-library > footer button {
    color: #3d4753;
    background: #fff;
    border-color: #cfd6de;
}
body:not(.dark).canvas-mode .pose-library-toolbar button.active,
body:not(.dark).canvas-mode .pose-library > footer button.primary {
    color: #fff;
    background: #252b32;
    border-color: #252b32;
}
body:not(.dark).canvas-mode .pose-library-toolbar label {
    color: #637080;
    background: #f5f7f9;
    border-color: #d3dae2;
}
body:not(.dark).canvas-mode .pose-library-toolbar input { color: #20262e; }
body:not(.dark).canvas-mode .pose-card {
    color: #252c34;
    background: #f7f8fa;
    border-color: #d8dee5;
}
body:not(.dark).canvas-mode .pose-card:hover,
body:not(.dark).canvas-mode .pose-card.active {
    background: #fff;
    border-color: #8293a6;
}
body:not(.dark).canvas-mode .pose-card-preview {
    color: #657487;
    background: #e9edf2;
}

body:not(.dark).canvas-mode .cinematic-style-library,
body:not(.dark).canvas-mode .video-creative-library { background: #fff; }
body:not(.dark).canvas-mode .cinematic-style-library-header,
body:not(.dark).canvas-mode .cinematic-style-library-medium-filters,
body:not(.dark).canvas-mode .cinematic-style-library-filters,
body:not(.dark).canvas-mode .cinematic-style-library-footer,
body:not(.dark).canvas-mode .video-creative-library-header,
body:not(.dark).canvas-mode .video-creative-library-filters,
body:not(.dark).canvas-mode .video-creative-library-footer {
    background: #fff;
    border-color: #dfe4ea;
}
body:not(.dark).canvas-mode .cinematic-style-library-title,
body:not(.dark).canvas-mode .video-creative-library-title,
body:not(.dark).canvas-mode .cinematic-style-card-content strong,
body:not(.dark).canvas-mode .video-creative-card-content strong,
body:not(.dark).canvas-mode .cinematic-style-canvas-card strong,
body:not(.dark).canvas-mode .video-creative-canvas-card strong { color: #20262e; }
body:not(.dark).canvas-mode .cinematic-style-library-title em,
body:not(.dark).canvas-mode .video-creative-library-title em,
body:not(.dark).canvas-mode .cinematic-style-result-count,
body:not(.dark).canvas-mode .video-creative-result-count,
body:not(.dark).canvas-mode .cinematic-style-card-content small,
body:not(.dark).canvas-mode .video-creative-card-content small { color: #667281; }
body:not(.dark).canvas-mode .cinematic-style-library-header-actions button,
body:not(.dark).canvas-mode .video-creative-library-header-actions button { color: #566271; }
body:not(.dark).canvas-mode .cinematic-style-library-header-actions button:hover,
body:not(.dark).canvas-mode .video-creative-library-header-actions button:hover {
    color: #20262e;
    background: #eef1f4;
}
body:not(.dark).canvas-mode .cinematic-style-library-views,
body:not(.dark).canvas-mode .video-creative-library-views { background: #eef1f4; }
body:not(.dark).canvas-mode .cinematic-style-library-views button,
body:not(.dark).canvas-mode .video-creative-library-views button,
body:not(.dark).canvas-mode .cinematic-style-library-medium-filters button,
body:not(.dark).canvas-mode .cinematic-style-library-filters button,
body:not(.dark).canvas-mode .video-creative-library-filters button { color: #4e5a68; }
body:not(.dark).canvas-mode .cinematic-style-library-views button.active,
body:not(.dark).canvas-mode .video-creative-library-views button.active,
body:not(.dark).canvas-mode .cinematic-style-library-medium-filters button.active,
body:not(.dark).canvas-mode .cinematic-style-library-filters button.active,
body:not(.dark).canvas-mode .video-creative-library-filters button.active {
    color: #fff;
    background: #303740;
    border-color: #303740;
}
body:not(.dark).canvas-mode .cinematic-style-search,
body:not(.dark).canvas-mode .cinematic-style-library-search,
body:not(.dark).canvas-mode .video-creative-search,
body:not(.dark).canvas-mode .video-creative-library-search {
    color: #647180;
    background: #f5f7f9;
    border-color: #d5dbe2;
}
body:not(.dark).canvas-mode .cinematic-style-search input,
body:not(.dark).canvas-mode .cinematic-style-library-search input,
body:not(.dark).canvas-mode .video-creative-search input,
body:not(.dark).canvas-mode .video-creative-library-search input { color: #20262e; }
body:not(.dark).canvas-mode .cinematic-style-library-tip,
body:not(.dark).canvas-mode .video-creative-library-tip {
    color: #4f6478;
    background: #edf4fb;
    border-color: #d4e4f2;
}
body:not(.dark).canvas-mode .cinematic-style-card,
body:not(.dark).canvas-mode .video-creative-card,
body:not(.dark).canvas-mode .cinematic-style-canvas-card,
body:not(.dark).canvas-mode .video-creative-canvas-card {
    color: #252c34;
    background: #f7f8fa;
    border-color: #d9dfe6;
}
body:not(.dark).canvas-mode .cinematic-style-card:hover,
body:not(.dark).canvas-mode .video-creative-card:hover,
body:not(.dark).canvas-mode .cinematic-style-canvas-card:hover,
body:not(.dark).canvas-mode .video-creative-canvas-card:hover { background: #fff; }
body:not(.dark).canvas-mode .cinematic-style-library-footer,
body:not(.dark).canvas-mode .video-creative-library-footer { box-shadow: 0 -8px 24px rgba(35, 46, 59, .05); }

/* ==========================================================================
   2026-08-03 · 主题可读性、绿色点缀与手机版画布最终覆盖
   黑/白/中性灰构成界面骨架，仅使用绿色表达选中、可用和进度状态。
   ========================================================================== */
:root {
    --primary: #20c997;
    --primary-hover: #18a77e;
    --ui-accent: #20c997;
    --ui-accent-strong: #148a69;
    --ui-accent-soft: rgba(32, 201, 151, .13);
}

body.dark,
body.dark.canvas-mode {
    --primary: #20c997;
    --primary-hover: #2dd4a6;
    --text: #f1f3f5;
    --text-secondary: #c2c8d0;
    --text-muted: #949da9;
    --surface: #25282c;
    --surface-hover: #30343a;
    --border: #454b53;
    --input-bg: #1c1f23;
}

body:not(.dark),
body:not(.dark).canvas-mode {
    --primary: #148a69;
    --primary-hover: #0f7258;
    --text: #171b20;
    --text-secondary: #313944;
    --text-muted: #5f6b79;
    --surface: #ffffff;
    --surface-hover: #edf0f3;
    --border: #cbd2da;
    --input-bg: #f2f4f6;
}

/* 浅色画布：所有节点和工作区保持足够对比度。 */
body:not(.dark).canvas-mode .node,
body:not(.dark).canvas-mode .node:hover,
body:not(.dark).canvas-mode .node:not(.image-node):not(.video-node),
body:not(.dark).canvas-mode .node.image-node,
body:not(.dark).canvas-mode .node.video-node,
body:not(.dark).canvas-mode .node.audio-node,
body:not(.dark).canvas-mode .node.style-node,
body:not(.dark).canvas-mode .node.effect-node,
body:not(.dark).canvas-mode .node.agent-node {
    color: #1b222a !important;
    background: #ffffff !important;
    border-color: #c8d0d9 !important;
    box-shadow: 0 8px 24px rgba(34, 44, 57, .11) !important;
}

body:not(.dark).canvas-mode .node.selected,
body:not(.dark).canvas-mode .node:not(.image-node):not(.video-node).selected,
body:not(.dark).canvas-mode .node.image-node.selected,
body:not(.dark).canvas-mode .node.video-node.selected {
    border-color: #169b78 !important;
    box-shadow: 0 0 0 1px rgba(22, 155, 120, .22), 0 10px 26px rgba(34, 44, 57, .13) !important;
}

body:not(.dark).canvas-mode .node .node-header,
body:not(.dark).canvas-mode .node .node-content,
body:not(.dark).canvas-mode .node.image-node .node-header,
body:not(.dark).canvas-mode .node.video-node .node-header,
body:not(.dark).canvas-mode .node.audio-node .node-header,
body:not(.dark).canvas-mode .node.text-node .node-header,
body:not(.dark).canvas-mode .node.style-node .node-header,
body:not(.dark).canvas-mode .node.effect-node .node-header,
body:not(.dark).canvas-mode .node.agent-node .node-header {
    color: #1c232b !important;
    background: #ffffff !important;
    border-color: #d2d8df !important;
}

body:not(.dark).canvas-mode .node .node-content,
body:not(.dark).canvas-mode .node .image-preview-box,
body:not(.dark).canvas-mode .node .video-preview-box,
body:not(.dark).canvas-mode .node .audio-preview-box,
body:not(.dark).canvas-mode .node.style-node .node-content,
body:not(.dark).canvas-mode .node.effect-node .node-content {
    color: #26313b !important;
    background: #f3f5f7 !important;
    border-color: #d2d9e1 !important;
}

body:not(.dark).canvas-mode .node .node-title,
body:not(.dark).canvas-mode .node .node-title-editor,
body:not(.dark).canvas-mode .node .media-placeholder-title,
body:not(.dark).canvas-mode .node .text-prompt-starters button,
body:not(.dark).canvas-mode .node .media-empty-actions button,
body:not(.dark).canvas-mode .node .text-upload-btn,
body:not(.dark).canvas-mode .style-node-open strong {
    color: #202831 !important;
}

body:not(.dark).canvas-mode .node .media-placeholder-subtitle,
body:not(.dark).canvas-mode .node .text-prompt-starters > span,
body:not(.dark).canvas-mode .node small,
body:not(.dark).canvas-mode .style-node-open small {
    color: #596675 !important;
}

body:not(.dark).canvas-mode .node .media-node-number,
body:not(.dark).canvas-mode .node .node-sequence-badge {
    color: #394552 !important;
    background: #e9edf1 !important;
    border-color: #c6ced7 !important;
}

/* 端口在浅色主题中使用浅灰底和深色加号，不再出现突兀的黑色圆点。 */
body:not(.dark).canvas-mode .node-port::after {
    width: 19px;
    height: 19px;
    color: #2d3742 !important;
    background: #f4f6f8 !important;
    border: 1px solid #9aa6b3 !important;
    box-shadow: 0 2px 6px rgba(36, 46, 58, .14) !important;
}

body:not(.dark).canvas-mode .node-port:hover::after,
body:not(.dark).canvas-mode .node-port.snap-target::after {
    color: #ffffff !important;
    background: #168c6d !important;
    border-color: #168c6d !important;
}

/* 智能体选择器跟随浅色主题，改为中性浅灰控件。 */
body:not(.dark).canvas-mode .agent-node .creation-footer,
body:not(.dark).canvas-mode .agent-node .creation-control,
body:not(.dark).canvas-mode .agent-node .agent-control {
    color: #26303a !important;
    background: #e9edf1 !important;
    border-color: #cbd3dc !important;
}

body:not(.dark).canvas-mode .agent-node .agent-picker-trigger,
body:not(.dark).canvas-mode .agent-node .agent-select {
    color: #26303a !important;
    background: #e9edf1 !important;
    border-color: #cbd3dc !important;
    color-scheme: light !important;
}

body:not(.dark).canvas-mode .agent-node .agent-select option {
    color: #20262e !important;
    background: #ffffff !important;
}

body:not(.dark).canvas-mode .agent-node .agent-select option:checked {
    color: #ffffff !important;
    background: #168c6d !important;
}

body:not(.dark) .agent-picker-popover {
    color: #20262e;
    background: #ffffff;
    border-color: #cfd6de;
    box-shadow: 0 18px 54px rgba(31, 41, 55, .18);
}
body:not(.dark) .agent-picker-search,
body:not(.dark) .agent-picker-card { color: #27313b; background: #f2f4f6; border-color: #d6dce3; }
body:not(.dark) .agent-picker-search input { color: #20262e; }
body:not(.dark) .agent-picker-card .agent-picker-description { color: #5f6b79; }
body:not(.dark) .agent-picker-card em { color: #1f5f99; background: #e8f2fc; }
body:not(.dark) .agent-picker-card:hover,
body:not(.dark) .agent-picker-card.selected { background: #e8efec; border-color: #35a886; }
body:not(.dark) .agent-picker-popover nav button { color: #53606f; }
body:not(.dark) .agent-picker-popover nav button.active { color: #ffffff; background: #31363d; }

/* 创作面板统一：去掉重复标题，关闭按钮保留在右上角。 */
.media-composer-panel.image-composer-panel,
.media-composer-panel.video-composer-panel,
.media-composer-panel.audio-composer-panel,
.media-composer-panel.text-composer-panel {
    padding-top: 16px;
}

.image-composer-panel .media-composer-header,
.video-composer-panel .media-composer-header,
.audio-composer-panel .media-composer-header,
.text-composer-panel .media-composer-header {
    min-height: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}

.image-composer-panel .media-composer-title,
.video-composer-panel .media-composer-title,
.audio-composer-panel .media-composer-title,
.text-composer-panel .media-composer-title { display: none !important; }

.image-composer-panel .media-composer-close,
.video-composer-panel .media-composer-close,
.audio-composer-panel .media-composer-close,
.text-composer-panel .media-composer-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 6;
}

.image-composer-panel .image-composer-tools,
.video-composer-panel .video-composer-tools,
.audio-composer-panel .audio-composer-tools,
.text-composer-panel .text-composer-tools { padding-right: 48px; }

/* 浅色创作面板不能继承暗色胶囊与黑色文字框。 */
body:not(.dark) .media-composer-panel,
body:not(.dark) .media-composer-panel textarea,
body:not(.dark) .media-composer-panel input,
body:not(.dark) .media-composer-panel select {
    color: #20262e !important;
    color-scheme: light;
}

body:not(.dark) .media-composer-panel {
    background: #ffffff !important;
    border-color: #cfd6de !important;
    box-shadow: 0 18px 52px rgba(31, 41, 55, .16) !important;
}

body:not(.dark) .text-composer-tools button,
body:not(.dark) .image-composer-tools button,
body:not(.dark) .video-composer-tools button,
body:not(.dark) .audio-composer-tools button,
body:not(.dark) .image-ref-add,
body:not(.dark) .media-capability-trigger {
    color: #3d4855 !important;
    background: #edf0f3 !important;
    border-color: #d2d8df !important;
}

body:not(.dark) .text-composer-tools button:hover,
body:not(.dark) .text-composer-tools button.active,
body:not(.dark) .image-composer-tools button:hover,
body:not(.dark) .video-composer-tools button:hover,
body:not(.dark) .audio-composer-tools button:hover {
    color: #1d2924 !important;
    background: #dfe7e3 !important;
    border-color: #8fc4b3 !important;
}

body:not(.dark) .media-composer-prompt,
body:not(.dark) .text-composer-content {
    color: #20262e !important;
    background: #ffffff !important;
    border-color: #d6dce3 !important;
}

body:not(.dark) .media-composer-prompt::placeholder,
body:not(.dark) .text-composer-content::placeholder { color: #677382 !important; opacity: 1; }

body:not(.dark) .media-composer-control,
body:not(.dark) .text-composer-mode-hint,
body:not(.dark) .media-composer-optimize {
    color: #26303a !important;
    background: #f0f2f4 !important;
    border-color: #d0d7df !important;
}

body:not(.dark) .media-composer-control select,
body:not(.dark) .composer-select-trigger { color: #26303a !important; }

body:not(.dark) .media-composer-close {
    color: #485462 !important;
    background: #edf0f3 !important;
    border-color: #d3d9e0 !important;
}

body:not(.dark) .media-composer-submit {
    color: #ffffff !important;
    background: #20252b !important;
    border-color: #20252b !important;
}

body:not(.dark) .media-composer-submit:hover { background: #168c6d !important; border-color: #168c6d !important; }

/* 暗色模式主文字、辅助文字、输入与操作按钮保持明确层级。 */
body.dark.canvas-mode .node,
body.dark.canvas-mode .node .node-header,
body.dark.canvas-mode .node .node-content,
body.dark.canvas-mode .media-composer-panel,
body.dark.canvas-mode .modal-content,
body.dark.canvas-mode .asset-picker {
    color: #edf0f3;
}
body.dark.canvas-mode .node .node-title,
body.dark.canvas-mode .node .media-placeholder-title,
body.dark.canvas-mode .media-composer-title { color: #f1f3f5 !important; }
body.dark.canvas-mode .node small,
body.dark.canvas-mode .media-placeholder-subtitle,
body.dark.canvas-mode .media-composer-hint { color: #9fa8b3 !important; }
body.dark.canvas-mode input,
body.dark.canvas-mode textarea,
body.dark.canvas-mode select { color: #e8ebef; background-color: #202328; border-color: #444b54; }
body.dark.canvas-mode input::placeholder,
body.dark.canvas-mode textarea::placeholder { color: #929ca8; opacity: 1; }

/* 选中与状态全部切换为绿色，移除蓝色视觉噪音。 */
body.canvas-mode .node { --node-accent: #87929f !important; }
body.canvas-mode .node.selected,
body.canvas-mode .cinematic-style-card.is-selected,
body.canvas-mode .video-creative-card.is-selected,
body.canvas-mode .pose-card.active,
body.canvas-mode .edit-studio-clip.active {
    border-color: #20c997 !important;
}

/* 设置中的账号/团队关系是数据设置，不用空开关冒充。 */
#settingsModal .modal-content {
    width: min(920px, calc(100vw - 40px));
    max-width: 920px;
    max-height: min(680px, calc(100vh - 40px));
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
}
#settingsModal .modal-header { padding: 16px 20px; }
#settingsModal .settings-layout {
    min-height: 360px;
    max-height: calc(100vh - 112px);
    padding: 0;
    display: grid;
    grid-template-columns: minmax(230px, .72fr) minmax(480px, 1.55fr);
    overflow: hidden;
}
#settingsModal .settings-section {
    min-width: 0;
    margin: 0;
    padding: 22px 24px;
}
#settingsModal .settings-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
#settingsModal .settings-section h3 svg { width: 18px; height: 18px; }
#settingsModal .settings-canvas-column {
    background: color-mix(in srgb, var(--canvas-bg) 74%, transparent);
}
#settingsModal .settings-canvas-column .setting-item {
    min-height: 54px;
    padding: 10px 2px;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
}
#settingsModal .settings-canvas-column .setting-item:last-child { border-bottom: 0; }
.account-team-settings {
    overflow: auto;
    border-left: 1px solid var(--border);
    scrollbar-width: thin;
}
.setting-account-summary,
.setting-team-field {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-height: 42px;
    color: var(--text-secondary);
    font-size: 13px;
}
.setting-team-onboarding { display: none; gap: 4px; }
.setting-team-onboarding:not([hidden]) { display: grid; }
.setting-team-current {
    grid-template-columns: 92px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 50px;
    color: var(--text-secondary);
    font-size: 13px;
}
.setting-team-current:not([hidden]) { display: grid; }
.setting-team-current strong { display: block; color: var(--text); font-weight: 600; }
.setting-team-current small { display: block; margin-top: 3px; color: var(--text-muted); font-size: 11px; }
.setting-team-owner-tools {
    margin: 8px 0 4px 104px;
    padding: 10px;
    display: none;
    gap: 7px;
    color: var(--text-secondary);
    background: color-mix(in srgb, #168c6d 8%, var(--canvas-bg));
    border: 1px solid color-mix(in srgb, #20c997 35%, var(--border));
    border-radius: 10px;
}
.setting-team-owner-tools:not([hidden]) { display: grid; }
.setting-team-owner-tools > small { color: var(--text-muted); font-size: 10px; line-height: 1.45; }
.setting-team-invite-copy {
    display: grid;
    grid-template-columns: auto minmax(92px, 1fr) auto;
    align-items: center;
    gap: 8px;
}
.setting-team-invite-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--text-secondary);
    font-size: 11px;
    white-space: nowrap;
}
.setting-team-invite-label svg { width: 14px; height: 14px; color: #2fcf9f; }
.setting-team-invite-copy code {
    min-width: 0;
    padding: 5px 8px;
    overflow: hidden;
    color: var(--text);
    background: color-mix(in srgb, var(--surface) 72%, transparent);
    border: 1px dashed color-mix(in srgb, #20c997 45%, var(--border));
    border-radius: 7px;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.setting-team-invite-copy button {
    min-height: 30px;
    padding: 0 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: #eafff8;
    background: #168c6d;
    border: 1px solid #20a981;
    border-radius: 7px;
    font-size: 10px;
    cursor: pointer;
}
.setting-team-invite-copy button:hover { background: #137a5f; }
.setting-team-invite-copy button:disabled { opacity: .62; cursor: default; }
.setting-team-invite-copy button svg { width: 13px; height: 13px; }
.setting-team-leave {
    height: 34px;
    padding: 0 12px;
    color: #e9a6aa;
    background: transparent;
    border: 1px solid #684248;
    border-radius: 8px;
    cursor: pointer;
}
.setting-team-leave:hover { color: #fff; background: #8c3943; }
.setting-account-summary strong {
    color: var(--text);
    font-weight: 550;
}
.setting-team-editor {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}
.setting-team-editor input {
    width: 100%;
    min-width: 0;
    height: 36px;
    padding: 0 11px;
    color: var(--text);
    background: var(--canvas-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
}
.setting-team-editor input:focus { border-color: #20c997; }
.setting-team-editor button {
    height: 36px;
    padding: 0 14px;
    color: #f5fffb;
    background: #168c6d;
    border: 1px solid #20a981;
    border-radius: 8px;
    cursor: pointer;
}
.setting-team-editor button:hover { background: #137a5f; }
.setting-team-editor button:disabled { opacity: .45; cursor: default; }
.setting-team-note {
    margin: 8px 0 0 104px;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.55;
}
.setting-team-members {
    margin: 8px 0 2px 104px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--canvas-bg);
}
.setting-team-members:not([hidden]) { display: block; }
.setting-team-members-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.setting-team-members-head > span { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-size: 12px; font-weight: 600; }
.setting-team-members-head > span b {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    display: inline-grid;
    place-items: center;
    color: #bdf7e4;
    background: #176a56;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
}
.setting-team-members-head small { color: var(--text-muted); font-size: 10px; }
.setting-team-members-head-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
.setting-team-members-head-actions small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setting-team-members-head-actions button {
    width: 27px;
    height: 27px;
    padding: 0;
    display: grid;
    place-items: center;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 7px;
    cursor: pointer;
}
.setting-team-members-head-actions button:hover { color: #2fcf9f; border-color: #2ba782; }
.setting-team-members-head-actions button:disabled { opacity: .5; cursor: default; }
.setting-team-members-head-actions button svg { width: 13px; height: 13px; }
@keyframes teamMemberRefreshSpin { to { transform: rotate(360deg); } }
.setting-team-members-head-actions button.is-loading svg { animation: teamMemberRefreshSpin .75s linear infinite; }
.setting-team-members-list { max-height: 252px; display: grid; gap: 5px; overflow: auto; scrollbar-width: thin; }
.setting-team-member { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 9px; min-height: 42px; padding: 3px; border-radius: 8px; }
.setting-team-member:hover { background: color-mix(in srgb, var(--surface-hover) 72%, transparent); }
.setting-team-member-avatar { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: #dffff4; background: #176a56; font-size: 12px; font-weight: 700; }
.setting-team-member-name { min-width: 0; display: flex; align-items: baseline; gap: 6px; }
.setting-team-member-name strong { overflow: hidden; color: var(--text); font-size: 12px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.setting-team-member-name small { color: var(--text-muted); font-size: 10px; white-space: nowrap; }
.setting-team-role { height: 32px; padding: 0 26px 0 9px; color: var(--text); background: var(--input-bg); border: 1px solid var(--border); border-radius: 7px; font-size: 10px; }
.setting-team-role:focus { outline: none; border-color: #20c997; }
.setting-team-member-actions { display: inline-flex; align-items: center; gap: 5px; }
.setting-team-remove {
    width: 32px;
    height: 32px;
    padding: 0;
    display: grid;
    place-items: center;
    color: #bd7f84;
    background: transparent;
    border: 1px solid color-mix(in srgb, #c75d65 50%, var(--border));
    border-radius: 7px;
    cursor: pointer;
}
.setting-team-remove svg { width: 14px; height: 14px; }
.setting-team-remove:hover,
.setting-team-remove.is-confirming { color: #fff; background: #a64149; border-color: #d45c66; }
.setting-team-remove:disabled { opacity: .45; cursor: default; }
.setting-team-role-label { color: var(--text-secondary); font-size: 10px; }
.setting-team-members-empty { margin: 8px 2px; color: var(--text-muted); font-size: 11px; }
body:not(.dark) .setting-team-editor input {
    color: #20262e;
    background: #fff;
    border-color: #cfd6de;
}
body:not(.dark) #settingsModal .settings-canvas-column { background: #f5f7f9; }
body:not(.dark) #settingsModal .account-team-settings { background: #fff; }
body:not(.dark) .setting-team-members { background: #f7f9fb; }
body:not(.dark) .setting-team-owner-tools { background: #f1fbf7; border-color: #b9e7d8; }
body:not(.dark) .setting-team-invite-copy code { color: #174c3d; background: #fff; border-color: #92d5c0; }
body:not(.dark) .setting-team-members-head > span b { color: #fff; background: #168c6d; }
body:not(.dark) .setting-team-role { color: #20262e; background: #fff; border-color: #cfd6de; }
@media (max-width: 760px) {
    #settingsModal .modal-content {
        width: min(94vw, 560px);
        max-height: calc(100vh - 24px);
    }
    #settingsModal .settings-layout {
        min-height: 0;
        max-height: calc(100vh - 88px);
        grid-template-columns: 1fr;
        overflow: auto;
    }
    #settingsModal .settings-section { padding: 18px; }
    #settingsModal .account-team-settings { overflow: visible; border-top: 1px solid var(--border); border-left: 0; }
    .setting-account-summary,
    .setting-team-field { grid-template-columns: 1fr; gap: 5px; }
    .setting-team-current { grid-template-columns: 1fr auto; gap: 6px; }
    .setting-team-current > span { grid-column: 1 / -1; }
    .setting-team-note { margin-left: 0; }
    .setting-team-members,
    .setting-team-owner-tools { margin-left: 0; }
    .setting-team-members-head { align-items: flex-start; }
    .setting-team-members-head-actions small { max-width: 180px; }
    .setting-team-invite-copy { grid-template-columns: 1fr auto; }
    .setting-team-invite-label { grid-column: 1 / -1; }
}
body.canvas-mode .cinematic-style-card.is-selected,
body.canvas-mode .video-creative-card.is-selected,
body.canvas-mode .edit-studio-clip.active {
    box-shadow: inset 0 0 0 1px rgba(32, 201, 151, .7) !important;
}
body.canvas-mode .video-preset-trigger.has-video-preset-selection,
body.canvas-mode .image-style-trigger.has-style-selection {
    color: #bdf5e2 !important;
    border-color: #208c70 !important;
    background: rgba(32, 201, 151, .12) !important;
}

/* 风格/特效节点选择后展示与库卡片一致的预览图，而不是溢出的文字块。 */
.style-node-selection,
.effect-node-selection {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) 30px;
    min-height: 0;
    overflow: hidden;
}
.style-node-preview-grid {
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(64px, 1fr);
    gap: 7px;
    overflow: hidden;
}
.style-node-preview-card {
    position: relative;
    min-width: 0;
    min-height: 0;
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    overflow: hidden;
    color: #ffffff;
    background:
        radial-gradient(circle at 76% 18%, color-mix(in srgb, var(--style-c) 68%, transparent) 0 6%, transparent 27%),
        linear-gradient(135deg, var(--style-a), var(--style-b) 58%, var(--style-c));
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 8px;
}
.style-node-preview-card::after {
    content: "";
    position: absolute;
    inset: 35% 0 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, .58));
    pointer-events: none;
}
.style-node-preview-card svg { width: 17px; height: 17px; z-index: 1; }
.style-node-preview-card strong {
    z-index: 1;
    overflow: hidden;
    font-size: 10px;
    font-weight: 550;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.style-node-change { grid-column: auto; width: 100%; }

/* 编组底板必须为不透明实色。 */
body.dark.canvas-mode .canvas-node-group-backdrop,
body.dark.canvas-mode .canvas-node-group-backdrop.is-composite,
body.dark.canvas-mode .canvas-node-group-backdrop.is-selected {
    background: #292d32 !important;
    border-color: #4b525b !important;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.025), 0 14px 38px rgba(0,0,0,.28) !important;
    opacity: 1 !important;
}
body:not(.dark).canvas-mode .canvas-node-group-backdrop,
body:not(.dark).canvas-mode .canvas-node-group-backdrop.is-composite,
body:not(.dark).canvas-mode .canvas-node-group-backdrop.is-selected {
    background: #ffffff !important;
    border-color: #cbd3dc !important;
    opacity: 1 !important;
}

/* 画板：导入固定在左侧，下载固定在右侧；文字在落点就地输入。 */
.whiteboard-import {
    margin: 0;
    padding: 0;
    line-height: 1;
}
.whiteboard-toolbar > [data-whiteboard-action="export"] { margin-left: 0; }
.whiteboard-inline-text {
    position: absolute;
    z-index: 8;
    width: clamp(120px, 32%, 320px);
    min-height: 30px;
    padding: 2px 4px;
    transform: translateY(-2px);
    color: #20252b;
    background: transparent !important;
    border: 0 !important;
    border-bottom: 1px solid currentColor !important;
    border-radius: 0 !important;
    outline: 0;
    box-shadow: none !important;
    font-family: system-ui, sans-serif;
    line-height: 1.25;
}
.whiteboard-inline-text::placeholder { color: currentColor; opacity: .5; }
.whiteboard-size input { accent-color: #20c997; }
.whiteboard-toolbar button.active { color: #d9fff2; border-color: rgba(32,201,151,.5); background: rgba(32,201,151,.15); }
body:not(.dark).canvas-mode .whiteboard-toolbar button.active { color: #126b54; border-color: #6bbda4; background: #e3f3ed; }

/* 手机端画布：安全区、底部工具栏、侧栏、创作框和弹层均适配触控。 */
@media (max-width: 760px) {
    body.canvas-mode .toolbar {
        height: calc(54px + env(safe-area-inset-top));
        min-height: calc(54px + env(safe-area-inset-top));
        padding: env(safe-area-inset-top) 7px 0;
    }
    body.canvas-mode .canvas-container { top: calc(54px + env(safe-area-inset-top)) !important; }
    body.canvas-mode .toolbar-left { gap: 5px; }
    body.canvas-mode .project-name { max-width: min(36vw, 150px); }
    body.canvas-mode .toolbar-right { max-width: 48vw; overflow-x: auto; scrollbar-width: none; }
    body.canvas-mode .toolbar-right::-webkit-scrollbar { display: none; }
    body.canvas-mode #toolbarHistoryBtn { width: 40px; min-width: 40px; padding: 0; font-size: 0; }
    body.canvas-mode #toolbarHistoryBtn svg { margin: 0; }
    body.canvas-mode .user-btn { width: 40px; min-width: 40px; padding: 0; font-size: 0; justify-content: center; }
    body.canvas-mode .user-btn svg { margin: 0; }

    body.canvas-mode .bottom-toolbar {
        min-height: 56px;
        height: auto;
        padding-bottom: max(6px, env(safe-area-inset-bottom));
        background: color-mix(in srgb, var(--surface) 96%, transparent);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }
    body.canvas-mode .btm-tool-btn { flex: 0 0 44px; width: 44px; height: 44px; min-width: 44px; }
    body.canvas-mode .canvas-zoom-readout { flex: 0 0 auto; min-width: 44px; text-align: center; }

    body.canvas-mode .node-sidebar {
        top: calc(62px + env(safe-area-inset-top));
        bottom: calc(74px + env(safe-area-inset-bottom));
        max-height: none;
        background: color-mix(in srgb, var(--surface) 98%, transparent);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
    }

    body.canvas-mode .media-composer-panel[data-placement],
    body.canvas-mode .media-composer-panel[data-placement="dock"],
    body.canvas-mode .media-composer-panel[data-placement="below"],
    body.canvas-mode .media-composer-panel[data-placement="above"] {
        inset: auto 6px calc(72px + env(safe-area-inset-bottom)) 6px !important;
        width: auto !important;
        max-height: calc(100dvh - 138px - env(safe-area-inset-top)) !important;
        padding: 14px !important;
        border-radius: 18px !important;
        overscroll-behavior: contain;
    }
    body.canvas-mode .text-composer-tools,
    body.canvas-mode .image-composer-tools,
    body.canvas-mode .video-composer-tools,
    body.canvas-mode .audio-composer-tools {
        min-height: 42px;
        padding-right: 46px;
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap;
        scrollbar-width: none;
    }
    body.canvas-mode .text-composer-tools::-webkit-scrollbar,
    body.canvas-mode .image-composer-tools::-webkit-scrollbar,
    body.canvas-mode .video-composer-tools::-webkit-scrollbar,
    body.canvas-mode .audio-composer-tools::-webkit-scrollbar { display: none; }
    body.canvas-mode .text-composer-tools button,
    body.canvas-mode .image-composer-tools button,
    body.canvas-mode .video-composer-tools button,
    body.canvas-mode .audio-composer-tools button { flex: 0 0 auto; min-height: 40px; }
    body.canvas-mode .media-composer-prompt,
    body.canvas-mode .text-composer-content { min-height: 96px !important; font-size: 16px; }
    body.canvas-mode .media-composer-footer { align-items: center; }
    body.canvas-mode .media-composer-footer .media-composer-control { min-height: 40px; }
    body.canvas-mode .media-composer-submit { min-width: 46px !important; width: 46px !important; height: 46px !important; }

    body.canvas-mode .cinematic-style-library-overlay,
    body.canvas-mode .video-creative-library-overlay,
    body.canvas-mode .pose-library-overlay,
    body.canvas-mode .media-capability-overlay { align-items: flex-end; padding: 0; }
    body.canvas-mode .cinematic-style-library,
    body.canvas-mode .video-creative-library,
    body.canvas-mode .pose-library,
    body.canvas-mode .media-capability-library {
        width: 100vw !important;
        max-width: none !important;
        height: min(88dvh, 760px);
        max-height: calc(100dvh - env(safe-area-inset-top)) !important;
        border-radius: 20px 20px 0 0 !important;
        padding-bottom: env(safe-area-inset-bottom);
    }
    body.canvas-mode .cinematic-style-grid,
    body.canvas-mode .video-creative-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    body.canvas-mode .cinematic-style-library-toolbar,
    body.canvas-mode .video-creative-library-toolbar { grid-template-columns: 1fr; }
    body.canvas-mode .cinematic-style-search,
    body.canvas-mode .video-creative-search { width: 100%; }

    body.canvas-mode .whiteboard-toolbar {
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        touch-action: pan-x;
    }
    body.canvas-mode .whiteboard-toolbar::-webkit-scrollbar { display: none; }
    body.canvas-mode .whiteboard-toolbar button,
    body.canvas-mode .whiteboard-import { flex: 0 0 38px; width: 38px; height: 38px; }

    body.canvas-mode .node-port { width: 34px !important; height: 34px !important; }
    body.canvas-mode .input-port { left: -17px; }
    body.canvas-mode .output-port { right: -17px; }
    body.canvas-mode .node-port::after { width: 20px; height: 20px; }
}

@media (max-width: 420px) {
    body.canvas-mode .save-status { display: none; }
    body.canvas-mode .project-name { max-width: 34vw; }
    body.canvas-mode .media-composer-panel[data-placement] { inset-inline: 4px !important; }
    body.canvas-mode .cinematic-style-grid,
    body.canvas-mode .video-creative-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
}

/* 浅色画布的拉线菜单必须保持正文级对比度。前面的暗色画布规则拥有更高
   选择器权重，这里用同等级主题选择器做最终覆盖。 */
body:not(.dark).canvas-mode .port-drop-menu.port-reference-menu {
    color: #20262e !important;
    background: #ffffff !important;
    border-color: #ccd4dd !important;
    box-shadow: 0 16px 42px rgba(30, 42, 55, .18) !important;
}
body:not(.dark).canvas-mode .port-reference-menu .port-drop-menu-title {
    color: #4b5663 !important;
}
body:not(.dark).canvas-mode .port-reference-menu .port-drop-menu-item {
    color: #20262e !important;
}
body:not(.dark).canvas-mode .port-reference-menu .port-drop-menu-item .item-icon {
    color: #4b5663 !important;
}
body:not(.dark).canvas-mode .port-reference-menu .port-drop-menu-item:hover {
    color: #15221d !important;
    background: #e7f3ee !important;
}

/* 2026-08-06 · 分组视觉收口：标题收进组框预留带，组底板与画布拉开层级。 */
.canvas-node-group {
    background: rgba(24, 28, 34, .76);
    border-color: rgba(148, 163, 184, .56);
}

.canvas-node-group-title {
    /* 编组操作固定贴在组合框上方，避免与第一排节点争抢空间。 */
    top: -38px;
    left: 0;
    height: 34px;
    padding: 0 10px;
    gap: 7px;
    font-size: 14px;
    border-radius: 8px;
    background: #2b3038;
    border-color: #59636e;
    box-shadow: 0 5px 14px rgba(0, 0, 0, .28);
}

.canvas-group-selection-actions {
    /* 未成组时的“成组 / 解组”操作条同样紧贴选择框上沿。 */
    transform: translateY(10px);
}

.canvas-node-group-title :is(.canvas-node-group-rename,.canvas-node-group-tools-button,.canvas-node-group-delete) {
    width:24px; height:24px; border-radius:7px;
}
.canvas-node-group-title .canvas-node-group-ungroup { height:24px; padding:0 7px; }
.canvas-node-group-title :is(.canvas-node-group-rename,.canvas-node-group-tools-button,.canvas-node-group-ungroup,.canvas-node-group-delete) svg {
    width:15px; height:15px;
}
.canvas-node-group-resize {
    position:absolute; right:-7px; bottom:-7px; z-index:6; width:24px; height:24px;
    display:grid; place-items:center; padding:0; color:#d8dee7; background:#343940;
    border:1px solid #727a84; border-radius:7px; cursor:nwse-resize; pointer-events:auto;
    box-shadow:0 4px 12px rgba(0,0,0,.3);
}
.canvas-node-group-resize:hover { color:#fff; background:#454b53; }
.canvas-node-group-resize svg { width:14px; height:14px; }
body:not(.dark) .canvas-node-group-resize { color:#57606a; background:#fff; border-color:#8c959f; }

/* 对标布局：提示词优化与翻译停靠在底部参数栏、生成按钮左侧。 */
body.canvas-mode :is(.image-composer-panel,.video-composer-panel) .media-composer-prompt-wrap > .media-composer-prompt {
    padding:10px 11px !important;
}
body.canvas-mode .media-composer-footer-prompt-tools {
    position:static !important; right:auto !important; bottom:auto !important;
    width:66px !important; min-width:66px !important; height:34px !important;
    display:flex !important; align-items:center; justify-content:center; gap:4px !important;
    margin:0 !important; padding:0 !important;
}
body.canvas-mode .media-composer-footer-prompt-tools button,
body.canvas-mode .media-composer-footer-prompt-tools .media-composer-optimize {
    width:30px !important; min-width:30px !important; height:30px !important; min-height:30px !important;
}
body.canvas-mode .image-composer-panel .media-composer-footer {
    grid-template-columns:minmax(154px,1fr) 96px 84px 84px 66px 40px 44px !important;
}
body.canvas-mode .video-composer-panel .media-composer-footer {
    grid-template-columns:minmax(170px,1fr) 120px 84px 84px 82px 84px 66px 44px 48px !important;
}

.canvas-node-group.is-selected .canvas-node-group-title {
    background: #303945;
}

/* GitHub Primer 风格浅色层级。使用语义令牌统一画布、节点、浮层和控件，
   避免旧规则叠加后出现整页纯白、禁用项几乎不可见的问题。 */
body:not(.dark).canvas-mode {
    --gh-canvas: #f6f8fa;
    --gh-subtle: #eef1f4;
    --gh-surface: #ffffff;
    --gh-inset: #f6f8fa;
    --gh-border: #d0d7de;
    --gh-border-muted: #d8dee4;
    --gh-text: #1f2328;
    --gh-muted: #59636e;
    --gh-disabled: #818b98;
    --gh-accent: #1f883d;
    --gh-accent-soft: #dafbe1;
    color: var(--gh-text) !important;
    background: var(--gh-canvas) !important;
}

body:not(.dark).canvas-mode .canvas-container {
    background-color: var(--gh-canvas) !important;
    background-image: radial-gradient(circle, rgba(31, 35, 40, .16) 0, rgba(31, 35, 40, .16) .72px, transparent .9px) !important;
}

body:not(.dark).canvas-mode .node,
body:not(.dark).canvas-mode .node:hover,
body:not(.dark).canvas-mode .node:not(.image-node):not(.video-node),
body:not(.dark).canvas-mode .node.image-node,
body:not(.dark).canvas-mode .node.video-node,
body:not(.dark).canvas-mode .node.audio-node,
body:not(.dark).canvas-mode .node.style-node,
body:not(.dark).canvas-mode .node.effect-node,
body:not(.dark).canvas-mode .node.agent-node,
body:not(.dark).canvas-mode .node.skill-node {
    color: var(--gh-text) !important;
    background: var(--gh-surface) !important;
    border-color: var(--gh-border) !important;
    box-shadow: 0 8px 24px rgba(31, 35, 40, .10) !important;
}

body:not(.dark).canvas-mode .node .node-header {
    color: var(--gh-text) !important;
    background: var(--gh-surface) !important;
    border-color: var(--gh-border-muted) !important;
}

body:not(.dark).canvas-mode .node .node-content,
body:not(.dark).canvas-mode .node .image-preview-box,
body:not(.dark).canvas-mode .node .video-preview-box,
body:not(.dark).canvas-mode .node .audio-preview-box {
    color: var(--gh-text) !important;
    background: var(--gh-inset) !important;
    border-color: var(--gh-border) !important;
}

body:not(.dark).canvas-mode .node-sidebar,
body:not(.dark).canvas-mode .bottom-toolbar,
body:not(.dark).canvas-mode .port-drop-menu,
body:not(.dark).canvas-mode .context-menu,
body:not(.dark).canvas-mode .node-menu {
    color: var(--gh-text) !important;
    background: rgba(255, 255, 255, .98) !important;
    border-color: var(--gh-border) !important;
    box-shadow: 0 12px 32px rgba(31, 35, 40, .14) !important;
}

body:not(.dark).canvas-mode .port-drop-menu-item,
body:not(.dark).canvas-mode .context-menu-item,
body:not(.dark).canvas-mode .node-menu button {
    color: var(--gh-text) !important;
}

body:not(.dark).canvas-mode .port-drop-menu-item:hover,
body:not(.dark).canvas-mode .context-menu-item:hover,
body:not(.dark).canvas-mode .node-menu button:hover {
    background: var(--gh-subtle) !important;
}

body:not(.dark).canvas-mode :is(button, .port-drop-menu-item, .context-menu-item)[disabled],
body:not(.dark).canvas-mode :is(.disabled, [aria-disabled="true"]) {
    color: var(--gh-disabled) !important;
    opacity: .72 !important;
}

body:not(.dark).canvas-mode .canvas-node-group {
    background: rgba(208, 215, 222, .42) !important;
    border-color: #8c959f !important;
}

body:not(.dark).canvas-mode .canvas-node-group-title {
    color: var(--gh-text) !important;
    background: var(--gh-surface) !important;
    border-color: var(--gh-border) !important;
    box-shadow: 0 5px 14px rgba(31, 35, 40, .14) !important;
}

body:not(.dark).canvas-mode .canvas-node-group.is-selected {
    border-color: var(--gh-accent) !important;
    background: rgba(31, 136, 61, .10) !important;
}

body:not(.dark).canvas-mode .canvas-node-group.is-selected .canvas-node-group-title {
    color: #116329 !important;
    background: var(--gh-accent-soft) !important;
    border-color: #4ac26b !important;
}

/* 2026-08-03 · 创作框第二轮收口：紧凑、统一、无额外大标题行。 */
body.canvas-mode .media-composer-panel[data-placement].text-composer-panel,
body.canvas-mode .media-composer-panel[data-placement].image-composer-panel,
body.canvas-mode .media-composer-panel[data-placement].audio-composer-panel {
    width: min(var(--composer-width, 560px), calc(100vw - 28px)) !important;
}
body.canvas-mode .media-composer-panel[data-placement].video-composer-panel {
    width: min(var(--composer-width, 760px), calc(100vw - 28px)) !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) {
    padding: 13px 16px 14px !important;
    border-radius: 18px !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-header {
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-title { display: none !important; }
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-close,
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-expand {
    top: 12px !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 10px !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-close { right: 14px !important; }
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-expand { right: 50px !important; }
body.canvas-mode .image-composer-tools,
body.canvas-mode .video-composer-tools,
body.canvas-mode .audio-composer-tools,
body.canvas-mode .text-composer-tools {
    min-height: 34px !important;
    margin: 0 76px 8px 0 !important;
    padding: 0 !important;
    gap: 6px !important;
}
body.canvas-mode .image-composer-tools button,
body.canvas-mode .video-composer-tools button,
body.canvas-mode .audio-composer-tools button,
body.canvas-mode .text-composer-tools button {
    min-height: 32px !important;
    height: 32px !important;
    padding: 0 10px !important;
    gap: 6px !important;
    border-radius: 16px !important;
    font-size: 12px !important;
    font-weight: 450 !important;
}
body.canvas-mode .image-composer-tools button svg,
body.canvas-mode .video-composer-tools button svg,
body.canvas-mode .audio-composer-tools button svg,
body.canvas-mode .text-composer-tools button svg { width: 15px !important; height: 15px !important; }

.media-composer-prompt-wrap {
    position: relative;
    min-height: 0;
    margin: 0;
}
body.canvas-mode .media-composer-prompt-wrap > .media-composer-prompt {
    width: 100%;
    min-height: 74px !important;
    height: 74px;
    margin: 0 !important;
    padding: 10px 76px 30px 11px !important;
    border: 0 !important;
    border-radius: 8px !important;
    background: #20242a !important;
    box-shadow: none !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
}
.media-composer-prompt-tools {
    position: absolute;
    right: 8px;
    bottom: 7px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 3px;
}
.media-composer-prompt-tools button,
.media-composer-prompt-tools .media-composer-optimize {
    position: static !important;
    width: 29px !important;
    min-width: 29px !important;
    height: 29px !important;
    min-height: 29px !important;
    margin: 0 !important;
    padding: 0 !important;
    display: inline-grid !important;
    place-items: center !important;
    color: #aeb7c2 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 8px !important;
    box-shadow: none !important;
}
.media-composer-prompt-tools button:hover {
    color: #dffff4 !important;
    background: rgba(32, 201, 151, .14) !important;
}
.media-composer-prompt-tools button svg { width: 17px !important; height: 17px !important; }
.media-composer-prompt-tools button.is-loading svg { animation: spin .8s linear infinite; }

body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer {
    min-height: 40px !important;
    margin-top: 9px !important;
    padding: 9px 0 0 !important;
    gap: 6px !important;
    border-top-color: rgba(148, 163, 184, .13) !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-control {
    min-height: 34px !important;
    height: 34px !important;
    padding: 0 9px !important;
    border-radius: 10px !important;
    font-size: 12px !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-control svg { width: 14px !important; height: 14px !important; }
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-submit {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    border-radius: 12px !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-control.model { min-width: 172px !important; }
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-control.mode { min-width: 104px !important; }
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-control:not(.model):not(.mode) { min-width: 70px !important; }
body.canvas-mode .audio-composer-panel:not(.is-expanded) .audio-composer-prompt-wrap {
    min-height: 66px !important;
    height: 66px !important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .audio-composer-prompt-wrap > .media-composer-prompt {
    min-height: 66px !important;
    height: 66px !important;
    padding: 9px 74px 26px 10px !important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .audio-composer-source { margin: 0 0 6px !important; padding: 6px 8px !important; }
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer > label:has(.media-composer-duration) {
    width: 84px !important;
    min-width: 84px !important;
}
body.canvas-mode .audio-composer-panel .composer-select-trigger,
body.canvas-mode .audio-composer-panel .media-composer-duration { min-width: 58px !important; }
body.canvas-mode .audio-composer-panel .composer-select-value { overflow: visible !important; text-overflow: clip !important; white-space: nowrap !important; }

/* 风格库与特效库选中后都在节点内部展示正方形卡片，绝不越界。 */
body.canvas-mode .node.style-node .node-content,
body.canvas-mode .node.effect-node .node-content {
    position: relative !important;
    display: block !important;
    min-width: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
}
body.canvas-mode .node.style-node .style-node-selection,
body.canvas-mode .node.effect-node .effect-node-selection {
    position: absolute !important;
    inset: 10px !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, 1fr) 30px !important;
    gap: 7px !important;
    overflow: hidden !important;
}
body.canvas-mode .node.style-node .style-node-selection[hidden],
body.canvas-mode .node.effect-node .effect-node-selection[hidden] { display: none !important; }
body.canvas-mode .style-node-preview-grid {
    min-width: 0 !important;
    min-height: 0 !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-auto-rows: auto !important;
    align-content: start !important;
    gap: 7px !important;
    overflow: hidden !important;
}
body.canvas-mode .style-node-preview-card {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    aspect-ratio: 1 / 1 !important;
    padding: 7px !important;
    border-radius: 8px !important;
}
body.canvas-mode .style-node-change { height: 30px !important; min-height: 30px !important; margin: 0 !important; }

/* 轻剪辑：播放器比例可选、全屏可用、指针有足够鼠标命中区域。 */
.edit-studio-preview-shell {
    aspect-ratio: var(--edit-studio-aspect, 16 / 9) !important;
    width: auto !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    --edit-studio-fit: contain;
    --edit-studio-media-scale: 1;
}
.edit-studio-preview-shell video {
    object-fit: var(--edit-studio-fit, contain) !important;
    transform: scale(var(--edit-studio-media-scale, 1));
    transform-origin: center center;
    transition: transform 120ms ease;
}
.edit-studio-viewer-actions { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.edit-studio-viewer-actions label { display: inline-flex; align-items: center; gap: 6px; }
.edit-studio-output-ratio > span { color: #9da7b3; font-size: 10px; white-space: nowrap; }
.edit-studio-viewer-actions select,
.edit-studio-viewer-actions button {
    height: 28px;
    color: #aeb7c2;
    background: #262a2f;
    border: 1px solid #3a4047;
    border-radius: 7px;
}
.edit-studio-viewer-actions select { min-width: 62px; padding: 0 7px; font-size: 11px; }
.edit-studio-viewer-actions button { width: 30px; display: inline-grid; place-items: center; }
.edit-studio-viewer-actions button svg { width: 15px; height: 15px; }
.edit-studio-main:fullscreen { width: 100vw; height: 100vh; padding: 18px !important; background: #111419; }
.edit-studio-main:fullscreen .edit-studio-preview-shell {
    width: min(94vw, calc(92vh * var(--edit-studio-aspect-number, 1.7778))) !important;
    max-height: calc(100vh - 92px) !important;
}
.edit-studio-playhead { pointer-events: auto !important; cursor: ew-resize !important; touch-action: none; }
.edit-studio-playhead::after {
    content: "";
    position: absolute;
    inset: 0 -9px;
}

body:not(.dark) .media-composer-prompt-wrap > .media-composer-prompt { color: #232a31 !important; background: #f5f7f9 !important; }
body:not(.dark) .media-composer-prompt-tools button { color: #53606d !important; }
body:not(.dark) .edit-studio-viewer-actions select,
body:not(.dark) .edit-studio-viewer-actions button { color: #384451; background: #fff; border-color: #ccd4dc; }
body:not(.dark) .edit-studio-output-ratio > span { color: #4f5d6a; }

/* 2026-08-05 · 文本创作：模型与表达模式紧凑排列，模式可横向滑动选择。 */
body.canvas-mode .text-composer-footer {
    justify-content: flex-start !important;
    min-width: 0;
}
body.canvas-mode .text-composer-footer .media-composer-control.model {
    flex: 0 1 168px;
    min-width: 128px !important;
    max-width: 188px;
}
body.canvas-mode .text-composer-footer .text-composer-model {
    width: 100%;
    min-width: 0;
    text-overflow: ellipsis;
}
.text-composer-mode-switch {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    border: 1px solid rgba(148, 163, 184, .16);
    border-radius: 11px;
    background: rgba(30, 34, 40, .72);
}
.text-composer-mode-switch::-webkit-scrollbar { display: none; }
.text-composer-mode-switch button {
    flex: 0 0 auto;
    height: 28px;
    padding: 0 10px;
    color: #aeb7c2;
    background: transparent;
    border: 0;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
}
.text-composer-mode-switch button:hover { color: #eef4f8; background: rgba(148, 163, 184, .10); }
.text-composer-mode-switch button.active {
    color: #eafff8;
    background: rgba(32, 201, 151, .17);
    box-shadow: inset 0 0 0 1px rgba(61, 220, 171, .30);
}
body.canvas-mode .text-composer-translate {
    flex: 0 0 36px;
    width: 36px !important;
    min-width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    display: inline-grid;
    place-items: center;
}
body:not(.dark) .text-composer-mode-switch { background: #f0f2f4; border-color: #d0d7df; }
body:not(.dark) .text-composer-mode-switch button { color: #53606d; }
body:not(.dark) .text-composer-mode-switch button.active { color: #176f58; background: #dcefe8; }

/* 文本空节点：上传入口紧跟在“文字生音乐”下方，共用同一左边线。 */
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-prompt-starters .text-upload-row {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-prompt-starters .text-upload-btn {
    width: 100% !important;
    height: 26px !important;
    padding: 0 9px !important;
}

/* 2026-08-10 · 文本节点功能必须精确点选：选中态互斥，并阻断节点拖拽误触。 */
body.canvas-mode .node.text-node .text-prompt-starters [data-text-prompt],
body.canvas-mode .node.text-node .text-upload-btn {
    position: relative;
    cursor: pointer !important;
    user-select: none;
    touch-action: manipulation;
    transition: color .16s ease, background .16s ease, box-shadow .16s ease, opacity .16s ease;
}
body.canvas-mode .node.text-node .text-prompt-starters [data-text-prompt].is-selected,
body.canvas-mode .node.text-node .text-upload-btn.is-selected {
    color: #ecfff7 !important;
    background: rgba(54, 132, 101, .32) !important;
    box-shadow: inset 0 0 0 1px rgba(91, 190, 148, .55), 0 4px 14px rgba(20, 92, 65, .18);
}
body.canvas-mode .node.text-node .text-prompt-starters [data-text-prompt].is-selected svg,
body.canvas-mode .node.text-node .text-upload-btn.is-selected svg {
    color: #72d5a9 !important;
    stroke: currentColor;
}
body.canvas-mode .node.text-node .text-prompt-starters [data-text-prompt].is-running,
body.canvas-mode .node.text-node .text-upload-btn.is-running {
    pointer-events: none;
    opacity: .62;
}
body:not(.dark).canvas-mode .node.text-node .text-prompt-starters [data-text-prompt].is-selected,
body:not(.dark).canvas-mode .node.text-node .text-upload-btn.is-selected {
    color: #14543f !important;
    background: #dcefe7 !important;
    box-shadow: inset 0 0 0 1px rgba(45, 132, 96, .42);
}

/* 2026-08-05 · 生成框按对标产品的紧凑比例收口，避免模型栏挤掉参数。 */
body.canvas-mode .media-composer-panel[data-placement].text-composer-panel {
    width: min(920px, calc(100vw - 32px)) !important;
}
body.canvas-mode .media-composer-panel[data-placement].image-composer-panel {
    width: min(980px, calc(100vw - 32px)) !important;
}
body.canvas-mode .media-composer-panel[data-placement].video-composer-panel {
    width: min(1080px, calc(100vw - 32px)) !important;
}
body.canvas-mode .media-composer-panel[data-placement].audio-composer-panel {
    width: min(960px, calc(100vw - 32px)) !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: minmax(220px, 320px) 104px 96px 96px auto 44px !important;
    align-items: center;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control.model {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
}
body.canvas-mode .image-composer-panel .media-composer-control.ratio,
body.canvas-mode .image-composer-panel .media-composer-control.resolution,
body.canvas-mode .image-composer-panel .media-composer-control.count {
    min-width: 0 !important;
    width: auto !important;
}
body.canvas-mode .image-composer-panel .composer-select-value,
body.canvas-mode .image-composer-panel select { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: minmax(210px, 250px) minmax(130px, 150px) 82px 82px 88px 86px auto 44px !important;
    align-items: center;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer > * {
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
}
body.canvas-mode .video-composer-panel .composer-select-value,
body.canvas-mode .video-composer-panel select { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: minmax(200px, 230px) minmax(150px, 180px) 100px 86px 70px auto 44px !important;
    align-items: center;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer > * {
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
}
.audio-prompt-insertions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 76px 7px 0;
}
.audio-prompt-insertions button {
    height: 28px;
    padding: 0 9px;
    color: #c8d0d9;
    background: #34383e;
    border: 1px solid #454a52;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}
.audio-prompt-insertions button:hover { color: #effff9; border-color: #2f9f7d; }
.audio-clone-trigger {
    height: 34px;
    padding: 0 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #c8d0d9;
    background: #292d32;
    border: 1px solid #3d434a;
    border-radius: 10px;
    white-space: nowrap;
    cursor: pointer;
}
.audio-clone-trigger svg { width: 15px; height: 15px; }
.audio-character-count { color: #8994a0; font-size: 12px; white-space: nowrap; }
body:not(.dark) .audio-prompt-insertions button,
body:not(.dark) .audio-clone-trigger { color: #384451; background: #edf0f3; border-color: #d2d8df; }

@media (max-width: 900px) {
    body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer,
    body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer,
    body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer {
        display: flex !important;
        overflow-x: auto;
        scrollbar-width: none;
    }
    body.canvas-mode .media-composer-footer::-webkit-scrollbar { display: none; }
    body.canvas-mode .media-composer-footer > * { flex: 0 0 auto !important; }
}

/* Final light-mode palette override: keep the canvas UI strictly white and neutral gray. */
body:not(.dark) { --primary: #57606a !important; --primary-hover: #24292f !important; }
body:not(.dark).canvas-mode .user-btn { color:#fff!important; background:#24292f!important; border-color:#24292f!important; }
body:not(.dark).canvas-mode .save-status { color:#424a53!important; background:#eaeef2!important; border-color:#afb8c1!important; }
body:not(.dark).canvas-mode .save-status::before { background:#57606a!important; box-shadow:none!important; }
body:not(.dark).canvas-mode .node.selected,
body:not(.dark).canvas-mode .node.image-node.selected,
body:not(.dark).canvas-mode .node.video-node.selected,
body:not(.dark).canvas-mode .node.audio-node.selected,
body:not(.dark).canvas-mode .node.text-node.selected,
body:not(.dark).canvas-mode .node.agent-node.selected,
body:not(.dark).canvas-mode .node.skill-node.selected,
body:not(.dark).canvas-mode .node.edit-studio-node.selected { border-color:#57606a!important; box-shadow:0 0 0 1px rgba(87,96,106,.24),0 8px 24px rgba(31,35,40,.16)!important; }
body:not(.dark).canvas-mode .node.selected :is(.node-title,.node-icon),
body:not(.dark).canvas-mode .node.selected .node-header svg { color:#24292f!important; }
body:not(.dark).canvas-mode .node-port:hover::after,
body:not(.dark).canvas-mode .node-port.snap-target::after { color:#fff!important; background:#57606a!important; border-color:#424a53!important; }
body:not(.dark).canvas-mode .canvas-node-group.is-selected,
body:not(.dark).canvas-mode .canvas-node-group-backdrop.is-selected { background:rgba(140,149,159,.18)!important; border-color:#57606a!important; }
body:not(.dark).canvas-mode .canvas-node-group.is-selected .canvas-node-group-title { color:#24292f!important; background:#eaeef2!important; border-color:#8c959f!important; }
body:not(.dark).canvas-mode .connections-layer g.is-selected .conn-line,
body:not(.dark).canvas-mode .connections-layer g.is-selected .conn-flow { stroke:#57606a!important; }
body:not(.dark) .text-composer-mode-switch button.active,
body:not(.dark) .composer-mode-switch button.active,
body:not(.dark) .agent-picker-popover nav button.active { color:#fff!important; background:#57606a!important; border-color:#57606a!important; }
body:not(.dark) .media-composer-submit:hover,
body:not(.dark) .media-composer-submit:focus-visible { color:#fff!important; background:#424a53!important; border-color:#424a53!important; }

/* v1.0.5 · LibLib 实测比例最终覆盖（必须位于文件末尾）。 */
body.canvas-mode .media-composer-panel[data-placement].text-composer-panel{width:min(760px,64vw)!important;max-width:calc(100vw - 32px)!important}
body.canvas-mode .media-composer-panel[data-placement].image-composer-panel{width:min(900px,58vw)!important;max-width:calc(100vw - 32px)!important}
body.canvas-mode .media-composer-panel[data-placement].video-composer-panel{width:min(980px,64vw)!important;max-width:calc(100vw - 32px)!important}
body.canvas-mode .media-composer-panel[data-placement].audio-composer-panel{width:min(900px,60vw)!important;max-width:calc(100vw - 32px)!important}
body.canvas-mode .media-composer-panel:not(.is-expanded){min-height:0!important;padding:14px 16px 15px!important;gap:8px!important;border-radius:18px!important}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-prompt-wrap{min-height:112px!important;max-height:156px!important}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-prompt,
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-content{min-height:112px!important;height:112px!important;max-height:156px!important;padding:10px 8px!important;font-size:14px!important;line-height:1.55!important}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer{min-height:44px!important;padding-top:8px!important;align-items:center!important}
body.canvas-mode .media-composer-panel:not(.is-expanded) :is(.media-composer-control,.composer-select-trigger,.composer-select-value,.media-composer-mode-chip),
body.canvas-mode .text-composer-panel:not(.is-expanded) :is(.text-composer-mode-switch button,.media-composer-control){font-size:13px!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer{grid-template-columns:minmax(130px,1fr) 68px 64px 60px 60px 30px 40px!important;column-gap:5px!important}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer{grid-template-columns:minmax(110px,130px) minmax(82px,90px) 52px 58px 58px 60px 60px 30px 40px!important;column-gap:4px!important;justify-content:space-between!important}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer{grid-template-columns:minmax(145px,1fr) 130px 80px 64px 58px 32px 42px!important;column-gap:5px!important}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-submit,
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-apply{width:42px!important;min-width:42px!important;height:42px!important;min-height:42px!important;border-radius:13px!important}

/* v1.0.5 · 图片生成底栏最终修正：7 个控件各占一列，提交按钮永远固定最右。 */
body.canvas-mode .media-composer-panel[data-placement].image-composer-panel:not(.is-expanded){
    width:min(780px,54vw)!important;
    max-width:calc(100vw - 28px)!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer{
    display:grid!important;
    grid-template-columns:minmax(108px,138px) 60px 58px 54px 58px 28px 38px!important;
    grid-template-rows:40px!important;
    grid-auto-flow:column!important;
    column-gap:4px!important;
    align-items:center!important;
    justify-content:end!important;
    overflow:visible!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control.model{
    grid-column:1!important;
    width:138px!important;
    min-width:108px!important;
    max-width:138px!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control.ratio{grid-column:2!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control.resolution{grid-column:3!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control.count{grid-column:4!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer-prompt-tools{
    grid-column:5!important;
    width:58px!important;
    min-width:58px!important;
    max-width:58px!important;
    display:flex!important;
    gap:2px!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer-prompt-tools button{
    width:28px!important;
    min-width:28px!important;
    height:36px!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-credit{grid-column:6!important;width:28px!important;min-width:28px!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-submit{
    grid-column:7!important;
    grid-row:1!important;
    width:38px!important;
    min-width:38px!important;
    height:38px!important;
    min-height:38px!important;
    margin:0!important;
    align-self:center!important;
    justify-self:end!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control.model :is(.composer-select-trigger,.composer-select-value,span){
    min-width:0!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
}

body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-control.model{width:130px!important;min-width:110px!important;max-width:130px!important}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-control.mode{width:90px!important;min-width:82px!important;max-width:90px!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer-prompt-tools,
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer-prompt-tools{width:60px!important;min-width:60px!important;max-width:60px!important;display:flex!important;gap:2px!important;justify-content:center!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer-prompt-tools button,
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer-prompt-tools button{width:28px!important;min-width:28px!important;height:36px!important;padding:0!important}

/* v1.0.5 · LibLib 全景比例：面板约占视口六成，操作区固定靠右。 */
body.canvas-mode .media-composer-panel[data-placement].text-composer-panel{width:min(760px,64vw)!important;max-width:calc(100vw - 32px)!important}
body.canvas-mode .media-composer-panel[data-placement].image-composer-panel{width:min(900px,58vw)!important;max-width:calc(100vw - 32px)!important}
body.canvas-mode .media-composer-panel[data-placement].video-composer-panel{width:min(980px,64vw)!important;max-width:calc(100vw - 32px)!important}
body.canvas-mode .media-composer-panel[data-placement].audio-composer-panel{width:min(900px,60vw)!important;max-width:calc(100vw - 32px)!important}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer{width:100%!important;box-sizing:border-box!important;justify-content:stretch!important;overflow:visible!important}
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-footer{
    display:grid!important;
    grid-template-columns:minmax(150px,220px) max-content minmax(18px,1fr) 36px 42px!important;
    column-gap:7px!important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-control.model{grid-column:1!important}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-mode-switch{grid-column:2!important}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-translate{grid-column:4!important}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-apply{grid-column:5!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer{
    grid-template-columns:minmax(150px,1fr) 72px 68px 64px 32px 32px 42px!important;
    column-gap:6px!important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer{
    grid-template-columns:minmax(135px,1fr) 108px 58px 64px 64px 66px 32px 32px 42px!important;
    column-gap:5px!important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer{
    grid-template-columns:minmax(145px,1fr) 130px 80px 64px 58px 32px 42px!important;
    column-gap:5px!important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer-prompt-tools{
    width:32px!important;
    min-width:32px!important;
    max-width:32px!important;
    justify-content:center!important;
    gap:0!important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer-prompt-tools button{
    width:28px!important;
    height:36px!important;
    padding:0!important;
}
@media (max-width:900px){
    body.canvas-mode .media-composer-panel[data-placement]{width:calc(100vw - 24px)!important;max-width:calc(100vw - 24px)!important}
}

/* 2026-08-06 · 对照 LibLib 实际画布：生成对话框采用紧凑的宽扁比例。 */
body.canvas-mode .media-composer-panel[data-placement].text-composer-panel {
    width: min(760px, calc(100vw - 32px)) !important;
}
body.canvas-mode .media-composer-panel[data-placement].image-composer-panel {
    width: min(860px, calc(100vw - 32px)) !important;
}
body.canvas-mode .media-composer-panel[data-placement].video-composer-panel {
    width: min(920px, calc(100vw - 32px)) !important;
}
body.canvas-mode .media-composer-panel[data-placement].audio-composer-panel {
    width: min(820px, calc(100vw - 32px)) !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) {
    min-height: 0 !important;
    padding: 14px 16px 15px !important;
    gap: 8px !important;
    border-radius: 18px !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) :is(.video-composer-tools,.image-composer-tools) {
    min-height: 32px !important;
    gap: 6px !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) :is(.video-composer-tools,.image-composer-tools) button {
    height: 32px !important;
    padding: 0 12px !important;
    font-size: 13px !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-prompt-wrap {
    min-height: 112px !important;
    max-height: 156px !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-prompt,
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-content {
    min-height: 112px !important;
    height: 112px !important;
    max-height: 156px !important;
    padding: 10px 8px !important;
    font-size: 14px !important;
    line-height: 1.55 !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer {
    min-height: 44px !important;
    padding-top: 8px !important;
    align-items: center !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) :is(.media-composer-control,.composer-select-trigger,.composer-select-value,.media-composer-mode-chip),
body.canvas-mode .text-composer-panel:not(.is-expanded) :is(.text-composer-mode-switch button,.media-composer-control) {
    font-size: 13px !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-control,
body.canvas-mode .media-composer-panel:not(.is-expanded) .composer-select-trigger {
    height: 36px !important;
    min-height: 36px !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer {
    grid-template-columns: minmax(220px, 1fr) 112px 92px 82px 32px 42px !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer {
    grid-template-columns: minmax(170px, 1fr) 126px 72px 78px 72px 76px 32px 42px !important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer {
    grid-template-columns: minmax(170px, 1fr) 154px 82px 70px 56px 32px 42px !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-submit,
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-apply {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    border-radius: 13px !important;
}

/* 2026-08-06 · 最终对话框底栏：完整模型名、小字号、翻译与生成贴右。 */
body.canvas-mode :is(.text-composer-panel,.image-composer-panel,.video-composer-panel,.audio-composer-panel)
    :is(.composer-select-trigger,.composer-select-value,select) {
    font-size:13px !important;
    font-weight:500 !important;
    letter-spacing:0 !important;
}
body.canvas-mode .composer-select-trigger span {
    overflow:hidden !important;
    text-overflow:ellipsis !important;
    white-space:nowrap !important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-footer {
    display:grid !important;
    grid-template-columns:minmax(350px,430px) minmax(420px,1fr) 48px 56px !important;
    align-items:center !important;
    width:100% !important;
    column-gap:8px !important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-footer .media-composer-control.model {
    width:100% !important; min-width:350px !important; max-width:430px !important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) :is(.text-composer-translate,.text-composer-apply) {
    justify-self:end !important; margin-left:0 !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer {
    display:grid !important;
    grid-template-columns:minmax(250px,1fr) 108px 92px 92px 66px 40px 48px !important;
    align-items:center !important; column-gap:7px !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer {
    display:grid !important;
    grid-template-columns:minmax(260px,1fr) 132px 78px 78px 82px 82px 66px 40px 48px !important;
    align-items:center !important; column-gap:7px !important;
}
body.canvas-mode :is(.image-composer-panel,.video-composer-panel) .media-composer-footer-prompt-tools {
    position:static !important; width:66px !important; min-width:66px !important;
    display:flex !important; align-items:center !important; justify-content:center !important;
}

/* Group shell never paints over nodes. Only the dedicated z-index:0 backdrop is darkened. */
body.canvas-mode .canvas-node-group,
body.canvas-mode .canvas-node-group.is-composite,
body.canvas-mode .canvas-node-group.is-selected {
    background: transparent !important;
    backdrop-filter: none !important;
}
body.dark.canvas-mode .canvas-node-group-backdrop,
body.dark.canvas-mode .canvas-node-group-backdrop.is-composite {
    background: #191d22 !important;
}
body.dark.canvas-mode .canvas-node-group-backdrop.is-selected {
    background: #1d2228 !important;
}
body:not(.dark).canvas-mode .canvas-node-group-backdrop,
body:not(.dark).canvas-mode .canvas-node-group-backdrop.is-composite {
    background: #d8dee4 !important;
}
body:not(.dark).canvas-mode .canvas-node-group-backdrop.is-selected {
    background: #d0d7de !important;
}

/* 提高暗色编组底板灰阶：与黑色画布拉开层级，但不覆盖或压暗组内节点。 */
body.dark.canvas-mode .canvas-node-group-backdrop,
body.dark.canvas-mode .canvas-node-group-backdrop.is-composite {
    background: #303236 !important;
    border-color: #666a70 !important;
}
body.dark.canvas-mode .canvas-node-group-backdrop.is-selected {
    background: #37393d !important;
    border-color: #7a7e84 !important;
}

/* 风格、特效、技能三个方法节点使用同一紧凑规格。 */
body.canvas-mode .node.style-node,
body.canvas-mode .node.effect-node,
body.canvas-mode .node.skill-node {
    width: 284px !important;
    min-width: 284px !important;
    max-width: 284px !important;
    height: 190px !important;
    min-height: 190px !important;
    max-height: 190px !important;
}
body.canvas-mode .node.style-node .node-header,
body.canvas-mode .node.effect-node .node-header,
body.canvas-mode .node.skill-node .node-header {
    min-height: 42px !important;
    height: 42px !important;
    box-sizing: border-box !important;
}
body.canvas-mode .node.style-node .node-content,
body.canvas-mode .node.effect-node .node-content,
body.canvas-mode .node.skill-node .node-content {
    width: auto !important;
    height: 138px !important;
    min-height: 138px !important;
    margin: 0 10px 10px !important;
    padding: 8px 12px 12px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}
body.canvas-mode .node.style-node .style-node-open,
body.canvas-mode .node.effect-node .style-node-open,
body.canvas-mode .node.skill-node .skill-node-open {
    min-height: 116px !important;
    height: 116px !important;
}
body.canvas-mode .node.style-node .style-node-hero,
body.canvas-mode .node.effect-node .style-node-hero,
body.canvas-mode .node.skill-node .skill-node-hero {
    width: 46px !important;
    height: 46px !important;
}

/* 创作框技能入口与已选技能标签。 */
.composer-skill-trigger { position:relative; }
.composer-skill-trigger em {
    min-width:17px; height:17px; padding:0 4px; display:grid; place-items:center;
    color:#15211d; background:#70dfba; border-radius:9px; font-size:10px; font-style:normal;
}
.composer-skill-trigger em[hidden] { display:none!important; }
.composer-skill-selection {
    display:flex; align-items:center; gap:6px; min-height:32px; padding:5px 8px;
    overflow-x:auto; border:1px solid rgba(97,211,174,.24); border-radius:9px;
    background:rgba(97,211,174,.06);
}
.composer-skill-selection[hidden] { display:none!important; }
.composer-skill-selection > span {
    flex:0 0 auto; display:inline-flex; align-items:center; gap:5px; height:24px; padding:0 5px 0 8px;
    color:#dce8e4; background:#303a37; border:1px solid rgba(97,211,174,.3); border-radius:7px; font-size:11px;
}
.composer-skill-selection svg { width:13px; height:13px; }
.composer-skill-selection button { width:18px; height:18px; display:grid; place-items:center; padding:0; color:#9eaaa6; background:transparent; border:0; border-radius:5px; cursor:pointer; }
.composer-skill-picker { z-index:10200!important; }
body:not(.dark) .composer-skill-selection { background:#f0f2f4; border-color:#afb8c1; }
body:not(.dark) .composer-skill-selection > span { color:#24292f; background:#fff; border-color:#afb8c1; }

/* 右键“创作能力”二级菜单。 */
#canvasContextMenu .menu-submenu { position:relative; }
#canvasContextMenu.show { overflow:visible!important; }
#canvasContextMenu .menu-submenu-trigger {
    display:flex; align-items:center; gap:9px; min-height:34px; padding:0 10px; color:inherit; border-radius:7px; cursor:default;
    font-size:13px; font-weight:400; line-height:1.2;
}
#canvasContextMenu .menu-submenu-trigger > svg:last-child { margin-left:auto; }
#canvasContextMenu .menu-submenu-trigger svg { width:16px; height:16px; }
#canvasContextMenu .menu-submenu:hover > .menu-submenu-trigger { background:rgba(255,255,255,.07); }
#canvasContextMenu .menu-submenu-panel {
    position:absolute; left:calc(100% - 3px); top:-6px; width:150px; display:none; padding:6px;
    color:#e8edf2; background:#24272b; border:1px solid rgba(255,255,255,.12); border-radius:9px;
    box-shadow:0 14px 36px rgba(0,0,0,.38);
}
#canvasContextMenu .menu-submenu:hover > .menu-submenu-panel { display:block; }
#canvasContextMenu.submenu-left .menu-submenu-panel { left:auto; right:calc(100% - 3px); }
body:not(.dark) #canvasContextMenu .menu-submenu:hover > .menu-submenu-trigger { background:#eaeef2; }
body:not(.dark) #canvasContextMenu .menu-submenu-panel { color:#24292f; background:#fff; border-color:#d0d7de; box-shadow:0 12px 30px rgba(31,35,40,.16); }

/* v1.36 · 画布右键菜单紧凑化。完整容纳“粘贴节点”，避免末项越出圆角背景。 */
body.canvas-mode #canvasContextMenu {
    width: 196px !important;
    min-width: 196px !important;
    max-height: calc(100vh - 16px) !important;
    padding: 5px !important;
}

body.canvas-mode #canvasContextMenu .menu-section-title {
    min-height: 22px !important;
    padding: 3px 8px 2px !important;
    font-size: 11px !important;
}

body.canvas-mode #canvasContextMenu .menu-item,
body.canvas-mode #canvasContextMenu .menu-submenu-trigger {
    min-height: 27px !important;
    height: 27px !important;
    padding: 0 8px !important;
    gap: 8px !important;
    font-size: 13px !important;
    border-radius: 6px !important;
}

body.canvas-mode #canvasContextMenu :is(.menu-item, .menu-submenu-trigger) svg {
    width: 15px !important;
    height: 15px !important;
}

body.canvas-mode #canvasContextMenu .menu-divider {
    margin: 3px 2px !important;
}

body.canvas-mode #canvasContextMenu > .menu-item[data-action="paste"] {
    margin-top: 1px !important;
}

/* 2026-08-06 · 文本框底栏：翻译与生成固定在右下角。 */
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-footer {
    width: 100% !important;
    max-width: none !important;
    grid-template-columns: minmax(220px, 340px) minmax(360px, 1fr) 42px 42px !important;
    align-items: center !important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-translate {
    grid-column: 3 !important;
    justify-self: end !important;
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-apply {
    grid-column: 4 !important;
    justify-self: end !important;
}

/* GitHub Primer 浅色画布第二轮：画布用 control/inset 层，卡片保持 canvas-default 白色。 */
body:not(.dark).canvas-mode {
    --gh-canvas: #eaeef2;
    --gh-surface: #ffffff;
    --gh-inset: #f6f8fa;
    --gh-border: #afb8c1;
    --gh-border-muted: #d0d7de;
    --gh-text: #1f2328;
    --gh-muted: #59636e;
    background: var(--gh-canvas) !important;
}
body:not(.dark).canvas-mode .canvas-container {
    background-color: var(--gh-canvas) !important;
    background-image: radial-gradient(circle, rgba(89, 99, 110, .28) 0, rgba(89, 99, 110, .28) .78px, transparent 1px) !important;
}
body:not(.dark).canvas-mode .node-sidebar,
body:not(.dark).canvas-mode .bottom-toolbar {
    background: rgba(255, 255, 255, .98) !important;
    border-color: #afb8c1 !important;
    box-shadow: 0 8px 24px rgba(31, 35, 40, .16) !important;
}
body:not(.dark).canvas-mode .node,
body:not(.dark).canvas-mode .node:hover,
body:not(.dark).canvas-mode .node:not(.image-node):not(.video-node),
body:not(.dark).canvas-mode .node.image-node,
body:not(.dark).canvas-mode .node.video-node,
body:not(.dark).canvas-mode .node.audio-node,
body:not(.dark).canvas-mode .node.style-node,
body:not(.dark).canvas-mode .node.effect-node,
body:not(.dark).canvas-mode .node.agent-node,
body:not(.dark).canvas-mode .node.skill-node {
    color: var(--gh-text) !important;
    background: var(--gh-surface) !important;
    border-color: #afb8c1 !important;
    box-shadow: 0 6px 18px rgba(31, 35, 40, .16) !important;
}
body:not(.dark).canvas-mode .node .node-header {
    color: var(--gh-text) !important;
    background: #ffffff !important;
    border-bottom-color: #d0d7de !important;
}
body:not(.dark).canvas-mode .node .node-content,
body:not(.dark).canvas-mode .node .image-preview-box,
body:not(.dark).canvas-mode .node .video-preview-box,
body:not(.dark).canvas-mode .node .audio-preview-box {
    color: var(--gh-text) !important;
    background: var(--gh-inset) !important;
    border-color: #d0d7de !important;
}
body:not(.dark).canvas-mode .node .node-title,
body:not(.dark).canvas-mode .sidebar-title,
body:not(.dark).canvas-mode .sidebar-group-title,
body:not(.dark).canvas-mode .sidebar-item,
body:not(.dark).canvas-mode .sidebar-item .sbar-name {
    color: var(--gh-text) !important;
}
body:not(.dark).canvas-mode .node-close,
body:not(.dark).canvas-mode .sidebar-item .sbar-icon,
body:not(.dark).canvas-mode .sidebar-item .sbar-eye,
body:not(.dark).canvas-mode .sidebar-item .sbar-edit {
    color: var(--gh-muted) !important;
}

@media (max-width: 900px) {
    body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-footer {
        display: grid !important;
        grid-template-columns: minmax(180px, 1fr) 42px 42px !important;
    }
    body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-mode-switch {
        grid-column: 1 / -1 !important;
        grid-row: 1 !important;
    }
    body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-control.model {
        grid-column: 1 !important;
        grid-row: 2 !important;
    }
    body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-translate {
        grid-column: 2 !important;
        grid-row: 2 !important;
    }
    body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-apply {
        grid-column: 3 !important;
        grid-row: 2 !important;
    }
}

.edit-studio-framing-group { display: grid; gap: 10px; }
.edit-studio-framing-group label { display: grid; gap: 5px; color: var(--text-muted); font-size: 9px; }
.edit-studio-framing-group select {
    width: 100%;
    height: 32px;
    padding: 0 8px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 7px;
    outline: 0;
    color: var(--text);
    background: #17191d;
    font-size: 10px;
}
.edit-studio-scale-control > span { display: flex; justify-content: space-between; align-items: center; }
.edit-studio-scale-control output { color: #20c997; font-variant-numeric: tabular-nums; }
.edit-studio-scale-control input { width: 100%; accent-color: #20c997; cursor: ew-resize; }
body:not(.dark) .edit-studio-framing-group select { color: #26313b; background: #fff; border-color: #ccd4dc; }

/* 浅色画布必须从节点外壳一直贯穿到轻剪辑卡片内部。旧版空态写死了暗色背景，
   这里使用与图片、视频节点相同的浅色层级，避免出现白色画布中的黑色孤岛。 */
body:not(.dark).canvas-mode .node.edit-studio-node {
    color: #1f2730 !important;
    background: #ffffff !important;
    border-color: #ccd4dd !important;
}
body:not(.dark).canvas-mode .node.edit-studio-node .node-content,
body:not(.dark).canvas-mode .node.edit-studio-node .edit-studio-summary,
body:not(.dark).canvas-mode .node.edit-studio-node .edit-studio-node-open {
    color: #26313b !important;
    background: #f5f7f9 !important;
    border-color: #d5dce4 !important;
}
body:not(.dark).canvas-mode .node.edit-studio-node .edit-studio-node-open:hover {
    background: #eef1f4 !important;
    border-color: #aeb9c5 !important;
}
body:not(.dark).canvas-mode .node.edit-studio-node .edit-studio-node-icon {
    color: #4c5a68 !important;
    background: #e8ecf0 !important;
    border-color: #c8d0d9 !important;
}
body:not(.dark).canvas-mode .node.edit-studio-node .edit-studio-node-copy,
body:not(.dark).canvas-mode .node.edit-studio-node .edit-studio-node-duration,
body:not(.dark).canvas-mode .node.edit-studio-node .edit-studio-node-arrow {
    color: #52606e !important;
}

/* 浅色主题的连接端口保持浅灰底、深色加号；选中态只使用绿色点缀。 */
body:not(.dark).canvas-mode .node-port::after {
    color: #27323d !important;
    background: #f7f8fa !important;
    border-color: #8f9ba8 !important;
    box-shadow: 0 2px 6px rgba(34, 45, 58, .15) !important;
}
body:not(.dark).canvas-mode .node.selected {
    border-color: #20a981 !important;
    box-shadow: 0 0 0 1px rgba(32, 169, 129, .16), 0 10px 28px rgba(35, 45, 58, .12) !important;
}

/* 轻剪辑统一为中性黑灰 + 绿色状态色，移除旧版蓝色和渐变。 */
.edit-studio-heading-icon {
    color: #ecfff8 !important;
    background: #168c6d !important;
    border-color: #20a981 !important;
}
.edit-studio-import,
.edit-studio-source-item button {
    color: #78d8b9 !important;
    background: rgba(32, 201, 151, .09) !important;
    border-color: rgba(32, 201, 151, .42) !important;
}
.edit-studio-import:hover,
.edit-studio-source-item button:hover {
    color: #dffff4 !important;
    background: rgba(32, 201, 151, .16) !important;
    border-color: rgba(32, 201, 151, .65) !important;
}
.edit-studio-source-tabs button.active,
.edit-studio-timeline.drag-over,
.edit-studio-trim-group input:focus,
.edit-studio-name-field input:focus {
    border-color: #20a981 !important;
}
.edit-studio-source-tabs button.active {
    color: #dffff4 !important;
    background: rgba(32, 201, 151, .13) !important;
}
.edit-studio-source-thumb,
.edit-studio-clip-preview {
    color: #9fe7d0 !important;
    background: rgba(32, 201, 151, .10) !important;
}
.edit-studio-export,
.edit-studio-transport button.primary {
    color: #ffffff !important;
    background: #168c6d !important;
    border-color: #20a981 !important;
    box-shadow: none !important;
}
.edit-studio-export:hover,
.edit-studio-transport button.primary:hover { background: #137a5f !important; }
body:not(.dark) .edit-studio-heading-icon {
    color: #ffffff !important;
    background: #168c6d !important;
    border-color: #168c6d !important;
}
body:not(.dark) .edit-studio-import,
body:not(.dark) .edit-studio-source-item button {
    color: #126b54 !important;
    background: #e7f3ee !important;
    border-color: #79bba6 !important;
}
body:not(.dark) .edit-studio-source-tabs button.active {
    color: #155f4c !important;
    background: #e4f1ec !important;
    border-color: #83bca9 !important;
}

@media (max-width: 760px) {
    body.canvas-mode .media-composer-panel:not(.is-expanded) { padding: 11px 12px 12px !important; }
    body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer { overflow-x: auto; }
    body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-title { display: none !important; }
    body.canvas-mode .media-composer-prompt-wrap > .media-composer-prompt { font-size: 16px !important; }
    .edit-studio-preview-shell { width: 100% !important; }
}

/* 2026-08-04 · 文件末尾最终覆盖：紧凑视频/音频创作框不允许裁切任何参数或提交按钮。 */
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: 134px 84px 76px 80px 80px 80px 32px 42px !important;
    align-items: center !important;
    column-gap: 5px !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer > * {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer > .media-composer-control.model,
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer > .media-composer-control.mode,
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer > .media-composer-control:not(.model):not(.mode) {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    padding-inline: 7px !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer .composer-select-trigger,
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer .composer-select-value,
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer .media-composer-mode-chip {
    min-width: 0 !important;
    max-width: none !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-credit {
    width: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    gap: 2px !important;
    justify-content: center !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-submit {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: minmax(138px, 1fr) minmax(92px, 112px) 74px 32px 42px !important;
    align-items: center !important;
    column-gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer > * {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-credit {
    width: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    justify-content: center !important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-submit {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
}

/* 2026-08-04 · PHYSICAL-END text/image footer override.
   Legacy canvas rules above force these two footers back to flex; keep this
   override after every legacy block so all controls stay within the panel. */
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-footer,
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) 64px 42px !important;
    align-items: center !important;
    column-gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: minmax(148px, 1fr) 70px 66px 62px 30px 42px !important;
    align-items: center !important;
    column-gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-footer > *,
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-footer > *,
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer > * {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-credit {
    width: 30px !important;
    min-width: 30px !important;
    max-width: 30px !important;
    justify-content: center !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-submit {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
}

/* Duration labels need 84px to show 10/30/60 seconds without colliding with
   the credit counter; take the extra width from the flexible model column. */
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer {
    grid-template-columns: minmax(128px, 1fr) minmax(92px, 112px) 84px 32px 42px !important;
}

/* 2026-08-04 · V51 — single composer geometry contract.
   Keep every creator wide enough for one-line controls and let the prompt
   determine the compact height. This is deliberately the physical last rule
   so older per-node experiments cannot make the same panel jump between
   square, over-tall and clipped states. */
body.canvas-mode .media-composer-panel:not(.is-expanded) {
    box-sizing: border-box !important;
    min-height: 0 !important;
    height: auto;
    max-width: calc(100vw - 24px) !important;
    padding: 14px 18px 16px !important;
    gap: 9px !important;
    border-radius: 22px !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-tools {
    min-height: 34px !important;
    gap: 7px !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-tool,
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-close,
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-expand {
    min-height: 34px !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-prompt-wrap,
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-prompt {
    min-height: 0 !important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-prompt,
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-input {
    height: 112px !important;
    min-height: 112px !important;
    max-height: 112px !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-prompt,
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-prompt,
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-prompt {
    height: 104px !important;
    min-height: 104px !important;
    max-height: 104px !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer {
    min-height: 42px !important;
    padding-top: 8px !important;
    margin-top: 0 !important;
    border-top-color: rgba(148, 163, 184, .16) !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-control,
body.canvas-mode .media-composer-panel:not(.is-expanded) .composer-select-trigger,
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-submit,
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-translate {
    height: 42px !important;
    min-height: 42px !important;
    white-space: nowrap !important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-footer,
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-footer {
    grid-template-columns: minmax(210px, 1.2fr) minmax(170px, 1fr) 84px 44px !important;
    column-gap: 7px !important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-translate {
    width: 84px !important;
    min-width: 84px !important;
    max-width: 84px !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer {
    grid-template-columns: minmax(220px, 1fr) 86px 82px 76px 34px 44px !important;
    column-gap: 7px !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer {
    grid-template-columns: minmax(180px, 1fr) minmax(120px, .72fr) 72px 74px 82px 76px 34px 44px !important;
    column-gap: 6px !important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer {
    grid-template-columns: minmax(210px, 1fr) minmax(130px, .68fr) 96px 34px 44px !important;
    column-gap: 7px !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-credit,
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-credit,
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-credit {
    width: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-submit {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
}

@media (max-width: 820px) {
    body.canvas-mode .media-composer-panel:not(.is-expanded) {
        width: calc(100vw - 16px) !important;
        max-width: calc(100vw - 16px) !important;
        padding-inline: 12px !important;
    }
    body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer {
        display: flex !important;
        overflow-x: auto !important;
        scrollbar-width: thin;
    }
    body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer > * {
        flex: 0 0 auto !important;
    }
}

/* 2026-08-04 · V55 — PHYSICAL-END composer override.
   Do not insert new composer geometry above this block. */
/* V56 interaction contract：只有图标与文字是功能热区；其余留白归节点拖拽/正文点击。 */
body.canvas-mode .media-empty-actions {
    width: max-content !important;
    max-width: calc(100% - 20px) !important;
    justify-items: start !important;
    align-self: center !important;
    pointer-events: none !important;
}
body.canvas-mode .media-empty-actions button {
    position: relative !important;
    width: max-content !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 3px 0 !important;
    justify-self: start !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
    pointer-events: auto !important;
}
body.canvas-mode .media-empty-actions button > * {
    pointer-events: none !important;
}
@media (max-width: 820px) {
    body.canvas-mode .media-empty-actions {
        width: max-content !important;
    }
    body.canvas-mode .media-empty-actions button {
        min-height: 0 !important;
        padding-block: 4px !important;
    }
}
body.canvas-mode .media-composer-panel:not(.is-expanded) {
    min-height: 0 !important;
    height: auto !important;
    max-width: calc(100vw - 24px) !important;
    padding: 11px 16px 13px !important;
    gap: 7px !important;
    border-radius: 18px !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-tools {
    min-height: 30px !important;
    gap: 6px !important;
    margin: 0 !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-tool,
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-close,
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-expand {
    height: 30px !important;
    min-height: 30px !important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-prompt,
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-input,
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-content {
    height: 82px !important;
    min-height: 82px !important;
    max-height: 82px !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-prompt,
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-prompt {
    height: 78px !important;
    min-height: 78px !important;
    max-height: 78px !important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-prompt {
    height: 66px !important;
    min-height: 66px !important;
    max-height: 66px !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer {
    min-height: 36px !important;
    padding-top: 7px !important;
    margin-top: 0 !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-control,
body.canvas-mode .media-composer-panel:not(.is-expanded) .composer-select-trigger,
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-translate {
    height: 36px !important;
    min-height: 36px !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-submit {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-footer,
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: minmax(235px, 1.18fr) minmax(180px, 1fr) 82px 42px !important;
    column-gap: 7px !important;
    overflow: visible !important;
    min-height: 49px !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: minmax(250px, 1fr) 82px 78px 72px 32px 42px !important;
    column-gap: 7px !important;
    overflow: visible !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: minmax(200px, 1fr) minmax(120px, .72fr) 70px 72px 78px 72px 32px 42px !important;
    column-gap: 6px !important;
    overflow: visible !important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: minmax(240px, 1fr) minmax(150px, .72fr) 88px 32px 42px !important;
    column-gap: 7px !important;
    overflow: visible !important;
}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer > * {
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-translate {
    width: 82px !important;
    min-width: 82px !important;
    max-width: 82px !important;
    height: 36px !important;
    min-height: 36px !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-credit,
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-credit,
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-credit {
    width: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    justify-content: center !important;
}
body.canvas-mode .media-composer-panel.is-expanded {
    display: flex !important;
    flex-direction: column !important;
    padding: 16px 18px !important;
    gap: 10px !important;
    overflow: hidden !important;
}
body.canvas-mode .media-composer-panel.is-expanded .media-composer-prompt-wrap,
body.canvas-mode .text-composer-panel.is-expanded .text-composer-content {
    display: flex !important;
    flex: 1 1 auto !important;
    min-height: 180px !important;
    height: auto !important;
    max-height: none !important;
}
body.canvas-mode .media-composer-panel.is-expanded .media-composer-prompt,
body.canvas-mode .text-composer-panel.is-expanded .text-composer-input {
    flex: 1 1 auto !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 180px !important;
    max-height: none !important;
    overflow-y: auto !important;
}
body.canvas-mode .media-composer-panel.is-expanded .media-composer-footer {
    flex: 0 0 auto !important;
    width: 100% !important;
    margin-top: 0 !important;
}

@media (max-width: 820px) {
    body.canvas-mode .media-composer-panel:not(.is-expanded) {
        width: calc(100vw - 16px) !important;
        max-width: calc(100vw - 16px) !important;
        padding: 10px 12px 12px !important;
    }
    body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer {
        display: flex !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
    }
    body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer > * {
        flex: 0 0 auto !important;
    }
}
/* ===== v1.0.5 技能库：Skill 节点 + 智能体运行时技能选择 ===== */
body.canvas-mode .node.skill-node {
    width: 284px;
    min-height: 190px;
    color: #edf3f1;
    background: #202427;
    border: 1px solid rgba(97, 211, 174, .55);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .28);
}

body.canvas-mode .node.skill-node.selected,
body.canvas-mode .node.skill-node:hover {
    border-color: #61d3ae;
    box-shadow: 0 0 0 1px rgba(97, 211, 174, .2), 0 14px 34px rgba(0, 0, 0, .32);
}

body.canvas-mode .node.skill-node .node-header {
    min-height: 36px;
    padding: 8px 11px 4px;
}

body.canvas-mode .node.skill-node .node-icon { color: #70dfba; }
body.canvas-mode .node.skill-node .node-content { padding: 8px 12px 13px; }

.skill-node-open {
    width: 100%;
    min-height: 126px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: #e9efed;
    background: #292e32;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 11px;
    cursor: pointer;
}

.skill-node-open:hover { background: #30363a; border-color: rgba(97, 211, 174, .42); }
.skill-node-hero { width: 46px; height: 46px; display: grid; place-items: center; color: #70dfba; background: rgba(97, 211, 174, .1); border: 1px solid rgba(97, 211, 174, .24); border-radius: 13px; }
.skill-node-hero svg { width: 25px; height: 25px; }
.skill-node-open strong { font-size: 14px; font-weight: 600; }
.skill-node-open small { max-width: 210px; color: #8e9b99; font-size: 11px; line-height: 1.5; text-align: center; }

.skill-node-selection {
    min-height: 118px;
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    grid-template-rows: 1fr auto;
    gap: 9px 10px;
    padding: 13px;
    box-sizing: border-box;
    background: linear-gradient(145deg, rgba(97, 211, 174, .12), rgba(97, 211, 174, .035));
    border: 1px solid rgba(97, 211, 174, .24);
    border-radius: 11px;
}

.skill-node-selection[hidden] { display: none !important; }
.skill-selection-icon { width: 40px; height: 40px; display: grid; place-items: center; color: #73e0bc; background: rgba(97, 211, 174, .13); border-radius: 10px; }
.skill-selection-icon svg { width: 20px; height: 20px; }
.skill-selection-copy { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.skill-selection-copy strong { overflow: hidden; color: #f3f7f6; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.skill-selection-copy small { display: -webkit-box; overflow: hidden; color: #97a5a2; font-size: 10px; line-height: 1.45; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.skill-selection-change { grid-column: 1 / -1; height: 30px; color: #c7d4d1; background: rgba(255, 255, 255, .055); border: 0; border-radius: 8px; cursor: pointer; }
.skill-selection-change:hover { color: #fff; background: rgba(97, 211, 174, .15); }

body.canvas-mode .agent-skill-strip { display: flex; flex-direction: column; gap: 5px; }
body.canvas-mode .agent-skill-picker-trigger {
    width: 100%;
    min-height: 32px;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 10px;
    color: #b8c4c1;
    background: rgba(97, 211, 174, .06);
    border: 1px dashed rgba(97, 211, 174, .25);
    border-radius: 8px;
    cursor: pointer;
}

body.canvas-mode .agent-skill-picker-trigger:hover { color: #e8f7f2; background: rgba(97, 211, 174, .11); border-color: rgba(97, 211, 174, .5); }
body.canvas-mode .agent-skill-picker-trigger svg { width: 14px; height: 14px; color: #70dcb8; }
body.canvas-mode .agent-skill-picker-trigger span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.canvas-mode .agent-skill-picker-trigger em { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; color: #173b30; background: #70dcb8; border-radius: 9px; font-size: 10px; font-style: normal; line-height: 18px; text-align: center; }

.agent-skill-selection { display: flex; flex-wrap: wrap; gap: 5px; }
.agent-skill-selection[hidden] { display: none !important; }
.agent-skill-chip { max-width: 100%; min-height: 25px; display: inline-flex; align-items: center; gap: 5px; padding: 3px 6px 3px 7px; color: #bde8da; background: rgba(97, 211, 174, .09); border: 1px solid rgba(97, 211, 174, .2); border-radius: 7px; }
.agent-skill-chip.connected { color: #c7d2ff; background: rgba(117, 132, 246, .1); border-color: rgba(117, 132, 246, .24); }
.agent-skill-chip > svg { width: 12px; height: 12px; flex: none; }
.agent-skill-chip strong { max-width: 160px; overflow: hidden; font-size: 10px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.agent-skill-chip em { font-size: 9px; font-style: normal; opacity: .7; }
.agent-skill-chip button { width: 16px; height: 16px; display: grid; place-items: center; padding: 0; color: inherit; background: transparent; border: 0; border-radius: 4px; cursor: pointer; opacity: .75; }
.agent-skill-chip button:hover { background: rgba(255, 255, 255, .1); opacity: 1; }
.agent-skill-chip button svg { width: 11px; height: 11px; }

.skill-picker-popover {
    position: fixed;
    z-index: 10070;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #eef4f2;
    background: #222629;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 14px;
    box-shadow: 0 18px 54px rgba(0, 0, 0, .5);
}

.skill-picker-popover header { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 15px 17px 10px; }
.skill-picker-popover header > div { display: flex; flex-direction: column; gap: 3px; }
.skill-picker-popover header strong { font-size: 17px; }
.skill-picker-popover header small { color: #8e9a98; font-size: 11px; }
.skill-picker-popover header button { width: 30px; height: 30px; display: grid; place-items: center; color: #9ea8a6; background: transparent; border: 0; border-radius: 8px; cursor: pointer; }
.skill-picker-popover header button:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.skill-picker-search { flex: none; height: 38px; display: flex; align-items: center; gap: 8px; margin: 0 17px 10px; padding: 0 11px; box-sizing: border-box; background: #2d3235; border: 1px solid rgba(255, 255, 255, .07); border-radius: 9px; }
.skill-picker-search svg { width: 15px; height: 15px; color: #84908d; }
.skill-picker-search input { min-width: 0; flex: 1; color: #fff; background: transparent; border: 0; outline: 0; }
.skill-picker-popover nav { flex: none; display: flex; gap: 5px; overflow-x: auto; padding: 0 17px 10px; scrollbar-width: none; }
.skill-picker-popover nav::-webkit-scrollbar { display: none; }
.skill-picker-popover nav button { flex: none; padding: 6px 10px; color: #9ba6a3; background: transparent; border: 0; border-radius: 8px; cursor: pointer; }
.skill-picker-popover nav button.active { color: #102e25; background: #70dcb8; }
.skill-picker-list { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: max-content; align-content: start; gap: 8px; overflow-y: auto; padding: 0 12px 12px; }
.skill-picker-card { min-width: 0; min-height: 112px; display: flex; flex-direction: column; gap: 8px; padding: 11px 12px; color: #edf3f1; text-align: left; background: #2b3033; border: 1px solid transparent; border-radius: 11px; cursor: pointer; }
.skill-picker-card:hover,
.skill-picker-card.selected { background: #303a37; border-color: rgba(97, 211, 174, .58); }
.skill-picker-card.connected { border-style: dashed; }
.skill-picker-card-head { display: flex; align-items: center; gap: 6px; }
.skill-picker-card-head > svg { width: 15px; height: 15px; flex: none; color: #70dcb8; }
.skill-picker-card-head strong { min-width: 0; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.skill-picker-card-head em { margin-left: auto; padding: 2px 6px; color: #8ddfca; background: rgba(97, 211, 174, .09); border-radius: 5px; font-size: 9px; font-style: normal; white-space: nowrap; }
.skill-picker-card > small { display: -webkit-box; overflow: hidden; color: #98a39f; font-size: 10px; line-height: 1.45; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.skill-picker-tools { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; }
.skill-picker-tools b { padding: 2px 5px; color: #899592; background: rgba(255, 255, 255, .045); border-radius: 4px; font-size: 8px; font-weight: 500; }
.skill-picker-empty { grid-column: 1 / -1; padding: 54px 20px; color: #8e9895; text-align: center; }

body:not(.dark).canvas-mode .node.skill-node { color: #263630; background: #ffffff; border-color: #86cbb5; box-shadow: 0 10px 28px rgba(39, 75, 62, .12); }
body:not(.dark).canvas-mode .skill-node-open { color: #2f3d38; background: #f3f7f5; border-color: #d7e3df; }
body:not(.dark).canvas-mode .skill-node-open small,
body:not(.dark).canvas-mode .skill-selection-copy small { color: #687771; }
body:not(.dark).canvas-mode .skill-selection-copy strong { color: #263630; }
body:not(.dark).canvas-mode .skill-node-selection { background: #f1faf6; border-color: #bde1d4; }
body:not(.dark).canvas-mode .skill-selection-change { color: #3c5750; background: #e3f1ec; }
body:not(.dark).canvas-mode .agent-skill-picker-trigger { color: #466058; background: #f2faf7; border-color: #b8dace; }
body:not(.dark) .skill-picker-popover { color: #263630; background: #ffffff; border-color: #d4dfdb; box-shadow: 0 18px 54px rgba(31, 57, 48, .18); }
body:not(.dark) .skill-picker-search,
body:not(.dark) .skill-picker-card { color: #263630; background: #f3f6f5; border-color: #dde5e2; }
body:not(.dark) .skill-picker-search input { color: #263630; }
body:not(.dark) .skill-picker-card:hover,
body:not(.dark) .skill-picker-card.selected { background: #eaf7f2; border-color: #55b898; }
body:not(.dark) .skill-picker-popover nav button { color: #596a64; }
body:not(.dark) .skill-picker-popover nav button.active { color: #ffffff; background: #2f8f72; }

@media (max-width: 760px) {
    .skill-picker-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
    .skill-picker-list { grid-template-columns: 1fr; }
}

/* 2026-08-05 · v1.0.5 final composer contract. Keep physically last. */
body.canvas-mode .media-composer-panel[data-placement].text-composer-panel { width: min(720px, calc(100vw - 32px)) !important; }
body.canvas-mode .media-composer-panel[data-placement].image-composer-panel { width: min(980px, calc(100vw - 32px)) !important; }
body.canvas-mode .media-composer-panel[data-placement].video-composer-panel { width: min(1080px, calc(100vw - 32px)) !important; }
body.canvas-mode .media-composer-panel[data-placement].audio-composer-panel { width: min(960px, calc(100vw - 32px)) !important; }

body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: minmax(128px, 188px) max-content 36px 42px !important;
    justify-content: start !important;
    column-gap: 7px !important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-mode-switch {
    width: max-content !important;
    min-width: 0 !important;
    max-width: none !important;
    flex: none !important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-mode-switch button {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    flex: none !important;
}
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-upload-row {
    display: flex !important;
    width: 206px !important;
    min-height: 27px !important;
    margin: 0 auto !important;
    padding: 0 !important;
}
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-upload-btn {
    display: flex !important;
    flex: 1 1 auto !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 27px !important;
    min-height: 27px !important;
    gap: 8px !important;
    padding: 0 9px !important;
    color: #d6dde6 !important;
    font-size: 11px !important;
    visibility: visible !important;
    opacity: 1 !important;
}
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-upload-btn > span {
    display: none !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    color: inherit !important;
    font: inherit !important;
    visibility: visible !important;
    opacity: 1 !important;
    white-space: nowrap !important;
}
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-upload-btn::after {
    content: "上传文件" !important;
    display: inline-block !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    color: inherit !important;
    font: inherit !important;
    line-height: 1 !important;
    visibility: visible !important;
    opacity: 1 !important;
    white-space: nowrap !important;
}
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-file-name:empty {
    display: none !important;
}

/* v1.0.5 · 文本空节点最终排版：五项同列、紧凑且上下留白均衡。 */
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown) .node-content {
    justify-content: center !important;
    gap: 4px !important;
    padding: 16px 20px 18px !important;
}
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown) .text-node-hero {
    flex: 0 0 44px !important;
    margin: 0 0 2px !important;
}
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown) .text-node-hero svg {
    width: 34px !important;
    height: 34px !important;
}
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown) .text-prompt-starters {
    width: 214px !important;
    gap: 2px !important;
    margin: 0 auto !important;
}
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown) .text-prompt-starters > span {
    height: 16px !important;
    padding: 0 9px !important;
    line-height: 16px !important;
}
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown) .text-prompt-starters > button,
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown) .text-upload-btn {
    flex: 0 0 25px !important;
    width: 214px !important;
    min-width: 214px !important;
    height: 25px !important;
    min-height: 25px !important;
    padding: 0 9px !important;
    gap: 9px !important;
    line-height: 25px !important;
}
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown) .text-upload-row {
    flex: 0 0 25px !important;
    width: 214px !important;
    min-width: 214px !important;
    min-height: 25px !important;
    margin: 0 !important;
}
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown) .text-upload-row .text-upload-btn {
    flex: 1 1 auto !important;
}
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown) .text-prompt-starters svg {
    flex: 0 0 14px !important;
    width: 14px !important;
    height: 14px !important;
}

/* 顶部工具栏已经显示项目名，隐藏旧版左下角重复项目名框。 */
body.canvas-mode #canvasProjectNameBox,
#canvasProjectNameBox {
    display: none !important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-translate {
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: 320px 104px 96px 96px 34px 44px !important;
    column-gap: 7px !important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: 250px 150px 82px 82px 88px 86px 34px 44px !important;
    column-gap: 6px !important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer {
    display: grid !important;
    grid-template-columns: 230px 180px 100px 86px 70px 34px 44px !important;
    column-gap: 7px !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer > *,
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer > *,
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer > * {
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
}
@media (max-width: 900px) {
    body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer,
    body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer,
    body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer {
        display: flex !important;
        overflow-x: auto !important;
    }
    body.canvas-mode .media-composer-footer > * { flex: 0 0 auto !important; }
}

/* v1.0.5 · LibLib 全景比例：面板按视口比例，操作区贴右且不换行。 */
body.canvas-mode .media-composer-panel[data-placement].text-composer-panel{width:min(760px,64vw)!important;max-width:calc(100vw - 32px)!important}
body.canvas-mode .media-composer-panel[data-placement].image-composer-panel{width:min(900px,58vw)!important;max-width:calc(100vw - 32px)!important}
body.canvas-mode .media-composer-panel[data-placement].video-composer-panel{width:min(980px,64vw)!important;max-width:calc(100vw - 32px)!important}
body.canvas-mode .media-composer-panel[data-placement].audio-composer-panel{width:min(900px,60vw)!important;max-width:calc(100vw - 32px)!important}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer{width:100%!important;box-sizing:border-box!important;justify-content:stretch!important;overflow:visible!important}
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-footer{display:grid!important;grid-template-columns:minmax(150px,220px) max-content minmax(18px,1fr) 36px 42px!important;column-gap:7px!important}
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-control.model{grid-column:1!important}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-mode-switch{grid-column:2!important}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-translate{grid-column:4!important}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-apply{grid-column:5!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer{grid-template-columns:minmax(150px,1fr) 72px 68px 64px 32px 32px 42px!important;column-gap:6px!important}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer{grid-template-columns:minmax(135px,1fr) 108px 58px 64px 64px 66px 32px 32px 42px!important;column-gap:5px!important}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer{grid-template-columns:minmax(145px,1fr) 130px 80px 64px 58px 32px 42px!important;column-gap:5px!important}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer-prompt-tools{width:32px!important;min-width:32px!important;max-width:32px!important;justify-content:center!important;gap:0!important}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer-prompt-tools button{width:28px!important;height:36px!important;padding:0!important}
@media (max-width:900px){body.canvas-mode .media-composer-panel[data-placement]{width:calc(100vw - 24px)!important;max-width:calc(100vw - 24px)!important}}

/* Final neutral light theme — intentionally last in the stylesheet. */
body:not(.dark) { --primary:#57606a!important; --primary-hover:#24292f!important; }
body:not(.dark).canvas-mode .user-btn { color:#fff!important; background:#24292f!important; border-color:#24292f!important; }
body:not(.dark).canvas-mode .save-status { color:#424a53!important; background:#eaeef2!important; border-color:#afb8c1!important; }
body:not(.dark).canvas-mode .save-status::before { background:#57606a!important; box-shadow:none!important; }
body:not(.dark).canvas-mode .node.selected { border-color:#57606a!important; box-shadow:0 0 0 1px rgba(87,96,106,.24),0 8px 24px rgba(31,35,40,.16)!important; }
body:not(.dark).canvas-mode .node.selected :is(.node-title,.node-icon),
body:not(.dark).canvas-mode .node.selected .node-header svg { color:#24292f!important; }
body:not(.dark).canvas-mode .node-port:hover::after,
body:not(.dark).canvas-mode .node-port.snap-target::after { color:#fff!important; background:#57606a!important; border-color:#424a53!important; }
body:not(.dark).canvas-mode .canvas-node-group.is-selected,
body:not(.dark).canvas-mode .canvas-node-group-backdrop.is-selected { background:rgba(140,149,159,.18)!important; border-color:#57606a!important; }
body:not(.dark).canvas-mode .canvas-node-group.is-selected .canvas-node-group-title { color:#24292f!important; background:#eaeef2!important; border-color:#8c959f!important; }
body:not(.dark).canvas-mode .connections-layer g.is-selected :is(.conn-line,.conn-flow) { stroke:#57606a!important; }
body:not(.dark) .text-composer-mode-switch button.active,
body:not(.dark) .composer-mode-switch button.active,
body:not(.dark) .agent-picker-popover nav button.active { color:#fff!important; background:#57606a!important; border-color:#57606a!important; }
body:not(.dark) .media-composer-submit:hover,
body:not(.dark) .media-composer-submit:focus-visible { color:#fff!important; background:#424a53!important; border-color:#424a53!important; }

/* v1.0.5 · FINAL-COMPOSER-TAIL-UI32。 */
body.canvas-mode .media-composer-panel[data-placement].text-composer-panel{width:min(760px,64vw)!important;max-width:calc(100vw - 32px)!important}
body.canvas-mode .media-composer-panel[data-placement].image-composer-panel{width:min(900px,58vw)!important;max-width:calc(100vw - 32px)!important}
body.canvas-mode .media-composer-panel[data-placement].video-composer-panel{width:min(980px,64vw)!important;max-width:calc(100vw - 32px)!important}
body.canvas-mode .media-composer-panel[data-placement].audio-composer-panel{width:min(900px,60vw)!important;max-width:calc(100vw - 32px)!important}
body.canvas-mode .media-composer-panel:not(.is-expanded){min-height:0!important;padding:14px 16px 15px!important;gap:8px!important;border-radius:18px!important}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-prompt-wrap{min-height:112px!important;max-height:156px!important}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-prompt,
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-content{min-height:112px!important;height:112px!important;max-height:156px!important;padding:10px 8px!important;font-size:14px!important;line-height:1.55!important}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer{min-height:44px!important;padding-top:8px!important;align-items:center!important}
body.canvas-mode .media-composer-panel:not(.is-expanded) :is(.media-composer-control,.composer-select-trigger,.composer-select-value,.media-composer-mode-chip),
body.canvas-mode .text-composer-panel:not(.is-expanded) :is(.text-composer-mode-switch button,.media-composer-control){font-size:13px!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer{grid-template-columns:minmax(150px,1fr) 72px 68px 64px 32px 32px 42px!important;column-gap:6px!important}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer{grid-template-columns:minmax(135px,1fr) 108px 58px 64px 64px 66px 32px 32px 42px!important;column-gap:5px!important}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer{grid-template-columns:minmax(145px,1fr) 130px 80px 64px 58px 32px 42px!important;column-gap:5px!important}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-submit,
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-apply{width:42px!important;min-width:42px!important;height:42px!important;min-height:42px!important;border-radius:13px!important}

/* 图片底栏绝对末尾覆盖：模型、比例、清晰度、数量、工具、积分、生成。 */
body.canvas-mode .media-composer-panel[data-placement].image-composer-panel:not(.is-expanded){width:min(780px,54vw)!important;max-width:calc(100vw - 28px)!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer{display:grid!important;grid-template-columns:minmax(108px,138px) 60px 58px 54px 58px 28px 38px!important;grid-template-rows:40px!important;grid-auto-flow:column!important;column-gap:4px!important;align-items:center!important;justify-content:end!important;overflow:visible!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer>*{min-width:0!important;margin:0!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control.model{grid-column:1!important;width:138px!important;max-width:138px!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer-prompt-tools{grid-column:5!important;width:58px!important;min-width:58px!important;max-width:58px!important;display:flex!important;gap:2px!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer-prompt-tools button{width:28px!important;min-width:28px!important;height:36px!important;padding:0!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-credit{grid-column:6!important;width:28px!important;min-width:28px!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-submit{grid-column:7!important;grid-row:1!important;width:38px!important;min-width:38px!important;height:38px!important;min-height:38px!important;margin:0!important;align-self:center!important;justify-self:end!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control.model :is(.composer-select-trigger,.composer-select-value,span){min-width:0!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important}

/* 音频技能与底栏解耦：7 项各占固定列，启用技能时不改变控制栏排版。 */
body.canvas-mode .media-composer-panel[data-placement].audio-composer-panel:not(.is-expanded){width:min(820px,58vw)!important;max-width:calc(100vw - 28px)!important}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .composer-skill-selection{width:100%!important;max-width:100%!important;box-sizing:border-box!important;flex:none!important}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer{
    display:grid!important;
    grid-template-columns:minmax(140px,180px) minmax(118px,150px) 100px 76px 82px 34px 42px!important;
    grid-template-rows:42px!important;
    grid-auto-flow:column!important;
    column-gap:5px!important;
    align-items:center!important;
    justify-content:end!important;
    overflow:visible!important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer>*{min-width:0!important;max-width:100%!important;margin:0!important;box-sizing:border-box!important}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer>:nth-child(1){grid-column:1!important}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer>:nth-child(2){grid-column:2!important}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer>:nth-child(3){grid-column:3!important;width:100px!important}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer>:nth-child(4){grid-column:4!important;width:76px!important}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .audio-character-count{grid-column:5!important;width:82px!important;text-align:center!important;white-space:nowrap!important;font-size:12px!important}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-credit{grid-column:6!important;width:34px!important;min-width:34px!important;justify-content:center!important}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-submit{grid-column:7!important;grid-row:1!important;width:42px!important;min-width:42px!important;height:42px!important;min-height:42px!important;justify-self:end!important}
body.canvas-mode .audio-composer-panel:not(.is-expanded) :is(.media-composer-control.model,.audio-voice-trigger) :is(.composer-select-trigger,.composer-select-value,span){min-width:0!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important}

/* 全局创作框尺寸规范：与定位算法使用同一个宽度，确保始终和来源节点相对居中。 */
body.canvas-mode .media-composer-panel[data-placement]:is(.text-composer-panel,.image-composer-panel,.video-composer-panel,.audio-composer-panel):not(.is-expanded){
    width:var(--composer-width,940px)!important;
    max-width:calc(100vw - 28px)!important;
}

/* 图片创作底栏可读性修正：完整显示模型、比例、清晰度和张数。 */
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer{
    grid-template-columns:210px 90px 90px 80px 64px 34px 44px!important;
    grid-template-rows:44px!important;
    column-gap:6px!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control.model{
    width:210px!important;
    min-width:210px!important;
    max-width:210px!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer>:nth-child(2){width:90px!important;min-width:90px!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer>:nth-child(3){width:90px!important;min-width:90px!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer>:nth-child(4){width:80px!important;min-width:80px!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer-prompt-tools{width:64px!important;min-width:64px!important;max-width:64px!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-credit{width:34px!important;min-width:34px!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-submit{width:44px!important;min-width:44px!important;height:44px!important;min-height:44px!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer :is(.composer-select-trigger,.composer-select-value){font-size:13px!important}

/* 对齐 Lib 图片创作栏：参数作为一组紧凑工具显示，右侧操作永远完整保留。 */
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer{
    grid-template-columns:220px 104px 104px 92px 64px 40px 48px!important;
    grid-template-rows:46px!important;
    gap:0!important;
    justify-content:end!important;
    overflow:visible!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer>*{
    min-width:0!important;
    box-sizing:border-box!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control{
    height:42px!important;
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
    padding:0 10px!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control.model{
    width:220px!important;
    min-width:220px!important;
    max-width:220px!important;
    border-right:1px solid rgba(140,148,158,.32)!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer>:nth-child(2){width:104px!important;min-width:104px!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer>:nth-child(3){width:104px!important;min-width:104px!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer>:nth-child(4){width:92px!important;min-width:92px!important;border-right:1px solid rgba(140,148,158,.32)!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control :is(.composer-select-trigger,.composer-select-value){
    width:100%!important;
    font-size:13px!important;
    white-space:nowrap!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer-prompt-tools{width:64px!important;min-width:64px!important;max-width:64px!important;justify-content:center!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-credit{width:40px!important;min-width:40px!important;justify-content:center!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-submit{width:48px!important;min-width:48px!important;height:48px!important;min-height:48px!important;justify-self:end!important}

/* 文本/图片/视频/音频统一使用同一套生成面板骨架。 */
body.canvas-mode .media-composer-panel[data-placement]:is(.text-composer-panel,.image-composer-panel,.video-composer-panel,.audio-composer-panel):not(.is-expanded){
    --composer-width:940px;
    width:940px!important;
    max-width:calc(100vw - 28px)!important;
    min-height:286px!important;
    box-sizing:border-box!important;
}
body.canvas-mode .media-composer-panel[data-placement]:is(.text-composer-panel,.image-composer-panel,.video-composer-panel,.audio-composer-panel):not(.is-expanded) :is(.media-composer-prompt,.text-composer-content){
    height:112px!important;
    min-height:112px!important;
    max-height:112px!important;
    box-sizing:border-box!important;
}
body.canvas-mode .media-composer-panel[data-placement]:is(.text-composer-panel,.image-composer-panel,.video-composer-panel,.audio-composer-panel):not(.is-expanded) .media-composer-footer{
    min-height:52px!important;
    margin-top:auto!important;
    box-sizing:border-box!important;
}

/* 视频框按 Lib 的纵横比例收紧：去掉中部空档，底栏改为连续单行工具栏。 */
body.canvas-mode .media-composer-panel[data-placement].video-composer-panel:not(.is-expanded){
    width:940px!important;
    max-width:calc(100vw - 28px)!important;
    min-height:238px!important;
    padding:12px 16px 13px!important;
    gap:6px!important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-prompt-wrap{
    height:92px!important;
    min-height:92px!important;
    max-height:92px!important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-prompt{
    height:92px!important;
    min-height:92px!important;
    max-height:92px!important;
    padding:10px 8px!important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer{
    display:grid!important;
    grid-template-columns:190px 120px 60px 76px 72px 72px 64px 34px 48px!important;
    grid-template-rows:48px!important;
    column-gap:0!important;
    min-height:48px!important;
    padding-top:4px!important;
    margin-top:0!important;
    justify-content:end!important;
    align-items:center!important;
    overflow:visible!important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer>*{
    min-width:0!important;
    margin:0!important;
    box-sizing:border-box!important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-control{
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
    height:42px!important;
    padding:0 9px!important;
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-control.model{
    width:190px!important;
    min-width:190px!important;
    max-width:190px!important;
    border-right:1px solid rgba(140,148,158,.32)!important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-control.mode{
    width:120px!important;
    min-width:120px!important;
    max-width:120px!important;
    border-right:1px solid rgba(140,148,158,.32)!important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .composer-select-trigger{
    width:100%!important;
    min-width:0!important;
    gap:4px!important;
    padding:0!important;
    font-size:13px!important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer-prompt-tools{width:64px!important;min-width:64px!important;max-width:64px!important}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-credit{width:34px!important;min-width:34px!important;justify-content:center!important}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-submit{width:48px!important;min-width:48px!important;height:48px!important;min-height:48px!important;justify-self:end!important}

/* 文本生成也使用统一积分位：模型 / 模式 / 翻译 / 积分 / 生成。 */
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-footer,
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-footer {
    grid-template-columns: minmax(180px, 1.05fr) minmax(250px, 1fr) 42px 34px 48px !important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-credit {
    width: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
    justify-content: center !important;
}

/* 图片底栏按“参数组 + 操作组”排布，右侧优化/翻译/积分/生成保持紧凑。 */
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer {
    grid-template-columns: minmax(190px, 1fr) 74px 70px 72px 62px 42px 48px !important;
    column-gap: 4px !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer > :nth-child(2),
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer > :nth-child(3),
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer > :nth-child(4) {
    width: 100% !important;
    min-width: 0 !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer-prompt-tools {
    width: 62px !important;
    min-width: 62px !important;
    max-width: 62px !important;
    gap: 2px !important;
    justify-content: center !important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-credit {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
}

/* Lib 对标最终比例：四类生成框统一为 820×约238，底栏从左铺开，操作固定在右侧。 */
body.canvas-mode .media-composer-panel[data-placement]:is(.text-composer-panel,.image-composer-panel,.video-composer-panel,.audio-composer-panel):not(.is-expanded){
    --composer-width:820px;
    width:820px!important;
    max-width:calc(100vw - 28px)!important;
    min-height:238px!important;
    padding:12px 16px 13px!important;
    gap:6px!important;
}
body.canvas-mode .media-composer-panel[data-placement]:is(.text-composer-panel,.image-composer-panel,.video-composer-panel,.audio-composer-panel):not(.is-expanded) .media-composer-prompt-wrap{
    height:92px!important;
    min-height:92px!important;
    max-height:92px!important;
}
body.canvas-mode .media-composer-panel[data-placement]:is(.text-composer-panel,.image-composer-panel,.video-composer-panel,.audio-composer-panel):not(.is-expanded) :is(.media-composer-prompt,.text-composer-content){
    height:92px!important;
    min-height:92px!important;
    max-height:92px!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer{
    grid-template-columns:220px 104px 104px 92px minmax(64px,1fr) 40px 48px!important;
    width:100%!important;
    justify-content:stretch!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer-prompt-tools{
    justify-self:end!important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer{
    grid-template-columns:150px 70px 90px 80px 80px minmax(64px,1fr) 34px 48px!important;
    width:100%!important;
    justify-content:stretch!important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-control.model{
    width:150px!important;
    min-width:150px!important;
    max-width:150px!important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-control.mode{
    width:115px!important;
    min-width:115px!important;
    max-width:115px!important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer-prompt-tools{
    justify-self:end!important;
}

/* 最终图片底栏：四个参数连续排列，四个动作贴右且间距一致。 */
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer{
    grid-template-columns:minmax(180px,1fr) 74px 70px 72px minmax(20px,1fr) 62px 42px 48px!important;
    column-gap:4px!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control.model,
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer>:nth-child(2),
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer>:nth-child(3),
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer>:nth-child(4){
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer-prompt-tools{
    grid-column:6!important;
    width:62px!important;
    min-width:62px!important;
    max-width:62px!important;
    justify-self:end!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-credit{
    grid-column:7!important;
    width:42px!important;
    min-width:42px!important;
    max-width:42px!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-submit{
    grid-column:8!important;
    width:48px!important;
    min-width:48px!important;
    max-width:48px!important;
}

/* 图片生成框最终对标：左侧参数连续、中央仅留一段弹性空间、操作区固定靠右。 */
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer{
    display:grid!important;
    grid-template-columns:220px 78px 82px 88px minmax(12px,1fr) 62px 38px 48px!important;
    grid-template-rows:48px!important;
    column-gap:4px!important;
    align-items:center!important;
    justify-content:stretch!important;
    width:100%!important;
    min-width:0!important;
    overflow:visible!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer>*{
    min-width:0!important;
    max-width:none!important;
    margin:0!important;
    box-sizing:border-box!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control.model{
    grid-column:1!important;
    width:220px!important;
    min-width:220px!important;
    max-width:220px!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control.ratio{
    grid-column:2!important;
    width:78px!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control.resolution{
    grid-column:3!important;
    width:82px!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control.count{
    grid-column:4!important;
    width:88px!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer-prompt-tools{
    grid-column:6!important;
    width:62px!important;
    min-width:62px!important;
    max-width:62px!important;
    justify-self:end!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-credit{
    grid-column:7!important;
    width:38px!important;
    min-width:38px!important;
    max-width:38px!important;
    justify-content:center!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-submit{
    grid-column:8!important;
    width:48px!important;
    min-width:48px!important;
    max-width:48px!important;
    height:48px!important;
    min-height:48px!important;
    justify-self:end!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control :is(.composer-select-trigger,.composer-select-value){
    min-width:0!important;
    font-size:13px!important;
    white-space:nowrap!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control.model :is(.composer-select-trigger,.composer-select-value){
    overflow:hidden!important;
    text-overflow:ellipsis!important;
}

/* v1.0.5 生成框底栏总规范：模型靠左，参数居中，优化/翻译/积分/生成靠右。 */
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer{overflow:visible!important;align-items:center!important}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer .composer-select-trigger{min-width:0!important;width:100%!important;gap:4px!important}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer .media-composer-control:not(.model) .composer-select-trigger>span:first-child{min-width:max-content!important;max-width:none!important;overflow:visible!important;text-overflow:clip!important;white-space:nowrap!important}
body.canvas-mode .media-composer-panel:not(.is-expanded) .media-composer-footer :is(.composer-select-trigger,.composer-select-value,.audio-voice-trigger span){font-size:13px!important}

/* 图片：比例、清晰度、张数完整显示。 */
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer{grid-template-columns:210px 82px 84px 86px minmax(12px,1fr) 62px 38px 48px!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control.model{width:210px!important;min-width:210px!important;max-width:210px!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control.ratio{width:82px!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control.resolution{width:84px!important}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-control.count{width:86px!important}

/* 视频：模型、时长、比例、清晰度、声音均完整可见。 */
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer{display:grid!important;grid-template-columns:190px 68px 76px 78px 76px minmax(10px,1fr) 62px 36px 48px!important;grid-template-rows:48px!important;column-gap:4px!important;width:100%!important}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer>*{min-width:0!important;margin:0!important}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-control.model{grid-column:1!important;width:190px!important;min-width:190px!important;max-width:190px!important}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer-prompt-tools{grid-column:7!important;width:62px!important;min-width:62px!important;justify-self:end!important}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-credit{grid-column:8!important;width:36px!important;min-width:36px!important;justify-content:center!important}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-submit{grid-column:9!important;width:48px!important;min-width:48px!important;height:48px!important;justify-self:end!important}

/* 音频：与图片/视频保持同一阅读顺序。 */
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer{display:grid!important;grid-template-columns:190px 132px 92px 72px 68px minmax(8px,1fr) 62px 36px 48px!important;grid-template-rows:48px!important;column-gap:4px!important;width:100%!important;justify-content:stretch!important}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer>*{min-width:0!important;margin:0!important;box-sizing:border-box!important}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-control.model{grid-column:1!important;width:190px!important;min-width:190px!important;max-width:190px!important}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .audio-voice-trigger{grid-column:2!important;width:132px!important;min-width:132px!important}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .audio-clone-trigger{grid-column:3!important;width:92px!important;min-width:92px!important;font-size:13px!important}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .audio-character-count{grid-column:5!important;width:68px!important;font-size:12px!important;white-space:nowrap!important;text-align:center!important}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer-prompt-tools{grid-column:7!important;width:62px!important;min-width:62px!important;max-width:62px!important;justify-self:end!important}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-credit{grid-column:8!important;width:36px!important;min-width:36px!important;justify-content:center!important}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-submit{grid-column:9!important;width:48px!important;min-width:48px!important;height:48px!important;justify-self:end!important}

/* 文本生成按钮不得被面板边界裁切。 */
body.canvas-mode .text-composer-panel:not(.is-expanded),body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-footer{overflow:visible!important}
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-submit{position:relative!important;inset:auto!important;transform:none!important;margin:0!important;align-self:center!important}

/* 文本底栏最终修复：按钮全部纳入面板高度，左右两组互不挤压。 */
body.canvas-mode .media-composer-panel[data-placement].text-composer-panel:not(.is-expanded){
    width:820px!important;
    max-width:calc(100vw - 28px)!important;
    min-height:262px!important;
    height:auto!important;
    padding-bottom:16px!important;
    overflow:hidden!important;
    box-sizing:border-box!important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-footer{
    display:grid!important;
    grid-template-columns:210px 300px minmax(10px,1fr) 42px 34px 48px!important;
    grid-template-rows:48px!important;
    column-gap:4px!important;
    align-items:center!important;
    width:100%!important;
    min-height:48px!important;
    height:48px!important;
    margin:0!important;
    overflow:visible!important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-footer>*{min-width:0!important;margin:0!important;box-sizing:border-box!important}
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-control.model{grid-column:1!important;width:210px!important;min-width:210px!important;max-width:210px!important}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-mode-switch{grid-column:2!important;width:300px!important;min-width:300px!important;max-width:300px!important}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-translate{grid-column:4!important;grid-row:1!important;width:42px!important;min-width:42px!important;height:42px!important;align-self:center!important}
body.canvas-mode .text-composer-panel:not(.is-expanded) .media-composer-credit{grid-column:5!important;grid-row:1!important;width:34px!important;min-width:34px!important;justify-content:center!important;align-self:center!important}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-apply{grid-column:6!important;grid-row:1!important;width:48px!important;min-width:48px!important;max-width:48px!important;height:48px!important;min-height:48px!important;justify-self:end!important;align-self:center!important;position:static!important}

/* 四类生成框右侧动作均固定为：优化、翻译、积分、生成，且不得越出容器。 */
body.canvas-mode :is(.image-composer-panel,.video-composer-panel,.audio-composer-panel):not(.is-expanded) .media-composer-footer-prompt-tools{display:flex!important;align-items:center!important;justify-content:center!important;overflow:visible!important}
body.canvas-mode :is(.image-composer-panel,.video-composer-panel,.audio-composer-panel):not(.is-expanded) .media-composer-footer-prompt-tools button{width:29px!important;min-width:29px!important;height:40px!important;padding:0!important}
body.canvas-mode :is(.text-composer-panel,.image-composer-panel,.video-composer-panel,.audio-composer-panel):not(.is-expanded) .media-composer-submit{overflow:hidden!important}

/* 视频时长预留到两位数秒数（30秒/60秒），箭头与文字保持安全间距。 */
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer{
    grid-template-columns:184px 88px 76px 78px 76px minmax(10px,1fr) 62px 36px 48px!important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-control.model{
    width:184px!important;
    min-width:184px!important;
    max-width:184px!important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-duration + .composer-select-trigger{
    padding:0 8px!important;
    justify-content:space-between!important;
}

/* 视频时长：整项同时包含时钟图标，额外给“60秒”和下拉箭头保留点击空间。 */
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer{
    grid-template-columns:184px 102px 76px 78px 76px minmax(10px,1fr) 62px 36px 48px!important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-control:has(.media-composer-duration){
    width:102px!important;
    min-width:102px!important;
    max-width:102px!important;
    padding-left:8px!important;
    padding-right:8px!important;
    column-gap:7px!important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-control:has(.media-composer-duration) .composer-select-trigger{
    min-width:58px!important;
    padding:0!important;
    gap:10px!important;
    justify-content:flex-start!important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-control:has(.media-composer-duration) .composer-select-trigger svg{
    margin-left:auto!important;
    pointer-events:none!important;
}

/* 放大态只扩展编辑区域；底部参数栏保持普通态的尺寸、顺序与按钮比例。 */
body.canvas-mode :is(.text-composer-panel,.image-composer-panel,.video-composer-panel,.audio-composer-panel).is-expanded .media-composer-footer,
body.canvas-mode .text-composer-panel.is-expanded .text-composer-footer{
    flex:0 0 48px!important;
    grid-template-rows:48px!important;
    column-gap:6px!important;
    align-items:center!important;
    width:100%!important;
    height:48px!important;
    min-height:48px!important;
    max-height:48px!important;
    margin:0!important;
    padding:0!important;
    overflow:visible!important;
    box-sizing:border-box!important;
}
body.canvas-mode .image-composer-panel.is-expanded .media-composer-footer{
    display:grid!important;
    grid-template-columns:210px 82px 84px 86px minmax(16px,1fr) 62px 38px 48px!important;
}
body.canvas-mode .video-composer-panel.is-expanded .media-composer-footer{
    display:grid!important;
    grid-template-columns:200px 108px 90px 88px 88px minmax(16px,1fr) 62px 40px 48px!important;
}
body.canvas-mode .video-composer-panel.is-expanded .media-composer-control.model{
    grid-column:1!important;
}
body.canvas-mode .video-composer-panel.is-expanded .media-composer-control:has(.media-composer-duration){
    grid-column:2!important;
}
body.canvas-mode .video-composer-panel.is-expanded .media-composer-control:has(.media-composer-ratio){
    grid-column:3!important;
}
body.canvas-mode .video-composer-panel.is-expanded .media-composer-control:has(.media-composer-resolution){
    grid-column:4!important;
}
body.canvas-mode .video-composer-panel.is-expanded .media-composer-control:has(.media-composer-sound){
    grid-column:5!important;
}
body.canvas-mode .video-composer-panel.is-expanded .media-composer-footer-prompt-tools{
    grid-column:7!important;
}
body.canvas-mode .video-composer-panel.is-expanded .media-composer-credit{
    grid-column:8!important;
    justify-self:center!important;
}
body.canvas-mode .video-composer-panel.is-expanded .media-composer-submit{
    grid-column:9!important;
    justify-self:end!important;
}
body.canvas-mode .audio-composer-panel.is-expanded .media-composer-footer{
    display:grid!important;
    grid-template-columns:190px 132px 92px 102px 78px minmax(16px,1fr) 62px 36px 48px!important;
}
body.canvas-mode .text-composer-panel.is-expanded :is(.text-composer-footer,.media-composer-footer){
    display:grid!important;
    grid-template-columns:210px 300px minmax(16px,1fr) 42px 34px 48px!important;
}
body.canvas-mode .text-composer-panel.is-expanded .media-composer-control.model{
    grid-column:1!important;
}
body.canvas-mode .text-composer-panel.is-expanded .text-composer-mode-switch{
    grid-column:2!important;
}
body.canvas-mode .text-composer-panel.is-expanded .text-composer-translate{
    grid-column:4!important;
    justify-self:end!important;
}
body.canvas-mode .text-composer-panel.is-expanded .media-composer-credit{
    grid-column:5!important;
    justify-self:center!important;
}
body.canvas-mode .text-composer-panel.is-expanded .text-composer-apply{
    grid-column:6!important;
    justify-self:end!important;
}
body.canvas-mode :is(.text-composer-panel,.image-composer-panel,.video-composer-panel,.audio-composer-panel).is-expanded .media-composer-footer>*{
    min-width:0!important;
    margin:0!important;
    box-sizing:border-box!important;
}
body.canvas-mode :is(.image-composer-panel,.video-composer-panel,.audio-composer-panel).is-expanded .media-composer-footer-prompt-tools{
    display:flex!important;
    width:62px!important;
    min-width:62px!important;
    max-width:62px!important;
    gap:2px!important;
    justify-content:center!important;
}
body.canvas-mode :is(.image-composer-panel,.video-composer-panel,.audio-composer-panel).is-expanded .media-composer-footer-prompt-tools button{
    width:29px!important;
    min-width:29px!important;
    height:40px!important;
    padding:0!important;
}
body.canvas-mode :is(.text-composer-panel,.image-composer-panel,.video-composer-panel,.audio-composer-panel).is-expanded .media-composer-submit,
body.canvas-mode .text-composer-panel.is-expanded .text-composer-apply{
    width:48px!important;
    min-width:48px!important;
    max-width:48px!important;
    height:48px!important;
    min-height:48px!important;
    position:static!important;
    justify-self:end!important;
}
body.canvas-mode :is(.text-composer-panel,.image-composer-panel,.video-composer-panel,.audio-composer-panel).is-expanded{
    overflow:hidden!important;
}

/* 文本生成积分与媒体生成统一使用清晰的“闪电 + 数值”标识。 */
body.canvas-mode .text-composer-panel .media-composer-credit{
    display:inline-flex!important;
    width:40px!important;
    min-width:40px!important;
    max-width:40px!important;
    height:48px!important;
    padding:0!important;
    gap:5px!important;
    align-items:center!important;
    justify-content:center!important;
    color:#9da3ab!important;
    font-size:16px!important;
}
body.canvas-mode .text-composer-panel .media-composer-credit svg{
    display:block!important;
    width:17px!important;
    min-width:17px!important;
    height:17px!important;
    color:#9da3ab!important;
    stroke-width:2.2!important;
}
body.canvas-mode .text-composer-panel .media-composer-credit b{
    color:#b8bec7!important;
    font-size:16px!important;
    line-height:1!important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-footer{
    grid-template-columns:210px 300px minmax(10px,1fr) 42px 40px 48px!important;
}
body.canvas-mode .text-composer-panel.is-expanded :is(.text-composer-footer,.media-composer-footer){
    grid-template-columns:210px 300px minmax(16px,1fr) 42px 40px 48px!important;
}

/* 全局回归收口：图片/音频底栏显式占列，留白只用于伸缩，不再吞掉右侧动作。 */
body.canvas-mode .image-composer-panel .media-composer-control.model{grid-column:1!important}
body.canvas-mode .image-composer-panel .media-composer-control.ratio{grid-column:2!important}
body.canvas-mode .image-composer-panel .media-composer-control.resolution{grid-column:3!important}
body.canvas-mode .image-composer-panel .media-composer-control.count{grid-column:4!important}
body.canvas-mode .image-composer-panel .media-composer-footer-prompt-tools{grid-column:6!important;justify-self:end!important}
body.canvas-mode .image-composer-panel .media-composer-credit{grid-column:7!important;justify-self:center!important}
body.canvas-mode .image-composer-panel .media-composer-submit{grid-column:8!important;justify-self:end!important}

body.canvas-mode .audio-composer-panel .media-composer-control.model{grid-column:1!important}
body.canvas-mode .audio-composer-panel .audio-voice-trigger{grid-column:2!important}
body.canvas-mode .audio-composer-panel .audio-clone-trigger{grid-column:3!important}
body.canvas-mode .audio-composer-panel .media-composer-control:has(.media-composer-duration){grid-column:4!important}
body.canvas-mode .audio-composer-panel .audio-character-count{grid-column:5!important}
body.canvas-mode .audio-composer-panel .media-composer-footer-prompt-tools{grid-column:7!important;justify-self:end!important}
body.canvas-mode .audio-composer-panel .media-composer-credit{grid-column:8!important;justify-self:center!important}
body.canvas-mode .audio-composer-panel .media-composer-submit{grid-column:9!important;justify-self:end!important}

/* 四类底栏的积分与生成按钮保持单行、固定尺寸，不被模型名或参数挤压。 */
body.canvas-mode :is(.text-composer-panel,.image-composer-panel,.video-composer-panel,.audio-composer-panel) .media-composer-credit{
    white-space:nowrap!important;
    flex:none!important;
}
body.canvas-mode :is(.text-composer-panel,.image-composer-panel,.video-composer-panel,.audio-composer-panel) .media-composer-submit{
    flex:none!important;
    overflow:hidden!important;
}

/* ui53：展开态完整展示模型名；积分槽至少容纳“闪电 + 两位数”。 */
body.canvas-mode .text-composer-panel.is-expanded :is(.text-composer-footer,.media-composer-footer){
    grid-template-columns:260px 300px minmax(16px,1fr) 42px 52px 48px!important;
}
body.canvas-mode .text-composer-panel.is-expanded .media-composer-control.model{
    width:260px!important;
    min-width:260px!important;
    max-width:260px!important;
}
body.canvas-mode .image-composer-panel.is-expanded .media-composer-footer{
    grid-template-columns:300px 82px 84px 86px minmax(16px,1fr) 62px 52px 48px!important;
}
body.canvas-mode .image-composer-panel.is-expanded .media-composer-control.model{
    width:300px!important;
    min-width:300px!important;
    max-width:300px!important;
}
body.canvas-mode .video-composer-panel.is-expanded .media-composer-footer{
    grid-template-columns:200px 108px 90px 88px 88px minmax(16px,1fr) 62px 52px 48px!important;
}
body.canvas-mode .audio-composer-panel.is-expanded .media-composer-footer{
    grid-template-columns:190px 132px 92px 102px 78px minmax(16px,1fr) 62px 52px 48px!important;
}
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-footer{
    grid-template-columns:210px 300px minmax(10px,1fr) 42px 52px 48px!important;
}
body.canvas-mode .image-composer-panel:not(.is-expanded) .media-composer-footer{
    grid-template-columns:210px 82px 84px 86px minmax(12px,1fr) 62px 52px 48px!important;
}
body.canvas-mode .video-composer-panel:not(.is-expanded) .media-composer-footer{
    grid-template-columns:184px 102px 76px 78px 76px minmax(10px,1fr) 62px 52px 48px!important;
}
body.canvas-mode .audio-composer-panel:not(.is-expanded) .media-composer-footer{
    grid-template-columns:190px 132px 92px 72px 68px minmax(8px,1fr) 62px 52px 48px!important;
}
body.canvas-mode :is(.text-composer-panel,.image-composer-panel,.video-composer-panel,.audio-composer-panel) .media-composer-credit{
    width:52px!important;
    min-width:52px!important;
    max-width:52px!important;
    gap:5px!important;
    justify-content:center!important;
    font-variant-numeric:tabular-nums!important;
}
body.canvas-mode :is(.text-composer-panel,.image-composer-panel).is-expanded .media-composer-control.model .composer-select-trigger{
    width:100%!important;
    min-width:0!important;
    gap:10px!important;
}
body.canvas-mode :is(.text-composer-panel,.image-composer-panel).is-expanded .media-composer-control.model .composer-select-trigger>span{
    max-width:none!important;
    overflow:visible!important;
    text-overflow:clip!important;
    white-space:nowrap!important;
}

/* ui54：放大态右侧动作固定在底栏安全区内。
   参数项较多或浏览器缩放较大时，grid 的内容宽度可能超过面板；此前最后的
   积分与生成按钮会被面板 overflow:hidden 裁掉。右侧动作脱离参数网格后，
   始终锚定在可见边界内，同时为左侧参数预留足够空间。 */
body.canvas-mode :is(.text-composer-panel,.image-composer-panel,.video-composer-panel,.audio-composer-panel).is-expanded :is(.media-composer-footer,.text-composer-footer){
    position:relative!important;
    padding-right:174px!important;
    overflow:visible!important;
}
body.canvas-mode :is(.image-composer-panel,.video-composer-panel,.audio-composer-panel).is-expanded .media-composer-footer-prompt-tools{
    position:absolute!important;
    right:112px!important;
    bottom:0!important;
    grid-column:auto!important;
    z-index:2!important;
}
body.canvas-mode :is(.text-composer-panel,.image-composer-panel,.video-composer-panel,.audio-composer-panel).is-expanded .media-composer-credit{
    position:absolute!important;
    right:54px!important;
    bottom:0!important;
    grid-column:auto!important;
    z-index:2!important;
}
body.canvas-mode :is(.text-composer-panel,.image-composer-panel,.video-composer-panel,.audio-composer-panel).is-expanded .media-composer-submit,
body.canvas-mode .text-composer-panel.is-expanded .text-composer-apply{
    position:absolute!important;
    right:0!important;
    bottom:0!important;
    grid-column:auto!important;
    z-index:2!important;
}
body.canvas-mode .text-composer-panel.is-expanded .text-composer-translate{
    position:absolute!important;
    right:112px!important;
    bottom:3px!important;
    grid-column:auto!important;
    z-index:2!important;
}

/* ui55：文本放大态按网页实际可用宽度排版。
   文本底栏参数较少，不需要把右侧动作悬浮到模式切换器上方；恢复为同一网格后，
   浏览器缩放或窄视口下各项会共同收缩，不再互相覆盖。 */
body.canvas-mode .text-composer-panel.is-expanded :is(.text-composer-footer,.media-composer-footer){
    padding-right:0!important;
    grid-template-columns:minmax(0,260px) minmax(0,300px) minmax(0,1fr) 42px 52px 48px!important;
    overflow:hidden!important;
}
body.canvas-mode .text-composer-panel.is-expanded .media-composer-control.model{
    width:100%!important;
    min-width:0!important;
    max-width:260px!important;
}
body.canvas-mode .text-composer-panel.is-expanded .text-composer-mode-switch{
    width:100%!important;
    min-width:0!important;
    max-width:300px!important;
    overflow:hidden!important;
}
body.canvas-mode .text-composer-panel.is-expanded .text-composer-mode-switch button{
    flex:1 1 0!important;
    min-width:0!important;
    padding-inline:6px!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
}
body.canvas-mode .text-composer-panel.is-expanded :is(.media-composer-control.model,.text-composer-mode-switch) *{
    min-width:0!important;
}
body.canvas-mode .text-composer-panel.is-expanded .text-composer-translate,
body.canvas-mode .text-composer-panel.is-expanded .media-composer-credit,
body.canvas-mode .text-composer-panel.is-expanded .text-composer-apply{
    position:static!important;
    inset:auto!important;
    bottom:auto!important;
    z-index:auto!important;
}
body.canvas-mode .text-composer-panel.is-expanded .text-composer-translate{grid-column:4!important}
body.canvas-mode .text-composer-panel.is-expanded .media-composer-credit{grid-column:5!important}
body.canvas-mode .text-composer-panel.is-expanded .text-composer-apply{grid-column:6!important}

/* ui57：已选择技能后收束为与风格/特效一致的方形成品节点。
   双击方块可重新打开技能库。 */
body.canvas-mode .node.skill-node.has-skill-selection{
    width:184px!important;
    min-width:184px!important;
    max-width:184px!important;
    height:184px!important;
    min-height:184px!important;
    max-height:184px!important;
    overflow:visible!important;
    background:linear-gradient(145deg,#174f4b 0%,#276961 48%,#183d46 100%)!important;
    border:1px solid rgba(112,223,186,.72)!important;
    border-radius:16px!important;
    box-shadow:0 14px 34px rgba(0,0,0,.3),inset 0 1px 0 rgba(255,255,255,.08)!important;
}
body.canvas-mode .node.skill-node.has-skill-selection:hover,
body.canvas-mode .node.skill-node.has-skill-selection.selected{
    border-color:#79e5c0!important;
    box-shadow:0 0 0 2px rgba(97,211,174,.18),0 16px 38px rgba(0,0,0,.34)!important;
}
body.canvas-mode .node.skill-node.has-skill-selection .node-header,
body.canvas-mode .node.skill-node.has-skill-selection .skill-node-open{
    display:none!important;
}
body.canvas-mode .node.skill-node.has-skill-selection .node-content{
    position:absolute!important;
    inset:0!important;
    width:100%!important;
    height:100%!important;
    min-height:0!important;
    margin:0!important;
    padding:0!important;
    overflow:hidden!important;
    background:transparent!important;
    border:0!important;
    border-radius:inherit!important;
}
body.canvas-mode .node.skill-node.has-skill-selection .skill-node-selection{
    position:absolute!important;
    inset:0!important;
    display:block!important;
    min-height:0!important;
    padding:0!important;
    background:
        radial-gradient(circle at 78% 20%,rgba(122,229,192,.24),transparent 34%),
        linear-gradient(145deg,rgba(21,73,70,.96),rgba(36,105,94,.9) 58%,rgba(20,56,65,.98))!important;
    border:0!important;
    border-radius:inherit!important;
    cursor:pointer!important;
}
body.canvas-mode .node.skill-node.has-skill-selection .skill-selection-icon{
    position:absolute!important;
    top:14px!important;
    left:14px!important;
    width:32px!important;
    height:32px!important;
    color:#effff9!important;
    background:transparent!important;
    border-radius:0!important;
}
body.canvas-mode .node.skill-node.has-skill-selection .skill-selection-icon svg{
    width:27px!important;
    height:27px!important;
    stroke-width:2.2!important;
}
body.canvas-mode .node.skill-node.has-skill-selection .skill-selection-copy{
    position:absolute!important;
    left:15px!important;
    right:15px!important;
    bottom:14px!important;
    display:block!important;
}
body.canvas-mode .node.skill-node.has-skill-selection .skill-selection-copy strong{
    display:block!important;
    overflow:hidden!important;
    color:#fff!important;
    font-size:15px!important;
    font-weight:750!important;
    line-height:1.25!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
    text-shadow:0 2px 8px rgba(0,0,0,.36)!important;
}
body.canvas-mode .node.skill-node.has-skill-selection .skill-selection-copy small,
body.canvas-mode .node.skill-node.has-skill-selection .skill-selection-change{
    display:none!important;
}
body.canvas-mode .node.skill-node.has-skill-selection .output-port{
    top:50%!important;
}

/* ui58：风格、特效、技能三类成品节点统一为 184 × 184。 */
body.canvas-mode :is(
    .node.style-node.has-library-selection,
    .node.effect-node.has-library-selection,
    .node.skill-node.has-skill-selection
){
    width:184px!important;
    min-width:184px!important;
    max-width:184px!important;
    height:184px!important;
    min-height:184px!important;
    max-height:184px!important;
    overflow:visible!important;
    border-radius:16px!important;
}
body.canvas-mode .node.effect-node.has-library-selection{
    background:transparent!important;
    border-color:transparent!important;
    box-shadow:none!important;
}
body.canvas-mode .node.effect-node.has-library-selection .node-header,
body.canvas-mode .node.effect-node.has-library-selection .effect-node-open{
    display:none!important;
}
body.canvas-mode .node.effect-node.has-library-selection .node-content{
    position:absolute!important;
    inset:0!important;
    width:100%!important;
    height:100%!important;
    min-height:0!important;
    margin:0!important;
    padding:0!important;
    overflow:visible!important;
    background:transparent!important;
    border:0!important;
}
body.canvas-mode .node.effect-node.has-library-selection .effect-node-selection{
    position:absolute!important;
    inset:0!important;
    display:block!important;
    width:100%!important;
    height:100%!important;
    min-height:0!important;
    padding:0!important;
    cursor:pointer!important;
}
body.canvas-mode .node.effect-node.has-library-selection .style-node-preview-grid{
    position:absolute!important;
    inset:0!important;
    width:100%!important;
    height:100%!important;
    display:grid!important;
    grid-template-columns:1fr!important;
    grid-template-rows:1fr!important;
    gap:0!important;
}
body.canvas-mode .node.effect-node.has-library-selection .style-node-preview-card{
    position:absolute!important;
    inset:0!important;
    width:100%!important;
    height:100%!important;
    aspect-ratio:1 / 1!important;
    border-radius:16px!important;
}
body.canvas-mode .node.effect-node.has-library-selection .style-node-preview-card:not(:first-child){
    display:none!important;
}
body.canvas-mode :is(
    .node.style-node.has-library-selection,
    .node.effect-node.has-library-selection,
    .node.skill-node.has-skill-selection
) .node-port{
    top:50%!important;
}

/* 轻剪辑：播放线可在时间尺和轨道任意位置点击定位，主轨片段按真实时长占比排列。 */
.edit-studio-ruler,
.edit-studio-track-clips {
    cursor: crosshair;
}
.edit-studio-track.main .edit-studio-clip {
    flex: var(--clip-duration, 5) 1 0 !important;
    min-width: 72px;
    max-width: none;
}
.edit-studio-clip[draggable="true"] {
    touch-action: none;
}
.edit-studio-track.drop-target {
    border-color: #20c997 !important;
    background: rgba(32, 201, 151, .09) !important;
    box-shadow: inset 0 0 0 1px rgba(32, 201, 151, .42), 0 0 0 1px rgba(32, 201, 151, .10) !important;
}
.edit-studio-track.drop-target .edit-studio-track-empty {
    border-color: rgba(32, 201, 151, .68) !important;
    color: #9fe7d0 !important;
    background: rgba(32, 201, 151, .06) !important;
}
.edit-studio-playhead {
    left: var(--playhead-left, calc(var(--timeline-label-width) + (100% - var(--timeline-label-width) - 12px) * var(--playhead-progress, 0))) !important;
}

/* 媒体节点端口最终契约：上传/引用成品后左右连接点都必须保持可见。 */
body.canvas-mode :is(.node.image-node, .node.video-node) {
    overflow: visible !important;
}

body.canvas-mode :is(.node.image-node, .node.video-node) > .node-port {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 30 !important;
    pointer-events: auto !important;
}

body.canvas-mode :is(.node.image-node, .node.video-node):not(.zoomed) > .input-port {
    left: -12px !important;
    right: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

body.canvas-mode :is(.node.image-node, .node.video-node):not(.zoomed) > .output-port {
    right: -12px !important;
    left: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

/* v1.17 · 普通节点端口最终契约：历史项目即使曾被旧样式覆盖，左右“+”也
   必须停留在节点外沿并保持可点击。技能成品保留其单向输出语义。 */
body.canvas-mode :is(
    .node.text-node,
    .node.image-node,
    .node.video-node,
    .node.audio-node,
    .node.agent-node,
    .node.image-gen-node,
    .node.video-gen-node,
    .node.audio-gen-node,
    .node.style-node,
    .node.effect-node,
    .node.whiteboard-node,
    .node.edit-studio-node
) {
    overflow: visible !important;
}

body.canvas-mode :is(
    .node.text-node,
    .node.image-node,
    .node.video-node,
    .node.audio-node,
    .node.agent-node,
    .node.image-gen-node,
    .node.video-gen-node,
    .node.audio-gen-node,
    .node.style-node,
    .node.effect-node,
    .node.whiteboard-node,
    .node.edit-studio-node
) > .node-port {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    z-index: 40 !important;
    pointer-events: auto !important;
}

body.canvas-mode :is(
    .node.text-node,
    .node.image-node,
    .node.video-node,
    .node.audio-node,
    .node.agent-node,
    .node.image-gen-node,
    .node.video-gen-node,
    .node.audio-gen-node,
    .node.style-node,
    .node.effect-node,
    .node.whiteboard-node,
    .node.edit-studio-node
):not(.zoomed) > .input-port {
    left: -12px !important;
    right: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

body.canvas-mode :is(
    .node.text-node,
    .node.image-node,
    .node.video-node,
    .node.audio-node,
    .node.agent-node,
    .node.image-gen-node,
    .node.video-gen-node,
    .node.audio-gen-node,
    .node.style-node,
    .node.effect-node,
    .node.whiteboard-node,
    .node.edit-studio-node
):not(.zoomed) > .output-port {
    right: -12px !important;
    left: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

/* ui59：技能、风格、视频特效的空态共用同一张方法卡片。
   业务图标和文案可以不同，但外框、内容区、按钮、字号与交互反馈保持一致。 */
body.canvas-mode :is(
    .node.style-node:not(.has-library-selection),
    .node.effect-node:not(.has-library-selection),
    .node.skill-node:not(.has-skill-selection)
) {
    color: var(--text) !important;
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08) !important;
}
body.canvas-mode :is(
    .node.style-node:not(.has-library-selection),
    .node.effect-node:not(.has-library-selection),
    .node.skill-node:not(.has-skill-selection)
):is(:hover, .selected) {
    border-color: var(--border) !important;
    box-shadow: 0 0 0 1px var(--text-secondary) !important;
}
body.canvas-mode :is(
    .node.style-node:not(.has-library-selection),
    .node.effect-node:not(.has-library-selection),
    .node.skill-node:not(.has-skill-selection)
) .node-icon {
    color: #91a0b2 !important;
}
body.canvas-mode :is(
    .node.style-node:not(.has-library-selection),
    .node.effect-node:not(.has-library-selection),
    .node.skill-node:not(.has-skill-selection)
) .node-content {
    background: #181a1d !important;
    border: 1px solid rgba(148, 163, 184, .24) !important;
    border-radius: 8px !important;
}
body.canvas-mode :is(.style-node-open, .skill-node-open) {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 9px !important;
    color: #dce3ec !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    cursor: pointer !important;
}
body.canvas-mode :is(.style-node-hero, .skill-node-hero) {
    display: grid !important;
    place-items: center !important;
    color: #91a0b2 !important;
    background: #25282d !important;
    border: 1px solid #424850 !important;
    border-radius: 12px !important;
}
body.canvas-mode :is(.style-node-hero, .skill-node-hero) svg {
    width: 28px !important;
    height: 28px !important;
}
body.canvas-mode :is(.style-node-open, .skill-node-open) strong {
    color: inherit !important;
    font-size: 14px !important;
    font-weight: 500 !important;
}
body.canvas-mode :is(.style-node-open, .skill-node-open) small {
    max-width: 190px !important;
    color: #788392 !important;
    font-size: 10px !important;
    line-height: 1.6 !important;
    text-align: center !important;
}
body:not(.dark).canvas-mode :is(
    .node.style-node:not(.has-library-selection),
    .node.effect-node:not(.has-library-selection),
    .node.skill-node:not(.has-skill-selection)
) .node-content {
    color: #26313b !important;
    background: #f3f5f7 !important;
    border-color: #d2d9e1 !important;
}
body:not(.dark).canvas-mode :is(.style-node-open, .skill-node-open) {
    color: #303844 !important;
}
body:not(.dark).canvas-mode :is(.style-node-hero, .skill-node-hero) {
    color: #5f6b7a !important;
    background: #eef1f4 !important;
    border-color: #d2d8df !important;
}
body:not(.dark).canvas-mode :is(.style-node-open, .skill-node-open) small {
    color: #596675 !important;
}

/* 画板视口聚焦按钮：再次点击恢复进入放大前的画布缩放和位置。 */
body.canvas-mode .whiteboard-toolbar [data-whiteboard-action="expand"][aria-pressed="true"] {
    color: #d9fff2;
    border-color: rgba(32, 201, 151, .5);
    background: rgba(32, 201, 151, .15);
}
body:not(.dark).canvas-mode .whiteboard-toolbar [data-whiteboard-action="expand"][aria-pressed="true"] {
    color: #126b54;
    border-color: #6bbda4;
    background: #e3f3ed;
}

/* v1.07 · 动态创作框高度收口。
   技能、引用素材或上传文件加入后，面板可能超过当前网页可用高度；允许纵向滚动，
   同时把参数/积分/生成底栏保持在可见边缘。放大态仍由中部输入区占满剩余空间。 */
body.canvas-mode :is(
    .text-composer-panel,
    .image-composer-panel,
    .video-composer-panel,
    .audio-composer-panel
).is-viewport-compact,
body.canvas-mode :is(
    .text-composer-panel,
    .image-composer-panel,
    .video-composer-panel,
    .audio-composer-panel
).is-expanded {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

body.canvas-mode :is(
    .text-composer-panel,
    .image-composer-panel,
    .video-composer-panel,
    .audio-composer-panel
).is-expanded :is(.media-composer-prompt-wrap, .text-composer-content),
body.canvas-mode :is(
    .text-composer-panel,
    .image-composer-panel,
    .video-composer-panel,
    .audio-composer-panel
).is-expanded :is(.media-composer-prompt, .text-composer-input) {
    min-height: 120px !important;
}

body.canvas-mode :is(
    .text-composer-panel,
    .image-composer-panel,
    .video-composer-panel,
    .audio-composer-panel
):is(.is-viewport-compact, .is-expanded) :is(.media-composer-footer, .text-composer-footer) {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 6 !important;
    flex: 0 0 auto !important;
    background-color: inherit !important;
}

/* v1.10 · 浅色主题完整性：空画布入口、项目卡与文字均保持白底深字。 */
body:not(.dark).canvas-mode .empty-canvas-hint strong {
    color: #172033;
    line-height: 1.35;
}
body:not(.dark).canvas-mode .empty-canvas-hint small {
    color: #64748b;
    line-height: 1.45;
}
body:not(.dark).canvas-mode .empty-canvas-pointer {
    color: #ffffff;
    background: #202832;
    border-color: #3e4958;
}
body:not(.dark).canvas-mode .beginner-idea-form {
    background: rgba(255, 255, 255, .98);
    border-color: #d4dde7;
    box-shadow: 0 14px 34px rgba(30, 41, 59, .11);
}
body:not(.dark).canvas-mode .beginner-idea-form textarea { color: #172033; }
body:not(.dark).canvas-mode .beginner-idea-form textarea::placeholder { color: #7a8796; }
body:not(.dark).canvas-mode .beginner-or,
body:not(.dark).canvas-mode .beginner-safety-note { color: #657284; }
body:not(.dark).canvas-mode .starter-workflow-card {
    color: #172033;
    background: #ffffff;
    border-color: #d6dde6;
    box-shadow: 0 8px 24px rgba(30, 41, 59, .07);
}
body:not(.dark).canvas-mode .starter-workflow-card:hover {
    color: #111827;
    background: #f8fafc;
    border-color: #aeb9c7;
}
body:not(.dark).canvas-mode .starter-workflow-card strong {
    color: #172033;
    line-height: 1.35;
}
body:not(.dark).canvas-mode .starter-workflow-card small {
    color: #5f6b7a;
    line-height: 1.45;
}
body:not(.dark).canvas-mode .starter-workflow-icon {
    background: color-mix(in srgb, var(--starter-accent, #20c997) 13%, #ffffff);
}
body:not(.dark).canvas-mode .starter-workflow-arrow { color: #667085; }

body:not(.dark) .project-card .project-title {
    color: #171a1f;
    line-height: 1.35;
}
body:not(.dark) .project-card .card-preview {
    color: #475467;
    background: #f1f3f5;
}
body:not(.dark) .project-card .card-info,
body:not(.dark) .project-card .card-desc { border-color: #e0e5eb; }
body:not(.dark) .project-card .card-info .project-id,
body:not(.dark) .project-card .card-info .project-time,
body:not(.dark) .project-card .card-desc { color: #667085; }
body:not(.dark) .project-card .card-info .more-btn {
    color: #344054;
    background: #eef1f4;
}
body:not(.dark) .project-card .card-info .more-btn:hover { background: #e1e6eb; }

/* v1.11 · 素材悬停/单击预览最终裁切修复。
   此规则必须位于样式表末尾，覆盖历史上的面板 overflow:hidden !important。 */
body.canvas-mode .media-composer-panel:has(.media-square-reference:hover),
body.canvas-mode .media-composer-panel:has(.media-square-reference.is-previewing),
body.canvas-mode .media-composer-assets:has(.media-square-reference:hover),
body.canvas-mode .media-composer-assets:has(.media-square-reference.is-previewing),
body.canvas-mode .image-composer-references:has(.media-square-reference:hover),
body.canvas-mode .image-composer-references:has(.media-square-reference.is-previewing) {
    overflow: visible !important;
}

body.canvas-mode .media-square-reference:hover,
body.canvas-mode .media-square-reference.is-previewing {
    z-index: 3801 !important;
}

/* v1.12：能力库不再用省略号隐藏名称；状态只分为可使用和待接 API。 */
body.canvas-mode .media-capability-library{width:min(980px,calc(100vw - 40px))!important;max-width:980px!important}
body.canvas-mode .media-capability-groups{grid-template-columns:repeat(auto-fit,minmax(250px,1fr))!important;gap:16px!important;padding:16px!important}
body.canvas-mode .media-capability-group .media-capability-grid{display:grid!important;grid-template-columns:1fr!important;gap:8px!important}
body.canvas-mode .media-capability-card{grid-template-columns:44px minmax(0,1fr) auto!important;min-height:76px!important;height:auto!important;padding:10px 12px!important;align-items:center!important}
body.canvas-mode .media-capability-card>span:nth-child(2){gap:5px!important}
body.canvas-mode .media-capability-card strong,
body.canvas-mode .media-capability-card small{display:block!important;overflow:visible!important;text-overflow:clip!important;white-space:normal!important;word-break:break-word!important}
body.canvas-mode .media-capability-card strong{font-size:14px!important;line-height:1.35!important}
body.canvas-mode .media-capability-card small{font-size:11px!important;line-height:1.5!important}
body.canvas-mode .media-capability-card.is-pending em{color:#d9b949!important;border-color:#6b5b18!important}

/* v1.12：@ 菜单同时显示已引用项和当前画布素材。 */
.media-composer-mention-menu{width:320px!important;max-height:min(420px,calc(100vh - 36px))!important;padding:8px!important}
.media-composer-mention-menu section+section{margin-top:7px;padding-top:7px;border-top:1px solid rgba(148,163,184,.14)}
.media-composer-mention-menu section>header{padding:5px 8px;color:#7f8996;font-size:10px;font-weight:700;letter-spacing:.08em}
.media-composer-mention-menu button{min-height:54px!important;padding:6px 8px!important}
.media-composer-mention-menu button>span{display:flex;min-width:0;flex:1;flex-direction:column;gap:3px}
.media-composer-mention-menu button b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:1.35}
.media-composer-mention-menu button small{color:#818b97;font-size:10px;font-weight:500;line-height:1.3}
body:not(.dark) .media-composer-mention-menu{color:#20262d;background:rgba(255,255,255,.99);border-color:#cbd4de;box-shadow:0 18px 44px rgba(28,39,52,.18)}
body:not(.dark) .media-composer-mention-menu button{color:#303842}
body:not(.dark) .media-composer-mention-menu button:hover{color:#172029;background:#eef5f2}

/* v1.12：轻剪辑时间缩放、轨道静音与切断工具。 */
.edit-studio-track.main .edit-studio-clip,
.edit-studio-track.overlay .edit-studio-clip{flex:0 0 clamp(84px,calc(var(--clip-duration,5) * var(--edit-timeline-px-per-second,22px)),1400px)!important;max-width:none!important}
.edit-studio-zoom-controls{display:inline-flex!important;align-items:center;gap:2px;height:28px;padding:0 3px;border:1px solid rgba(148,163,184,.18);border-radius:7px;background:#24272c}
.edit-studio-zoom-controls button{width:26px!important;height:24px!important;padding:0!important;border:0!important;background:transparent!important;justify-content:center!important}
.edit-studio-zoom-controls b{width:38px;color:#8e97a3;font-size:9px;font-variant-numeric:tabular-nums;text-align:center}
.edit-studio-track-label .edit-studio-track-mute{margin-left:auto!important}
.edit-studio-track-label .edit-studio-track-mute.active{color:#f3b45b!important;background:rgba(243,180,91,.12)!important}
.edit-studio-track-label .edit-studio-track-mute+button{margin-left:0!important}
body:not(.dark) .edit-studio-zoom-controls{background:#fff;border-color:#d5dce4}

/* v1.12：风格、特效、技能成品以最小卡片为基准严格同尺寸。 */
body.canvas-mode :is(.node.style-node.has-library-selection,.node.effect-node.has-library-selection,.node.skill-node.has-skill-selection){box-sizing:border-box!important;width:184px!important;min-width:184px!important;max-width:184px!important;height:184px!important;min-height:184px!important;max-height:184px!important;aspect-ratio:1 / 1!important;cursor:grab!important}
body.canvas-mode :is(.node.style-node.has-library-selection,.node.effect-node.has-library-selection,.node.skill-node.has-skill-selection):active{cursor:grabbing!important}
body.canvas-mode :is(.node.style-node.has-library-selection,.node.effect-node.has-library-selection,.node.skill-node.has-skill-selection) :is(.style-node-selection,.effect-node-selection,.skill-node-selection,.style-node-preview-grid,.style-node-preview-card){box-sizing:border-box!important;width:100%!important;height:100%!important;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important}

/* v1.13：WaveSurfer 音频波形与可拖拽截取区间。 */
.audio-trim-card{width:min(760px,calc(100vw - 32px))!important}
.audio-trim-wave-shell{overflow:hidden;margin:12px 0 14px;padding:12px 12px 8px;background:#15191c;border:1px solid rgba(132,151,161,.28);border-radius:12px}
.audio-trim-waveform{min-height:112px;overflow-x:auto;border-radius:8px;background:linear-gradient(180deg,rgba(49,199,155,.055),rgba(0,0,0,.08))}
.audio-trim-wave-native .audio-trim-waveform{position:relative;overflow:hidden;touch-action:none;cursor:crosshair}
.audio-trim-native-canvas{display:block;width:100%;height:112px}
.audio-trim-native-region{position:absolute;top:0;bottom:0;z-index:2;min-width:2px;background:rgba(49,199,155,.2);border:1px solid rgba(95,233,191,.72);cursor:grab}
.audio-trim-native-region:active{cursor:grabbing}
.audio-trim-native-region i{position:absolute;top:0;bottom:0;width:10px;background:rgba(95,233,191,.78);cursor:ew-resize}
.audio-trim-native-region i:first-child{left:-5px;border-radius:5px 0 0 5px}.audio-trim-native-region i:last-child{right:-5px;border-radius:0 5px 5px 0}
.audio-trim-timeline{min-height:18px;color:#829099;font-size:9px}
.audio-trim-wave-toolbar{display:flex;align-items:center;gap:8px;min-height:36px;padding-top:7px;border-top:1px solid rgba(132,151,161,.18)}
.audio-trim-wave-toolbar>span{min-width:0;margin-right:auto;color:#8f9ba3;font-size:11px;line-height:1.35}
.audio-trim-wave-toolbar button{display:inline-flex;align-items:center;justify-content:center;gap:5px;min-height:28px;padding:0 10px;color:#c9d4d1;background:#242a2e;border:1px solid rgba(132,151,161,.26);border-radius:7px;cursor:pointer}
.audio-trim-wave-toolbar button:hover,.audio-trim-wave-toolbar button.is-playing{color:#eafff8;background:rgba(49,199,155,.16);border-color:rgba(49,199,155,.5)}
.audio-trim-wave-toolbar button svg{width:13px;height:13px}
.audio-trim-wave-fallback .audio-trim-waveform{position:relative;min-height:76px;background:repeating-linear-gradient(90deg,rgba(99,112,120,.72) 0 2px,transparent 2px 5px);mask-image:linear-gradient(180deg,transparent 4%,#000 48%,transparent 96%);opacity:.62}
.audio-trim-wave-fallback .audio-trim-timeline{display:none}
body:not(.dark) .audio-trim-wave-shell{background:#f5f7f8;border-color:#cbd4da}
body:not(.dark) .audio-trim-waveform{background:linear-gradient(180deg,rgba(23,153,115,.06),rgba(224,230,234,.42))}
body:not(.dark) .audio-trim-wave-toolbar{border-color:#d2d9de}
body:not(.dark) .audio-trim-wave-toolbar>span{color:#5f6d75}
body:not(.dark) .audio-trim-wave-toolbar button{color:#34434b;background:#fff;border-color:#cbd4da}
@media(max-width:680px){.audio-trim-wave-shell{padding:9px 9px 7px}.audio-trim-waveform{min-height:88px}.audio-trim-wave-toolbar{flex-wrap:wrap}.audio-trim-wave-toolbar>span{flex-basis:100%}}

/* v1.12：音色卡明确展示年龄、音色和适用角色，并提供本地近似试听。 */
.voice-picker-card .voice-picker-copy{min-width:0!important;gap:4px!important}
.voice-picker-card .voice-picker-copy em{color:#b9c1cb;font-size:11px;font-style:normal;line-height:1.35}
.voice-picker-card .voice-picker-actions{display:flex;flex:0 0 auto;align-items:center;gap:8px}
.voice-picker-card .voice-picker-actions button{height:36px;padding:0 15px;border:1px solid rgba(148,163,184,.26);border-radius:18px;color:#dce3eb;background:#25282c;font-weight:650;cursor:pointer}
.voice-picker-card .voice-picker-actions button:last-child{color:#161a1e;background:#f2f3f5;border-color:#f2f3f5}
body:not(.dark) .voice-picker-card .voice-picker-copy em{color:#5f6b78}
/* v1.14 · 短剧工作台进入画布后的新手引导与智能语言 */
.shortplay-guide{position:fixed;right:18px;top:86px;z-index:120;width:286px;padding:18px;border:1px solid rgba(71,160,122,.42);border-radius:22px;background:rgba(17,24,21,.94);color:#edf8f2;box-shadow:0 18px 56px rgba(0,0,0,.3);backdrop-filter:blur(18px);transition:.25s ease}
.shortplay-guide[hidden],.shortplay-language[hidden]{display:none!important}.shortplay-guide-head{padding:0 3px 13px;border-bottom:1px solid rgba(255,255,255,.09)}
.shortplay-guide-kicker{display:block;color:#71d3a5;font-size:11px;font-weight:750;letter-spacing:.08em}.shortplay-guide-head strong{display:block;margin-top:5px;font-size:20px}.shortplay-guide-head p{margin:5px 0 0;color:#aabbb2;font-size:12px;line-height:1.5}
.shortplay-guide-progress{display:grid;gap:6px;margin:12px 0}.shortplay-guide-progress button{display:grid;grid-template-columns:28px 1fr;grid-template-rows:auto auto;column-gap:9px;padding:8px;border:0;border-radius:12px;background:transparent;color:#f4f7f5;text-align:left;cursor:pointer}.shortplay-guide-progress button:hover{background:rgba(82,174,128,.12)}
.shortplay-guide-progress button>span{grid-row:1/3;display:grid;place-items:center;width:26px;height:26px;margin-top:2px;border-radius:50%;background:#2b3430;color:#9ba9a2;font-size:12px}.shortplay-guide-progress button.is-ready>span{background:#326c53;color:#fff}.shortplay-guide-progress b{font-size:13px}.shortplay-guide-progress small{margin-top:2px;color:#8fa198;font-size:10px}
.shortplay-guide-summary{display:grid;gap:3px;padding:11px;border-radius:12px;background:#111715;color:#a9b8b0;font-size:11px}.shortplay-guide-summary b{color:#e8f3ed}.shortplay-guide-next{width:100%;margin-top:10px;padding:11px 13px;border:0;border-radius:12px;background:#37775b;color:#fff;font-weight:700;cursor:pointer}.shortplay-guide-next span{float:right}
.shortplay-guide-collapse{position:absolute;left:-15px;top:20px;width:30px;height:38px;border:1px solid #315e4b;border-radius:11px 0 0 11px;background:#18231e;color:#9bd7ba;font-size:22px;cursor:pointer}.shortplay-guide.is-collapsed{transform:translateX(calc(100% + 18px))}
.shortplay-language{position:fixed;left:50%;bottom:76px;z-index:121;display:grid;grid-template-columns:auto minmax(260px,520px) 38px 38px;align-items:center;gap:10px;width:min(810px,calc(100vw - 420px));padding:9px 10px 9px 14px;border:1px solid rgba(83,171,130,.42);border-radius:18px;background:rgba(18,25,22,.95);color:#fff;box-shadow:0 18px 50px rgba(0,0,0,.28);transform:translateX(-50%);backdrop-filter:blur(16px)}
.shortplay-language-title{display:flex;align-items:center;gap:7px;color:#7bd4aa}.shortplay-language-title>span{display:grid}.shortplay-language-title b{font-size:12px}.shortplay-language-title small{color:#83978d;font-size:9px}.shortplay-language input{min-width:0;padding:9px 12px;border:1px solid #34413b;border-radius:11px;outline:0;background:#111613;color:#f6faf8}.shortplay-language input:focus{border-color:#57aa81}.shortplay-language>button{display:grid;place-items:center;width:36px;height:36px;border:0;border-radius:11px;background:#38785b;color:#fff;cursor:pointer}
.shortplay-language-feedback{position:absolute;left:50%;bottom:calc(100% + 8px);width:max-content;max-width:520px;padding:9px 12px;border:1px solid #3d6e57;border-radius:10px;background:#15241d;color:#dff4e9;font-size:12px;transform:translateX(-50%)}.shortplay-language-feedback.warning{border-color:#806837;color:#ffe3a6}
.shortplay-language>button.shortplay-language-help{border:1px solid rgba(90,190,140,.45);border-radius:50%;background:#17231e;color:#91d4b2;font-size:17px;font-weight:800}.shortplay-language>button.shortplay-language-help:hover,.shortplay-language>button.shortplay-language-help[aria-expanded="true"]{background:#315f4c;color:#fff}.shortplay-language-help-panel[hidden]{display:none!important}.shortplay-language-help-panel{position:absolute;right:0;bottom:calc(100% + 12px);width:250px;padding:16px;border:1px solid rgba(90,190,140,.35);border-radius:16px;background:#151b18;color:#eefaf4;box-shadow:0 18px 50px rgba(0,0,0,.45);display:flex;flex-wrap:wrap;gap:8px}.shortplay-language-help-panel>b,.shortplay-language-help-panel>p{width:100%;margin:0}.shortplay-language-help-panel>p{color:#8fa89b;font-size:12px}.shortplay-language-help-panel>button{border:0;border-radius:999px;padding:7px 10px;background:#28332e;color:#eaf6ef;font-size:12px;cursor:pointer}.shortplay-language-help-panel>button:hover{background:#315f4c}
.shortplay-guide-highlight{outline:4px solid rgba(82,211,146,.75)!important;box-shadow:0 0 0 10px rgba(54,151,105,.18),0 24px 55px rgba(0,0,0,.35)!important}
@media(max-width:1000px){.shortplay-guide{width:244px}.shortplay-language{left:18px;width:calc(100vw - 290px);transform:none}.shortplay-language-title small{display:none}}

/* v1.16 最终覆盖：紧凑 @ 素材、深色中性输入区、可见加载动画。 */
.media-composer-mention-menu{width:min(256px,calc(100vw - 24px))!important;max-height:min(310px,calc(100vh - 24px))!important;padding:6px!important}
.media-composer-mention-menu section+section{margin-top:5px!important;padding-top:5px!important}
.media-composer-mention-menu section>header{padding:4px 7px!important;font-size:9px!important}
.media-composer-mention-menu button{min-height:42px!important;padding:5px 7px!important;gap:8px!important}
.media-composer-mention-menu button>img,.media-composer-mention-menu button>video{width:34px!important;height:34px!important;flex:0 0 34px!important;border-radius:7px!important}
.media-composer-mention-menu button b{font-size:11px!important}.media-composer-mention-menu button small{font-size:9px!important}
body.dark.canvas-mode .media-composer-panel :is(.media-composer-prompt-wrap,.media-composer-prompt){color:#eef1f4!important;background:#181a1d!important}
@keyframes composerWorkingSpinFinal{to{transform:rotate(360deg)}}
.media-composer-prompt-tools button.is-loading svg,[data-prompt-action].is-loading svg{animation:composerWorkingSpinFinal .72s linear infinite!important;transform-origin:center!important;will-change:transform}

/* v1.16 · 角色素材库与角色设计器 */
.asset-tab-character{margin-left:auto;gap:7px!important}.asset-tab-character svg{width:16px;height:16px}
.character-create-card{grid-column:1/-1;display:flex;align-items:center;gap:14px;width:100%;padding:16px 18px;border:1px dashed rgba(67,214,174,.55);border-radius:14px;background:rgba(32,201,151,.08);color:#e9f8f3;text-align:left;cursor:pointer}.character-create-card>svg{width:24px;color:#61ddba}.character-create-card span{display:grid;gap:3px;flex:1}.character-create-card small{font-size:12px;color:#91a49f}
.character-designer-overlay{position:fixed;inset:0;z-index:6500;display:flex;align-items:center;justify-content:center;padding:24px;background:rgba(4,6,8,.72);backdrop-filter:blur(12px)}.character-designer-dialog{width:min(1040px,calc(100vw - 48px));max-height:min(820px,calc(100vh - 48px));display:grid;grid-template-rows:auto auto minmax(220px,1fr) auto auto;overflow:hidden;border:1px solid #3d434b;border-radius:24px;background:#202327;color:#eef2f5;box-shadow:0 30px 90px rgba(0,0,0,.5)}
.character-designer-dialog>header{display:flex;align-items:center;justify-content:space-between;padding:24px 28px 18px;border-bottom:1px solid #343940}.character-designer-dialog h2{margin:0 0 5px;font-size:24px}.character-designer-dialog p{margin:0;color:#929ba5;font-size:13px}.character-designer-dialog>header button{width:40px;height:40px;border:0;border-radius:12px;background:#2c3137;color:#b6c0ca;cursor:pointer}
.character-designer-tabs{display:flex;gap:10px;padding:18px 28px 14px;overflow-x:auto}.character-designer-tabs button,.character-option-row button{border:1px solid #424951;border-radius:999px;background:#25292e;color:#c9d0d7;cursor:pointer;white-space:nowrap}.character-designer-tabs button{padding:10px 16px}.character-designer-tabs button.active,.character-option-row button.active{border-color:#57d9b4;background:#1a6b58;color:#f4fffc}
.character-designer-body{margin:0 28px;padding:22px 24px;overflow:auto;border-radius:18px;background:#191c20}.character-option-row{display:grid;grid-template-columns:105px 1fr;gap:18px;margin-bottom:20px}.character-option-row>strong{padding-top:8px;color:#929ba5;font-size:13px}.character-option-row>div{display:flex;flex-wrap:wrap;gap:9px}.character-option-row button{padding:8px 13px;font-size:13px}
.character-designer-brief{display:grid;grid-template-columns:minmax(190px,.35fr) 1fr;gap:14px;padding:16px 28px}.character-designer-brief label{display:grid;gap:7px;color:#aab3bc;font-size:12px}.character-designer-brief input,.character-designer-brief textarea,.character-designer-dialog select{border:1px solid #424951;border-radius:12px;background:#171a1e;color:#edf2f6}.character-designer-brief input{height:44px;padding:0 13px}.character-designer-brief textarea{height:72px;padding:12px;resize:none}.character-designer-dialog>footer{display:flex;align-items:center;justify-content:flex-end;gap:10px;padding:16px 28px 22px;border-top:1px solid #343940}.character-designer-dialog>footer label{display:flex;align-items:center;gap:8px;margin-right:auto}.character-designer-dialog select{height:42px;padding:0 12px}.character-designer-dialog>footer>button{height:44px;padding:0 20px;border:1px solid #454c54;border-radius:12px;background:#292e34;color:#d5dce2;cursor:pointer}.character-designer-dialog>footer>button.primary{border-color:#24c99a;background:#20b98d;color:#071611;font-weight:700}
body:not(.dark) .character-designer-dialog{background:#fff;color:#171a1e;border-color:#dce1e6}body:not(.dark) .character-designer-body{background:#f6f7f8}body:not(.dark) .character-designer-tabs button,body:not(.dark) .character-option-row button{background:#fff;color:#343a40;border-color:#dce1e6}body:not(.dark) .character-designer-tabs button.active,body:not(.dark) .character-option-row button.active{background:#151719;color:#fff}body:not(.dark) .character-designer-brief input,body:not(.dark) .character-designer-brief textarea,body:not(.dark) .character-designer-dialog select{background:#fff;color:#171a1e;border-color:#dce1e6}
@media(max-width:720px){.character-designer-overlay{padding:0;align-items:flex-end}.character-designer-dialog{width:100vw;max-height:94vh;border-radius:22px 22px 0 0;grid-template-rows:auto auto minmax(200px,1fr) auto auto}.character-designer-dialog>header{padding:18px}.character-designer-tabs{padding:12px 18px}.character-designer-body{margin:0 14px;padding:16px}.character-option-row{grid-template-columns:1fr;gap:8px}.character-designer-brief{grid-template-columns:1fr;padding:14px 18px}.character-designer-dialog>footer{padding:12px 18px 18px;flex-wrap:wrap}.character-designer-dialog>footer label{width:100%}.character-designer-dialog>footer>button{flex:1}.asset-tab-character{margin-left:0}}

/* v1.17 · 素材分类使用独立层级，避免被素材库遮挡或吞掉点击。 */
.asset-category-dialog-overlay{position:fixed;inset:0;z-index:7200;display:grid;place-items:center;padding:20px;background:rgba(5,7,9,.68);opacity:0;backdrop-filter:blur(9px);transition:opacity .16s ease}.asset-category-dialog-overlay.is-open{opacity:1}.asset-category-dialog{width:min(440px,calc(100vw - 32px));overflow:hidden;border:1px solid #3b424a;border-radius:18px;background:#22262a;color:#eef2f5;box-shadow:0 28px 80px rgba(0,0,0,.48)}.asset-category-dialog>header{display:flex;align-items:center;justify-content:space-between;padding:18px 20px;border-bottom:1px solid #343a41}.asset-category-dialog>header>div{display:flex;align-items:center;gap:9px}.asset-category-dialog>header svg{width:18px;height:18px;color:#64dcb9}.asset-category-dialog>header strong{font-size:17px}.asset-category-dialog-close{display:grid;width:34px;height:34px;place-items:center;border:0;border-radius:10px;background:#30353b;color:#aeb7c0;cursor:pointer}.asset-category-dialog>label{display:grid;gap:8px;padding:20px}.asset-category-dialog>label>span{color:#cbd2d8;font-size:13px;font-weight:700}.asset-category-dialog input{width:100%;height:46px;padding:0 13px;border:1px solid #48515a;border-radius:11px;outline:0;background:#171a1e;color:#f2f5f7;font-size:14px}.asset-category-dialog input:focus{border-color:#50d6af;box-shadow:0 0 0 3px rgba(51,205,159,.13)}.asset-category-dialog>label small{color:#89939d;font-size:11px;line-height:1.5}.asset-category-dialog>footer{display:flex;justify-content:flex-end;gap:9px;padding:0 20px 20px}.asset-category-dialog>footer button{display:inline-flex;align-items:center;justify-content:center;gap:6px;height:40px;padding:0 16px;border:1px solid #444b53;border-radius:10px;background:#292e33;color:#d4dbe1;cursor:pointer}.asset-category-dialog>footer .asset-category-dialog-save{border-color:#28c99b;background:#22b98d;color:#071711;font-weight:750}.asset-category-dialog>footer svg{width:15px;height:15px}body:not(.dark) .asset-category-dialog{border-color:#d7dde3;background:#fff;color:#15191d}body:not(.dark) .asset-category-dialog>header{border-color:#e4e8ec}body:not(.dark) .asset-category-dialog input{border-color:#ccd3da;background:#f7f8f9;color:#15191d}body:not(.dark) .asset-category-dialog>label>span{color:#3b4249}body:not(.dark) .asset-category-dialog-close,body:not(.dark) .asset-category-dialog>footer button:not(.asset-category-dialog-save){background:#f2f4f6;color:#4c555e;border-color:#d9dee3}

/* v1.17 · 画布角色预设：完整缩略图、整卡可点、清晰选中态。 */
.video-creative-grid.is-canvas-role-grid{grid-template-columns:repeat(auto-fill,minmax(224px,1fr));gap:16px;padding-top:18px}.video-creative-canvas-card{min-height:238px;border-color:rgba(118,133,149,.28);background:#24282c}.video-creative-canvas-card .video-creative-card-select{position:relative;align-items:stretch;min-height:236px;cursor:pointer}.video-creative-canvas-preview{position:relative;align-self:stretch;width:100%;height:auto;aspect-ratio:16/9;flex:0 0 auto;background:linear-gradient(145deg,#16191c,#23282d)}.video-creative-canvas-preview>svg{position:absolute;z-index:0;width:34px;height:34px;color:#606a74}.video-creative-canvas-preview img{position:absolute;z-index:1;inset:0;display:block;width:100%;height:100%;object-fit:cover;object-position:center}.video-creative-canvas-preview img[hidden]{display:none}.video-creative-canvas-preview.is-missing{background:linear-gradient(145deg,#1c2227,#2b333a)}.video-creative-canvas-card .video-creative-card-content{flex:1;padding:13px 14px 15px}.video-creative-canvas-card .video-creative-card-content strong{font-size:15px}.video-creative-canvas-card .video-creative-card-content small{display:flex;align-items:center;gap:5px;min-height:0;color:#a6afb8;font-size:11px;-webkit-line-clamp:1}.video-creative-canvas-card .video-creative-card-content small svg{width:13px;height:13px}.video-creative-canvas-check{position:absolute;z-index:3;top:10px;right:10px;display:grid;width:28px;height:28px;place-items:center;color:transparent;background:rgba(8,11,14,.58);border:1px solid rgba(255,255,255,.2);border-radius:50%;box-shadow:0 4px 12px rgba(0,0,0,.2);backdrop-filter:blur(6px)}.video-creative-canvas-check svg{width:15px;height:15px}.video-creative-canvas-card:hover .video-creative-canvas-check{color:#aeb8c2}.video-creative-canvas-card.is-selected{border-color:#43d4aa;background:#25332f;box-shadow:0 0 0 2px rgba(67,212,170,.22),0 12px 32px rgba(0,0,0,.25)}.video-creative-canvas-card.is-selected .video-creative-canvas-check{color:#082019;background:#5be0b8;border-color:#79ebc8}.video-creative-canvas-card.is-selected .video-creative-canvas-preview:after{position:absolute;z-index:2;inset:0;content:'';box-shadow:inset 0 0 0 2px rgba(91,224,184,.72);pointer-events:none}.video-creative-canvas-card:focus-within{outline:2px solid #6ce4c0;outline-offset:2px}
@media(max-width:620px){.video-creative-grid.is-canvas-role-grid{grid-template-columns:1fr;gap:12px}.video-creative-canvas-card,.video-creative-canvas-card .video-creative-card-select{min-height:0}.video-creative-canvas-preview{aspect-ratio:16/8}}

/* v1.17 · 视频按秒切帧设置，替代浏览器原生 prompt。 */
.video-frame-dialog-overlay{position:fixed;inset:0;z-index:7300;display:grid;place-items:center;padding:20px;background:rgba(4,6,8,.72);opacity:0;backdrop-filter:blur(10px);transition:opacity .16s ease}.video-frame-dialog-overlay.is-open{opacity:1}.video-frame-dialog{width:min(560px,calc(100vw - 32px));overflow:hidden;border:1px solid #3c434b;border-radius:20px;background:#22262a;color:#eff3f6;box-shadow:0 30px 90px rgba(0,0,0,.52)}.video-frame-dialog>header{display:flex;align-items:center;justify-content:space-between;padding:20px 22px;border-bottom:1px solid #343a41}.video-frame-dialog-heading{display:flex;align-items:center;gap:12px}.video-frame-dialog-heading>span{display:grid;width:42px;height:42px;place-items:center;border-radius:12px;background:rgba(42,207,158,.14);color:#58dcb5}.video-frame-dialog-heading>span svg{width:21px;height:21px}.video-frame-dialog-heading>div{display:grid;gap:3px}.video-frame-dialog-heading strong{font-size:18px}.video-frame-dialog-heading small{color:#8f99a3;font-size:11px}.video-frame-dialog-close{display:grid;width:36px;height:36px;place-items:center;border:0;border-radius:11px;background:#30353b;color:#aeb8c2;cursor:pointer}.video-frame-dialog-metrics{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;padding:18px 22px 8px}.video-frame-dialog-metrics>span{display:grid;gap:5px;padding:12px;border:1px solid #3a4148;border-radius:12px;background:#1b1f23}.video-frame-dialog-metrics small{color:#8c96a0;font-size:10px}.video-frame-dialog-metrics strong{overflow:hidden;font-size:14px;text-overflow:ellipsis;white-space:nowrap}.video-frame-dialog-controls{display:grid;gap:14px;padding:14px 22px 18px}.video-frame-dialog-controls>label{display:flex;align-items:center;justify-content:space-between;gap:16px;color:#cbd2d9;font-size:13px;font-weight:650}.video-frame-number{width:128px;height:42px;padding:0 12px;border:1px solid #4a535c;border-radius:10px;outline:0;background:#171a1e;color:#f3f6f8;font-size:14px}.video-frame-number:focus{border-color:#51d9b1;box-shadow:0 0 0 3px rgba(56,211,166,.12)}.video-frame-range{width:100%;accent-color:#40d0a5}.video-frame-presets{display:flex;gap:8px}.video-frame-presets button{height:34px;padding:0 13px;border:1px solid #414850;border-radius:9px;background:#292e33;color:#b9c1c9;cursor:pointer}.video-frame-presets button:hover,.video-frame-presets button.active{border-color:#4ed8af;background:rgba(37,196,149,.16);color:#ddfff5}.video-frame-dialog-controls>p{display:flex;align-items:flex-start;gap:7px;margin:0;color:#89949e;font-size:11px;line-height:1.55}.video-frame-dialog-controls>p svg{flex:0 0 auto;width:14px;height:14px;margin-top:1px;color:#6cb9ff}.video-frame-dialog>footer{display:flex;justify-content:flex-end;gap:9px;padding:15px 22px 20px;border-top:1px solid #343a41}.video-frame-dialog>footer button{display:inline-flex;align-items:center;gap:7px;height:41px;padding:0 17px;border:1px solid #454c54;border-radius:10px;background:#2b3035;color:#d4dbe1;cursor:pointer}.video-frame-dialog>footer .video-frame-dialog-confirm{border-color:#29c99a;background:#24ba8f;color:#071812;font-weight:750}.video-frame-dialog>footer svg{width:16px;height:16px}body:not(.dark) .video-frame-dialog{border-color:#d8dde3;background:#fff;color:#171b1f}body:not(.dark) .video-frame-dialog>header,body:not(.dark) .video-frame-dialog>footer{border-color:#e5e9ed}body:not(.dark) .video-frame-dialog-metrics>span{border-color:#dce2e7;background:#f5f7f8}body:not(.dark) .video-frame-number{border-color:#ccd4db;background:#f7f8f9;color:#171b1f}body:not(.dark) .video-frame-dialog-controls>label{color:#3f474f}body:not(.dark) .video-frame-presets button,body:not(.dark) .video-frame-dialog>footer button:not(.video-frame-dialog-confirm){border-color:#d7dde3;background:#f3f5f6;color:#4b555e}
@media(max-width:560px){.video-frame-dialog-overlay{align-items:end;padding:0}.video-frame-dialog{width:100%;border-radius:20px 20px 0 0}.video-frame-dialog-metrics{grid-template-columns:1fr}.video-frame-dialog-controls>label{align-items:stretch;flex-direction:column}.video-frame-number{width:100%}.video-frame-presets{display:grid;grid-template-columns:repeat(4,1fr)}.video-frame-presets button{padding:0 4px}}

/* v1.21 · 浅色画布可读性最终覆盖。
   右键菜单真实类名是 .menu-item，不能继续只覆盖历史 .context-menu-item。 */
body:not(.dark).canvas-mode :is(.context-menu,.canvas-context-menu,.connection-context-menu,#canvasContextMenu) {
    color: #202936 !important;
    border-color: #cbd4de !important;
    background: rgba(255,255,255,.99) !important;
    box-shadow: 0 18px 48px rgba(23,34,46,.18) !important;
}
body:not(.dark).canvas-mode :is(.context-menu,.canvas-context-menu,.connection-context-menu,#canvasContextMenu) .menu-item {
    min-height: 34px !important;
    color: #27313d !important;
    opacity: 1 !important;
    line-height: 1.35 !important;
    white-space: normal !important;
    text-overflow: clip !important;
}
body:not(.dark).canvas-mode :is(.context-menu,.canvas-context-menu,.connection-context-menu,#canvasContextMenu) .menu-item:hover {
    color: #0f5138 !important;
    background: #eaf5f0 !important;
}
body:not(.dark).canvas-mode :is(.context-menu,.canvas-context-menu,.connection-context-menu,#canvasContextMenu) :is(.menu-section-title,.menu-submenu-trigger) {
    color: #475569 !important;
    opacity: 1 !important;
}
body:not(.dark).canvas-mode :is(.context-menu,.canvas-context-menu,.connection-context-menu,#canvasContextMenu) :is(.menu-item,.menu-submenu-trigger) :is(svg,span) {
    color: inherit !important;
}
body:not(.dark).canvas-mode :is(.context-menu,.canvas-context-menu,.connection-context-menu,#canvasContextMenu) .menu-divider {
    border-color: #e1e7ed !important;
    background: #e1e7ed !important;
}
body:not(.dark).canvas-mode :is(.context-menu,.canvas-context-menu,.connection-context-menu,#canvasContextMenu) :is(.menu-item.disabled,.menu-item[aria-disabled="true"]) {
    color: #8a95a3 !important;
    opacity: .62 !important;
}
body:not(.dark).canvas-mode :is(.node-sidebar,.sidebar-header,.sidebar-content,.sidebar-list,.sidebar-group,.sidebar-item) {
    color: #27313d;
}
body:not(.dark).canvas-mode :is(.sidebar-title,.sidebar-group-title,.sidebar-item-title,.node-title,.node-label,.empty-canvas-hint strong) {
    color: #1f2937 !important;
    line-height: 1.35 !important;
    opacity: 1 !important;
}
body:not(.dark).canvas-mode :is(.sidebar-item small,.node-subtitle,.node-description,.empty-canvas-hint small) {
    color: #657284 !important;
    line-height: 1.5 !important;
    opacity: 1 !important;
}
body:not(.dark).canvas-mode :is(.node-textarea,.user-input,.media-composer-prompt) {
    color: #202936 !important;
}
body:not(.dark).canvas-mode :is(.node-textarea,.user-input,.media-composer-prompt)::placeholder {
    color: #7a8796 !important;
    opacity: 1 !important;
}

/* v1.21 · 登录工作台技能页 */
.home-skills-page {
    min-height: calc(100vh - 160px);
    /* 与“项目”视图的最近项目标题使用同一顶部基线。 */
    margin-top: 64px;
}

/* v1.36 · 独立“项目 / 技能”视图不需要首页创作区预留的大段呼吸空间。 */
.project-home-main:is([data-home-view="projects"], [data-home-view="skills"]) .home-content {
    padding-top: 24px;
}

.project-home-main[data-home-view="projects"] .recent-projects,
.project-home-main[data-home-view="skills"] .home-skills-page {
    margin-top: 16px;
}
.home-skills-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}
.home-skills-heading>div>span {
    display: block;
    margin-bottom: 7px;
    color: #6f7884;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
}
.home-skills-heading h1 { margin: 0; color: #f4f6f7; font-size: 28px; line-height: 1.25; }
.home-skills-heading p { margin: 8px 0 0; color: #8a929d; font-size: 13px; line-height: 1.55; }
.home-skills-search {
    display: flex;
    align-items: center;
    gap: 9px;
    width: min(360px, 42vw);
    min-height: 42px;
    padding: 0 13px;
    border: 1px solid #3a3e43;
    border-radius: 12px;
    background: #202225;
    color: #8f98a3;
}
.home-skills-search svg { width: 17px; height: 17px; flex: 0 0 auto; }
.home-skills-search input { min-width: 0; width: 100%; border: 0; outline: 0; color: #edf1f4; background: transparent; font: inherit; font-size: 12px; }
.home-skills-search input::placeholder { color: #78818c; }
.home-skills-tag-panel {
    margin-bottom: 18px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}
.home-skills-tag-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 11px; }
.home-skills-tag-heading>span { display: inline-flex; align-items: center; gap: 7px; color: #dce3e7; font-size: 12px; font-weight: 700; }
.home-skills-tag-heading svg { width: 15px; height: 15px; color: #69dbb7; }
.home-skills-tag-heading small { color: #76808b; font-size: 10px; }
.home-skills-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.home-skills-filters button {
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid #383c41;
    border-radius: 999px;
    color: #aab1ba;
    background: #202225;
    cursor: pointer;
}
.home-skills-filters button:hover { color: #fff; border-color: #535960; }
.home-skills-filters button.active { color: #071610; border-color: #70dfbd; background: #78e2c1; font-weight: 700; }
.home-skills-filter-result { margin: 10px 2px 0; color: #7e8893; font-size: 10px; }
.home-skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 360px));
    grid-auto-rows: 154px;
    align-items: stretch;
    align-content: start;
    justify-content: start;
    gap: 14px;
}
.home-skills-grid>.home-skill-card[hidden] { display: none !important; }
.home-skill-card {
    position: relative;
    display: grid;
    grid-template-columns: 48px minmax(0,1fr) 18px;
    align-items: start;
    gap: 13px;
    width: 100%;
    height: 154px;
    min-height: 154px;
    max-height: 154px;
    overflow: hidden;
    padding: 18px;
    border: 1px solid #34383d;
    border-radius: 16px;
    color: #dce1e6;
    background: linear-gradient(150deg,#232528,#1d1f22);
    text-align: left;
    cursor: pointer;
    transition: transform .18s ease,border-color .18s ease,background .18s ease;
}
.home-skill-card:hover { transform: translateY(-2px); border-color: #56616a; background: linear-gradient(150deg,#292c30,#222529); }
.home-skill-card>svg { width: 17px; height: 17px; color: #68737e; }
.home-skill-card>span:nth-child(2) {
    display: grid;
    grid-template-rows: 14px 21px 36px 19px;
    min-width: 0;
    align-content: start;
    gap: 5px;
    overflow: hidden;
}
.home-skill-card em { color: #7d8792; font-size: 10px; font-style: normal; font-weight: 700; }
.home-skill-card strong {
    min-width: 0;
    overflow: hidden;
    color: #f3f5f6;
    font-size: 15px;
    line-height: 21px;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.home-skill-card small {
    display: -webkit-box;
    overflow: hidden;
    color: #919aa5;
    font-size: 11px;
    line-height: 1.6;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.home-skill-card-tags {
    display: flex !important;
    flex-wrap: nowrap;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    min-height: 19px;
    margin: 0;
    overflow: hidden;
}
.home-skill-card-tags b {
    flex: 0 0 auto;
    padding: 3px 7px;
    border: 1px solid #3c4248;
    border-radius: 999px;
    color: #8f9aa6;
    background: rgba(255,255,255,.025);
    font-size: 9px;
    font-weight: 600;
    line-height: 1.2;
}
.home-skill-card-tags b[data-skill-tag="planning"] { color: #e2b56e; border-color: rgba(218,157,63,.25); background: rgba(218,157,63,.08); }
.home-skill-card-tags b[data-skill-tag="prompt"] { color: #b7aaf5; border-color: rgba(132,112,230,.28); background: rgba(132,112,230,.09); }
.home-skill-card-tags b[data-skill-tag="video"],
.home-skill-card-tags b[data-skill-tag="production"] { color: #84c1f3; border-color: rgba(70,151,218,.27); background: rgba(70,151,218,.08); }
.home-skill-card-tags b[data-skill-tag="image"] { color: #75d9ba; border-color: rgba(47,198,153,.25); background: rgba(47,198,153,.08); }
.home-skill-card-tags b[data-skill-tag="voice"] { color: #e49ab0; border-color: rgba(205,93,127,.27); background: rgba(205,93,127,.08); }
.home-skill-card-icon { display: grid !important; width: 48px; height: 48px; place-items: center; border-radius: 13px; }
.home-skill-card-icon svg { width: 22px; height: 22px; }
.home-skill-card-icon.mint { color: #67dbb7; background: rgba(47,198,153,.15); }
.home-skill-card-icon.violet { color: #a99bf4; background: rgba(125,105,224,.16); }
.home-skill-card-icon.amber { color: #efb35d; background: rgba(217,145,49,.16); }
.home-skill-card-icon.blue { color: #79b9f1; background: rgba(64,139,210,.16); }
.home-skill-card-icon.rose { color: #e68ea7; background: rgba(202,80,116,.16); }
.home-skills-empty { padding: 52px 0; color: #818a95; text-align: center; }
body:not(.dark) .home-skills-heading h1 { color: #171a1f; }
body:not(.dark) .home-skills-heading p { color: #667085; }
body:not(.dark) .home-skills-search { border-color: #d4dbe2; color: #677280; background: #fff; }
body:not(.dark) .home-skills-search input { color: #20262d; }
body:not(.dark) .home-skills-tag-panel { border: 0; background: transparent; }
body:not(.dark) .home-skills-tag-heading>span { color: #303942; }
body:not(.dark) .home-skills-tag-heading small,
body:not(.dark) .home-skills-filter-result { color: #73808d; }
body:not(.dark) .home-skills-filters button { border-color: #d7dde3; color: #58636f; background: #fff; }
body:not(.dark) .home-skills-filters button.active { border-color: #168c6d; color: #fff; background: #168c6d; }
body:not(.dark) .home-skill-card { border-color: #dbe1e6; color: #303841; background: #fff; box-shadow: 0 10px 28px rgba(35,48,61,.07); }
body:not(.dark) .home-skill-card:hover { border-color: #aab7c2; background: #f8fafb; }
body:not(.dark) .home-skill-card strong { color: #1e252c; }
body:not(.dark) .home-skill-card small { color: #65717d; }
body:not(.dark) .home-skill-card em { color: #77828e; }
body:not(.dark) .home-skill-card-tags b { border-color: #d9dfe5; background: #f6f8f9; }
body:not(.dark) .home-skill-card-tags b[data-skill-tag="planning"] { color: #9a620f; border-color: #ead8b9; background: #fff8eb; }
body:not(.dark) .home-skill-card-tags b[data-skill-tag="prompt"] { color: #6d55b8; border-color: #ddd4f5; background: #f7f3ff; }
body:not(.dark) .home-skill-card-tags b[data-skill-tag="video"],
body:not(.dark) .home-skill-card-tags b[data-skill-tag="production"] { color: #276b9f; border-color: #cfe1ef; background: #f1f8fd; }
body:not(.dark) .home-skill-card-tags b[data-skill-tag="image"] { color: #137d60; border-color: #c9e8dd; background: #effaf6; }
body:not(.dark) .home-skill-card-tags b[data-skill-tag="voice"] { color: #a53c61; border-color: #efd2dc; background: #fff2f6; }

/* v1.21 · 素材仅在单击预览时展开，普通悬停不再浮出黑框。 */
body.canvas-mode .media-square-reference:hover:not(.is-previewing) .media-asset-hover {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}
body.canvas-mode .media-square-reference.is-previewing .media-asset-hover {
    display: flex !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

@media (max-width: 720px) {
    .home-skills-page { margin-top: 44px; }
    .project-home-main:is([data-home-view="projects"], [data-home-view="skills"]) .home-content {
        padding-top: 16px;
    }
    .project-home-main[data-home-view="projects"] .recent-projects,
    .project-home-main[data-home-view="skills"] .home-skills-page {
        margin-top: 12px;
    }
    .home-skills-heading { align-items: stretch; flex-direction: column; gap: 16px; }
    .home-skills-heading h1 { font-size: 24px; }
    .home-skills-search { width: 100%; }
    .home-skills-tag-panel { margin-inline: 0; padding: 0; }
    .home-skills-tag-heading small { display: none; }
    .home-skills-filters {
        flex-wrap: nowrap;
        margin-inline: -14px;
        padding: 0 34px 5px 14px;
        overflow-x: auto;
        scroll-padding-inline: 14px 34px;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        -webkit-mask-image: linear-gradient(to right,#000 0,#000 calc(100% - 26px),transparent 100%);
        mask-image: linear-gradient(to right,#000 0,#000 calc(100% - 26px),transparent 100%);
    }
    .home-skills-filters::-webkit-scrollbar { display: none; }
    .home-skills-filters button { flex: 0 0 auto; scroll-snap-align: start; }
    .home-skills-grid { grid-template-columns: minmax(0,360px); grid-auto-rows: 146px; }
    .home-skill-card { height: 146px; min-height: 146px; max-height: 146px; padding: 16px; }
}

/* v1.29 · 浅色主题已加载视频保持在单一卡片边界内。
   节点本体继续 overflow:visible 以显示左右端口，裁切只发生在媒体内容区。 */
body:not(.dark).canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])) .node-content {
    min-width: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: transparent !important;
    border-radius: 0 0 9px 9px !important;
}

body:not(.dark).canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])) .video-preview-box {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 0 9px 9px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    background: #111316 !important;
}

body:not(.dark).canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])) .video-preview {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    margin: 0 !important;
    border-radius: 0 0 8px 8px !important;
    object-fit: cover !important;
}

/* 原生视频控制条点击后 Chromium 会把焦点留在 video 上；
   画布已经用节点选中态反馈交互，不再显示浏览器额外的白色焦点框。 */
body.canvas-mode .node.video-node .video-preview:focus,
body.canvas-mode .node.video-node .video-preview:focus-visible {
    outline: none !important;
    outline-offset: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
}

/* 浅色下点击原生播放区可能同时触发视频焦点或节点选中。
   已加载视频沿用静止时的细边界，不再叠加一圈高亮框。 */
body:not(.dark).canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])).selected,
body:not(.dark).canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])):focus-within {
    border-color: #afb8c1 !important;
    box-shadow: 0 6px 18px rgba(31, 35, 40, .16) !important;
}

body:not(.dark).canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])).selected .video-preview-box,
body:not(.dark).canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])):focus-within .video-preview-box {
    border: 0 !important;
    box-shadow: none !important;
}

/* v1.35 · 空媒体入口保持统一方形；已有图片/视频必须按素材真实比例显示。
   不能把 1280×720 等 16:9 素材强塞进方形内容区，否则画面与原生控制条都会变形。 */
/* 重复 canvas-mode 只用于提高空媒体规则优先级，覆盖旧版 505×284 入口。 */
body.canvas-mode.canvas-mode .node.image-node:not(.zoomed):not(:has(.image-preview:not([hidden]))),
body.canvas-mode.canvas-mode .node.video-node:not(.zoomed):not(:has(.video-preview:not([hidden]))) {
    width: 284px !important;
    min-width: 284px !important;
    max-width: 284px !important;
    height: 284px !important;
    min-height: 284px !important;
    max-height: 284px !important;
    box-sizing: border-box !important;
}

/* 已加载媒体的宽度由 fitMediaNodeToAspect() 按原始比例和目标面积计算；
   高度由预览盒的原始 aspect-ratio 自然撑开。 */
body.canvas-mode.canvas-mode .node.image-node:not(.zoomed):has(.image-preview:not([hidden])),
body.canvas-mode.canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])) {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
}

body.canvas-mode :is(.node.image-node, .node.video-node):not(.zoomed) .node-header {
    height: 38px !important;
    min-height: 38px !important;
    box-sizing: border-box !important;
}

body.canvas-mode :is(.node.image-node, .node.video-node):not(.zoomed) .node-content {
    width: 100% !important;
    height: calc(100% - 38px) !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-height: none !important;
    box-sizing: border-box !important;
}

body.canvas-mode .node.image-node:not(.zoomed):has(.image-preview:not([hidden])) .node-content,
body.canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])) .node-content {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
}

body.canvas-mode .node.image-node:not(.zoomed):has(.image-preview:not([hidden])) .image-preview-box,
body.canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])) .video-preview-box {
    width: 100% !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 100% !important;
    max-height: none !important;
    box-sizing: border-box !important;
}

body.canvas-mode .node.image-node:not(.zoomed):has(.image-preview:not([hidden])) .image-preview,
body.canvas-mode .node.video-node:not(.zoomed):has(.video-preview:not([hidden])) .video-preview {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    background: #111316 !important;
}

body.canvas-mode .node:is(.text-node, .image-node, .video-node):not(.zoomed) .node-title {
    cursor: grab;
}

body.canvas-mode .node:is(.text-node, .image-node, .video-node):not(.zoomed).dragging .node-title {
    cursor: grabbing;
}

/* v1.29 · 账号级生成历史画廊：媒体分类 + 瀑布流 / 网格 / 列表。 */
.asset-picker-overlay.is-generation-history .asset-picker {
    width: min(1160px, calc(100vw - 44px));
    height: min(760px, calc(100vh - 46px));
    padding: 22px;
    border-radius: 16px;
    box-sizing: border-box;
}

.asset-picker-heading { min-width: 0; display: grid; gap: 4px; }
.asset-picker-subtitle { color: #8f99a7; font-size: 12px; font-weight: 400; }

.generation-history-controls {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin: 0 0 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(148, 163, 184, .16);
}
.generation-history-controls[hidden] { display: none !important; }
.generation-history-search {
    width: min(440px, 100%);
    height: 36px;
    padding: 0 7px 0 11px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
    border: 1px solid #454a52;
    border-radius: 9px;
    color: #8f99a7;
    background: #292c31;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.generation-history-search:focus-within {
    border-color: rgba(55, 211, 162, .75);
    box-shadow: 0 0 0 3px rgba(32, 201, 151, .1);
}
.generation-history-search > svg { width: 15px; height: 15px; flex: 0 0 15px; }
.generation-history-search input {
    min-width: 0;
    flex: 1;
    border: 0;
    outline: 0;
    color: #edf1f6;
    background: transparent;
    font: inherit;
    font-size: 12px;
}
.generation-history-search input::placeholder { color: #7f8996; }
.generation-history-search input::-webkit-search-cancel-button { display: none; }
.generation-history-search button {
    width: 25px;
    height: 25px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 6px;
    color: #8f99a7;
    background: transparent;
    cursor: pointer;
}
.generation-history-search button:hover { color: #f2f6fa; background: rgba(148, 163, 184, .13); }
.generation-history-search button[hidden] { display: none !important; }
.generation-history-search button svg { width: 14px; height: 14px; }
.generation-history-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.generation-history-filters, .generation-history-views { display: flex; align-items: center; gap: 7px; }
.generation-history-filters button, .generation-history-views button {
    height: 34px;
    border: 1px solid #454a52;
    border-radius: 8px;
    color: #aeb6c2;
    background: #292c31;
    cursor: pointer;
    transition: border-color .16s ease, color .16s ease, background .16s ease;
}
.generation-history-filters button {
    min-width: 82px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-size: 13px;
}
.generation-history-filters button svg, .generation-history-views button svg { width: 14px; height: 14px; }
.generation-history-filters button small {
    min-width: 20px;
    height: 19px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: #8f99a7;
    background: rgba(148, 163, 184, .13);
    font-size: 10px;
}
.generation-history-filters button:hover, .generation-history-views button:hover,
.generation-history-filters button.active, .generation-history-views button.active {
    color: #effff9;
    border-color: rgba(55, 211, 162, .6);
    background: rgba(32, 201, 151, .14);
}
.generation-history-filters button.active small { color: #baffea; background: rgba(32, 201, 151, .22); }
.generation-history-views { padding: 3px; border: 1px solid #3d424a; border-radius: 10px; background: #25282d; }
.generation-history-views button {
    width: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.asset-picker-grid.is-generation-history-grid { display: block; overflow-x: hidden; padding: 2px 7px 16px 2px; }
.is-generation-history-grid .asset-card { margin: 0; padding: 6px; gap: 0; align-items: stretch; overflow: hidden; }
.is-generation-history-grid.history-view-masonry { column-width: 210px; column-gap: 12px; }
.is-generation-history-grid.history-view-masonry .asset-card {
    display: inline-flex;
    width: 100%;
    margin: 0 0 12px;
    vertical-align: top;
    break-inside: avoid-column;
}
.is-generation-history-grid.history-view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    align-content: start;
    gap: 12px;
}
.is-generation-history-grid.history-view-grid .asset-card-media { aspect-ratio: 4 / 3; }
.is-generation-history-grid.history-view-grid :is(.asset-card-thumb, .asset-card-video) {
    width: 100%; height: 100%; max-height: none; object-fit: cover;
}
.is-generation-history-grid .asset-card-media { min-height: 112px; border-radius: 7px; }
.is-generation-history-grid .asset-card-info {
    min-width: 0;
    padding: 9px 5px 5px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 8px;
    align-items: center;
}
.is-generation-history-grid .asset-card-type {
    display: inline-flex;
    align-items: center;
    gap: 0;
    color: #81dec2;
    font-size: 10px;
    font-weight: 650;
}
.is-generation-history-grid .asset-card-name {
    grid-column: 1 / -1;
    min-height: 34px;
    padding: 0;
    -webkit-line-clamp: 2;
    color: #edf1f6;
    font-size: 12px;
    line-height: 17px;
}
.is-generation-history-grid .asset-card-info time { color: #828b98; font-size: 10px; white-space: nowrap; }
.asset-card-audio {
    min-height: 126px !important;
    padding: 16px 12px 12px;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 0;
    background: linear-gradient(145deg, rgba(32, 201, 151, .16), #191d22 72%);
}
.asset-history-audio { width: 100%; height: 30px; }
.is-generation-history-grid.history-view-list { display: grid; align-content: start; gap: 8px; }
.is-generation-history-grid.history-view-list .asset-card {
    min-height: 82px;
    display: grid;
    grid-template-columns: 116px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 7px;
}
.is-generation-history-grid.history-view-list .asset-card-media { width: 116px; height: 66px; min-height: 66px; }
.is-generation-history-grid.history-view-list :is(.asset-card-thumb, .asset-card-video) {
    width: 100%; height: 100%; max-height: none; object-fit: cover;
}
.is-generation-history-grid.history-view-list .asset-card-audio { padding: 6px; display: flex; min-height: 66px !important; }
.is-generation-history-grid.history-view-list .asset-card[data-media-type="audio"] {
    grid-template-columns: minmax(230px, 36%) minmax(0, 1fr);
}
.is-generation-history-grid .asset-card:focus-visible {
    outline: 2px solid #20c997;
    outline-offset: -2px;
}
.is-generation-history-grid.history-view-list .asset-card-info { padding: 4px 8px 4px 0; }

body:not(.dark) .generation-history-search {
    color: #687586;
    border-color: #d2d9e1;
    background: #f8fafb;
}
body:not(.dark) .generation-history-search input { color: #242a32; }
body:not(.dark) .generation-history-search input::placeholder { color: #8792a0; }
body:not(.dark) .generation-history-filters button, body:not(.dark) .generation-history-views {
    color: #53606e; border-color: #d2d9e1; background: #f6f8fa;
}
body:not(.dark) .generation-history-views button { background: transparent; }
body:not(.dark) .generation-history-filters button.active, body:not(.dark) .generation-history-views button.active {
    color: #116a53; border-color: #73cdb2; background: #e3f7f0;
}
body:not(.dark) .is-generation-history-grid .asset-card-type { color: #17775e; }
body:not(.dark) .is-generation-history-grid .asset-card-name { color: #242a32; }
body:not(.dark) .asset-card-audio { background: linear-gradient(145deg, #e4f6f0, #f4f6f8 72%); }

@media (max-width: 720px) {
    .asset-picker-overlay.is-generation-history .asset-picker { width: calc(100vw - 16px); height: calc(100vh - 18px); padding: 16px 12px; }
    .generation-history-search { width: 100%; }
    .generation-history-toolbar { align-items: flex-start; }
    .generation-history-filters { max-width: calc(100vw - 92px); overflow-x: auto; padding-bottom: 3px; }
    .generation-history-filters button { min-width: 76px; padding: 0 9px; }
    .is-generation-history-grid.history-view-masonry { column-width: 145px; column-gap: 8px; }
    .is-generation-history-grid.history-view-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .is-generation-history-grid.history-view-list .asset-card { grid-template-columns: 90px minmax(0, 1fr); }
    .is-generation-history-grid.history-view-list .asset-card-media { width: 90px; }
}

/* v1.32 · 大画布渲染降级。
   只跳过固定外框节点的正文子树；标题、端口和节点几何始终参与布局。 */
.canvas-container.large-canvas-mode .node:is(
    .text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]),
    .image-node:not(.zoomed),
    .video-node:not(.zoomed),
    .audio-node,
    .edit-studio-node
) > .node-content,
.canvas-container.large-canvas-mode .node.text-node[data-generated-text-result="true"] > .node-content {
    content-visibility: auto;
    contain-intrinsic-block-size: auto 246px;
}

.canvas-container.large-canvas-mode .node:is(.style-node, .effect-node, .skill-node) > .node-content {
    content-visibility: auto;
    contain-intrinsic-block-size: auto 138px;
}

/* 低缩放 LOD：正文不可读时停止绘制，但用 visibility 保留自适应节点高度。
   当前选中、聚焦、拖动、放大、播放、运行和创作来源节点继续完整显示。 */
.canvas-container.large-canvas-mode.canvas-lod-low
    .node:not(.selected):not(.dragging):not(.zoomed):not(.media-viewport-focused):not(.composer-source-node):not(.is-video-playing):not(.is-agent-running):not(.is-text-result-resizing):not(:focus-within)
    > .node-content {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: none !important;
}

.canvas-container.large-canvas-mode.canvas-lod-low :is(.node, .canvas-node-group-backdrop) {
    box-shadow: none !important;
    filter: none !important;
    transition: none !important;
}

.canvas-container.large-canvas-mode.canvas-lod-low :is(.conn-flow, .conn-flow-glow, .conn-delete-control) {
    display: none !important;
}

/* 拖动/缩放时关闭随画布重绘的高成本光效；交互结束后原样恢复。 */
.canvas-container.large-canvas-mode.canvas-interacting :is(
    .node,
    .canvas-node-group,
    .canvas-node-group-backdrop,
    .connections-layer path
) {
    box-shadow: none !important;
    filter: none !important;
    transition: none !important;
}

.canvas-container.large-canvas-mode.canvas-interacting .node :is(
    .media-download-btn,
    .media-delete-btn,
    .media-replace-btn,
    .video-frame-btn,
    .video-zoom-play-btn
) {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
    transition: none !important;
}

/* 固定工具层是画布的兄弟节点，使用 body 状态选择器在交互期间关闭背景模糊。 */
body.canvas-mode:has(> .canvas-container.large-canvas-mode.canvas-interacting) :is(
    .canvas-minimap,
    .node-sidebar,
    .bottom-toolbar,
    .toolbar .back-btn,
    .toolbar .action-btn,
    .canvas-project-name-box,
    .agent-composer-bar,
    .shortplay-guide,
    .shortplay-language
) {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
    transition: none !important;
}
/* 红白人物膜在本地逐帧处理时保持持续可见反馈；不改变节点几何和端口。 */
body.canvas-mode .node.video-node.is-red-white-matte-processing {
    box-shadow: 0 0 0 2px rgba(255, 75, 86, .72), 0 0 24px rgba(255, 75, 86, .24) !important;
}

body.canvas-mode .node.video-node.is-red-white-matte-processing::after {
    content: "逐帧识别人像…";
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 12;
    transform: translate(-50%, -50%);
    padding: 7px 11px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    color: #fff;
    background: rgba(24, 25, 28, .86);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .02em;
    white-space: nowrap;
    pointer-events: none;
    animation: red-white-matte-status 1.15s ease-in-out infinite alternate;
}

@keyframes red-white-matte-status {
    from { opacity: .72; }
    to { opacity: 1; }
}

body:not(.dark).canvas-mode .node.video-node.is-red-white-matte-processing::after {
    color: #7a1520;
    border-color: rgba(207, 34, 46, .22);
    background: rgba(255, 245, 246, .94);
    box-shadow: 0 8px 22px rgba(138, 18, 31, .16);
}

/* v1.33：画布顶部整行统一图标、文字、间距与垂直节奏。 */
body.canvas-mode .toolbar-left,
body.canvas-mode .toolbar-right {
    height: 40px;
    align-items: center;
}

body.canvas-mode :is(.back-btn, .toolbar-right .action-btn) {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    min-height: 40px;
    padding: 0 13px;
    gap: 7px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

body.canvas-mode .toolbar :is(.back-btn, .toolbar-right .action-btn) svg {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin: 0;
    stroke-width: 2;
}

body.canvas-mode .toolbar-right .action-btn:not(.user-btn),
body.canvas-mode #toolbarThemeModeBtn,
body.canvas-mode .toolbar-right .user-btn {
    width: 42px;
    min-width: 42px;
    padding: 0 !important;
    justify-content: center;
}

body.canvas-mode .toolbar-right .toolbar-action-label {
    display: none !important;
}

body.canvas-mode .toolbar-right .user-btn {
    min-width: 42px;
    max-width: 42px;
}

body.canvas-mode .toolbar-action-label {
    display: inline-block;
    line-height: 1;
}

body.canvas-mode .user-btn .toolbar-action-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.canvas-mode .project-name {
    display: inline-flex;
    align-items: center;
    height: 40px;
    line-height: 1.2;
}

body.canvas-mode .save-status {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    line-height: 1;
}

@media (max-width: 760px) {
    body.canvas-mode .toolbar-right .toolbar-action-label,
    body.canvas-mode .back-btn .toolbar-action-label {
        display: none;
    }

    body.canvas-mode .back-btn::before {
        content: none;
    }

    body.canvas-mode .toolbar-right .action-btn:not(.user-btn),
    body.canvas-mode #toolbarThemeModeBtn,
    body.canvas-mode .toolbar-right .user-btn {
        width: 40px;
        min-width: 40px;
        max-width: 40px;
        padding: 0 !important;
    }
}

/* v1.53 · 浅色画布全局校正。
   文本结果原先沿用暗色按钮和滚动条，空正文也强制显示滚动条；在浅色背景上
   会像一条错位的灰色遮罩，同时“展开/续写”看起来像被禁用。 */
body:not(.dark).canvas-mode {
    scrollbar-color: #b6c0ca transparent;
}

body:not(.dark).canvas-mode ::-webkit-scrollbar-track {
    background: transparent;
}

body:not(.dark).canvas-mode ::-webkit-scrollbar-thumb {
    background: #b6c0ca;
    border-radius: 999px;
}

body:not(.dark).canvas-mode .node.text-node[data-generated-text-result="true"] .node-textarea {
    border-color: #d8e0e7 !important;
    background: #f7f9fb !important;
    color: #202936 !important;
    caret-color: #13785e;
}

body:not(.dark).canvas-mode .node.text-node[data-generated-text-result="true"] .node-textarea:focus {
    border-color: #6dc6aa !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 2px rgba(21, 149, 117, .10) !important;
}

body:not(.dark).canvas-mode .node.text-node[data-generated-text-result="true"] .node-textarea::-webkit-scrollbar-track {
    background: transparent;
}

body:not(.dark).canvas-mode .node.text-node[data-generated-text-result="true"] .node-textarea::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    background: #aeb9c4;
    background-clip: padding-box;
}

body:not(.dark).canvas-mode .node.text-node[data-generated-text-result="true"] .node-textarea::-webkit-scrollbar-thumb:hover {
    background: #8f9ca9;
    background-clip: padding-box;
}

body:not(.dark).canvas-mode :is(.text-result-expand, .text-result-continue) {
    border-color: #d4dce4;
    background: #f4f7f9;
    color: #536170;
    box-shadow: 0 1px 2px rgba(31, 41, 55, .06);
}

body:not(.dark).canvas-mode :is(.text-result-expand, .text-result-continue):hover {
    border-color: #6fc5aa;
    background: #e8f6f1;
    color: #116c53;
}

body:not(.dark).canvas-mode .text-result-resize-handle {
    color: #687789;
    background: linear-gradient(135deg, transparent 38%, #dce3e9 39%);
    opacity: .9;
}

body:not(.dark).canvas-mode :is(.text-result-resize-handle:hover, .node.is-text-result-resizing .text-result-resize-handle) {
    color: #116c53;
}

/* v1.33：浅色画布中的智能体节点使用独立高对比配色。 */
body:not(.dark).canvas-mode .node.agent-node .user-input {
    color: #202936 !important;
    background: #ffffff !important;
    border-color: #b8c2cc !important;
}

body:not(.dark).canvas-mode .node.agent-node .user-input::placeholder {
    color: #657284 !important;
    opacity: 1;
}

body:not(.dark).canvas-mode .node.agent-node .agent-prompt-shell .user-input:focus,
body:not(.dark).canvas-mode .node.agent-node .agent-prompt-shell .user-input:focus-visible {
    border-color: #57606a !important;
    box-shadow: 0 0 0 2px rgba(87, 96, 106, .12) !important;
}

body:not(.dark).canvas-mode .node.agent-node .agent-prompt-expand {
    color: #57606a !important;
    background: #f6f8fa !important;
    border-color: #d0d7de !important;
    opacity: 1;
}

body:not(.dark).canvas-mode .node.agent-node .agent-prompt-expand:hover,
body:not(.dark).canvas-mode .node.agent-node .agent-prompt-expand:focus-visible {
    color: #24292f !important;
    background: #eaeef2 !important;
    border-color: #afb8c1 !important;
}

body:not(.dark).canvas-mode .node.agent-node .agent-workflow-guide {
    color: #344054 !important;
    background: #f6f8fa !important;
    border-color: #c7d2de !important;
}

body:not(.dark).canvas-mode .node.agent-node .agent-workflow-category {
    color: #1f5f99 !important;
    background: #e7f1fb !important;
    border: 1px solid #bdd5eb !important;
}

body:not(.dark).canvas-mode .node.agent-node .agent-workflow-flow {
    color: #27364a !important;
}

body:not(.dark).canvas-mode .node.agent-node .agent-workflow-input::before,
body:not(.dark).canvas-mode .node.agent-node .agent-workflow-output::before {
    color: #66788d !important;
}

body:not(.dark).canvas-mode .node.agent-node .agent-workflow-arrow {
    color: #2f6fa8 !important;
}

body:not(.dark).canvas-mode .node.agent-node .agent-workflow-next,
body:not(.dark).canvas-mode .node.agent-node .agent-workflow-next::before {
    color: #59697b !important;
}

body:not(.dark).canvas-mode .node.agent-node .agent-skill-picker-trigger {
    color: #344b43 !important;
    background: #f4f8f6 !important;
    border-color: #9fbeb2 !important;
}

body:not(.dark).canvas-mode .node.agent-node .agent-skill-picker-trigger svg {
    color: #16745a !important;
}

body:not(.dark).canvas-mode .node.agent-node .agent-skill-picker-trigger:hover {
    color: #1f3b32 !important;
    background: #e8f3ef !important;
    border-color: #5f9e88 !important;
}

body:not(.dark).canvas-mode .node.agent-node .agent-skill-chip {
    color: #245c49 !important;
    background: #eaf6f1 !important;
    border-color: #a8d5c6 !important;
}

body:not(.dark).canvas-mode .node.agent-node .agent-skill-chip.connected {
    color: #3f4f85 !important;
    background: #eef0ff !important;
    border-color: #b8c1ee !important;
}

body:not(.dark).canvas-mode .node.agent-node .creation-footer {
    color: #344054 !important;
    background: transparent !important;
    border-color: transparent !important;
}

body:not(.dark).canvas-mode .node.agent-node .agent-control {
    color: #344054 !important;
    background: #f6f8fa !important;
    border: 1px solid #c9d1d9 !important;
}

body:not(.dark).canvas-mode .node.agent-node .agent-picker-trigger {
    color: #24292f !important;
    background: transparent !important;
    border: 0 !important;
}

body:not(.dark).canvas-mode .node.agent-node .agent-select {
    color: #24292f !important;
    background: #ffffff !important;
    border-color: #c9d1d9 !important;
    color-scheme: light !important;
}

body:not(.dark).canvas-mode .node.agent-node .creation-submit {
    color: #ffffff !important;
    background: #24292f !important;
    border-color: #24292f !important;
}

body:not(.dark).canvas-mode .node.agent-node .creation-submit:hover {
    color: #ffffff !important;
    background: #424a53 !important;
    border-color: #424a53 !important;
}

body:not(.dark).canvas-mode .node.agent-node .creation-submit:disabled {
    color: #8c959f !important;
    background: #eaeef2 !important;
    border-color: #d0d7de !important;
}

/* v1.33：媒体节点统一工具栏。
   下载、截帧/截音频、替换和删除不再覆盖素材画面；尺寸/时长与操作共用独立一行。 */
body.canvas-mode.canvas-mode .node.node:is(.image-node, .video-node, .audio-node) > .media-node-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    min-height: 34px;
    padding: 4px 8px;
    gap: 8px;
    color: #aeb7c4;
    background: #202326;
    border-top: 1px solid #343a40;
    border-bottom: 1px solid #343a40;
    box-sizing: border-box;
}

body.canvas-mode.canvas-mode .node.node:is(.image-node, .video-node, .audio-node) > .media-node-toolbar[hidden] {
    display: none !important;
}

body.canvas-mode .media-node-meta {
    min-width: 0;
    overflow: hidden;
    color: inherit;
    font-size: 11px;
    font-weight: 550;
    font-variant-numeric: tabular-nums;
    line-height: 24px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.canvas-mode .media-node-meta[hidden] {
    display: none !important;
}

body.canvas-mode .media-node-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    min-width: 0;
}

/* 重复 canvas-mode/node 用于覆盖旧版 zoom/:has + !important 的画面浮层规则。 */
body.canvas-mode.canvas-mode .node.node:is(.image-node, .video-node, .audio-node)
    > .media-node-toolbar .media-node-actions
    > :is(.media-download-btn, .video-frame-btn, .audio-trim-btn, .media-replace-btn, .media-delete-btn) {
    position: static !important;
    inset: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    display: inline-flex !important;
    flex: 0 0 26px !important;
    align-items: center !important;
    justify-content: center !important;
    width: 26px !important;
    min-width: 26px !important;
    max-width: 26px !important;
    height: 26px !important;
    min-height: 26px !important;
    max-height: 26px !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 0 !important;
    color: #b9c2cd !important;
    background: #2b2f33 !important;
    border: 1px solid #444b52 !important;
    border-radius: 7px !important;
    box-shadow: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    pointer-events: auto !important;
    cursor: pointer;
    z-index: 1 !important;
}

body.canvas-mode.canvas-mode .node.node:is(.image-node, .video-node, .audio-node)
    > .media-node-toolbar .media-node-actions
    > :is(.media-download-btn, .video-frame-btn, .audio-trim-btn, .media-replace-btn, .media-delete-btn)[hidden] {
    display: none !important;
}

body.canvas-mode.canvas-mode .node.node:is(.image-node, .video-node, .audio-node)
    > .media-node-toolbar .media-node-actions
    > :is(.media-download-btn, .video-frame-btn, .audio-trim-btn, .media-replace-btn, .media-delete-btn) svg {
    display: block;
    flex: 0 0 14px;
    width: 14px !important;
    height: 14px !important;
    stroke-width: 2;
}

body.canvas-mode.canvas-mode .node.node:is(.image-node, .video-node, .audio-node)
    > .media-node-toolbar .media-node-actions
    > :is(.media-download-btn, .video-frame-btn, .audio-trim-btn, .media-replace-btn, .media-delete-btn):hover {
    color: #ffffff !important;
    background: #3a4046 !important;
    border-color: #65707b !important;
    transform: none !important;
}

body.canvas-mode.canvas-mode .node.node:is(.image-node, .video-node, .audio-node)
    > .media-node-toolbar .media-node-actions > .media-delete-btn:hover {
    color: #ffb4ad !important;
    background: #4a292b !important;
    border-color: #8f464a !important;
}

/* 浅色模式使用浅底、深色图标，工具按钮不再像四个黑色浮块。 */
body:not(.dark).canvas-mode.canvas-mode .node.node:is(.image-node, .video-node, .audio-node) > .media-node-toolbar {
    color: #57606a;
    background: #f6f8fa;
    border-color: #d0d7de;
}

body:not(.dark).canvas-mode.canvas-mode .node.node:is(.image-node, .video-node, .audio-node)
    > .media-node-toolbar .media-node-actions
    > :is(.media-download-btn, .video-frame-btn, .audio-trim-btn, .media-replace-btn, .media-delete-btn) {
    color: #57606a !important;
    background: #ffffff !important;
    border-color: #c5cdd5 !important;
}

body:not(.dark).canvas-mode.canvas-mode .node.node:is(.image-node, .video-node, .audio-node)
    > .media-node-toolbar .media-node-actions
    > :is(.media-download-btn, .video-frame-btn, .audio-trim-btn, .media-replace-btn, .media-delete-btn):hover,
body:not(.dark).canvas-mode.canvas-mode .node.node:is(.image-node, .video-node, .audio-node)
    > .media-node-toolbar .media-node-actions
    > :is(.media-download-btn, .video-frame-btn, .audio-trim-btn, .media-replace-btn, .media-delete-btn):focus-visible {
    color: #24292f !important;
    background: #eaeef2 !important;
    border-color: #8c959f !important;
    outline: none !important;
}

body:not(.dark).canvas-mode.canvas-mode .node.node:is(.image-node, .video-node, .audio-node)
    > .media-node-toolbar .media-node-actions > .media-delete-btn:hover,
body:not(.dark).canvas-mode.canvas-mode .node.node:is(.image-node, .video-node, .audio-node)
    > .media-node-toolbar .media-node-actions > .media-delete-btn:focus-visible {
    color: #cf222e !important;
    background: #ffebe9 !important;
    border-color: #ff8182 !important;
}

/* 时长已进入工具栏，取消旧标题徽标的外边距与暗色胶囊。 */
body.canvas-mode .media-node-toolbar .audio-duration-badge {
    margin: 0;
    padding: 0;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 0;
}

/* 成品音频原有固定总高度没有为新增工具栏预留空间；改为内容自然撑高。 */
body.canvas-mode.canvas-mode .node.audio-node:has(.audio-preview:not([hidden])) {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
}

body.canvas-mode.canvas-mode .node.audio-node:has(.audio-preview:not([hidden])) .node-content {
    height: 132px !important;
    min-height: 132px !important;
}

body.canvas-mode.canvas-mode .node.audio-node:has(.audio-preview:not([hidden])) .audio-preview-box {
    padding-right: 12px !important;
}

@media (max-width: 760px) {
    body.canvas-mode .media-node-toolbar {
        padding-inline: 6px !important;
        gap: 5px !important;
    }

    body.canvas-mode .media-node-actions {
        gap: 3px;
    }
}

/* 技能库滚动只作用于卡片列表，滚到边界也不把滚轮继续传给画布。 */
body.canvas-mode .skill-picker-list {
    overscroll-behavior: contain;
}

/* 文本创作底栏：提示词优化使用魔法图标，固定放在翻译按钮之前。 */
body.canvas-mode :is(.text-composer-prompt-optimize, .text-composer-translate) {
    display: inline-grid !important;
    place-items: center !important;
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 !important;
    color: #c0c8d2;
    background: #30343a;
    border: 1px solid #444b54;
    border-radius: 10px;
    cursor: pointer;
}

body.canvas-mode :is(.text-composer-prompt-optimize, .text-composer-translate) svg {
    width: 17px;
    height: 17px;
}

body.canvas-mode :is(.text-composer-prompt-optimize, .text-composer-translate):hover,
body.canvas-mode :is(.text-composer-prompt-optimize, .text-composer-translate):focus-visible,
body.canvas-mode .text-composer-prompt-optimize.is-loading {
    color: #ecfff8;
    background: #3a4442;
    border-color: #5b9b85;
    outline: none;
}

body.canvas-mode .text-composer-prompt-optimize:disabled {
    cursor: wait;
    opacity: .72;
}

body:not(.dark).canvas-mode :is(.text-composer-prompt-optimize, .text-composer-translate) {
    color: #57606a;
    background: #f6f8fa;
    border-color: #c9d1d9;
}

body:not(.dark).canvas-mode :is(.text-composer-prompt-optimize, .text-composer-translate):hover,
body:not(.dark).canvas-mode :is(.text-composer-prompt-optimize, .text-composer-translate):focus-visible,
body:not(.dark).canvas-mode .text-composer-prompt-optimize.is-loading {
    color: #176f58;
    background: #e6f3ee;
    border-color: #82b9a6;
}

body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-prompt-optimize {
    grid-column: 3 !important;
    grid-row: 1 !important;
    justify-self: end !important;
    align-self: center !important;
}

body.canvas-mode .text-composer-panel.is-expanded .text-composer-prompt-optimize {
    position: static !important;
    inset: auto !important;
    grid-column: 3 !important;
    grid-row: 1 !important;
    justify-self: end !important;
    align-self: center !important;
}

/* 旧的紧凑底栏会把每个直接子项强制拉到 100%；用真实按钮选择器锁回图标尺寸。 */
body.canvas-mode .text-composer-panel:not(.is-expanded) .text-composer-footer
    > :is(button.text-composer-prompt-optimize, button.text-composer-translate),
body.canvas-mode .text-composer-panel.is-expanded .text-composer-footer
    > :is(button.text-composer-prompt-optimize, button.text-composer-translate) {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    padding: 0 !important;
}

/* v1.34 · 轻剪辑采用常见非编式操作：整轨播放、可拖时间尺、帧吸附与适应时间线。 */
.edit-studio-body {
    grid-template-rows: minmax(0, 1fr) 260px;
}

.edit-studio-timeline-summary {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 7px;
}

.edit-studio-timeline-summary small {
    overflow: hidden;
    color: #737d89;
    font-size: 9px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.edit-studio-timeline-actions {
    gap: 7px;
}

.edit-studio-timeline-actions button:disabled {
    opacity: .35;
    cursor: not-allowed;
}

.edit-studio-ruler {
    position: relative;
    display: block;
    overflow: hidden;
    padding: 0;
    cursor: ew-resize;
    touch-action: none;
    user-select: none;
}

.edit-studio-ruler-track {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 132px;
    min-width: 1px;
    transform: translateX(calc(-1 * var(--edit-ruler-scroll, 0px)));
    pointer-events: none;
}

.edit-studio-ruler-track > span {
    position: absolute;
    top: 4px;
    display: block;
    color: #68727e;
    font-size: 8px;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    transform: translateX(-1px);
    white-space: nowrap;
}

.edit-studio-ruler-track > span > i {
    display: block;
    width: 1px;
    height: 4px;
    margin-bottom: 2px;
    background: currentColor;
    opacity: .58;
}

.edit-studio-ruler.scrubbing {
    color: #20c997;
    background: rgba(32, 201, 151, .055);
}

.edit-studio-track {
    grid-template-columns: 112px minmax(0, 1fr);
}

.edit-studio-track.main .edit-studio-track-clips {
    gap: 0;
}

.edit-studio-track.main .edit-studio-clip {
    border-radius: 4px;
    background:
        repeating-linear-gradient(90deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 34px),
        linear-gradient(135deg, rgba(42, 194, 156, .18), rgba(53, 102, 168, .13)),
        #252a31;
}

.edit-studio-playhead {
    --timeline-label-width: 124px;
}

.edit-studio-playhead > span {
    position: absolute;
    top: -34px;
    left: 50%;
    display: none;
    min-width: 52px;
    padding: 4px 6px;
    border: 1px solid rgba(32, 201, 151, .55);
    border-radius: 5px;
    color: #eafff7;
    background: #18201e;
    box-shadow: 0 5px 14px rgba(0, 0, 0, .34);
    font-size: 9px;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    text-align: center;
    transform: translateX(-50%);
    white-space: nowrap;
}

.edit-studio-timeline.scrubbing .edit-studio-playhead > span,
.edit-studio-playhead.dragging > span {
    display: block;
}

body:not(.dark) .edit-studio-timeline-summary small {
    color: #657181;
}

body:not(.dark) .edit-studio-ruler-track > span {
    color: #657181;
}

body:not(.dark) .edit-studio-track.main .edit-studio-clip {
    background:
        repeating-linear-gradient(90deg, rgba(255, 255, 255, .42) 0 1px, transparent 1px 34px),
        linear-gradient(135deg, rgba(32, 201, 151, .19), rgba(104, 145, 198, .16)),
        #e7eef4;
}

body:not(.dark) .edit-studio-playhead > span {
    color: #174f40;
    background: #effbf7;
    border-color: #43a98a;
    box-shadow: 0 5px 14px rgba(31, 53, 47, .16);
}

@media (max-width: 1100px) {
    .edit-studio-timeline-summary small {
        display: none;
    }
    .edit-studio-track {
        grid-template-columns: 96px minmax(0, 1fr);
    }
    .edit-studio-ruler-track {
        left: 116px;
    }
}

/* 轻剪辑基础功能：音量与历史控制保持紧凑、清晰。 */
.edit-studio-volume-control {
    display: grid;
    gap: 5px;
    color: var(--text-muted);
    font-size: 9px;
}

.edit-studio-volume-control > span {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.edit-studio-volume-control output {
    color: #20c997;
    font-variant-numeric: tabular-nums;
}

.edit-studio-volume-control input {
    width: 100%;
    accent-color: #20c997;
    cursor: ew-resize;
}

#editStudioUndo,
#editStudioRedo {
    width: 32px;
    min-width: 32px;
    padding-inline: 0;
}

#editStudioUndo + #editStudioRedo {
    margin-right: 4px;
}

/* v1.35 · 节点空态交互契约：只有图标与文字属于功能热区。
   功能列表的其余留白继续交给节点选择、打开创作框和拖动。 */
body.canvas-mode .node :is(.text-prompt-starters, .text-upload-row, .media-empty-actions) {
    pointer-events: none !important;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"])
    .text-prompt-starters > button,
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"])
    .text-upload-row .text-upload-btn,
body.canvas-mode .node :is(.image-placeholder, .video-placeholder, .audio-placeholder)
    .media-empty-actions > button {
    box-sizing: border-box !important;
    flex: 0 0 auto !important;
    width: max-content !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding-inline: 2px !important;
    justify-self: start !important;
    align-self: flex-start !important;
    pointer-events: auto !important;
}

body.canvas-mode .node :is(
    .text-prompt-starters > button,
    .text-upload-row .text-upload-btn,
    .media-empty-actions > button
) > * {
    pointer-events: none !important;
}

body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"])
    .text-upload-row .text-upload-btn {
    flex-grow: 0 !important;
}

/* 覆盖文本空节点末尾的 214px 整行按钮规则。 */
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown)
    .text-prompt-starters > button,
body.canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown)
    .text-upload-row .text-upload-btn {
    flex: 0 0 auto !important;
    width: max-content !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding-inline: 2px !important;
}

/* 视频提示词优化中：窄工具按钮只显示旋转图标，状态文字固定在左侧。 */
body.canvas-mode .video-composer-panel .media-composer-optimize.is-loading {
    position: relative !important;
    overflow: visible !important;
}

body.canvas-mode .video-composer-panel .media-composer-optimize.is-loading::before {
    content: "生成中";
    position: absolute;
    top: 50%;
    right: calc(100% + 7px);
    color: #aeb6c0;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
    transform: translateY(-50%);
}

body.canvas-mode .video-composer-panel .media-composer-optimize.is-loading svg {
    margin: 0 !important;
}

body:not(.dark).canvas-mode .video-composer-panel .media-composer-optimize.is-loading::before {
    color: #5e6875;
}

/* v1.36 · 文本生成状态与图片、视频一致：按钮只转圈，左侧明确显示“生成中”。 */
body.canvas-mode .text-composer-panel .text-composer-apply.is-generating {
    position: relative !important;
    overflow: visible !important;
}

body.canvas-mode .text-composer-panel .text-composer-apply.is-generating::before {
    content: "生成中";
    position: absolute;
    top: 50%;
    right: calc(100% + 8px);
    color: #aeb6c0;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
    transform: translateY(-50%);
}

body:not(.dark).canvas-mode .text-composer-panel .text-composer-apply.is-generating::before {
    color: #5e6875;
}

/* 影视旁白使用更紧凑的输入区，减少面板遮挡画布；全屏展开状态保持原高度。 */
body.canvas-mode .text-composer-panel.text-mode-script:not(.is-expanded) .text-composer-content {
    min-height: 82px !important;
    height: 82px !important;
    max-height: 108px !important;
}

/* 图片提示词优化中：与视频保持一致，在旋转图标左侧显示状态。 */
body.canvas-mode .image-composer-panel [data-prompt-action="optimize"].is-loading {
    position: relative !important;
    overflow: visible !important;
}

body.canvas-mode .image-composer-panel [data-prompt-action="optimize"].is-loading::before {
    content: "生成中";
    position: absolute;
    top: 50%;
    right: calc(100% + 7px);
    color: #aeb6c0;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
    transform: translateY(-50%);
}

body.canvas-mode .image-composer-panel [data-prompt-action="optimize"].is-loading svg {
    margin: 0 !important;
}

body:not(.dark).canvas-mode .image-composer-panel [data-prompt-action="optimize"].is-loading::before {
    color: #5e6875;
}
/* v1.36 · 所有项目统一显示加载反馈，并通过分阶段恢复避免阻塞主线程。 */
.canvas-load-screen {
    position: fixed;
    inset: 0;
    z-index: 12050;
    display: grid;
    place-items: center;
    background: rgba(9, 11, 14, .78);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity .18s ease;
}

.canvas-load-screen[hidden] { display: none; }
.canvas-load-screen.is-visible { opacity: 1; }
.canvas-load-card {
    width: min(360px, calc(100vw - 40px));
    display: grid;
    justify-items: center;
    gap: 12px;
    padding: 28px 30px;
    color: #f4f7fa;
    background: #1b1e22;
    border: 1px solid #343941;
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .42);
}
.canvas-load-card strong { font-size: 16px; }
.canvas-load-card > span:not(.canvas-load-spinner) { color: #a9b1bc; font-size: 13px; }
.canvas-load-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(94, 224, 184, .2);
    border-top-color: #5ee0b8;
    border-radius: 50%;
    animation: canvas-load-spin .75s linear infinite;
}
.canvas-load-track { width: 100%; height: 4px; overflow: hidden; border-radius: 999px; background: #30353c; }
.canvas-load-track i { display: block; width: 8%; height: 100%; border-radius: inherit; background: #5ee0b8; transition: width .16s ease; }
@keyframes canvas-load-spin { to { transform: rotate(360deg); } }
body.canvas-is-loading .canvas-container { pointer-events: none; }

/* v1.37 · 画布背景延伸到顶部工具栏背后，消除两块背景交界形成的横线。 */
body.canvas-mode .canvas-container {
    top: 0 !important;
}

body.canvas-mode .toolbar {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

/* v1.37 · 浅色基础节点统一外框；媒体内容层不能盖住底部圆角与选中边框。 */
body:not(.dark).canvas-mode .node:is(.text-node, .image-node, .video-node, .audio-node, .style-node, .effect-node, .skill-node) {
    border: 1px solid #9ea8b3 !important;
    border-radius: 12px !important;
    background: #ffffff !important;
    box-shadow: 0 7px 20px rgba(31, 35, 40, .14) !important;
}

body:not(.dark).canvas-mode .node:is(.text-node, .image-node, .video-node, .audio-node, .style-node, .effect-node, .skill-node) > .node-header {
    border-radius: 11px 11px 0 0 !important;
}

body:not(.dark).canvas-mode .node:is(.image-node, .video-node, .audio-node) > .node-content {
    overflow: hidden;
    border-radius: 0 0 11px 11px;
}

body:not(.dark).canvas-mode .node:is(.text-node, .image-node, .video-node, .audio-node, .style-node, .effect-node, .skill-node).selected {
    border-color: #159575 !important;
    box-shadow: 0 0 0 1px rgba(21, 149, 117, .22), 0 8px 24px rgba(31, 35, 40, .16) !important;
}

/* v1.37 · 浅色主题复用暗色节点结构，只替换颜色：外卡片 + 内内容框。 */
body:not(.dark).canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) > .node-content {
    width: calc(100% - 20px) !important;
    height: calc(100% - 58px) !important;
    margin: 10px !important;
    border: 1px solid #c9d1da !important;
    border-radius: 8px !important;
    background: #f6f8fa !important;
    box-shadow: none !important;
}

body:not(.dark).canvas-mode .node:is(.image-node, .video-node, .audio-node):not(:has(.image-preview:not([hidden]))):not(:has(.video-preview:not([hidden]))):not(:has(.audio-preview:not([hidden]))) > .node-content {
    padding: 10px !important;
    background: #ffffff !important;
}

body:not(.dark).canvas-mode .node.image-node:not(:has(.image-preview:not([hidden]))) .image-preview-box,
body:not(.dark).canvas-mode .node.video-node:not(:has(.video-preview:not([hidden]))) .video-preview-box,
body:not(.dark).canvas-mode .node.audio-node:not(:has(.audio-preview:not([hidden]))) .audio-preview-box {
    border: 1px solid #c9d1da !important;
    border-radius: 8px !important;
    background: #f6f8fa !important;
}

body:not(.dark).canvas-mode .node.style-node:not(.has-library-selection) > .node-content,
body:not(.dark).canvas-mode .node.effect-node:not(.has-library-selection) > .node-content,
body:not(.dark).canvas-mode .node.skill-node:not(.has-skill-selection) > .node-content {
    width: auto !important;
    height: 138px !important;
    min-height: 138px !important;
    margin: 0 10px 10px !important;
    padding: 8px 12px 12px !important;
    overflow: hidden !important;
    border: 1px solid #c9d1da !important;
    border-radius: 8px !important;
    background: #f6f8fa !important;
    box-shadow: none !important;
}

body:not(.dark).canvas-mode .node.skill-node:not(.has-skill-selection) .skill-node-open {
    border-color: #d2d9e1 !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* v1.37 · 文本空节点五个入口完整可见，上传入口不再因浅色弱化而像被截断。 */
body:not(.dark).canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]):has(.node-textarea:placeholder-shown) > .node-content {
    justify-content: center !important;
    gap: 3px !important;
    padding: 12px 20px 14px !important;
}

body:not(.dark).canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-upload-btn,
body:not(.dark).canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-upload-btn::after {
    color: #44515f !important;
    visibility: visible !important;
    opacity: 1 !important;
}

body:not(.dark).canvas-mode .node.text-node:not([data-generated-by-agent]):not([data-generated-text-result="true"]) .text-upload-btn svg {
    color: #718092 !important;
    opacity: 1 !important;
}

/* v1.37 · 风格、特效、技能成品节点统一为同一种无标题方卡结构。 */
body.canvas-mode :is(
    .node.style-node.has-library-selection,
    .node.effect-node.has-library-selection,
    .node.skill-node.has-skill-selection
) {
    width: 184px !important;
    min-width: 184px !important;
    max-width: 184px !important;
    height: 184px !important;
    min-height: 184px !important;
    max-height: 184px !important;
    overflow: visible !important;
    border: 1px solid #8f99a5 !important;
    border-radius: 14px !important;
    background: transparent !important;
    box-shadow: 0 10px 28px rgba(31, 35, 40, .18) !important;
}

body.canvas-mode :is(
    .node.style-node.has-library-selection,
    .node.effect-node.has-library-selection,
    .node.skill-node.has-skill-selection
) > .node-header,
body.canvas-mode :is(
    .node.style-node.has-library-selection .style-node-open,
    .node.effect-node.has-library-selection .effect-node-open,
    .node.skill-node.has-skill-selection .skill-node-open
) {
    display: none !important;
}

body.canvas-mode :is(
    .node.style-node.has-library-selection,
    .node.effect-node.has-library-selection,
    .node.skill-node.has-skill-selection
) > .node-content {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 0 !important;
    border-radius: 13px !important;
    background: transparent !important;
}

body.canvas-mode :is(
    .node.style-node.has-library-selection .style-node-selection,
    .node.effect-node.has-library-selection .effect-node-selection,
    .node.skill-node.has-skill-selection .skill-node-selection
) {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 0 !important;
    border-radius: 13px !important;
    cursor: pointer !important;
}

body.canvas-mode :is(
    .node.style-node.has-library-selection,
    .node.effect-node.has-library-selection,
    .node.skill-node.has-skill-selection
).selected {
    border-color: #159575 !important;
    box-shadow: 0 0 0 1px rgba(21, 149, 117, .24), 0 12px 30px rgba(31, 35, 40, .20) !important;
}

/* v1.37 · 暗色成品方卡只保留一层外框，内容直接贴合边缘，消除双圆角缝隙。 */
body.dark.canvas-mode :is(
    .node.style-node.has-library-selection,
    .node.effect-node.has-library-selection,
    .node.skill-node.has-skill-selection
) {
    border: 1px solid rgba(112, 223, 186, .58) !important;
    border-radius: 14px !important;
    background: transparent !important;
}

/* 风格库封面采用 16:9 横版构图，避免把方形原图硬裁成矮条。 */
body.canvas-mode .cinematic-style-card-preview,
body.canvas-mode .cinematic-style-card-media,
body.canvas-mode .cinematic-style-card img {
    aspect-ratio: 16 / 9 !important;
    width: 100% !important;
    object-fit: cover !important;
}

body.dark.canvas-mode :is(
    .node.style-node.has-library-selection,
    .node.effect-node.has-library-selection,
    .node.skill-node.has-skill-selection
) > .node-content,
body.dark.canvas-mode :is(
    .node.style-node.has-library-selection .style-node-selection,
    .node.effect-node.has-library-selection .effect-node-selection,
    .node.skill-node.has-skill-selection .skill-node-selection,
    .node.style-node.has-library-selection .style-node-preview-grid,
    .node.effect-node.has-library-selection .style-node-preview-grid,
    .node.style-node.has-library-selection .style-node-preview-card,
    .node.effect-node.has-library-selection .style-node-preview-card
) {
    width: auto !important;
    height: auto !important;
    inset: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 13px !important;
    box-shadow: none !important;
}

body.dark.canvas-mode :is(
    .node.style-node.has-library-selection,
    .node.effect-node.has-library-selection,
    .node.skill-node.has-skill-selection
).selected {
    border-color: #70dfba !important;
    box-shadow: 0 0 0 1px rgba(112, 223, 186, .22), 0 12px 28px rgba(0, 0, 0, .28) !important;
}

/* v1.37 · 浅色远景增强：缩小查看大型画布时仍能区分节点、编组和连线。 */
body:not(.dark).canvas-mode .canvas-container.large-canvas-mode.canvas-lod-low .node {
    border-color: #778594 !important;
    background-color: #ffffff !important;
}

body:not(.dark).canvas-mode .canvas-container.large-canvas-mode.canvas-lod-low .node > .node-header {
    color: #111820 !important;
    border-bottom-color: #aab5c0 !important;
}

body:not(.dark).canvas-mode .canvas-container.large-canvas-mode.canvas-lod-low .canvas-node-group-backdrop {
    background: rgba(174, 188, 202, .42) !important;
    border-color: #7e8d9c !important;
    border-width: 1.5px !important;
}

body:not(.dark).canvas-mode .canvas-container.large-canvas-mode.canvas-lod-low .connections-layer path.conn-line {
    stroke: #647587 !important;
    opacity: .88 !important;
}

/* 小地图属于画布基础导航，不再被旧的本地隐藏状态永久关闭。 */
body.canvas-mode .canvas-minimap.is-user-hidden {
    display: flex !important;
}

/* Final cascade guard: light image composer parameter strip. */
body:not(.dark).canvas-mode .media-composer-panel.image-composer-panel:not(.is-expanded) .media-composer-footer {
    min-height: 56px !important;
    padding: 9px 0 0 !important;
    column-gap: 0 !important;
    border-top: 1px solid #d8dee6 !important;
    background: transparent !important;
}
body:not(.dark).canvas-mode .media-composer-panel.image-composer-panel:not(.is-expanded) .media-composer-footer > .media-composer-control {
    box-sizing: border-box !important;
    height: 38px !important;
    min-height: 38px !important;
    margin: 0 !important;
    padding: 0 10px !important;
    gap: 7px !important;
    color: #34404d !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 8px !important;
    box-shadow: none !important;
}
body:not(.dark).canvas-mode .media-composer-panel.image-composer-panel:not(.is-expanded) .media-composer-footer > .media-composer-control:not(.model) {
    border-left: 1px solid #d4dae2 !important;
    border-radius: 0 !important;
}
body:not(.dark).canvas-mode .media-composer-panel.image-composer-panel:not(.is-expanded) .media-composer-footer > .media-composer-control:hover {
    background: #eef2f6 !important;
}
body:not(.dark).canvas-mode .media-composer-panel.image-composer-panel:not(.is-expanded)
    .media-composer-control :is(.composer-select-trigger,.composer-select-value,select) {
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
    color: #34404d !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* v1.44 · 视频成品端口最终契约。
   左右端口必须浮在视频、工具栏和选中描边之上；视觉从旧灰色粗圆点收为
   轻量青绿色连接点，热区保持 30px，避免为了好看而牺牲可点击性。 */
body.canvas-mode .node.video-node > .node-port {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 30px !important;
    height: 30px !important;
    overflow: visible !important;
    z-index: 120 !important;
    pointer-events: auto !important;
    background: transparent !important;
    border: 0 !important;
}

body.canvas-mode .node.video-node:not(.zoomed) > .input-port {
    left: -15px !important;
    right: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

body.canvas-mode .node.video-node:not(.zoomed) > .output-port {
    right: -15px !important;
    left: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

body.canvas-mode .node.video-node > .node-port::after {
    content: '+' !important;
    box-sizing: border-box !important;
    width: 18px !important;
    height: 18px !important;
    border: 1px solid rgba(92, 211, 174, .78) !important;
    border-radius: 6px !important;
    background: rgba(24, 31, 35, .94) !important;
    color: #8ce5c7 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 16px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .24) !important;
    transform: none !important;
}

body.canvas-mode .node.video-node > .node-port:is(:hover, .snap-target)::after {
    border-color: #70dfba !important;
    background: #159575 !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(21, 149, 117, .18), 0 4px 12px rgba(0, 0, 0, .30) !important;
    transform: scale(1.12) !important;
}

body:not(.dark).canvas-mode .node.video-node > .node-port::after {
    border-color: #159575 !important;
    background: rgba(255, 255, 255, .98) !important;
    color: #117a60 !important;
    box-shadow: 0 2px 8px rgba(30, 41, 51, .18) !important;
}

/* v1.53 · 浅色编组远景重构。
   编组是内容的轻量工作区，不应在缩小画布后变成大面积不透明灰板。 */
body:not(.dark).canvas-mode {
    --gh-canvas: #f4f6f8;
}

body:not(.dark).canvas-mode .canvas-container {
    background-color: var(--gh-canvas) !important;
    background-image: radial-gradient(circle, rgba(80, 94, 108, .16) 0, rgba(80, 94, 108, .16) .68px, transparent .92px) !important;
}

body:not(.dark).canvas-mode .canvas-node-group-backdrop,
body:not(.dark).canvas-mode .canvas-node-group-backdrop.is-composite {
    background: linear-gradient(180deg, rgba(255, 255, 255, .66) 0%, rgba(255, 255, 255, .42) 22%, rgba(255, 255, 255, .26) 100%) !important;
    border: 1px solid rgba(98, 113, 128, .24) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 5px 18px rgba(31, 41, 55, .045) !important;
    opacity: 1 !important;
}

body:not(.dark).canvas-mode .canvas-node-group-backdrop.is-composite {
    background: linear-gradient(180deg, rgba(246, 250, 255, .76), rgba(255, 255, 255, .30)) !important;
}

body:not(.dark).canvas-mode .canvas-node-group-backdrop.is-selected {
    background: linear-gradient(180deg, rgba(213, 250, 239, .42), rgba(236, 253, 247, .24)) !important;
    border-color: rgba(21, 149, 117, .55) !important;
    box-shadow: inset 0 0 0 1px rgba(21, 149, 117, .09), 0 7px 20px rgba(21, 105, 82, .06) !important;
}

body:not(.dark).canvas-mode .canvas-node-group,
body:not(.dark).canvas-mode .canvas-node-group.is-composite,
body:not(.dark).canvas-mode .canvas-node-group.is-selected {
    background: transparent !important;
    border-color: rgba(91, 107, 123, .40) !important;
}

body:not(.dark).canvas-mode .canvas-node-group.is-selected {
    border-color: rgba(21, 149, 117, .78) !important;
}

body:not(.dark).canvas-mode .canvas-node-group-title {
    color: #34404c !important;
    background: rgba(255, 255, 255, .96) !important;
    border-color: #cbd5df !important;
    box-shadow: 0 3px 10px rgba(31, 41, 55, .08) !important;
}

body:not(.dark).canvas-mode .canvas-node-group.is-selected .canvas-node-group-title {
    color: #116b53 !important;
    background: rgba(231, 248, 242, .97) !important;
    border-color: #6fc7aa !important;
}

body:not(.dark).canvas-mode .canvas-container.large-canvas-mode.canvas-lod-low .canvas-node-group-backdrop {
    background: rgba(255, 255, 255, .26) !important;
    border-color: rgba(98, 113, 128, .18) !important;
}

body:not(.dark).canvas-mode .canvas-container.large-canvas-mode.canvas-lod-low .canvas-node-group-backdrop.is-composite {
    background: rgba(255, 255, 255, .32) !important;
}

body:not(.dark).canvas-mode .canvas-container.large-canvas-mode.canvas-lod-low .canvas-node-group-backdrop.is-selected {
    background: rgba(211, 245, 235, .24) !important;
    border-color: rgba(21, 149, 117, .44) !important;
}

body:not(.dark).canvas-mode .canvas-container.large-canvas-mode.canvas-lod-low .canvas-node-group,
body:not(.dark).canvas-mode .canvas-container.large-canvas-mode.canvas-lod-low .canvas-node-group.is-selected {
    background: transparent !important;
    border-width: 1.5px !important;
}

body:not(.dark).canvas-mode .canvas-container.large-canvas-mode.canvas-lod-low .connections-layer path.conn-line {
    stroke: #7d8c9b !important;
    stroke-width: .85 !important;
    opacity: .56 !important;
}

/* v1.45 · 画布版本更新检查与刷新确认。 */
.setting-update-card{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:11px;margin-top:14px;padding:12px;border:1px solid var(--border);border-radius:13px;background:rgba(255,255,255,.035)}
.setting-update-icon{display:grid;width:36px;height:36px;place-items:center;border-radius:11px;background:rgba(54,211,164,.13);color:#45d5aa}.setting-update-icon svg{width:18px;height:18px}.setting-update-copy{display:grid;min-width:0;gap:3px}.setting-update-copy strong{font-size:13px}.setting-update-copy small{overflow:hidden;color:var(--text-secondary);font-size:11px;text-overflow:ellipsis;white-space:nowrap}.setting-update-card>button{height:34px;padding:0 11px;border:1px solid #46515a;border-radius:9px;background:#30363c;color:#dce3e8;font-size:11px;cursor:pointer}.setting-update-card>button:hover{border-color:#44d5aa;color:#72e7c3}.setting-update-card>button.is-loading{opacity:.7}
.app-update-dialog[hidden]{display:none!important}.app-update-dialog{position:fixed;inset:0;z-index:9500;display:grid;place-items:center;padding:22px}.app-update-backdrop{position:absolute;inset:0;background:rgba(4,7,9,.72);backdrop-filter:blur(9px)}.app-update-card{position:relative;display:grid;width:min(430px,calc(100vw - 32px));grid-template-columns:auto 1fr;gap:16px;padding:24px;border:1px solid #3e4a52;border-radius:20px;background:#22272b;color:#f2f6f8;box-shadow:0 30px 100px rgba(0,0,0,.58);transform:translateY(10px) scale(.98);opacity:0;transition:opacity .18s ease,transform .18s ease}.app-update-dialog.is-open .app-update-card{transform:none;opacity:1}.app-update-mark{display:grid;width:48px;height:48px;place-items:center;border-radius:15px;background:linear-gradient(145deg,#38d5a6,#24aee8);color:#071512}.app-update-mark svg{width:23px;height:23px}.app-update-card small{color:#6ce2bd;font-size:11px;font-weight:750}.app-update-card h2{margin:4px 0 7px;font-size:20px}.app-update-card p{margin:0;color:#aab5bd;font-size:13px;line-height:1.6}.app-update-card footer{display:flex;grid-column:1/-1;justify-content:flex-end;gap:9px;margin-top:5px}.app-update-card footer button{display:inline-flex;align-items:center;justify-content:center;gap:7px;height:40px;padding:0 15px;border-radius:11px;font-weight:700;cursor:pointer}.app-update-later{border:1px solid #465059;background:#30363b;color:#bcc6cd}.app-update-refresh{border:1px solid #3ed1a6;background:#35c99d;color:#071713}.app-update-refresh:hover{background:#4edcb3}.app-update-refresh.is-loading svg{animation:app-update-spin .8s linear infinite}@keyframes app-update-spin{to{transform:rotate(360deg)}}
body:not(.dark) .setting-update-card{background:#f7f9fa}body:not(.dark) .setting-update-card>button{border-color:#ccd5dc;background:#fff;color:#3d4952}body:not(.dark) .app-update-card{border-color:#d7dfe4;background:#fff;color:#172027}body:not(.dark) .app-update-card p{color:#63717b}
@media(max-width:520px){.setting-update-card{grid-template-columns:auto 1fr}.setting-update-card>button{grid-column:1/-1}.app-update-card{grid-template-columns:1fr}.app-update-mark{width:44px;height:44px}.app-update-card footer{grid-column:1;display:grid;grid-template-columns:1fr 1fr}.app-update-card footer button{padding:0 9px;font-size:12px}}

/* v1.57 · 更新弹窗改为克制的靛蓝层级，避免高饱和青绿与纯黑按钮抢占注意力。 */
.setting-update-card{border-color:rgba(129,140,248,.22);background:rgba(99,102,241,.055)}.setting-update-icon{background:rgba(99,102,241,.13);color:#6865dd}.setting-update-card>button{border-color:#cfd6e5;background:#f8fafc;color:#445064}.setting-update-card>button:hover{border-color:#8582eb;color:#504ec3}
.app-update-backdrop{background:radial-gradient(circle at 50% 38%,rgba(99,102,241,.2),transparent 42%),rgba(15,23,42,.62);backdrop-filter:blur(12px) saturate(112%)}.app-update-card{border-color:rgba(203,213,225,.9);background:linear-gradient(145deg,#fff 0%,#f7f8fc 100%);color:#172033;box-shadow:0 28px 88px rgba(15,23,42,.28)}.app-update-mark{border-radius:14px;background:linear-gradient(145deg,#7c7af2,#5b5bd6);color:#fff;box-shadow:0 10px 22px rgba(91,91,214,.22)}.app-update-card small{color:#625ed3;font-weight:720;letter-spacing:.01em}.app-update-card h2{letter-spacing:-.02em}.app-update-card p{color:#64748b}.app-update-later{border-color:#d7deea;background:#eef1f6;color:#4b5a70}.app-update-later:hover{border-color:#bcc7dc;background:#e5eaf2}.app-update-refresh{border-color:#5b5bd6;background:#5b5bd6;color:#fff;box-shadow:0 8px 18px rgba(91,91,214,.2)}.app-update-refresh:hover{background:#4f4fc5;border-color:#4f4fc5}.app-update-card footer button:focus-visible{outline:3px solid rgba(99,102,241,.28);outline-offset:3px}body.dark .setting-update-card{border-color:rgba(129,140,248,.25);background:rgba(99,102,241,.1)}body.dark .setting-update-card>button{border-color:#46516a;background:#262d3b;color:#dbe3f2}body.dark .app-update-card{border-color:#48546a;background:linear-gradient(145deg,#252c3a 0%,#1c2230 100%);color:#f3f6ff;box-shadow:0 30px 92px rgba(0,0,0,.5)}body.dark .app-update-card p{color:#aeb9cb}body.dark .app-update-later{border-color:#4b566b;background:#303847;color:#d4dceb}

/* v1.46 · 参考素材必须完整显示；靠近视口顶部时预览自动向下展开。 */
body.canvas-mode .image-composer-references .media-square-reference > img.media-asset-thumb,
body.canvas-mode .video-composer-panel .media-composer-assets .media-square-reference > img.media-asset-thumb {
    box-sizing: border-box !important;
    object-fit: contain !important;
    object-position: center !important;
    background: #111417 !important;
}
body.canvas-mode .media-square-reference.preview-below .media-asset-hover {
    top: calc(100% + 12px) !important;
    bottom: auto !important;
}
body.canvas-mode .media-square-reference .media-asset-hover > img {
    display: block !important;
    width: auto !important;
    max-width: min(320px, 42vw) !important;
    height: auto !important;
    max-height: min(320px, calc(100vh - 32px)) !important;
    margin: auto !important;
    object-fit: contain !important;
    object-position: center !important;
}

/* v1.49 · 轻剪辑拖拽到轨道下方时，显式出现自动新建轨道落点。 */
.edit-studio-new-track-drop {
    display: none;
    grid-template-columns: 92px minmax(0, 1fr);
    min-height: 58px;
    border: 1px dashed rgba(86, 216, 176, .34);
    border-radius: 8px;
    color: #7fcfb5;
    background: rgba(32, 201, 151, .035);
    pointer-events: auto;
}
.edit-studio-timeline.drag-over .edit-studio-new-track-drop { display: grid; }
.edit-studio-new-track-drop > i { display: grid; place-items: center; border-right: 1px solid rgba(86,216,176,.16); }
.edit-studio-new-track-drop > i svg { width: 15px; height: 15px; }
.edit-studio-new-track-drop > span { display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; letter-spacing: .02em; }
.edit-studio-new-track-drop.drop-target {
    display: grid;
    border-color: #38d5a6;
    color: #b9f5e2;
    background: rgba(32, 201, 151, .13);
    box-shadow: inset 0 0 0 1px rgba(56,213,166,.35), 0 0 22px rgba(32,201,151,.10);
}
body:not(.dark) .edit-studio-new-track-drop { color:#15785d; background:rgba(21,149,117,.045); border-color:rgba(21,149,117,.35); }

/* v1.53 · 统一语言切换器：入口随首页、工作台和画布顶部一起出现。 */
.language-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
}
.language-trigger > :is(svg, span) { flex: 0 0 auto; }
.language-trigger > svg:first-child { width: 16px; height: 16px; }
.language-trigger > svg:last-child { width: 13px; height: 13px; opacity: .72; }
.home-actions .language-trigger {
    min-width: 76px;
    padding-inline: 9px;
}
/* 画布旧工具栏会把所有非账户按钮强制压成 42px；语言按钮必须单独恢复
   内容宽度，否则语言图标和当前代码会溢出到按钮外，看起来像两个控件。 */
body.canvas-mode .toolbar-right > .action-btn.language-trigger {
    box-sizing: border-box;
    flex: 0 0 auto;
    width: auto !important;
    min-width: 76px !important;
    max-width: none !important;
    padding: 0 9px !important;
    overflow: hidden;
}
.language-menu[hidden] { display: none !important; }
.language-menu {
    position: fixed;
    z-index: 9600;
    display: grid;
    min-width: 94px;
    padding: 6px;
    border: 1px solid rgba(105, 119, 131, .42);
    border-radius: 13px;
    color: #e9eef2;
    background: rgba(26, 30, 34, .98);
    box-shadow: 0 18px 48px rgba(0, 0, 0, .34);
    backdrop-filter: blur(14px);
}
.language-menu button {
    display: grid;
    grid-template-columns: 1fr 18px;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 38px;
    padding: 0 9px;
    border: 0;
    border-radius: 9px;
    color: inherit;
    background: transparent;
    text-align: left;
    cursor: pointer;
}
.language-menu button:hover,
.language-menu button:focus-visible { background: rgba(104, 226, 184, .12); outline: none; }
.language-menu button > span {
    display: grid;
    width: 42px;
    height: 24px;
    place-items: center;
    border: 1px solid rgba(161, 179, 193, .26);
    border-radius: 7px;
    color: #b8f1dd;
    background: rgba(255, 255, 255, .045);
    font-size: 10px;
    font-weight: 800;
}
.language-menu button > svg { width: 16px; height: 16px; opacity: 0; color: #75e6bf; }
.language-menu button.is-active { color: #ecfff7; background: rgba(76, 210, 164, .14); }
.language-menu button.is-active > svg { opacity: 1; }
body:not(.dark):not(.guest-home) .language-menu {
    border-color: #d8e0e4;
    color: #27313a;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 18px 48px rgba(31, 41, 55, .16);
}
body:not(.dark):not(.guest-home) .language-menu button:hover,
body:not(.dark):not(.guest-home) .language-menu button.is-active { background: #edf8f4; }
body:not(.dark):not(.guest-home) .language-menu button > span { border-color: #d1dce0; color: #168565; background: #f6faf9; }
@media (max-width: 720px) {
    .home-actions .language-trigger { display: inline-flex !important; width: 38px; min-width: 38px; padding-inline: 0; }
    .home-actions .language-trigger > :is(span, svg:last-child),
    body.canvas-mode .toolbar-right .language-trigger > :is(span, svg:last-child) { display: none; }
    body.canvas-mode .toolbar-right > .action-btn.language-trigger {
        width: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
        padding: 0 !important;
        gap: 0;
    }
}

/* v1.64 · 更新弹窗统一为翡翠绿，文字与操作层级使用同一语义色。 */.setting-update-card{border-color:rgba(22,163,74,.23);background:rgba(34,197,94,.055)}.setting-update-icon{background:rgba(34,197,94,.13);color:#159a5b}.setting-update-card>button{border-color:#c9e8d5;background:#f5fcf7;color:#2f6850}.setting-update-card>button:hover{border-color:#6cc795;color:#087a41}.app-update-backdrop{background:radial-gradient(circle at 50% 38%,rgba(16,185,129,.23),transparent 43%),rgba(7,25,18,.66);backdrop-filter:blur(12px) saturate(112%)}.app-update-card{border-color:rgba(177,225,200,.92);background:linear-gradient(145deg,#fff 0%,#f3fbf6 100%);color:#163126;box-shadow:0 28px 88px rgba(5,65,37,.23)}.app-update-mark{border-radius:14px;background:linear-gradient(145deg,#34d399,#099668);color:#fff;box-shadow:0 10px 22px rgba(16,150,104,.24)}.app-update-card small{color:#07834b;font-weight:720;letter-spacing:.01em}.app-update-card h2{letter-spacing:-.02em}.app-update-card p{color:#577165}.app-update-later{border-color:#cce8d8;background:#eff9f2;color:#35654e}.app-update-later:hover{border-color:#a5d8ba;background:#e3f4e9}.app-update-refresh{border-color:#119761;background:#119761;color:#fff;box-shadow:0 8px 18px rgba(17,151,97,.22)}.app-update-refresh:hover{background:#078554;border-color:#078554}.app-update-card footer button:focus-visible{outline:3px solid rgba(16,185,129,.28);outline-offset:3px}body.dark .setting-update-card{border-color:rgba(74,222,128,.25);background:rgba(34,197,94,.1)}body.dark .setting-update-card>button{border-color:#35634a;background:#1e3427;color:#d6f2e0}body.dark .app-update-card{border-color:#39634b;background:linear-gradient(145deg,#1e3829 0%,#14271c 100%);color:#ecfff3;box-shadow:0 30px 92px rgba(0,0,0,.5)}body.dark .app-update-card p{color:#b6d2c0}body.dark .app-update-later{border-color:#416f54;background:#294534;color:#d5eddf}

/* v1.67 · 更新弹窗采用中文界面字体、常规字重与紧凑文案，避免粗重生硬。 */
.app-update-card,
.app-update-card footer button {
    font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Source Han Sans SC", "Segoe UI", sans-serif;
}
.app-update-card { gap: 18px; padding: 28px 30px; }
.app-update-card small { font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.app-update-card h2 { margin: 6px 0 8px; font-size: 23px; font-weight: 600; line-height: 1.35; letter-spacing: -.025em; }
.app-update-card p { font-size: 14px; font-weight: 400; line-height: 1.65; letter-spacing: 0; }
.app-update-card footer { gap: 10px; margin-top: 8px; }
.app-update-card footer button { height: 42px; padding: 0 17px; font-size: 14px; font-weight: 600; letter-spacing: 0; }
.app-update-card footer button svg { width: 19px; height: 19px; }
@media (max-width: 520px) { .app-update-card { padding: 23px; } .app-update-card h2 { font-size: 21px; } }

/* v1.88 · 浅色生成面板使用独立的明亮层级，不再沿用暗色弹层配色。 */
body:not(.dark).canvas-mode .media-composer-panel:is(
    .image-composer-panel,
    .video-composer-panel,
    .audio-composer-panel,
    .text-composer-panel
) {
    color: #25313d !important;
    background: linear-gradient(180deg, #fbfcfd 0%, #f6f8fa 100%) !important;
    border-color: #ccd6e0 !important;
    box-shadow:
        0 24px 64px rgba(36, 47, 58, .14),
        0 3px 12px rgba(36, 47, 58, .07),
        inset 0 1px 0 rgba(255, 255, 255, .92) !important;
}

body:not(.dark).canvas-mode .media-composer-panel .media-composer-prompt-wrap {
    overflow: hidden;
    background: #ffffff !important;
    border: 1px solid #dbe3eb !important;
    border-radius: 13px !important;
    box-shadow: inset 0 1px 2px rgba(36, 47, 58, .035) !important;
}

body:not(.dark).canvas-mode .media-composer-panel :is(.media-composer-prompt, .text-composer-content) {
    color: #1f2a35 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

body:not(.dark).canvas-mode .media-composer-panel :is(
    .image-composer-tools,
    .video-composer-tools,
    .audio-composer-tools,
    .text-composer-tools
) button {
    color: #44515e !important;
    background: #f0f3f6 !important;
    border-color: #d6dee6 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .86) !important;
}

body:not(.dark).canvas-mode .media-composer-panel :is(
    .image-composer-tools,
    .video-composer-tools,
    .audio-composer-tools,
    .text-composer-tools
) button:is(:hover, :focus-visible, .active) {
    color: #145b49 !important;
    background: #e7f3ef !important;
    border-color: #a9d2c4 !important;
    outline: none;
}

body:not(.dark).canvas-mode .media-composer-panel :is(.media-composer-close, .media-composer-expand) {
    color: #536171 !important;
    background: #eef2f5 !important;
    border: 1px solid #d6dee6 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9) !important;
}

body:not(.dark).canvas-mode .media-composer-panel :is(.media-composer-close, .media-composer-expand):is(:hover, :focus-visible) {
    color: #1f2a35 !important;
    background: #e3e9ee !important;
    border-color: #c5d0da !important;
    outline: 2px solid rgba(22, 140, 109, .16);
    outline-offset: 1px;
}

body:not(.dark).canvas-mode .media-composer-panel .media-composer-footer {
    border-top-color: #dfe6ed !important;
}

body:not(.dark).canvas-mode .media-composer-panel .media-composer-control {
    color: #344250 !important;
    background: #ffffff !important;
    border-color: #d7e0e8 !important;
    box-shadow: 0 1px 2px rgba(36, 47, 58, .035) !important;
}

body:not(.dark).canvas-mode .media-composer-panel .media-composer-control:hover {
    background: #f8fafb !important;
    border-color: #c5d1db !important;
}

body:not(.dark).canvas-mode .media-composer-panel .composer-select-trigger {
    color: #344250 !important;
}

body:not(.dark).canvas-mode .media-composer-panel .composer-select-trigger svg {
    color: #758393 !important;
}

body:not(.dark).canvas-mode .media-composer-panel .composer-select-trigger:focus-visible {
    border-radius: 7px;
    outline: 2px solid rgba(22, 140, 109, .22);
    outline-offset: 2px;
}

body:not(.dark).canvas-mode .media-composer-panel .media-composer-footer-prompt-tools button {
    color: #718090 !important;
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

body:not(.dark).canvas-mode .media-composer-panel .media-composer-footer-prompt-tools button:is(:hover, :focus-visible) {
    color: #145b49 !important;
    background: #e8f3ef !important;
    outline: none;
}

body:not(.dark).canvas-mode .media-composer-panel .media-composer-credit {
    color: #7a8795 !important;
}

/* 下拉浮层挂在 body 下，必须单独定义浅色状态，否则会显示成突兀的黑色菜单。 */
body:not(.dark) .composer-select-menu {
    padding: 6px !important;
    color: #25313d !important;
    background: rgba(255, 255, 255, .985) !important;
    border-color: #cfd9e3 !important;
    border-radius: 12px !important;
    box-shadow:
        0 18px 44px rgba(36, 47, 58, .17),
        0 3px 10px rgba(36, 47, 58, .08) !important;
    scrollbar-color: #b8c4cf transparent;
    color-scheme: light;
    backdrop-filter: blur(16px) saturate(118%);
}

body:not(.dark) .composer-select-menu button {
    color: #44515e !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    border-radius: 8px !important;
}

body:not(.dark) .composer-select-menu button:is(:hover, :focus-visible) {
    color: #1f2a35 !important;
    background: #f0f4f7 !important;
    border-color: #e0e7ed !important;
    outline: none;
}

body:not(.dark) .composer-select-menu button.selected {
    color: #125944 !important;
    background: #e6f4ef !important;
    border-color: #c5e3d8 !important;
}

body:not(.dark) .composer-select-menu button > span > small {
    color: #758393 !important;
}

body:not(.dark) .composer-select-menu button.selected > span > small,
body:not(.dark) .composer-select-menu button svg {
    color: #168c6d !important;
}

/* v1.89 · 节点名称双击命中区只覆盖可见文字，不再铺满整条标题栏。 */
body.canvas-mode .node .node-header > .node-title {
    flex: 0 1 auto !important;
    width: fit-content !important;
    min-width: 0 !important;
    max-width: calc(100% - 54px) !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.canvas-mode .node .node-header > .node-title:has(.node-title-editor) {
    width: auto !important;
    max-width: calc(100% - 54px) !important;
}

body.canvas-mode .node .node-header > .node-close {
    margin-left: auto !important;
}

/* v1.91 · 素材选择器关键词搜索，与类型、范围、分类和排序组合生效。 */
.asset-picker-library-search {
    width: min(420px, 100%);
    height: 36px;
    margin: 0 0 8px;
    padding: 0 7px 0 11px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    box-sizing: border-box;
    border: 1px solid #454a52;
    border-radius: 9px;
    color: #8f99a7;
    background: #292c31;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.asset-picker-library-search[hidden] {
    display: none !important;
}

.asset-picker-library-search:focus-within {
    border-color: rgba(55, 211, 162, .75);
    box-shadow: 0 0 0 3px rgba(32, 201, 151, .1);
}

.asset-picker-library-search > svg {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
}

.asset-picker-library-search input {
    min-width: 0;
    flex: 1;
    border: 0;
    outline: 0;
    appearance: none;
    color: #edf1f6;
    background: transparent;
    font: inherit;
    font-size: 12px;
}

.asset-picker-library-search input::placeholder {
    color: #7f8996;
}

.asset-picker-library-search input::-webkit-search-cancel-button {
    display: none;
}

.asset-picker-library-search button {
    width: 25px;
    height: 25px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 6px;
    color: #8f99a7;
    background: transparent;
    cursor: pointer;
}

.asset-picker-library-search button:hover {
    color: #f2f6fa;
    background: rgba(148, 163, 184, .13);
}

.asset-picker-library-search button[hidden] {
    display: none !important;
}

.asset-picker-library-search button svg {
    width: 14px;
    height: 14px;
}

body:not(.dark) .asset-picker-library-search {
    color: #687586;
    border-color: #d2d9e1;
    background: #f8fafb;
}

body:not(.dark) .asset-picker-library-search input {
    color: #242a32;
}

body:not(.dark) .asset-picker-library-search input::placeholder {
    color: #8792a0;
}

@media (max-width: 720px) {
    .asset-picker-library-search {
        width: 100%;
    }
}
/* v1.93 · 视频提示词内联素材引用胶囊 */
body.canvas-mode .video-composer-panel .media-composer-rich-prompt {
    display: block;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    overflow-y: auto;
    cursor: text;
    caret-color: #f5f7fa;
}

body.canvas-mode .video-composer-panel .media-composer-rich-prompt[data-empty]::before {
    content: attr(data-placeholder);
    color: #6e747c;
    pointer-events: none;
}

body.canvas-mode .video-composer-panel .media-composer-rich-prompt:focus-visible {
    outline: none;
    box-shadow: none;
}

.media-prompt-reference-chip {
    display: inline-flex;
    height: 26px;
    margin: 0 3px 0 1px;
    padding: 2px 6px 2px 2px;
    align-items: center;
    gap: 5px;
    color: #f0f3f7;
    background: #303236;
    border: 1px solid #45494f;
    border-radius: 8px;
    box-sizing: border-box;
    vertical-align: middle;
    line-height: 1;
    user-select: all;
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.media-prompt-reference-chip:hover {
    background: #383b40;
    border-color: #5b626b;
    transform: translateY(-1px);
}

.media-prompt-reference-preview {
    display: inline-grid;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    place-items: center;
    overflow: hidden;
    color: #72e2c3;
    background: #17191c;
    border-radius: 6px;
}

.media-prompt-reference-preview img,
.media-prompt-reference-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-prompt-reference-preview svg {
    width: 12px;
    height: 12px;
}

.media-prompt-reference-label {
    color: inherit;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .01em;
    white-space: nowrap;
}

.media-prompt-reference-verified {
    color: #24c5ea;
}

.media-prompt-reference-chip > svg {
    width: 13px;
    height: 13px;
    flex: 0 0 13px;
    stroke-width: 2.1;
}

body:not(.dark).canvas-mode .video-composer-panel .media-composer-rich-prompt {
    color: #17202b !important;
    caret-color: #17202b;
}

body:not(.dark).canvas-mode .video-composer-panel .media-composer-rich-prompt[data-empty]::before {
    color: #8793a0;
}

body:not(.dark).canvas-mode .media-prompt-reference-chip {
    color: #26313d;
    background: #f4f7fa;
    border-color: #cbd5df;
    box-shadow: 0 1px 2px rgba(31, 41, 55, .05);
}

body:not(.dark).canvas-mode .media-prompt-reference-chip:hover {
    background: #edf4f8;
    border-color: #aebdca;
}

@media (max-width: 760px) {
    .media-prompt-reference-chip {
        height: 25px;
        padding-right: 5px;
        gap: 4px;
    }
    .media-prompt-reference-preview {
        width: 19px;
        height: 19px;
        flex-basis: 19px;
    }
    .media-prompt-reference-label {
        font-size: 12px;
    }
}
