/* 首页「爆款深度复刻」制作面板
 * 首页原生视图：点击左侧图标栏入口后在主区域就地展开，不弹浮层。
 * 左列操作区底部固定生成按钮，右列示例 + 生成结果回显。
 * 依赖 chat-home.css 中 .chr 定义的 --chr-* 变量；面板作为 .chr 的网格子节点渲染。
 */

.dcp[hidden] {
    display: none !important;
}

.dcp {
    grid-column: 2 / -1;
    grid-row: 1;
    display: flex;
    min-width: 0;
    min-height: 0;
    padding: 8px 18px 18px 6px;
    color: var(--chr-text);
    font-family: inherit;
}

/* 展开制作视图时隐藏首页主内容与对话历史，只保留左侧图标栏 */
.chr.is-dcp-view .chr-main,
.chr.is-dcp-view .chr-history,
.chr.is-dcp-view .chr-history-backdrop {
    display: none !important;
}

/* 左侧图标栏入口激活态 */
.chr-rail-btn[data-dcp-launch][aria-expanded="true"] {
    background: color-mix(in srgb, var(--chr-accent) 14%, var(--chr-panel));
    border-color: color-mix(in srgb, var(--chr-accent) 42%, transparent);
    color: var(--chr-accent);
}

.dcp-dialog {
    display: grid;
    grid-template-columns: clamp(520px, 42vw, 780px) minmax(0, 1fr);
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    border: 1px solid var(--chr-line);
    border-radius: 20px;
    background: var(--chr-panel);
    box-shadow: var(--chr-shadow-soft);
    overflow: hidden;
    animation: dcpFade .16s ease both;
}

/* 左侧操作区 */

.dcp-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    border-right: 1px solid var(--chr-line);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--chr-panel-2) 55%, transparent), transparent 220px),
        var(--chr-panel);
}

.dcp-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex: none;
    padding: 14px 16px 13px;
    border-bottom: 1px solid var(--chr-line);
}

.dcp-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.dcp-identity-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--chr-accent) 26%, transparent), color-mix(in srgb, var(--chr-accent-2) 26%, transparent));
    color: var(--chr-accent);
    border: 1px solid color-mix(in srgb, var(--chr-accent) 35%, transparent);
}

.dcp-identity-icon svg {
    width: 20px;
    height: 20px;
}

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

.dcp-identity-copy strong {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .01em;
}

.dcp-identity-copy small {
    color: var(--chr-muted);
    font-size: 11.5px;
    line-height: 1.45;
}

.dcp-top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
}

.dcp-new {
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--chr-line-strong);
    border-radius: 10px;
    background: var(--chr-panel-2);
    color: var(--chr-text);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.dcp-new:hover {
    border-color: color-mix(in srgb, var(--chr-accent) 45%, var(--chr-line-strong));
    background: color-mix(in srgb, var(--chr-accent) 10%, var(--chr-panel-2));
}

.dcp-close {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--chr-line-strong);
    border-radius: 10px;
    background: transparent;
    color: var(--chr-muted);
    cursor: pointer;
    transition: color .16s ease, border-color .16s ease;
}

.dcp-close:hover {
    color: var(--chr-text);
    border-color: color-mix(in srgb, var(--chr-accent) 45%, var(--chr-line-strong));
}

.dcp-close svg {
    width: 16px;
    height: 16px;
}

.dcp-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px 10px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--chr-line-strong) transparent;
}

.dcp-body::-webkit-scrollbar {
    width: 8px;
}

.dcp-body::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: var(--chr-line-strong);
    background-clip: padding-box;
}

.dcp-card {
    flex: none;
    padding: 11px 12px 10px;
    border: 1px solid var(--chr-line);
    border-radius: 16px;
    background: color-mix(in srgb, var(--chr-panel-2) 78%, transparent);
}

.dcp-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 9px;
}

.dcp-card-head strong {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.dcp-card-head strong em {
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--chr-accent-3) 18%, transparent);
    color: var(--chr-accent-3);
    font-size: 10px;
    font-style: normal;
    font-weight: 700;
    vertical-align: 1px;
}

.dcp-card-head small {
    min-width: 0;
    color: var(--chr-muted);
    font-size: 11px;
    line-height: 1.4;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 复刻方式 */

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

.dcp-mode {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 9px 6px 8px;
    border: 1px solid var(--chr-line);
    border-radius: 12px;
    background: var(--chr-panel);
    color: var(--chr-text);
    text-align: center;
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.dcp-mode:hover {
    border-color: var(--chr-line-strong);
    background: var(--chr-panel-2);
}

.dcp-mode.is-active {
    border-color: color-mix(in srgb, var(--chr-accent) 62%, transparent);
    background: color-mix(in srgb, var(--chr-accent) 11%, var(--chr-panel));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--chr-accent) 30%, transparent) inset;
}

.dcp-mode-icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 9px;
    background: var(--chr-panel-3);
    color: var(--chr-soft);
}

.dcp-mode.is-active .dcp-mode-icon {
    background: color-mix(in srgb, var(--chr-accent) 18%, transparent);
    color: var(--chr-accent);
}

.dcp-mode-icon svg {
    width: 16px;
    height: 16px;
}

.dcp-mode-copy {
    display: block;
    min-width: 0;
}

.dcp-mode-copy strong {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.dcp-mode-check {
    position: absolute;
    top: 6px;
    right: 6px;
    display: grid;
    place-items: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--chr-accent);
    color: #04121a;
    font-size: 10px;
    font-weight: 800;
    opacity: 0;
    transform: scale(.7);
    transition: opacity .16s ease, transform .16s ease;
}

.dcp-mode.is-active .dcp-mode-check {
    opacity: 1;
    transform: scale(1);
}

.dcp-mode-hint {
    margin: 8px 2px 0;
    color: var(--chr-soft);
    font-size: 11.5px;
    line-height: 1.5;
}

/* 参考素材槽位 */

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

/* 只有「参考声音」模式才露出参考声音槽位，其余模式按 3 列排布 */
.dcp-slots[data-voice="off"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dcp-slot[hidden] {
    display: none;
}

.dcp-slot {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 6px 7px;
    border: 1px dashed var(--chr-line-strong);
    border-radius: 12px;
    background: var(--chr-panel);
    text-align: center;
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease;
}

.dcp-slot:hover,
.dcp-slot:focus-within {
    border-color: color-mix(in srgb, var(--chr-accent) 50%, var(--chr-line-strong));
    background: var(--chr-panel-2);
}

.dcp-slot.has-file {
    border-style: solid;
    border-color: color-mix(in srgb, var(--chr-accent) 42%, transparent);
}

.dcp-slot.is-disabled {
    opacity: .5;
    cursor: not-allowed;
}

.dcp-slot-thumb {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background-color: var(--chr-panel-3);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    color: var(--chr-muted);
    overflow: hidden;
}

.dcp-slot-thumb svg {
    width: 20px;
    height: 20px;
}

.dcp-slot-thumb.has-image svg {
    display: none;
}

.dcp-slot.has-file .dcp-slot-thumb {
    color: var(--chr-accent);
}

.dcp-slot-name {
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
}

.dcp-slot-tip {
    max-width: 100%;
    color: var(--chr-muted);
    font-size: 10px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}



.dcp-slot-clear {
    position: absolute;
    top: 4px;
    right: 4px;
    display: grid;
    place-items: center;
    width: 17px;
    height: 17px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
}

.dcp-slot-clear:hover {
    background: rgba(239, 68, 68, .85);
}

.dcp-hint {
    margin: 8px 2px 0;
    color: var(--chr-muted);
    font-size: 11px;
    line-height: 1.45;
}

.dcp-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.dcp-attachments[hidden] {
    display: none;
}

/* 参考音频试听列表 */

.dcp-audio {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--chr-line);
    border-radius: 10px;
    background: var(--chr-panel);
}

.dcp-audio-player {
    flex: 0 0 auto;
    width: 210px;
    height: 32px;
}

.dcp-audio-meta {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.dcp-audio-meta strong {
    overflow: hidden;
    color: var(--chr-text);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dcp-audio-meta small {
    color: var(--chr-muted);
    font-size: 10px;
}

.dcp-audio-remove {
    flex: 0 0 auto;
    padding: 4px 9px;
    border: 1px solid var(--chr-line);
    border-radius: 8px;
    background: transparent;
    color: var(--chr-muted);
    font-size: 11px;
    cursor: pointer;
}

.dcp-audio-remove:hover {
    border-color: rgba(239, 68, 68, .6);
    color: #ef4444;
}

@media (max-width: 520px) {
    .dcp-audio {
        flex-wrap: wrap;
    }

    .dcp-audio-player {
        width: 100%;
    }
}

/* 成片声音：原片声音 / 参考声音 / 我的配音 / 静音 */

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

.dcp-sound {
    padding: 9px 4px;
    border: 1px solid var(--chr-line);
    border-radius: 12px;
    background: var(--chr-panel);
    color: var(--chr-text);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.dcp-sound:hover {
    border-color: var(--chr-line-strong);
    background: var(--chr-panel-2);
}

.dcp-sound.is-active {
    border-color: color-mix(in srgb, var(--chr-accent) 62%, transparent);
    background: color-mix(in srgb, var(--chr-accent) 11%, var(--chr-panel));
    color: var(--chr-accent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--chr-accent) 30%, transparent) inset;
}

.dcp-sound-hint {
    margin: 8px 2px 0;
    color: var(--chr-soft);
    font-size: 11.5px;
    line-height: 1.5;
}

/* 台词来源：换了商品时让用户选「原视频台词 / 按新商品重写」 */
.dcp-dialogue {
    display: grid;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--chr-line);
}

.dcp-dialogue[hidden] {
    display: none;
}

.dcp-dialogue-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.dcp-dialogue-head strong {
    color: var(--chr-text);
    font-size: 12.5px;
    font-weight: 600;
}

.dcp-dialogue-head small {
    color: var(--chr-muted);
    font-size: 11px;
}

.dcp-dialogue-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.dcp-dialogue-option {
    padding: 9px 6px;
    border: 1px solid var(--chr-line);
    border-radius: 12px;
    background: var(--chr-panel);
    color: var(--chr-text);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.dcp-dialogue-option:hover {
    border-color: var(--chr-line-strong);
    background: var(--chr-panel-2);
}

.dcp-dialogue-option.is-active {
    border-color: color-mix(in srgb, var(--chr-accent) 62%, transparent);
    background: color-mix(in srgb, var(--chr-accent) 11%, var(--chr-panel));
    color: var(--chr-accent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--chr-accent) 30%, transparent) inset;
}

/* 台词来源放在参考商品图下方，只有「参考声音」这一档能选；其它声音档置灰并说明原因 */
.dcp-dialogue-option[disabled] {
    cursor: not-allowed;
}

.dcp-dialogue.is-locked .dcp-dialogue-option {
    opacity: .52;
}

.dcp-dialogue.is-locked .dcp-dialogue-option.is-active {
    opacity: .72;
}

.dcp-dialogue-note {
    color: var(--chr-muted);
    font-size: 11px;
    line-height: 1.55;
}

.dcp-dialogue-note:empty {
    display: none;
}

.dcp-dubbing {
    display: grid;
    gap: 8px;
    margin-top: 9px;
    padding-top: 9px;
    border-top: 1px dashed var(--chr-line);
}

.dcp-dubbing[hidden] {
    display: none;
}

.dcp-dubbing-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.dcp-dubbing-tip {
    flex: 1 1 100%;
    color: var(--chr-soft);
    font-size: 11px;
    line-height: 1.5;
}

.dcp-dubbing-btn {
    padding: 6px 10px;
    border: 1px solid var(--chr-line);
    border-radius: 9px;
    background: var(--chr-panel);
    color: var(--chr-text);
    font-size: 12px;
    cursor: pointer;
}

.dcp-dubbing-btn:hover {
    border-color: var(--chr-line-strong);
    background: var(--chr-panel-2);
}

.dcp-dubbing-current {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border: 1px solid var(--chr-line);
    border-radius: 10px;
    background: var(--chr-panel-2);
}

.dcp-dubbing-current[hidden] {
    display: none;
}

/* 播放器独占一行：卡片窄时不会把名称和「移除」挤出可视区域 */
.dcp-dubbing-player {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    height: 32px;
}

.dcp-dubbing-name {
    flex: 1 1 auto;
    min-width: 0;
    max-width: calc(100% - 64px);
    color: var(--chr-soft);
    font-size: 11.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dcp-dubbing-clear {
    flex: none;
    margin-left: auto;
    padding: 4px 8px;
    border: 1px solid var(--chr-line);
    border-radius: 8px;
    background: transparent;
    color: var(--chr-soft);
    font-size: 11.5px;
    cursor: pointer;
}

.dcp-dubbing-clear:hover {
    border-color: var(--chr-line-strong);
    color: var(--chr-text);
}

/* 配音比参考视频长：行内标红提示，提交会被拦下 */
.dcp-dubbing-current.is-over {
    border-color: rgba(239, 68, 68, .55);
    background: rgba(239, 68, 68, .08);
}

.dcp-dubbing-warn {
    display: block;
    color: #f87171;
    font-size: 11.5px;
    line-height: 1.5;
}

.dcp-dubbing-warn[hidden] {
    display: none;
}

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

    .dcp-dubbing-current {
        flex-wrap: wrap;
    }

    .dcp-dubbing-player {
        width: 100%;
    }
}

/* 参考视频 */

.dcp-drop {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1.5px dashed var(--chr-line-strong);
    border-radius: 13px;
    background: var(--chr-panel);
    text-align: left;
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease;
}

.dcp-drop:hover,
.dcp-drop.is-drag {
    border-color: var(--chr-accent);
    background: color-mix(in srgb, var(--chr-accent) 8%, var(--chr-panel));
}

.dcp-drop[hidden] {
    display: none;
}

.dcp-drop-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--chr-panel-3);
    color: var(--chr-accent);
}

.dcp-drop-icon svg {
    width: 18px;
    height: 18px;
}

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

.dcp-drop-copy strong {
    font-size: 12.5px;
    font-weight: 600;
}

.dcp-drop-copy small {
    color: var(--chr-muted);
    font-size: 11px;
}

.dcp-video {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 1px solid var(--chr-line);
    border-radius: 13px;
    background: var(--chr-panel);
}

.dcp-video[hidden] {
    display: none;
}

.dcp-video video {
    flex: none;
    width: 122px;
    height: 70px;
    border-radius: 8px;
    background: #000;
    object-fit: cover;
}

.dcp-video-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.dcp-video-meta strong {
    font-size: 12px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dcp-video-meta small {
    color: var(--chr-muted);
    font-size: 11px;
}

.dcp-video-remove {
    flex: none;
    height: 28px;
    padding: 0 10px;
    border: 1px solid var(--chr-line-strong);
    border-radius: 8px;
    background: transparent;
    color: var(--chr-soft);
    font-size: 11.5px;
    cursor: pointer;
}

.dcp-video-remove:hover {
    border-color: rgba(248, 113, 113, .45);
    color: #fca5a5;
}

/* 补充说明（自适应剩余高度） */

.dcp-card-note {
    flex: 1 1 auto;
    min-height: 132px;
    display: flex;
    flex-direction: column;
}

.dcp-textarea {
    display: block;
    flex: 1 1 auto;
    width: 100%;
    min-height: 62px;
    padding: 9px 11px;
    border: 1px solid var(--chr-line);
    border-radius: 11px;
    background: var(--chr-panel);
    color: var(--chr-text);
    font-size: 12.5px;
    line-height: 1.55;
    resize: none;
    outline: none;
    transition: border-color .16s ease;
}

.dcp-textarea::placeholder {
    color: var(--chr-muted);
}

.dcp-textarea:focus {
    border-color: color-mix(in srgb, var(--chr-accent) 55%, transparent);
}

.dcp-count {
    margin-top: 4px;
    color: var(--chr-muted);
    font-size: 10.5px;
    text-align: right;
}

/* 底部操作区（固定贴底） */

.dcp-foot {
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 11px 16px 14px;
    border-top: 1px solid var(--chr-line);
    background: color-mix(in srgb, var(--chr-panel-2) 72%, transparent);
}

.dcp-fields {
    display: grid;
    /* 视频模型 / 写词模型(可选) / 清晰度 / 画面比例 / 字幕语言 / 时长：按可用宽度自动排布 */
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
    gap: 8px;
}

/* 视频模型 / 写词模型都按普通字段占一格：和清晰度、画面比例同一尺寸，
   不再单独占整行，模型名太长时下拉展开就能看到全名 */
.dcp-field-model,
.dcp-field-prompt-model {
    grid-column: auto;
}

.dcp-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.dcp-field[hidden] {
    display: none;
}

.dcp-field-label {
    color: var(--chr-muted);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .02em;
}

/* 字段下的补充提示（如清晰度对换人的影响），不撑高整行，小屏可换行 */
.dcp-field-note {
    color: var(--chr-muted);
    font-size: 10px;
    line-height: 1.35;
    opacity: .85;
}

.dcp-field select {
    width: 100%;
    height: 34px;
    min-width: 0;
    padding: 0 8px;
    border: 1px solid var(--chr-line);
    border-radius: 9px;
    background: var(--chr-panel);
    color: var(--chr-text);
    font-size: 12px;
    outline: none;
    cursor: pointer;
}

.dcp-field select:focus {
    border-color: color-mix(in srgb, var(--chr-accent) 55%, transparent);
}

.dcp-field select:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* 视频模型不再单独放大：和写词模型、清晰度这些字段保持同一尺寸，
   免得一行的下拉框高低不齐、模型名还被挤成两行 */

/* 写词模型与视频模型同排时也用普通尺寸，不做单独拔高 */
.dcp-field-prompt-model select {
    height: 34px;
    border-radius: 9px;
    font-size: 12px;
}

/* 时长跟随参考视频，只读展示，不提供下拉选择 */
.dcp-field-value {
    display: flex;
    align-items: center;
    width: 100%;
    height: 34px;
    min-width: 0;
    padding: 0 8px;
    border: 1px dashed color-mix(in srgb, var(--chr-line) 80%, transparent);
    border-radius: 9px;
    background: color-mix(in srgb, var(--chr-panel) 55%, transparent);
    color: var(--chr-text);
    font-size: 11px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default;
}

.dcp-field.is-warning .dcp-field-value {
    border-color: color-mix(in srgb, #f0b45c 48%, transparent);
    color: #f0b45c;
}

.dcp-model-note {
    margin: 0;
    color: var(--chr-muted);
    font-size: 11px;
    line-height: 1.45;
}

.dcp-model-note[hidden] {
    display: none;
}

.dcp-model-note.is-warning {
    color: #fbbf24;
}

.dcp-submit {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 44px;
    padding: 0 16px;
    border: 0;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--chr-accent), var(--chr-accent-2));
    color: #04121a;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .01em;
    cursor: pointer;
    box-shadow: 0 10px 24px color-mix(in srgb, var(--chr-accent) 22%, transparent);
    transition: filter .16s ease, opacity .16s ease;
}

.dcp-submit:hover {
    filter: brightness(1.05);
}

.dcp-submit:disabled {
    opacity: .58;
    cursor: not-allowed;
    filter: none;
}

.dcp-spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 0, 0, .25);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: dcpSpin .7s linear infinite;
}

.dcp.is-submitting .dcp-spinner {
    display: block;
}

.dcp.is-submitting .dcp-submit {
    cursor: progress;
}

.dcp-status {
    margin: 0;
    color: var(--chr-muted);
    font-size: 11.5px;
    line-height: 1.5;
    text-align: center;
}

.dcp-status[hidden] {
    display: none;
}

.dcp-status.is-error {
    color: #fca5a5;
}

.dcp-status.is-ok {
    color: #5eead4;
}

.dcp-status a {
    color: var(--chr-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* 右侧示例与结果 */

.dcp-side {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    min-height: 0;
    padding: 20px 20px 16px;
    background: var(--chr-panel);
}

/* 画布标题居中，右上角只留一个轻量入口 */
.dcp-side-head {
    position: relative;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 96px;
}

.dcp-side-titles {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 0;
    text-align: center;
}

.dcp-side-titles strong {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: .01em;
    line-height: 1.25;
}

.dcp-side-titles small {
    color: var(--chr-muted);
    font-size: 12px;
    line-height: 1.5;
}

.dcp-side-link {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 26px;
    padding: 0 10px;
    border: 1px solid var(--chr-line);
    border-radius: 999px;
    background: var(--chr-panel);
    color: var(--chr-soft);
    font-size: 11.5px;
    text-decoration: none;
    transition: border-color .16s ease, color .16s ease;
}

.dcp-side-link:hover {
    border-color: color-mix(in srgb, var(--chr-accent) 48%, var(--chr-line));
    color: var(--chr-text);
}

/* 示例画布：中间一张主图，两侧略微缩小淡出，避免三张并排占满 */
.dcp-showcase {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: clamp(200px, 30vh, 320px);
    padding: 2px 0;
}

.dcp-showcase-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    min-width: 0;
    height: 100%;
}

.dcp-showcase-item:nth-child(1),
.dcp-showcase-item:nth-child(3) {
    position: absolute;
    top: 50%;
    z-index: 1;
    width: 30%;
    max-width: 250px;
    height: 82%;
    transform: translateY(-50%);
    opacity: .55;
}

.dcp-showcase-item:nth-child(1) {
    left: 2%;
}

.dcp-showcase-item:nth-child(3) {
    right: 2%;
}

.dcp-showcase-item:nth-child(2) {
    position: relative;
    z-index: 2;
    width: min(46%, 400px);
    height: 100%;
}

.dcp-showcase-thumb {
    --dcp-tone: var(--chr-accent);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    border: 1px solid var(--chr-line);
    border-radius: 16px;
    background:
        radial-gradient(120% 90% at 20% 0%, color-mix(in srgb, var(--dcp-tone) 22%, transparent), transparent 64%),
        linear-gradient(160deg, color-mix(in srgb, var(--dcp-tone) 12%, var(--chr-panel)), var(--chr-panel-2) 78%);
    box-shadow: 0 16px 32px color-mix(in srgb, #0f172a 10%, transparent);
    overflow: hidden;
}

.dcp-showcase-thumb[data-kind="shot"] {
    --dcp-tone: var(--chr-accent-2);
}

.dcp-showcase-thumb[data-kind="element"] {
    --dcp-tone: var(--chr-accent-3);
}

.dcp-showcase-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 3px 9px;
    border: 1px solid var(--chr-line);
    border-radius: 999px;
    background: color-mix(in srgb, var(--chr-panel) 84%, transparent);
    color: var(--chr-soft);
    font-size: 10px;
    font-weight: 600;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.dcp-showcase-play {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--chr-line);
    border-radius: 50%;
    background: color-mix(in srgb, var(--chr-panel) 88%, transparent);
    color: var(--chr-text);
    box-shadow: 0 8px 18px color-mix(in srgb, #0f172a 14%, transparent);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.dcp-showcase-play svg {
    width: 16px;
    height: 16px;
    margin-left: 2px;
}

.dcp-showcase-item figcaption {
    display: none;
    color: var(--chr-muted);
    font-size: 11.5px;
    line-height: 1.5;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dcp-showcase-item:nth-child(2) figcaption {
    display: block;
}

/* 后台「展示示例」上传后的真实素材：按数量切换排布 */
.dcp-showcase-thumb img,
.dcp-showcase-thumb video {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
}

.dcp-showcase-thumb img {
    object-fit: cover;
}

/* 视频必须整帧可见：contain + 深色底，避免上下左右被裁掉 */
.dcp-showcase-thumb video {
    object-fit: contain;
    background: #0b0f14;
}

.dcp-showcase[data-count="1"] .dcp-showcase-item {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    transform: none;
    opacity: 1;
    width: min(76%, 480px);
    max-width: none;
    height: 100%;
}

.dcp-showcase[data-count="2"] {
    gap: 10px;
}

.dcp-showcase[data-count="2"] .dcp-showcase-item {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    transform: none;
    opacity: 1;
    width: min(46%, 380px);
    max-width: none;
    height: 100%;
}

/* 出片后让视频独占画布 */
.dcp-side:has(.dcp-stage[data-state="success"]) .dcp-showcase,
.dcp-side:has(.dcp-stage[data-state="success"]) .dcp-script {
    display: none;
}

/* 分镜脚本：先出脚本、用户确认后才制作视频 */
.dcp-script {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    /* 脚本 + 台词可能比可视区高：整块自己滚，别让下方的「确认脚本」按钮被挤出可视区 */
    overflow-y: auto;
    scrollbar-width: thin;
}

.dcp-script[hidden] {
    display: none;
}

.dcp-side:has(.dcp-script:not([hidden])) .dcp-showcase {
    display: none;
}

.dcp-script-head {
    flex: none;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 2px 10px;
}

.dcp-script-head strong {
    font-size: 13px;
    font-weight: 700;
}

.dcp-script-head small {
    color: var(--chr-muted);
    font-size: 11.5px;
    line-height: 1.5;
}

.dcp-script-body {
    flex: 1 1 auto;
    width: 100%;
    min-height: 180px;
    max-height: 46vh;
    padding: 12px 14px;
    border: 1px solid var(--chr-line);
    border-radius: 14px;
    background: var(--chr-panel-2);
    color: var(--chr-text);
    font-family: inherit;
    font-size: 12.5px;
    line-height: 1.85;
    resize: none;
    outline: none;
    transition: border-color .16s ease;
}

.dcp-script-body:focus {
    border-color: color-mix(in srgb, var(--chr-accent) 46%, var(--chr-line));
}

.dcp-script-actions {
    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
    /* 吸附在脚本区底部：无论脚本多长、台词框多高，「确认脚本，开始制作视频」都看得见 */
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding: 8px 0 2px;
    background: linear-gradient(to top, var(--chr-panel) 72%, transparent);
}

.dcp-script-regen {
    flex: none;
    height: 36px;
    padding: 0 15px;
    border: 1px solid var(--chr-line);
    border-radius: 999px;
    background: var(--chr-panel);
    color: var(--chr-soft);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .16s ease, color .16s ease;
}

.dcp-script-regen:hover {
    border-color: color-mix(in srgb, var(--chr-accent) 44%, var(--chr-line));
    color: var(--chr-text);
}

.dcp-script-confirm {
    flex: 1 1 auto;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--chr-accent), var(--chr-accent-2));
    color: #04121a;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: filter .16s ease, opacity .16s ease;
}

.dcp-script-confirm:hover {
    filter: brightness(1.06);
}

.dcp.is-scripting .dcp-script-regen,
.dcp.is-scripting .dcp-script-confirm,
.dcp.is-submitting .dcp-script-regen,
.dcp.is-submitting .dcp-script-confirm {
    opacity: .55;
    pointer-events: none;
}

/* 生成结果舞台 */

.dcp-stage {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 9px;
    min-height: 0;
    margin-top: auto;
    padding: 12px 14px 13px;
    border: 1px solid var(--chr-line);
    border-radius: 16px;
    background: var(--chr-panel-2);
    color: var(--chr-text, #0d1526);
}

.dcp-stage-head {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.dcp-stage-head strong {
    font-size: 13px;
    font-weight: 700;
}

.dcp-stage-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 21px;
    padding: 0 9px;
    border-radius: 999px;
    background: var(--chr-panel-3);
    color: var(--chr-muted);
    font-size: 10.5px;
    font-weight: 600;
}

.dcp-stage[data-state="pending"] .dcp-stage-badge,
.dcp-stage[data-state="scripting"] .dcp-stage-badge {
    background: color-mix(in srgb, var(--chr-accent) 16%, transparent);
    color: var(--chr-accent);
}

.dcp-stage[data-state="script"] .dcp-stage-badge {
    background: color-mix(in srgb, var(--chr-accent-2) 18%, transparent);
    color: var(--chr-accent-2);
}

.dcp-stage[data-state="success"] .dcp-stage-badge {
    background: color-mix(in srgb, #10b981 18%, transparent);
    color: #34d399;
}

.dcp-stage[data-state="failed"] .dcp-stage-badge {
    background: color-mix(in srgb, #ef4444 16%, transparent);
    color: #f87171;
}

.dcp-stage-frame {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background:
        radial-gradient(120% 100% at 50% 0%, color-mix(in srgb, var(--chr-panel-3) 60%, transparent), transparent 70%),
        color-mix(in srgb, var(--chr-panel-3) 45%, transparent);
    overflow: hidden;
}

/* 待生成 / 生成中 / 失败：一个作品只占一个小方图，不预留整列大画布 */
.dcp-stage:not([data-state="success"]) {
    flex: 0 0 auto;
}

.dcp-stage:not([data-state="success"]) .dcp-stage-frame {
    flex: 0 0 auto;
    place-items: start;
    background: none;
    border-radius: 0;
    overflow: visible;
}

.dcp-stage-idle {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    align-items: center;
    column-gap: 10px;
    row-gap: 2px;
    min-width: 0;
}

.dcp-stage-idle[hidden] {
    display: none;
}

.dcp-stage-idle-icon {
    position: relative;
    grid-row: 1 / span 2;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: var(--chr-panel-2);
    border: 1px solid var(--chr-line);
    color: var(--chr-accent);
}

.dcp-stage-idle-icon svg {
    width: 22px;
    height: 22px;
}

.dcp-stage-idle strong {
    font-size: 12.5px;
    font-weight: 700;
}

.dcp-stage-idle small {
    color: var(--chr-muted);
    font-size: 11px;
    line-height: 1.5;
}

/* 写脚本中：预览区放大，让用户一眼看出模型正在干活 */
.dcp-stage[data-state="scripting"] .dcp-stage-idle {
    grid-template-columns: 76px minmax(0, 1fr);
    row-gap: 6px;
    padding: 18px 16px;
}

.dcp-stage[data-state="scripting"] .dcp-stage-idle-icon {
    width: 76px;
    height: 76px;
    border-radius: 18px;
    border-color: color-mix(in srgb, var(--chr-accent) 55%, transparent);
    background: color-mix(in srgb, var(--chr-accent) 12%, var(--chr-panel-2));
}

.dcp-stage[data-state="scripting"] .dcp-stage-idle-icon svg {
    display: none;
}

.dcp-stage[data-state="scripting"] .dcp-stage-idle-icon::after {
    content: '';
    position: absolute;
    inset: 18px;
    border-radius: 50%;
    border: 3px solid color-mix(in srgb, var(--chr-accent) 22%, transparent);
    border-top-color: var(--chr-accent);
    animation: dcpSpin .8s linear infinite;
}

.dcp-stage[data-state="scripting"] .dcp-stage-idle strong {
    font-size: 16px;
    letter-spacing: .2px;
}

.dcp-stage[data-state="scripting"] .dcp-stage-idle small {
    font-size: 12.5px;
    line-height: 1.7;
}

/* 脚本已写好：脚本框放大，方便直接看和改 */
.dcp.is-script-ready .dcp-script-body {
    min-height: 280px;
    font-size: 13.5px;
    line-height: 1.75;
}

/* 生成中：小方图内转圈即可 */
.dcp-stage[data-state="pending"] .dcp-stage-idle-icon svg {
    display: none;
}

.dcp-stage[data-state="pending"] .dcp-stage-idle-icon::after {
    content: '';
    position: absolute;
    inset: 14px;
    border-radius: 50%;
    border: 2px solid color-mix(in srgb, var(--chr-accent) 26%, transparent);
    border-top-color: var(--chr-accent);
    animation: dcpSpin .8s linear infinite;
}

.dcp-stage[data-state="failed"] .dcp-stage-idle-icon {
    border-color: color-mix(in srgb, #ef4444 40%, transparent);
    color: #f87171;
}

.dcp-stage-video {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 12px;
    background: #000;
    object-fit: contain;
}

.dcp-stage-video[hidden] {
    display: none;
}

.dcp-stage-foot {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.dcp-stage-note {
    margin: 0;
    min-width: 0;
    color: var(--chr-muted);
    font-size: 11px;
    line-height: 1.45;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dcp-stage-note.is-error {
    color: #f87171;
    white-space: normal;
}

.dcp-stage-note.is-ok {
    color: #5eead4;
}

.dcp-stage-link {
    flex: none;
    color: var(--chr-accent);
    font-size: 11.5px;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.dcp-stage-link[hidden] {
    display: none;
}

/* 滚动锁定 */

body.dcp-open {
    overflow: hidden;
}

/* 亮色模式微调 */

/* 亮色模式：主按钮改为黑底白字，不用彩色底；
   文字颜色同时写到按钮和内部文本节点，并覆盖 -webkit-text-fill-color，避免被其它规则改写。 */
html.jn-light-mode .dcp-submit,
html[data-theme="light"] .dcp-submit,
body.jn-light-mode .dcp-submit,
body[data-theme="light"] .dcp-submit {
    background: #111827 !important;
    border: 1px solid #111827 !important;
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    opacity: 1 !important;
    box-shadow: 0 4px 14px rgba(17, 24, 39, .18) !important;
}

html.jn-light-mode .dcp-submit [data-dcp-submit-label],
html[data-theme="light"] .dcp-submit [data-dcp-submit-label],
body.jn-light-mode .dcp-submit [data-dcp-submit-label],
body[data-theme="light"] .dcp-submit [data-dcp-submit-label] {
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    opacity: 1 !important;
}

/* 禁用态：灰底灰字，依然不要透明压暗 */
html.jn-light-mode .dcp-submit:disabled,
html[data-theme="light"] .dcp-submit:disabled,
body.jn-light-mode .dcp-submit:disabled,
body[data-theme="light"] .dcp-submit:disabled {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #64748b !important;
    -webkit-text-fill-color: #64748b !important;
    opacity: 1 !important;
    box-shadow: none !important;
    cursor: not-allowed;
}

html.jn-light-mode .dcp-submit:disabled [data-dcp-submit-label],
html[data-theme="light"] .dcp-submit:disabled [data-dcp-submit-label],
body.jn-light-mode .dcp-submit:disabled [data-dcp-submit-label],
body[data-theme="light"] .dcp-submit:disabled [data-dcp-submit-label] {
    color: #64748b !important;
    -webkit-text-fill-color: #64748b !important;
}

/* 「确认脚本，开始制作视频」亮色下同样黑底白字，保持一致的可读性 */
html.jn-light-mode .dcp-script-confirm,
html[data-theme="light"] .dcp-script-confirm,
body.jn-light-mode .dcp-script-confirm,
body[data-theme="light"] .dcp-script-confirm {
    background: #111827 !important;
    border: 1px solid #111827 !important;
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    opacity: 1 !important;
    box-shadow: 0 4px 14px rgba(17, 24, 39, .18) !important;
}

/* 黑底上的加载圈改为白色描边 */
html.jn-light-mode .dcp-spinner,
html[data-theme="light"] .dcp-spinner,
body.jn-light-mode .dcp-spinner,
body[data-theme="light"] .dcp-spinner {
    border-color: rgba(255, 255, 255, .35);
    border-top-color: #fff;
}

html.jn-light-mode .dcp-status.is-error,
html[data-theme="light"] .dcp-status.is-error,
body.jn-light-mode .dcp-status.is-error,
body[data-theme="light"] .dcp-status.is-error {
    color: #b91c1c;
}

html.jn-light-mode .dcp-status.is-ok,
html[data-theme="light"] .dcp-status.is-ok,
body.jn-light-mode .dcp-status.is-ok,
body[data-theme="light"] .dcp-status.is-ok {
    color: #0f766e;
}

html.jn-light-mode .dcp-model-note.is-warning,
html[data-theme="light"] .dcp-model-note.is-warning,
body.jn-light-mode .dcp-model-note.is-warning,
body[data-theme="light"] .dcp-model-note.is-warning {
    color: #b45309;
}

html.jn-light-mode .dcp-stage-note.is-error,
html[data-theme="light"] .dcp-stage-note.is-error,
body.jn-light-mode .dcp-stage-note.is-error,
body[data-theme="light"] .dcp-stage-note.is-error {
    color: #b91c1c;
}

html.jn-light-mode .dcp-stage-badge,
html[data-theme="light"] .dcp-stage-badge,
body.jn-light-mode .dcp-stage-badge,
body[data-theme="light"] .dcp-stage-badge {
    color: #475569;
}

html.jn-light-mode .dcp-stage[data-state="success"] .dcp-stage-badge,
html[data-theme="light"] .dcp-stage[data-state="success"] .dcp-stage-badge,
body.jn-light-mode .dcp-stage[data-state="success"] .dcp-stage-badge,
body[data-theme="light"] .dcp-stage[data-state="success"] .dcp-stage-badge {
    color: #0f766e;
}

/* 响应式 */

@media (max-width: 1180px) {
    .dcp {
        padding: 8px 14px 14px 4px;
    }

    .dcp-dialog {
        grid-template-columns: clamp(400px, 42vw, 560px) minmax(0, 1fr);
    }

    .dcp-side {
        padding: 18px 18px 16px;
    }

    .dcp-side-head {
        padding: 0 84px;
    }

    .dcp-showcase {
        min-height: clamp(150px, 24vh, 220px);
    }

    .dcp-showcase-item:nth-child(2) {
        width: min(52%, 340px);
    }
}

@media (max-width: 980px) {
    .dcp {
        padding: 0;
    }

    .dcp-dialog {
        grid-template-columns: minmax(0, 1fr);
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .dcp-main {
        border-right: 0;
    }

    .dcp-side {
        display: none;
    }

    /* 窄屏仍然要能看到并确认脚本，否则流程会卡在“未确认” */
    .dcp-side:has(.dcp-script:not([hidden])) {
        display: flex;
        border-top: 1px solid var(--chr-line);
        padding: 16px;
    }

    .dcp-script-body {
        flex: none;
        height: 240px;
        min-height: 160px;
        max-height: none;
    }
}

@media (max-width: 760px) {
    .dcp {
        grid-column: 1;
        grid-row: 1;
    }
}

@media (max-width: 640px) {
    .dcp-top {
        padding: 12px 13px 11px;
    }

    .dcp-identity-copy small {
        display: none;
    }

    .dcp-body {
        padding: 10px 13px 8px;
        gap: 9px;
    }

    .dcp-card {
        padding: 10px 11px 9px;
        border-radius: 14px;
    }

    .dcp-card-head small {
        display: none;
    }

    .dcp-mode-copy strong {
        font-size: 11.5px;
    }

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

    /* 手机屏同样两列：声音槽位收起时不留空位 */
    .dcp-slots[data-voice="off"] {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dcp-foot {
        padding: 10px 13px 13px;
    }

    /* 小屏统一两列 */
    .dcp-fields {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .dcp-field:first-child {
        grid-column: 1 / -1;
    }

    .dcp-video {
        flex-wrap: wrap;
    }

    .dcp-video video {
        width: 100%;
        height: 148px;
    }
}

@keyframes dcpFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes dcpSpin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .dcp-dialog,
    .dcp-spinner,
    .dcp-stage[data-state="pending"] .dcp-stage-idle-icon::after {
        animation: none;
    }
}

.dcp-card-head .dcp-asset-count{margin-left:auto;font-size:12px;color:#8b95a5;font-variant-numeric:tabular-nums;}
.dcp-estimate{font-size:12px;color:#8b95a5;margin-right:10px;white-space:nowrap;}

.dcp-card-head .dcp-asset-pick{margin-left:auto;flex:none;border:1px solid #dbe4f0;background:#f7faff;color:#2f6bff;border-radius:8px;padding:4px 10px;font-size:12px;cursor:pointer;white-space:nowrap;}

.dcp-side-block{margin-top:14px;border:1px solid #e6ebf1;border-radius:12px;background:#fff;padding:10px 12px;}
body.dark .dcp-side-block{background:#17181c;border-color:#2a2c32;}
.dcp-side-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;}
.dcp-side-head strong{font-size:13px;color:#445;}
body.dark .dcp-side-head strong{color:#d7dae2;}
/* 用双类名提高优先级，避免被 .chr button{color:inherit} 覆盖成浅色文字压在浅色底上 */
.dcp-side-head .dcp-side-refresh{border:1px solid var(--chr-line-strong,#e3e9f2);background:var(--chr-panel-3,#f7faff);color:var(--chr-soft,#2f6bff);border-radius:8px;padding:2px 10px;font-size:12px;line-height:1.6;cursor:pointer;transition:border-color .16s ease,background .16s ease,color .16s ease;}
.dcp-side-head .dcp-side-refresh:hover{background:var(--chr-panel-2,#eef2f7);border-color:color-mix(in srgb,var(--chr-accent,#2f6bff) 55%,var(--chr-line-strong,#e3e9f2));color:var(--chr-accent,#2f6bff);}
.dcp-side-head .dcp-side-refresh:focus-visible{outline:2px solid var(--chr-accent,#2f6bff);outline-offset:2px;}
/* 「最近制作」这一行的草稿标签与两个按钮靠右成组，标题保持在原位 */
.dcp-side-block .dcp-side-head{justify-content:flex-start;gap:8px;}
.dcp-side-nav{display:inline-flex;align-items:center;gap:5px;margin-left:auto;}
.dcp-side-page{width:20px;height:20px;padding:0;border:1px solid var(--chr-line,#e3e9f2);border-radius:6px;background:transparent;color:var(--chr-text,#1f2430);font-size:13px;line-height:1;cursor:pointer;}
.dcp-side-page:disabled{opacity:.35;cursor:default;}
.dcp-side-page-num{min-width:30px;color:var(--chr-muted,#8b95a5);font-size:11px;font-style:normal;text-align:center;}
.dcp-side-block .dcp-draft-label{margin-left:auto;color:var(--chr-muted,#8b95a5);font-size:11.5px;white-space:nowrap;}
.dcp-recent-list{display:flex;flex-direction:column;gap:6px;max-height:220px;overflow:auto;}
.dcp-recent-empty{margin:0;font-size:12px;color:#8b95a5;}
.dcp-recent-item{display:flex;align-items:center;gap:8px;width:100%;text-align:left;border:1px solid #eef2f7;background:#fff;border-radius:8px;padding:6px;cursor:pointer;color:#1f2430;}
body.dark .dcp-recent-item{background:#1b1d22;border-color:#2a2c32;color:#d7dae2;}
.dcp-recent-thumb{width:54px;height:34px;border-radius:6px;background:#eef3f9 center/cover no-repeat;flex:none;}
.dcp-recent-meta{display:flex;flex-direction:column;min-width:0;}
.dcp-recent-meta strong{font-size:12px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.dcp-recent-meta small{font-size:11px;color:#8b95a5;}
.dcp-showcase-list{display:flex;gap:8px;overflow:auto;}
.dcp-showcase-item{border:1px solid #eef2f7;background:#fff;border-radius:8px;padding:0;overflow:hidden;cursor:pointer;flex:none;width:96px;height:56px;}
.dcp-showcase-item video,.dcp-showcase-item img{width:100%;height:100%;object-fit:cover;display:block;}

/* ===== 生成结果小方图 + 放大预览（仅「爆款深度复刻」面板） ===== */
/* 有成片时占满画布，小卡从左上排列；单行拉满高度，分析结果才有空间把提示词放大 */
.dcp-stage[data-state="success"] .dcp-stage-frame {
    grid-template-rows: minmax(0, 1fr);
    place-items: stretch;
    align-content: start;
    padding: 2px;
    background: none;
    border-radius: 0;
    overflow-y: auto;
}

.dcp-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    align-content: start;
    gap: 10px;
    width: 100%;
}

.dcp-result-grid[hidden] {
    display: none;
}

.dcp-result-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    margin: 0;
}

.dcp-result-media {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 0;
    border: 1px solid var(--chr-line);
    border-radius: 12px;
    overflow: hidden;
    background: var(--chr-panel-3);
    cursor: pointer;
}

.dcp-result-media img,
.dcp-result-media video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dcp-result-play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(180deg, rgba(3, 7, 18, 0) 42%, rgba(3, 7, 18, .55));
}

.dcp-result-play svg {
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 1px 6px rgba(0, 0, 0, .45));
}

.dcp-result-card figcaption {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-width: 0;
    font-size: 11px;
    color: var(--chr-muted);
}

.dcp-result-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dcp-result-download {
    flex: none;
    color: var(--chr-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* 最近制作：横向排列的方形小图，不再竖向堆叠 */
.dcp-side-block {
    border-color: var(--chr-line);
    background: var(--chr-panel-2);
}

.dcp-side-head strong {
    color: var(--chr-text);
}

.dcp-recent-list {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 8px;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    scroll-snap-type: x proximity;
}

.dcp-recent-item {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
    width: 112px;
    padding: 6px;
    border: 1px solid var(--chr-line);
    border-radius: 10px;
    background: var(--chr-panel-3);
    color: var(--chr-text);
    cursor: pointer;
    scroll-snap-align: start;
}

.dcp-recent-thumb {
    position: relative;
    flex: none;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    background: var(--chr-panel) center / cover no-repeat;
}

.dcp-recent-thumb video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dcp-recent-play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(180deg, rgba(3, 7, 18, 0) 45%, rgba(3, 7, 18, .5));
}

.dcp-recent-play svg {
    width: 22px;
    height: 22px;
}

.dcp-recent-meta {
    display: block;
    min-width: 0;
    text-align: center;
}

.dcp-recent-meta small {
    display: block;
    overflow: hidden;
    color: var(--chr-muted);
    font-size: 10.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 放大预览弹层 */
.dcp-viewer {
    position: fixed;
    inset: 0;
    z-index: 100060;
    display: grid;
    place-items: center;
    padding: 24px;
}

.dcp-viewer[hidden] {
    display: none;
}

.dcp-viewer-mask {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, .78);
    backdrop-filter: blur(6px);
}

.dcp-viewer-dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(960px, 94vw);
    max-height: 92vh;
    padding: 12px 14px 16px;
    border: 1px solid var(--chr-line);
    border-radius: 16px;
    background: var(--chr-panel);
    box-shadow: var(--chr-shadow-soft);
}

.dcp-viewer-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dcp-viewer-head strong {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dcp-viewer-download {
    flex: none;
    color: var(--chr-accent);
    font-size: 12px;
}

.dcp-viewer-close {
    flex: none;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--chr-line);
    border-radius: 50%;
    background: var(--chr-panel-2);
    color: var(--chr-text);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.dcp-viewer-frame {
    display: grid;
    place-items: center;
    min-height: 0;
    border-radius: 12px;
    background: #000;
    overflow: hidden;
}

.dcp-viewer-video {
    display: block;
    width: 100%;
    max-height: 76vh;
    background: #000;
    object-fit: contain;
}

@media (max-width: 640px) {
    .dcp-result-grid {
        grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
        gap: 8px;
    }

    .dcp-recent-item {
        width: 96px;
    }

    .dcp-viewer {
        padding: 10px;
    }

    .dcp-viewer-dialog {
        width: 100%;
        max-height: 94vh;
    }
}

/* ===== 生成结果双页签：预览 / 分析结果 ===== */
.dcp-stage-tabs {
    display: flex;
    flex: none;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    padding: 2px;
    border-radius: 9px;
    background: var(--chr-panel-3);
}

.dcp-stage-tab {
    flex: none;
    height: 22px;
    padding: 0 12px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--chr-muted);
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
}

.dcp-stage-tab:hover {
    color: var(--chr-text);
}

.dcp-stage-tab.is-active {
    background: var(--chr-panel);
    color: var(--chr-text);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .18);
}

.dcp-analysis {
    display: flex;
    flex-direction: column;
    align-content: start;
    gap: 10px;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
}

.dcp-analysis[hidden] {
    display: none;
}

.dcp-analysis-empty {
    margin: 0;
    color: var(--chr-muted);
    font-size: 12.5px;
}

.dcp-analysis-item {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    padding: 12px 14px;
    border: 1px solid var(--chr-line);
    border-radius: 12px;
    background: var(--chr-panel-3);
}

.dcp-analysis-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.dcp-analysis-head strong {
    font-size: 14px;
    font-weight: 700;
}

.dcp-analysis-head small {
    color: var(--chr-muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.dcp-analysis-label {
    color: var(--chr-text);
    font-size: 12px;
    font-weight: 600;
    opacity: .72;
}

/* 提示词占满卡片剩余高度：有多大空间就显示多大，不再挤成几行小字 */
.dcp-analysis-text {
    flex: 1 1 auto;
    min-height: 2.6em;
    max-height: none;
    margin: 0;
    overflow: auto;
    color: var(--chr-text);
    font-size: 15px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
}

.dcp-analysis-actions {
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

.dcp-analysis-action {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    border: 1px solid var(--chr-line-strong);
    border-radius: 8px;
    background: transparent;
    color: var(--chr-text);
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.dcp-analysis-action:hover {
    border-color: var(--chr-accent);
    color: var(--chr-accent);
}

/* 复制提示词：把这次的制作概要带走，突出成主动作 */
.dcp-analysis-copy {
    border-color: var(--chr-accent);
    color: var(--chr-accent);
}

.dcp-analysis-copy.is-copied {
    opacity: 0.72;
}

/* 生成中：AI 推理进度条 */
.dcp-progress { margin-top: 10px; width: 100%; max-width: 420px; }
.dcp-progress[hidden] { display: none; }
.dcp-progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.dcp-progress-head strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.dcp-progress-head span { color: var(--chr-muted); font-size: 11.5px; }
.dcp-progress-track { height: 6px; border-radius: 999px; background: var(--chr-panel-3); overflow: hidden; }
.dcp-progress-track i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--chr-accent), var(--chr-accent-2)); transition: width .4s ease; }

/* 最近制作：制作中/失败状态 */
.dcp-recent-item.is-pending { border-color: color-mix(in srgb, var(--chr-accent) 45%, var(--chr-line)); }
.dcp-recent-item.is-failed { border-color: color-mix(in srgb, #ef4444 45%, var(--chr-line)); }
.dcp-recent-thumb { position: relative; }
.dcp-recent-progress { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 4px; border-radius: 999px; background: rgba(15, 23, 42, .45); overflow: hidden; }
.dcp-recent-progress i { display: block; height: 100%; width: 42%; border-radius: inherit; background: linear-gradient(90deg, var(--chr-accent), var(--chr-accent-2)); animation: dcpRecentProgress 1.2s ease-in-out infinite alternate; }
.dcp-recent-status { display: block; margin-top: 2px; color: var(--chr-muted); font-size: 10px; }
.dcp-recent-item.is-pending .dcp-recent-status { color: var(--chr-accent); }
.dcp-recent-item.is-failed .dcp-recent-status { color: #f87171; }
@keyframes dcpRecentProgress { from { transform: translateX(-35%); } to { transform: translateX(180%); } }

/* 最近制作：删除按钮 */
.dcp-recent-delete { position: absolute; top: 3px; right: 3px; z-index: 2; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: rgba(15, 23, 42, .7); color: #fff; font-size: 13px; line-height: 1; cursor: pointer; }
.dcp-recent-delete:hover { background: rgba(239, 68, 68, .92); }

/* 最近制作：失败记录手动重提 */
.dcp-recent-retry { display: inline-flex; margin-top: 3px; padding: 1px 7px; border: 1px solid color-mix(in srgb, var(--chr-accent) 55%, var(--chr-line)); border-radius: 999px; color: var(--chr-accent); font-size: 10px; cursor: pointer; }
.dcp-recent-retry:hover { background: color-mix(in srgb, var(--chr-accent) 16%, transparent); }

/* ===== 长视频分段：部分成功提示、失败分段手动补做 ===== */
/* 跟随站点主题变量：深色为默认，浅色由 html[data-theme="light"] 覆盖，避免白底浅字看不清。 */
.dcp-lv { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--chr-line, #e6ebf3); border-radius: 10px; background: var(--chr-panel-3, #f7f9fc); color: var(--chr-text, #0d1526); }
.dcp-lv-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--chr-muted, #64748b); }
.dcp-lv-head strong { font-size: 12px; font-weight: 600; color: var(--chr-text, #0d1526); }
.dcp-lv-head small { font-size: 11px; color: var(--chr-muted, #64748b); }
.dcp-lv-note { margin: 6px 0 0; font-size: 12px; line-height: 1.6; color: var(--chr-soft, #334155); }
.dcp-lv-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.dcp-lv-seg { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--chr-line, #e6ebf3); background: var(--chr-panel-2, #f7f9fc); font-size: 11px; color: var(--chr-soft, #334155); }
.dcp-lv-seg.is-succeeded { border-color: color-mix(in srgb, #22c55e 45%, var(--chr-line, #e6ebf3)); color: #86efac; }
.dcp-lv-seg.is-failed { border-color: color-mix(in srgb, #ef4444 48%, var(--chr-line, #e6ebf3)); color: #fca5a5; }
.dcp-lv-seg.is-pending { border-color: color-mix(in srgb, var(--chr-accent, #2f6bff) 45%, var(--chr-line, #e6ebf3)); color: var(--chr-accent, #2f6bff); }
.dcp-lv-reason { margin: 8px 0 0; font-size: 12px; line-height: 1.55; color: #fca5a5; }
.dcp-lv-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dcp-lv-btn { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--chr-accent, #2f6bff) 55%, var(--chr-line, #e6ebf3)); background: transparent; color: var(--chr-accent, #2f6bff); font-size: 11px; font-weight: 600; cursor: pointer; text-decoration: none; }
.dcp-lv-btn:hover { background: color-mix(in srgb, var(--chr-accent, #2f6bff) 14%, transparent); }
.dcp-lv-btn[disabled] { opacity: .5; cursor: not-allowed; }
.dcp-lv-btn.is-ghost { border-color: var(--chr-line, #e6ebf3); color: var(--chr-soft, #334155); font-weight: 500; }
.dcp-lv-btn.is-ghost:hover { color: var(--chr-accent, #2f6bff); }

/* 浅色模式：浅底深字，状态色加深一档 */
html.jn-light-mode .dcp-lv,
html[data-theme="light"] .dcp-lv,
body.jn-light-mode .dcp-lv,
body[data-theme="light"] .dcp-lv { background: #f8fafc; border-color: #e6ebf3; color: #0d1526; }
html.jn-light-mode .dcp-lv-head,
html[data-theme="light"] .dcp-lv-head,
body.jn-light-mode .dcp-lv-head,
body[data-theme="light"] .dcp-lv-head { color: #64748b; }
html.jn-light-mode .dcp-lv-head strong,
html[data-theme="light"] .dcp-lv-head strong,
body.jn-light-mode .dcp-lv-head strong,
body[data-theme="light"] .dcp-lv-head strong { color: #0d1526; }
html.jn-light-mode .dcp-lv-note,
html[data-theme="light"] .dcp-lv-note,
body.jn-light-mode .dcp-lv-note,
body[data-theme="light"] .dcp-lv-note { color: #334155; }
html.jn-light-mode .dcp-lv-seg,
html[data-theme="light"] .dcp-lv-seg,
body.jn-light-mode .dcp-lv-seg,
body[data-theme="light"] .dcp-lv-seg { background: #fff; border-color: #e6ebf3; color: #475569; }
html.jn-light-mode .dcp-lv-seg.is-succeeded,
html[data-theme="light"] .dcp-lv-seg.is-succeeded,
body.jn-light-mode .dcp-lv-seg.is-succeeded,
body[data-theme="light"] .dcp-lv-seg.is-succeeded { color: #15803d; }
html.jn-light-mode .dcp-lv-seg.is-failed,
html[data-theme="light"] .dcp-lv-seg.is-failed,
body.jn-light-mode .dcp-lv-seg.is-failed,
body[data-theme="light"] .dcp-lv-seg.is-failed { color: #b91c1c; }
html.jn-light-mode .dcp-lv-reason,
html[data-theme="light"] .dcp-lv-reason,
body.jn-light-mode .dcp-lv-reason,
body[data-theme="light"] .dcp-lv-reason { color: #b91c1c; }
html.jn-light-mode .dcp-lv-btn.is-ghost,
html[data-theme="light"] .dcp-lv-btn.is-ghost,
body.jn-light-mode .dcp-lv-btn.is-ghost,
body[data-theme="light"] .dcp-lv-btn.is-ghost { color: #64748b; }

/* 背景锚点开关（默认关闭） */
.dcp-anchor { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.dcp-anchor input { margin-top: 3px; }
.dcp-anchor span { display: flex; flex-direction: column; gap: 4px; }
.dcp-anchor strong { font-size: 13px; color: #e5e7eb; }
.dcp-anchor small { color: #94a3b8; font-size: 12px; line-height: 1.6; }

/* 宽屏左栏两列排布：整屏可见全部设置，不再需要上下滚动 */
@media (min-width: 1100px) and (min-height: 640px) {
    .dcp-side {
        overflow: hidden;
    }

    .dcp-body {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        align-content: start;
        gap: 8px 10px;
        padding: 10px 14px 8px;
        overflow-y: auto;
        scrollbar-gutter: stable;
    }

    .dcp-body > .dcp-card {
        padding: 9px 12px;
    }

    /* 按卡片类名定位（不再依赖 nth-child：隐藏卡片不会留下空洞）：
       复刻方式、参考视频、选择角色、参考素材、首帧锁定各占整行，成片声音与补充说明并排 */
    .dcp-body > .dcp-card-modes,
    .dcp-body > .dcp-card-video,
    .dcp-body > .dcp-card-roles,
    .dcp-body > .dcp-card-assets,
    .dcp-body > .dcp-card-anchor {
        grid-column: 1 / -1;
    }

    .dcp-body > .dcp-card-sound {
        grid-column: 1 / 2;
        align-self: start;
    }

    .dcp-body > .dcp-card-note {
        grid-column: 2 / 3;
        align-self: stretch;
        min-height: 0;
    }

    /* 卡片内部收紧，保证一屏放下 */
    .dcp-body .dcp-card-head {
        margin-bottom: 6px;
    }

    .dcp-body .dcp-slots {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
    }

    /* 声音模式不是「参考声音」时参考声音槽位收起，按 3 列铺满 */
    .dcp-body .dcp-slots[data-voice="off"] {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .dcp-body .dcp-slot {
        min-height: 0;
    }

    .dcp-body .dcp-hint {
        margin: 6px 0 0;
        font-size: 10.5px;
        line-height: 1.45;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .dcp-body .dcp-sounds {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
    }

    .dcp-body .dcp-sound-hint {
        margin: 6px 0 0;
        font-size: 10.5px;
        line-height: 1.45;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .dcp-body .dcp-note-area,
    .dcp-body textarea {
        min-height: 56px;
    }
}

/* 参考声音：脚本没有台词时，是否强制去掉原片人声（换音色优先） */
.dcp-body .dcp-force-voice {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 8px 0 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--dcp-text-weak, #9aa4b2);
    cursor: pointer;
}

.dcp-body .dcp-force-voice[hidden] {
    display: none;
}

.dcp-body .dcp-force-voice input {
    margin: 2px 0 0;
    flex: 0 0 auto;
}

/* ===== 选择角色：在参考视频画面上框选要替换的角色 ===== */
.dcp-body .dcp-video {
    position: relative;
}

.dcp-body .dcp-video.is-picking {
    flex-wrap: wrap;
}

.dcp-body .dcp-video.is-picking video {
    flex: 1 1 100%;
    width: 100%;
    height: auto;
    max-height: 380px;
    object-fit: contain;
    cursor: crosshair;
}

.dcp-body .dcp-video.is-framing {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

/* 框选时把画面放大：原来的 122×70 缩略图太小，拖框很难对准 */
.dcp-body .dcp-video.is-framing video {
    width: 100%;
    height: auto;
    /* 上限同时受可视高度约束：面板底部是固定按钮栏，太高会把画面顶出可视区 */
    max-height: min(360px, 46vh);
    object-fit: contain;
}

.dcp-body .dcp-video.is-framing .dcp-video-remove {
    align-self: flex-end;
}

/* 上方「已确认画面」：一眼看到确认到的是哪一帧，下方放大的画面用于框选 */
.dcp-body .dcp-role-frozen {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 1px solid var(--chr-line);
    border-radius: 10px;
    background: rgba(255, 122, 61, .06);
}

.dcp-body .dcp-role-frozen[hidden] {
    display: none;
}

.dcp-body .dcp-role-frozen video {
    flex: none;
    width: 96px;
    height: 54px;
    object-fit: cover;
    border-radius: 6px;
    background: #000;
}

.dcp-body .dcp-role-frozen-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.dcp-body .dcp-role-frozen-meta strong {
    font-size: 13px;
}

.dcp-body .dcp-role-frozen-meta small {
    font-size: 12px;
    opacity: .7;
    line-height: 1.35;
}

.dcp-body .dcp-role-layer {
    position: absolute;
    z-index: 6;
    border: 1px dashed rgba(255, 122, 61, .85);
    border-radius: 8px;
    background: rgba(0, 0, 0, .18);
    cursor: crosshair;
    touch-action: none;
}

.dcp-body .dcp-role-layer[hidden] {
    display: none;
}

.dcp-body .dcp-role-box {
    position: absolute;
    border: 2px solid #ff7a3d;
    border-radius: 6px;
    background: rgba(255, 122, 61, .2);
    pointer-events: none;
}

.dcp-body .dcp-card-roles[hidden] {
    display: none;
}

.dcp-body .dcp-role-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 0 6px;
}

.dcp-body .dcp-role-add,
.dcp-body .dcp-role-cancel {
    border-radius: 10px;
    padding: 7px 14px;
    font-size: 13px;
    cursor: pointer;
}

.dcp-body .dcp-role-add {
    border: 1px solid rgba(255, 122, 61, .55);
    background: rgba(255, 122, 61, .12);
    color: #ff9d6b;
}

.dcp-body .dcp-role-add:disabled {
    opacity: .5;
    cursor: default;
}

.dcp-body .dcp-role-cancel {
    border: 1px solid var(--chr-line);
    background: transparent;
    color: inherit;
}

.dcp-body .dcp-role-hint {
    margin: 0 0 8px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--dcp-text-weak, #9aa4b2);
}

.dcp-body .dcp-role-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dcp-body .dcp-role-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border: 1px solid var(--chr-line);
    border-radius: 12px;
    background: var(--chr-panel);
}

.dcp-body .dcp-role-thumb {
    position: relative;
    flex: 0 0 auto;
    width: 64px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}

.dcp-body .dcp-role-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 跨域素材裁不出像素时的示意图：暗底 + 框选位置 + 说明 */
.dcp-body .dcp-role-thumb-box {
    position: absolute;
    border: 1px dashed rgba(255, 122, 61, .9);
    background: rgba(255, 122, 61, .18);
}

.dcp-body .dcp-role-thumb-note {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1px 0;
    background: rgba(0, 0, 0, .55);
    color: #ffb08a;
    font-size: 9px;
    line-height: 14px;
    text-align: center;
}

.dcp-body .dcp-role-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 120px;
}

.dcp-body .dcp-role-name {
    border: 1px solid var(--chr-line);
    background: transparent;
    color: inherit;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 13px;
}

.dcp-body .dcp-role-detail {
    font-size: 11px;
    color: var(--dcp-text-weak, #9aa4b2);
}

.dcp-body .dcp-role-remove {
    border: none;
    background: transparent;
    color: #ff8a80;
    font-size: 12px;
    cursor: pointer;
}

/* 框选面板：把当前帧抓成大图，在大图上框人，框完点确认 */
.dcp-body .dcp-role-crop {
    margin: 8px 0 10px;
}

.dcp-body .dcp-role-crop[hidden] {
    display: none;
}

.dcp-body .dcp-role-crop-stage {
    position: relative;
    width: 100%;
    max-width: 560px;
    height: 360px;
    border: 1px solid var(--chr-line);
    border-radius: 12px;
    background: #000;
    overflow: hidden;
    cursor: crosshair;
    touch-action: none;
}

.dcp-body .dcp-role-crop-stage img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

.dcp-body .dcp-role-crop-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

/* 框选操作条：确认这个角色 / 重新框 / 取消 */
.dcp-body .dcp-role-pickbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 4px;
}

.dcp-body .dcp-role-pickbar[hidden] {
    display: none;
}

.dcp-body .dcp-role-pickbar button,
.dcp-body .dcp-role-crop-actions button {
    border: 1px solid var(--chr-line);
    background: transparent;
    color: inherit;
    border-radius: 10px;
    padding: 7px 14px;
    font-size: 13px;
    cursor: pointer;
}

.dcp-body .dcp-role-pickbar .dcp-role-crop-confirm,
.dcp-body .dcp-role-crop-confirm {
    border-color: rgba(255, 122, 61, .55) !important;
    background: rgba(255, 122, 61, .12) !important;
    color: #ff9d6b !important;
}

.dcp-body .dcp-role-pickbar .dcp-role-crop-confirm:disabled,
.dcp-body .dcp-role-crop-confirm:disabled {
    opacity: .45;
    cursor: default;
}

.dcp-body .dcp-role-thumb.is-empty {
    background: #1b2230;
}

/* 框选原片商品：与「台词来源」同一张卡片，放在商品槽位下方 */
.dcp-product-pick {
    display: grid;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--chr-line);
}

.dcp-product-pick[hidden] {
    display: none;
}

.dcp-product-pick-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.dcp-product-pick-btn {
    padding: 7px 12px;
    border: 1px solid var(--chr-line);
    border-radius: 10px;
    background: var(--chr-panel);
    color: var(--chr-text);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease;
}

.dcp-product-pick-btn:hover {
    border-color: var(--chr-line-strong);
    background: var(--chr-panel-2);
}

.dcp-product-pick-current {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dcp-product-pick-current[hidden] {
    display: none;
}

.dcp-product-pick-current img {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--chr-line);
}

.dcp-product-pick-label {
    color: var(--chr-muted);
    font-size: 11.5px;
}

.dcp-product-pick-clear {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--chr-muted);
    font-size: 11.5px;
    cursor: pointer;
    text-decoration: underline;
}

.dcp-product-pick-hint {
    color: var(--chr-muted);
    font-size: 11px;
    line-height: 1.55;
}

/* 商品框选时整张卡片切成商品风格，避免和「选择角色」混在一起 */
.dcp-card-roles.is-product-pick {
    border-color: color-mix(in srgb, var(--chr-accent) 45%, transparent);
}

.dcp-card-roles.is-product-pick .dcp-card-head strong {
    color: var(--chr-accent);
}

/* 制作方式：与视频编导面板同一套交互（默认先分析，勾选后直接写词出片）。
   放在主按钮上方做成卡片 + 开关，比一行小字更容易看见；勾选后整块高亮。 */
.dcp-direct-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 8px 0 6px;
    padding: 10px 12px;
    border: 1px solid var(--chr-line);
    border-radius: 12px;
    background: var(--chr-panel-2, #f7faff);
    transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.dcp-direct-field[hidden] {
    display: none !important;
}

.dcp-direct-field.is-on {
    border-color: color-mix(in srgb, var(--chr-accent, #2f6bff) 60%, var(--chr-line, #e3e9f2));
    background: color-mix(in srgb, var(--chr-accent, #2f6bff) 10%, var(--chr-panel, #fff));
    box-shadow: inset 3px 0 0 var(--chr-accent, #2f6bff);
}

.dcp-direct-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

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

.dcp-direct-state {
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--chr-panel, #fff);
    color: var(--chr-muted);
    font-size: 11px;
    line-height: 1.7;
}

.dcp-direct-field.is-on .dcp-direct-state {
    background: var(--chr-accent, #2f6bff);
    color: #fff;
}

.dcp-direct-option {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    cursor: pointer;
}

.dcp-direct-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.dcp-direct-switch {
    position: relative;
    flex: 0 0 auto;
    width: 34px;
    height: 20px;
    margin-top: 1px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--chr-muted) 35%, transparent);
    transition: background .16s ease;
}

.dcp-direct-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .28);
    transition: transform .16s ease;
}

.dcp-direct-field.is-on .dcp-direct-switch {
    background: var(--chr-accent, #2f6bff);
}

.dcp-direct-field.is-on .dcp-direct-switch::after {
    transform: translateX(14px);
}

.dcp-direct-option input:focus-visible + .dcp-direct-switch {
    outline: 2px solid color-mix(in srgb, var(--chr-accent, #2f6bff) 65%, transparent);
    outline-offset: 2px;
}

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

.dcp-direct-text strong {
    color: var(--chr-text);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
}

.dcp-direct-text small {
    color: var(--chr-muted);
    font-size: 11px;
    line-height: 1.5;
}

/* 预估改成两段（出片 + 分析素材），单独占一行，和视频编导面板一致 */
.dcp-estimate {
    display: block;
    margin: 2px 0 8px;
    white-space: normal;
    line-height: 1.6;
}

.dcp-estimate strong {
    color: var(--chr-text);
    font-weight: 600;
}

/* 换人 + 480P：一键改 720P 的小按钮，紧跟清晰度说明 */
.dcp-resolution-bump {
    align-self: flex-start;
    margin-top: 4px;
    padding: 3px 10px;
    border: 1px solid color-mix(in srgb, var(--chr-accent, #2f6bff) 45%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--chr-accent, #2f6bff) 10%, transparent);
    color: var(--chr-accent, #2f6bff);
    font-size: 11px;
    line-height: 1.6;
    cursor: pointer;
}

.dcp-resolution-bump[hidden] {
    display: none !important;
}

.dcp-resolution-bump:hover {
    background: color-mix(in srgb, var(--chr-accent, #2f6bff) 18%, transparent);
}

.dcp-resolution-bump:focus-visible {
    outline: 2px solid var(--chr-accent, #2f6bff);
    outline-offset: 2px;
}

/* 原片台词（听写，可修正）：脚本下面单独一块，提示同音字风险 */
.dcp-transcript {
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px dashed color-mix(in srgb, var(--chr-accent, #2f6bff) 38%, var(--chr-line, #e3e9f2));
    border-radius: 12px;
    background: color-mix(in srgb, var(--chr-accent, #2f6bff) 6%, transparent);
}

.dcp-transcript[hidden] {
    display: none !important;
}

.dcp-transcript-head {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dcp-transcript-head strong {
    color: var(--chr-text);
    font-size: 12px;
    font-weight: 600;
}

.dcp-transcript-head small {
    color: var(--chr-muted);
    font-size: 11px;
    line-height: 1.5;
}

.dcp-transcript-body {
    width: 100%;
    min-height: 64px;
    max-height: 140px;
    padding: 8px 10px;
    border: 1px solid var(--chr-line, #e3e9f2);
    border-radius: 10px;
    background: var(--chr-panel, #fff);
    color: var(--chr-text);
    font-family: inherit;
    font-size: 12px;
    line-height: 1.7;
    resize: vertical;
    outline: none;
}

.dcp-transcript-body:focus {
    border-color: color-mix(in srgb, var(--chr-accent, #2f6bff) 46%, var(--chr-line, #e3e9f2));
}

/* ===== 第一百五十七节：紧凑布局 =====
   问题：「参考素材」卡片文字多、槽位高，把「添加参考视频」按钮挤到首屏之外。
   做法：参考视频上移到第二块（用 order 排序，不动 DOM 顺序与提交逻辑）；素材槽位改成
   横排小卡；说明压成一行并用 title 保留全文；底部参数收成单行、主按钮放右侧，
   让选素材、选声音、提交尽量一屏完成。 */

/* 视觉顺序：复刻方式 → 参考视频 → 选择角色 → 参考素材 → 首帧锁定 → 成片声音 → 补充说明 */
.dcp-body > .dcp-card-modes { order: 1; }
.dcp-body > .dcp-card-video { order: 2; }
.dcp-body > .dcp-card-roles { order: 3; }
.dcp-body > .dcp-card-assets { order: 4; }
.dcp-body > .dcp-card-anchor { order: 5; }
.dcp-body > .dcp-card-sound { order: 6; }
.dcp-body > .dcp-card-note { order: 7; }

/* 复刻方式：三档改成一行「图标 + 名称」的分段按钮 */
.dcp .dcp-modes {
    gap: 6px;
}

.dcp .dcp-mode {
    flex-direction: row;
    justify-content: center;
    gap: 6px;
    padding: 6px 18px 6px 8px;
}

.dcp .dcp-mode-icon {
    width: 22px;
    height: 22px;
    border-radius: 7px;
}

.dcp .dcp-mode-icon svg {
    width: 14px;
    height: 14px;
}

.dcp .dcp-mode-check {
    top: 50%;
    right: 5px;
    width: 13px;
    height: 13px;
    font-size: 9px;
    transform: translateY(-50%) scale(.7);
}

.dcp .dcp-mode.is-active .dcp-mode-check {
    transform: translateY(-50%) scale(1);
}

.dcp .dcp-mode-hint {
    margin: 6px 2px 0;
    font-size: 11px;
    line-height: 1.45;
}

/* 参考素材：槽位横排（缩略图 + 名称 + 已选数量），高度从 74px 降到 40px 左右 */
.dcp .dcp-slots {
    gap: 6px;
}

.dcp .dcp-slot {
    flex-direction: row;
    justify-content: flex-start;
    gap: 7px;
    padding: 5px 7px;
    text-align: left;
}

.dcp .dcp-slot-thumb {
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 8px;
}

.dcp .dcp-slot-thumb svg {
    width: 16px;
    height: 16px;
}

.dcp .dcp-slot-name {
    font-size: 11.5px;
}

.dcp .dcp-slot-tip {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: auto;
    font-size: 9.5px;
    text-align: right;
}

/* 「移除」按钮改到行尾，避免压在「已选 N 张」上 */
.dcp .dcp-slot-clear {
    position: static;
    flex: none;
    width: 15px;
    height: 15px;
    margin-left: 2px;
    font-size: 11px;
}

/* 参考视频：必选项做成更醒目的投放区，位置紧跟复刻方式 */
.dcp .dcp-drop {
    gap: 8px;
    padding: 9px 12px;
    border-color: color-mix(in srgb, var(--chr-accent) 42%, var(--chr-line-strong));
    background: color-mix(in srgb, var(--chr-accent) 6%, var(--chr-panel));
}

.dcp .dcp-drop-icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
}

.dcp .dcp-drop-icon svg {
    width: 16px;
    height: 16px;
}

.dcp .dcp-drop-copy small {
    font-size: 10.5px;
}

/* 卡片与说明整体收紧 */
.dcp .dcp-card {
    padding: 9px 11px;
}

.dcp .dcp-card-head {
    margin-bottom: 7px;
}

.dcp .dcp-hint {
    margin: 6px 2px 0;
    font-size: 10.5px;
}

.dcp .dcp-sound {
    padding: 7px 4px;
    font-size: 11.5px;
}

.dcp .dcp-sound-hint {
    margin: 6px 2px 0;
    font-size: 10.5px;
}

.dcp .dcp-card-note {
    min-height: 0;
}

.dcp .dcp-textarea {
    min-height: 52px;
}

/* 首帧锁定：收成一行 */
.dcp .dcp-card-anchor {
    padding: 8px 11px;
}

.dcp .dcp-anchor {
    align-items: center;
    gap: 8px;
}

.dcp .dcp-anchor input {
    margin-top: 0;
}

.dcp .dcp-anchor strong {
    font-size: 12.5px;
}

.dcp .dcp-anchor small {
    font-size: 11px;
    line-height: 1.4;
}

/* 底部：参数单行 + 制作方式/预估 + 右侧主按钮 */
@media (min-width: 700px) {
    .dcp-foot {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto 190px;
        align-items: center;
        gap: 8px 10px;
        padding: 9px 16px 11px;
    }

    .dcp-fields {
        grid-column: 1 / -1;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
        align-items: end;
    }

    /* 视频模型 / 写词模型和别的字段同宽同高，不再单独占整行 */
    .dcp-field-model,
    .dcp-field-prompt-model {
        grid-column: auto;
    }

    .dcp-field-model select.dcp-select-model,
    .dcp-field-prompt-model select {
        height: 34px;
        font-size: 12px;
    }

    .dcp-field-value {
        height: 32px;
    }

    /* 清晰度说明收进 title + 720P 一键按钮，避免把参数行撑成多行 */
    .dcp-field-note {
        display: none;
    }

    .dcp-model-note {
        grid-column: 1 / -1;
        margin: 0;
    }

    .dcp-direct-field {
        grid-column: 1;
        flex-direction: row;
        align-items: center;
        margin: 0;
        padding: 5px 8px;
        border-radius: 10px;
    }

    .dcp-direct-head {
        display: none;
    }

    .dcp-direct-option {
        align-items: center;
        gap: 7px;
    }

    .dcp-direct-switch {
        margin-top: 0;
    }

    .dcp-direct-text {
        flex-direction: row;
        align-items: center;
        gap: 6px;
    }

    .dcp-direct-text strong {
        white-space: nowrap;
    }

    .dcp-direct-text small {
        display: none;
    }

    .dcp-estimate {
        grid-column: 2;
        margin: 0;
        max-width: 190px;
        font-size: 11px;
        line-height: 1.45;
        text-align: right;
    }

    .dcp-submit {
        grid-column: 3;
        width: 180px;
        height: 40px;
        font-size: 13.5px;
    }

    .dcp-status {
        grid-column: 1 / -1;
        margin: 0;
    }
}
