/* 测试短剧 (testdrama) – UI-only styles, mirrored from shortdrama with td- prefix */

/* ── Upload tab switcher ── */
.td-upload-tabs-wrap { margin-bottom: 18px; }
.td-upload-tab-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.td-upload-tab {
    box-sizing: border-box; min-height: 60px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    border: 1px solid var(--border-base, rgba(255,255,255,0.12)); border-radius: 14px;
    padding: 10px 14px; background: rgba(255,255,255,0.03);
    color: var(--text-secondary, #94a3b8); font-size: 13px; font-weight: 500; cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}
.td-upload-tab i { font-size: 15px; color: #60a5fa; }
.td-upload-tab.is-active {
    border-color: rgba(139,92,246,0.55);
    background: linear-gradient(180deg, rgba(124,58,237,0.18), rgba(124,58,237,0.06));
    color: #e2e8f0;
}
.td-upload-tab.is-active i { color: #a78bfa; }
.td-upload-tab:not(.is-active):hover {
    border-color: rgba(96,165,250,0.3); background: rgba(255,255,255,0.05); color: #e2e8f0;
}
.td-upload-panel { display: block; padding: 4px 0 14px; }

/* ── Asset generation step sections (Step 1 & Step 2) ── */
.td-asset-gen-wrap {
    margin-top: 16px;
    padding: 14px 16px 16px;
    border: 1px solid rgba(139,92,246,0.2);
    border-radius: 14px;
    background: rgba(15,10,40,0.35);
}
/* connector arrow between step 1 and step 2 */
.td-asset-gen-wrap--step1 { margin-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom-color: transparent; }
.td-asset-gen-wrap--step2 { margin-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; border-top: 1px dashed rgba(139,92,246,0.25); }
.td-asset-gen-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.td-asset-gen-label {
    font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
    background: rgba(139,92,246,0.22); color: #c4b5fd;
    padding: 2px 10px; border-radius: 20px;
}
.td-asset-gen-title { font-size: 12px; color: #64748b; }
.td-asset-gen-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.td-asset-gen-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px; padding: 18px 8px; border-radius: 12px;
    border: 1px solid rgba(139,92,246,0.28);
    background: linear-gradient(160deg, rgba(124,58,237,0.1), rgba(30,27,75,0.18));
    color: #c4b5fd; cursor: pointer;
    transition: border-color 0.18s, background 0.18s, transform 0.12s, color 0.18s;
}
.td-asset-gen-btn i { font-size: 20px; color: #a78bfa; transition: color 0.18s; }
.td-asset-gen-btn-name { font-size: 13px; font-weight: 600; }
.td-asset-gen-btn-sub { font-size: 11px; color: #6b5fa0; }
/* full-width solo button (Step 1) */
.td-asset-gen-btn--solo {
    width: 100%; flex-direction: row; gap: 14px; padding: 18px 24px; justify-content: center;
}
.td-asset-gen-btn--solo i { font-size: 20px; }
.td-asset-gen-btn--solo .td-asset-gen-btn-name { font-size: 14px; }
.td-asset-gen-btn--solo .td-asset-gen-btn-sub { font-size: 12px; margin-left: 2px; }
/* grid buttons (Step 2) — suppress the row ::after chevron, center content */
.td-asset-gen-grid-btn {
    width: 100%; min-width: 0; align-items: center; justify-content: center; text-align: center;
}
.td-asset-gen-grid-btn::after { display: none !important; }
.td-asset-gen-btn:hover:not(:disabled) {
    border-color: rgba(139,92,246,0.6);
    background: linear-gradient(160deg, rgba(124,58,237,0.2), rgba(30,27,75,0.28));
    color: #e2e8f0; transform: translateY(-2px);
}
.td-asset-gen-btn--solo:hover:not(:disabled) { transform: translateY(-1px); }
.td-asset-gen-btn:hover:not(:disabled) i { color: #c4b5fd; }
.td-asset-gen-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.td-asset-gen-btn.is-done {
    border-color: rgba(52,211,153,0.4);
    background: linear-gradient(160deg, rgba(16,185,129,0.1), rgba(6,95,70,0.08));
    color: #6ee7b7;
}
.td-asset-gen-btn.is-done i { color: #34d399; }
.td-asset-gen-btn.is-loading { border-color: rgba(96,165,250,0.4); }

.td-page-shell {
    max-width: 1180px;
}

.td-page-header {
    margin-bottom: 20px;
}

.td-wizard-card {
    background: linear-gradient(180deg, rgba(20,20,22,0.96), rgba(15,15,18,0.98));
    border: 1px solid var(--border-base);
    border-radius: 24px;
    padding: 24px;
    box-shadow: var(--shadow-lg);
}

.td-project-manager {
    margin-bottom: 10px;
    padding: 16px;
    border: 1px solid var(--border-color, #2a2a2a);
    border-radius: 12px;
    background: rgba(255,255,255,0.02);
}

.td-project-list {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: center;
    gap: 8px;
}

.td-project-list.has-pager {
    grid-template-columns: 32px repeat(5, minmax(0, 1fr)) 32px;
}

.td-project-tab,
.td-project-tab-add {
    min-height: 38px;
    border: 1px solid var(--border-base);
    background: rgba(255,255,255,0.04);
    color: var(--text-secondary);
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: border-color var(--trans-fast), background var(--trans-fast), color var(--trans-fast), transform var(--trans-fast);
}

.td-project-tab {
    width: 100%;
    min-width: 0;
    justify-content: space-between;
    padding: 8px 8px 8px 14px;
    font-size: 13px;
}

.td-project-tab-name {
    flex: 1 1 auto;
}

.td-project-tab span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.td-project-tab::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #5b6270;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.td-project-tab:hover,
.td-project-tab-add:hover {
    color: var(--text-primary);
    border-color: rgba(139,92,246,0.5);
    background: rgba(124,58,237,0.12);
}

.td-project-tab.active {
    color: var(--text-primary);
    border-color: rgba(139,92,246,0.72);
    background: linear-gradient(180deg, rgba(124,58,237,0.2), rgba(124,58,237,0.08));
}

.td-project-tab.active::before {
    background: #8b5cf6;
    box-shadow: 0 0 10px rgba(139,92,246,0.58);
}

/* 后台生成中（未选中）：蓝色脉冲边框，暗底 */
.td-project-tab--running:not(.active) {
    border-color: rgba(96, 165, 250, 0.5);
    color: var(--text-secondary);
    background: rgba(255,255,255,0.04);
    animation: tdTabBorderPulse 2s ease-in-out infinite;
}

/* 当前所在且生成中：优先显示 active 紫色样式 */
.td-project-tab--running.active {
    border-color: rgba(139,92,246,0.72);
    color: var(--text-primary);
    background: linear-gradient(180deg, rgba(124,58,237,0.2), rgba(124,58,237,0.08));
    box-shadow: none;
    animation: none;
}

@keyframes tdTabBorderPulse {
    0%, 100% { border-color: rgba(96, 165, 250, 0.35); }
    50%       { border-color: rgba(96, 165, 250, 0.85); }
}

/* 后台跑：蓝色脉冲圆点 */
.td-project-tab--running:not(.active)::before {
    background: #60a5fa;
    box-shadow: 0 0 10px rgba(96,165,250,0.65);
    animation: tdProjectStatusPulse 1s ease-in-out infinite;
}

/* 当前所在且生成中：紫色圆点（和普通 active 保持一致） */
.td-project-tab--running.active::before {
    background: #8b5cf6;
    box-shadow: 0 0 10px rgba(139,92,246,0.58);
    animation: none;
}

.td-project-tab--done {
    color: var(--text-secondary);
    background: rgba(255,255,255,0.04);
}

.td-project-tab--done.active {
    border-color: rgba(139,92,246,0.72);
    color: var(--text-primary);
    background: linear-gradient(180deg, rgba(124,58,237,0.2), rgba(124,58,237,0.08));
}

.td-project-tab--done::before {
    background: #34d399;
    box-shadow: 0 0 10px rgba(52,211,153,0.58);
}

.td-project-tab--done.active::before {
    background: #8b5cf6;
    box-shadow: 0 0 10px rgba(139,92,246,0.58);
}

.td-project-tab-status {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 86px;
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
}

.td-project-tab-status--running {
    color: #dbeafe;
    background: rgba(37, 99, 235, 0.28);
}

.td-project-tab-status--done {
    color: #bbf7d0;
    background: rgba(22, 163, 74, 0.28);
}

.td-project-tab-status--partial,
.td-project-tab-status--pending {
    color: #fed7aa;
    background: rgba(249, 115, 22, 0.18);
}

.td-project-tab-close {
    width: 20px;
    height: 20px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: rgba(248,113,113,0.92);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@keyframes tdProjectStatusPulse {
    0%, 100% { transform: scale(1); opacity: 0.72; }
    50% { transform: scale(1.35); opacity: 1; }
}

.td-project-tab-close:hover {
    background: rgba(239,68,68,0.16);
    color: #fecaca;
}

.td-project-tab-add {
    width: 38px;
    height: 38px;
    min-width: 38px;
    justify-content: center;
    justify-self: start;
    padding: 0;
    color: #dbeafe;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
}

.td-project-pager {
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
}

.td-project-page-btn {
    width: 30px;
    height: 30px;
    min-height: 30px;
    border: 1px solid var(--border-base);
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: border-color var(--trans-fast), background var(--trans-fast), color var(--trans-fast);
}

.td-project-page-btn--edge[data-td-project-page="prev"] {
    grid-column: 1;
}

.td-project-page-btn--edge[data-td-project-page="next"] {
    grid-column: -2 / -1;
}

.td-project-page-btn:hover:not(:disabled) {
    color: var(--text-primary);
    border-color: rgba(139,92,246,0.5);
    background: rgba(124,58,237,0.12);
}

.td-project-page-btn:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.td-project-page-state {
    color: var(--text-secondary);
    font-size: 12px;
}

.td-stepbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.td-step-item {
    box-sizing: border-box;
    min-height: 66px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 1px solid var(--border-base);
    border-radius: 16px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.03);
    line-height: 1.25;
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.td-step-item.active {
    border-color: rgba(139, 92, 246, 0.55);
    background: linear-gradient(180deg, rgba(124,58,237,0.18), rgba(124,58,237,0.06));
}

.td-step-item.done {
    border-color: rgba(148, 163, 184, 0.20);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.36), rgba(15, 23, 42, 0.18));
    color: rgba(226, 232, 240, 0.68);
}

.td-stage {
    display: none;
}

.td-stage.active {
    display: block;
}

.td-stage-badge {
    display: inline-flex;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(124,58,237,0.16);
    border: 1px solid rgba(139,92,246,0.28);
    color: #ddd6fe;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 14px;
}

#tdStage1 .td-stage-badge {
    margin-bottom: 10px;
}

#tdStage1 h3 {
    margin-top: 0;
    margin-bottom: 14px;
}

.td-stage-desc {
    color: var(--text-secondary);
    margin: 8px 0 20px;
}

#tdStage1 .td-stage-desc {
    margin: 0 0 14px;
}

.td-form-group {
    margin-bottom: 18px;
}

.td-form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.td-style-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.td-style-card {
    border: 1px solid var(--border-base);
    border-radius: 16px;
    padding: 16px;
    background: rgba(255,255,255,0.03);
    cursor: pointer;
    transition: all var(--trans-normal);
}

.td-style-card.active {
    border-color: rgba(139, 92, 246, 0.55);
    background: linear-gradient(180deg, rgba(124,58,237,0.18), rgba(124,58,237,0.06));
}

.td-style-title {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.td-style-desc {
    color: var(--text-secondary);
    font-size: 12px;
}

.td-input,
.td-textarea {
    border-radius: 16px;
}

.td-file-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.td-file-picker {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.td-file-picker-name {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
    word-break: break-all;
}

.td-upload-file-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.td-upload-file-meta--manual {
    margin-top: 10px;
}

.td-upload-file-meta .td-file-picker-name,
.td-upload-file-meta .td-manual-upload-name {
    flex: 1;
    min-width: 0;
}

.td-upload-clear-btn {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: #cbd5e1;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.td-upload-clear-btn:hover {
    background: rgba(59, 130, 246, 0.16);
    border-color: rgba(96, 165, 250, 0.34);
    opacity: 1;
}

.td-upload-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 1px minmax(0, 1fr);
    gap: 24px;
    align-items: stretch;
    margin-bottom: 18px;
}

.td-upload-pane {
    display: grid;
    grid-template-rows: 22px 42px minmax(220px, 1fr) 46px 22px;
    row-gap: 14px;
    min-width: 0;
    padding: 10px 0;
}

.td-upload-pane--auto,
.td-upload-pane:not(.td-upload-pane--auto) {
    min-height: 100%;
}

.td-upload-pane--auto {
    width: auto;
    justify-self: stretch;
}

.td-upload-pane-title {
    margin-bottom: 0;
    color: #facc15;
    font-size: 15px;
    font-weight: 700;
}

.td-upload-pane-title--manual {
    text-align: center;
}

.td-upload-pane-title--auto {
    text-align: center;
}

.td-upload-pane-subtitle {
    min-height: 42px;
    margin-bottom: 0;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.7;
    text-align: center;
}

.td-upload-pane-subtitle--auto {
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

.td-upload-divider {
    width: 1px;
    min-height: 100%;
    background: linear-gradient(180deg, rgba(96, 165, 250, 0), rgba(96, 165, 250, 0.9), rgba(96, 165, 250, 0));
    border-radius: 999px;
}

.td-upload-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.td-upload-chip-row--manual {
    justify-content: center;
    gap: 14px;
    margin-top: auto;
}

.td-manual-upload-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 14px;
    flex: 1;
    align-content: stretch;
}

.td-auto-upload-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.td-auto-upload-card {
    padding: 12px 16px;
    border: 1px solid rgba(96, 165, 250, 0.18);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.08), rgba(255, 255, 255, 0.02));
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
}

.td-auto-upload-label {
    flex: none;
    white-space: nowrap;
    margin-bottom: 0;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
}

.td-file-picker--stack {
    flex: 1;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.td-file-picker-btn--auto {
    flex: none;
    white-space: nowrap;
    min-height: 38px;
    border-color: rgba(96, 165, 250, 0.34);
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.18), rgba(59, 130, 246, 0.08));
    color: #bfdbfe;
}

.td-file-picker-btn--auto:hover {
    border-color: rgba(96, 165, 250, 0.52);
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.24), rgba(59, 130, 246, 0.1));
}

.td-upload-file-meta--stack {
    flex: 1;
    min-width: 0;
    margin-top: 0;
}

.td-manual-upload-card {
    padding: 14px;
    border: 1px solid rgba(96, 165, 250, 0.18);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.08), rgba(255, 255, 255, 0.02));
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.td-manual-upload-btn {
    width: 100%;
    min-height: 46px;
    border-color: rgba(96, 165, 250, 0.34);
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.18), rgba(59, 130, 246, 0.08));
    color: #bfdbfe;
}

.td-manual-upload-btn:hover {
    border-color: rgba(96, 165, 250, 0.52);
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.24), rgba(59, 130, 246, 0.1));
}

.td-manual-upload-name {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.6;
    word-break: break-all;
}

.td-manual-upload-success,
.td-manual-upload-reading,
.td-manual-upload-error,
.td-manual-upload-file {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.td-manual-upload-success {
    color: #22c55e;
    font-weight: 600;
}

.td-manual-upload-reading {
    color: #60a5fa;
}

.td-manual-upload-error {
    color: #f87171;
    font-weight: 600;
}

.td-manual-upload-file {
    display: block;
    color: var(--text-secondary);
    opacity: 0.86;
}

.td-manual-generate-btn {
    width: 100%;
    min-height: 46px;
    margin-top: 0;
}

.td-upload-chip {
    padding: 0;
    border: none;
    background: transparent;
    color: #60a5fa;
    font-size: 18px;
    line-height: 1.4;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.td-upload-chip:hover,
.td-upload-link-btn:hover {
    opacity: 0.82;
}

.td-upload-chip--manual {
    min-width: 112px;
    padding: 12px 16px;
    border: 1px solid rgba(96, 165, 250, 0.34);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.14), rgba(59, 130, 246, 0.06));
    color: #93c5fd;
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.14);
}

.td-upload-chip--manual:hover {
    border-color: rgba(96, 165, 250, 0.54);
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.22), rgba(59, 130, 246, 0.1));
    opacity: 1;
}

.td-upload-link-btn {
    margin: 0 auto;
    padding: 0;
    border: none;
    background: transparent;
    color: #84cc16;
    font-size: 14px;
    cursor: pointer;
}

.td-upload-pane-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.td-upload-pane-actions--auto {
    margin-top: 0;
}

.td-upload-pane-actions--auto .btn {
    min-width: 220px;
}

.td-upload-pane-actions--auto-centered {
    margin-top: 0;
}

.td-auto-flow-actions {
    width: 100%;
    display: inline-flex;
    align-items: stretch;
    gap: 12px;
}

.td-auto-flow-btn {
    flex: 1 1 0;
    min-width: 0;
}

.td-auto-flow-btn--done {
    border-color: rgba(74, 222, 128, 0.72);
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.92), rgba(21, 128, 61, 0.92));
    color: #f0fdf4;
    box-shadow: 0 14px 30px rgba(21, 128, 61, 0.28);
}

.td-auto-flow-btn--done:hover {
    border-color: rgba(134, 239, 172, 0.9);
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.98), rgba(22, 101, 52, 0.96));
}

.td-auto-flow-btn--loading {
    border-color: rgba(251, 191, 36, 0.72);
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.92), rgba(180, 83, 9, 0.92));
    color: #fffbeb;
    box-shadow: 0 14px 30px rgba(180, 83, 9, 0.28);
    cursor: not-allowed;
    opacity: 1;
}

.td-auto-flow-btn--loading:hover {
    border-color: rgba(251, 191, 36, 0.9);
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.98), rgba(180, 83, 9, 0.96));
}

.td-auto-generate-btn {
    width: 100%;
    min-height: 46px;
}

.td-time-block {
    padding: 14px 16px;
    border: 1px solid rgba(96, 165, 250, 0.18);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.08), rgba(255, 255, 255, 0.02));
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
    align-items: start;
}

.td-time-block .td-time-block-group { margin-top: 0 !important; }

.td-time-block-title {
    margin-bottom: 10px;
    color: #93c5fd;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
}

.td-time-block #tdTotalDuration {
    min-height: 46px;
    border-color: rgba(96, 165, 250, 0.34);
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.18), rgba(59, 130, 246, 0.08));
    color: #f8fafc;
    font-weight: 800;
}

.td-time-block #tdTotalDuration:focus {
    border-color: rgba(96, 165, 250, 0.58);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.td-time-block-group {
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
}

.td-time-block-inline-label {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 700;
}

.td-time-block-inline-label span {
    color: inherit;
    font-size: 13px;
    font-weight: 600;
}

.td-stage-actions--separate {
    justify-content: flex-start;
    margin-top: 4px;
    padding-top: 8px;
}

.td-style-select-wrap {
    position: relative;
    isolation: isolate;
}

.td-style-select-wrap::before {
    content: '';
    position: absolute;
    left: 0;
    top: 13px;
    bottom: 13px;
    width: 3px;
    border-radius: 999px;
    background: linear-gradient(180deg, #8b5cf6, #38bdf8);
    opacity: 0.86;
    pointer-events: none;
    z-index: 2;
}

.td-style-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    min-height: 56px;
    padding: 0 52px 0 16px;
    cursor: pointer;
    font-weight: 700;
    color: #f8fafc;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.025)),
        rgba(12, 14, 20, 0.92);
    border: 1px solid rgba(148,163,184,0.24);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.07), 0 12px 26px rgba(0,0,0,0.2);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.td-style-select:hover,
.td-style-select:focus {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.035)),
        rgba(15, 18, 27, 0.96);
    border-color: rgba(129,140,248,0.7);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.09), 0 0 0 3px rgba(59,130,246,0.12), 0 14px 30px rgba(0,0,0,0.24);
    outline: none;
}

.td-style-select option {
    background: #1f1b2d;
    color: #f8fafc;
}

.td-style-select-wrap::after {
    content: '';
    position: absolute;
    right: 20px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 1.6px solid #93c5fd;
    border-bottom: 1.6px solid #93c5fd;
    transform: translateY(-65%) rotate(45deg);
    pointer-events: none;
    z-index: 2;
}

.td-style-hint {
    margin-top: 8px;
    color: #aeb7c7;
    font-size: 13px;
    line-height: 1.6;
    padding: 10px 0 0 14px;
    border-left: 2px solid rgba(148,163,184,0.28);
    border-radius: 0;
    background: transparent;
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
}

#tdStage1 .td-style-hint {
    min-height: 34px;
    padding: 9px 0 0 14px;
    border-color: rgba(148,163,184,0.24);
}

.td-stage--production {
    position: relative;
}

.td-stage3-hero {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.92fr);
    gap: 22px;
    align-items: stretch;
    margin-bottom: 18px;
    padding: 22px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 22px;
    background:
        linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px),
        linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
        radial-gradient(circle at 14% 8%, rgba(34, 197, 94, 0.18), transparent 32%),
        radial-gradient(circle at 88% 20%, rgba(59, 130, 246, 0.16), transparent 34%),
        linear-gradient(135deg, rgba(8, 13, 22, 0.98), rgba(20, 18, 30, 0.96));
    background-size: 38px 38px, 38px 38px, 100% 100%, 100% 100%, 100% 100%;
    box-shadow: 0 24px 70px rgba(2, 6, 23, 0.34), inset 0 1px 0 rgba(255,255,255,0.06);
}

.td-stage3-hero::after {
    content: '';
    position: absolute;
    inset: auto 26px 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(52, 211, 153, 0.58), rgba(96, 165, 250, 0.52), transparent);
    pointer-events: none;
}

.td-stage3-hero-copy {
    position: relative;
    z-index: 1;
}

.td-stage3-badge {
    margin-bottom: 12px;
    border-color: rgba(52, 211, 153, 0.28);
    background: rgba(16, 185, 129, 0.12);
    color: #a7f3d0;
}

#tdStage3 h3 {
    margin: 0;
    color: #f8fafc;
    font-size: 28px;
    font-weight: 900;
    line-height: 1.2;
}

#tdStage3 .td-stage-desc {
    max-width: 680px;
    margin: 12px 0 0;
    color: #b8c2d6;
    font-size: 14px;
    line-height: 1.8;
}

.td-step2-flow {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr) 42px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 14px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px;
    background: rgba(255,255,255,0.035);
    backdrop-filter: blur(8px);
}

.td-step2-flow-item {
    min-width: 0;
    min-height: 78px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    padding: 14px 16px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.54);
    color: #cbd5e1;
}

.td-step2-flow-item span {
    color: #93c5fd;
    font-size: 11px;
    font-weight: 800;
}

.td-step2-flow-item strong {
    overflow: hidden;
    color: inherit;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.td-step2-flow-item.is-done {
    border-color: rgba(34, 197, 94, 0.28);
    background: linear-gradient(180deg, rgba(22, 163, 74, 0.18), rgba(15, 23, 42, 0.56));
    color: #dcfce7;
}

.td-step2-flow-item.is-done span {
    color: #86efac;
}

.td-step2-flow-item.is-active {
    border-color: rgba(96, 165, 250, 0.42);
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.22), rgba(15, 23, 42, 0.62));
    color: #dbeafe;
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.10), 0 14px 30px rgba(37, 99, 235, 0.14);
}

.td-step2-flow-line {
    height: 2px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.24);
}

.td-step2-flow-line.is-done {
    background: linear-gradient(90deg, #22c55e, #38bdf8);
}

.td-step2-flow-line.is-active {
    background: linear-gradient(90deg, #38bdf8, rgba(96, 165, 250, 0.28));
}

.td-step2-command {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: stretch;
    margin-bottom: 24px;
}

.td-step2-command-main,
.td-step2-actions {
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 20px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.025)),
        rgba(10, 14, 24, 0.82);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.055), 0 16px 42px rgba(2, 6, 23, 0.22);
}

.td-step2-command-main {
    min-width: 0;
    padding: 16px;
}

.td-step2-command-label {
    margin-bottom: 10px;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 800;
}

.td-step2-summary {
    width: 100%;
    min-height: 42px;
    display: flex;
    align-items: center;
    margin: 0;
    border-color: rgba(52, 211, 153, 0.20);
    border-radius: 14px;
    background: rgba(34, 197, 94, 0.08);
    color: #d1fae5;
    font-size: 13px;
    line-height: 1.6;
}

.td-step2-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px;
    flex-wrap: wrap;
}

.td-step2-action-btn,
.td-add-asset-btn,
.td-step2-generate-btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.td-step2-action-btn {
    border-color: rgba(96, 165, 250, 0.28);
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.16), rgba(37, 99, 235, 0.07));
    color: #bfdbfe;
}

.td-step2-generate-btn {
    min-width: 168px;
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.22);
}

.td-video-size-control {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px 5px 12px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.72);
    color: #94a3b8;
    font-size: 12px;
    font-weight: 800;
}

.td-video-size-control select {
    width: 86px;
    min-height: 30px;
    padding: 4px 28px 4px 10px;
    border-radius: 9px;
    font-size: 13px;
}

.td-step2-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 4px 0 14px;
}

.td-step2-section-head h4 {
    margin: 0;
    color: #f8fafc;
    font-size: 18px;
    font-weight: 900;
    line-height: 1.25;
}

.td-step2-section-head > span {
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.5;
}

.td-detail-switcher {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin: 0 0 24px;
}

.td-detail-tab {
    position: relative;
    min-width: 0;
    min-height: 88px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px 14px;
    border: 1px solid rgba(148, 163, 184, 0.20);
    border-radius: 16px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.018)),
        rgba(8, 13, 22, 0.86);
    color: #cbd5e1;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.055), 0 14px 32px rgba(2, 6, 23, 0.20);
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.td-detail-tab-step {
    display: inline-flex;
    align-self: center;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    height: 20px;
    padding: 0 8px;
    border: 1px solid rgba(147, 197, 253, 0.24);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    color: #93c5fd;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
}

.td-detail-tab::before {
    content: '';
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: -8px;
    height: 2px;
    border-radius: 999px;
    background: rgba(248, 113, 113, 0.52);
    opacity: 0.72;
}

.td-detail-tab:hover {
    transform: translateY(-2px);
    border-color: rgba(96, 165, 250, 0.34);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.07), 0 18px 38px rgba(2, 6, 23, 0.26);
}

.td-detail-tab.is-active {
    border-color: rgba(96, 165, 250, 0.46);
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.20), transparent 42%),
        linear-gradient(180deg, rgba(37, 99, 235, 0.20), rgba(15, 23, 42, 0.74));
    color: #f8fafc;
}

.td-detail-tab.is-active::before {
    background: linear-gradient(90deg, #38bdf8, #22c55e);
    opacity: 1;
}

.td-detail-tab-main {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: inherit;
    font-size: 15px;
    font-weight: 900;
    line-height: 1.3;
    white-space: nowrap;
}

.td-detail-tab-main i {
    color: #93c5fd;
    font-size: 15px;
}

.td-detail-tab-sub {
    overflow: hidden;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.td-detail-tab.is-active .td-detail-tab-sub {
    color: #bfdbfe;
}

.td-detail-tab.is-active .td-detail-tab-step {
    border-color: rgba(34, 197, 94, 0.44);
    background: rgba(34, 197, 94, 0.12);
    color: #bbf7d0;
}

.td-detail-panel[hidden] {
    display: none !important;
}

.td-section-action-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.5;
}

.td-section-generate-btn {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.td-asset-flow-actions {
    display: inline-flex;
    align-items: stretch;
    gap: 12px;
}

.td-asset-flow-btn {
    position: relative;
    min-width: 136px;
    min-height: 50px;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
    padding: 8px 16px;
    border-radius: 12px;
    border: 1px solid rgba(96, 165, 250, 0.28);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 10px 22px rgba(2, 6, 23, 0.18);
    line-height: 1.1;
}

.td-asset-flow-btn[hidden] {
    display: none !important;
}

.td-asset-flow-btn:not(:last-child)::after {
    content: '\f054';
    position: absolute;
    top: 50%;
    right: -10px;
    z-index: 2;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: 999px;
    background: #101827;
    color: #93c5fd;
    font-family: "Font Awesome 6 Free";
    font-size: 9px;
    font-weight: 900;
    transform: translateY(-50%);
}

.td-asset-flow-btn--generate {
    background: linear-gradient(180deg, #2f7cf6, #1d5ed8);
}

.td-asset-flow-btn--audit {
    background: linear-gradient(180deg, #2563eb, #1e40af);
}

.td-asset-flow-btn--save {
    background: linear-gradient(180deg, #1d4ed8, #1e3a8a);
}

/* Center content for step-gen buttons inside the upload panel */
.td-asset-gen-wrap .td-asset-flow-btn {
    align-items: center;
    text-align: center;
}
.td-asset-gen-grid-btn { align-items: center !important; justify-content: center !important; }

.td-chat-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    align-items: center;
}
.td-chat-input { flex: 1; min-width: 0; }
.td-chat-btn { flex: none; white-space: nowrap; }
.td-import-storyboard-btn { font-size: 11px; padding: 3px 10px; }

.td-batch-footer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-base);
    border-radius: 8px;
}

.td-batch-footer-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.td-batch-footer-label {
    color: var(--text-muted, #6b7280);
}

.td-batch-footer-state {
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: #4b5563;
    background: rgba(255,255,255,0.05);
    transition: color 0.2s, background 0.2s;
}

.td-batch-footer-state.active-running {
    color: #93c5fd;
    background: rgba(96,165,250,0.15);
}

.td-batch-footer-state.active-done {
    color: #4ade80;
    background: rgba(74,222,128,0.15);
}

.td-next-step-btn {
    flex: none;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.06);
    color: #4b5563;
    cursor: not-allowed;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.td-next-step-btn:not([disabled]) {
    background: linear-gradient(135deg, rgba(139,92,246,0.85), rgba(109,40,217,0.85));
    border-color: rgba(139,92,246,0.6);
    color: #fff;
    cursor: pointer;
}

.td-next-step-btn:not([disabled]):hover {
    background: linear-gradient(135deg, rgba(139,92,246,1), rgba(109,40,217,1));
}

.td-asset-flow-step {
    color: rgba(219, 234, 254, 0.78);
    font-size: 11px;
    font-weight: 900;
}

.td-asset-flow-main {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
}

.td-step2-section-kicker {
    margin-bottom: 4px;
    color: #38bdf8;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.td-step2-section-head--assets {
    margin-top: 26px;
}

.td-step2-footer-actions {
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.td-textarea {
    min-height: 180px;
}

.td-project-pill {
    display: inline-flex;
    margin-bottom: 16px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-base);
    color: var(--text-secondary);
}

.td-project-pill--split {
    width: min(100%, 920px);
    display: grid;
    grid-template-columns: 1.15fr 1fr 1fr;
    gap: 12px;
    align-items: stretch;
    margin: 4px 0 18px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
}

.td-project-pill--editor {
    width: min(100%, 1120px);
    display: grid;
    grid-template-columns: minmax(220px, 1.2fr) minmax(180px, 1fr) minmax(180px, 1fr) 120px;
    gap: 12px;
    align-items: stretch;
    margin: 6px 0 18px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
}

.td-save-project-btn {
    min-height: 56px;
    gap: 7px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
}

.td-project-pill-segment {
    position: relative;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 10px 14px;
    border: 1px solid rgba(148,163,184,0.18);
    border-radius: 14px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.02)),
        rgba(10, 13, 20, 0.82);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 10px 22px rgba(0,0,0,0.14);
}

.td-project-pill-segment--editor {
    gap: 12px;
    min-height: 56px;
    padding: 10px 14px 10px 16px;
}

.td-project-pill-segment::before {
    content: '';
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 3px;
    border-radius: 999px;
    background: linear-gradient(180deg, #38bdf8, #8b5cf6);
    opacity: 0.8;
}

.td-project-pill-label {
    flex: 0 0 auto;
    color: #93c5fd;
    font-size: 12px;
    font-weight: 800;
}

.td-project-pill-input,
.td-project-pill-select {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: #f8fafc;
    font-size: 15px;
    font-weight: 700;
    padding: 0;
    appearance: none;
}

.td-project-pill-input::placeholder {
    color: rgba(226, 232, 240, 0.6);
}

.td-project-pill-select {
    cursor: pointer;
    padding-right: 18px;
    background-image: linear-gradient(45deg, transparent 50%, #93c5fd 50%), linear-gradient(135deg, #93c5fd 50%, transparent 50%);
    background-position: calc(100% - 10px) calc(50% - 1px), calc(100% - 5px) calc(50% - 1px);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}

.td-project-pill-select option {
    background: #111827;
    color: #f8fafc;
}

.td-stage-actions {
    gap: 12px;
    flex-wrap: wrap;
}

.td-analyze-preview {
    margin-top: 18px;
    border: 1px solid var(--border-base);
    border-radius: 18px;
    background: rgba(255,255,255,0.03);
    padding: 16px;
}

.td-preview-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.td-analyze-list {
    display: grid;
    gap: 10px;
}

.td-analyze-item {
    border: 1px solid var(--border-base);
    border-radius: 14px;
    padding: 12px;
    background: rgba(255,255,255,0.02);
}

.td-analyze-kind {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.td-analyze-name {
    color: var(--text-primary);
    font-weight: 600;
}

.td-mapping-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.td-mapping-grid.is-single-detail {
    grid-template-columns: 1fr;
}

.td-mapping-column {
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 20px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.018)),
        rgba(8, 13, 22, 0.78);
    padding: 14px;
    box-shadow: 0 18px 42px rgba(2, 6, 23, 0.24);
}

.td-mapping-column.is-single-detail {
    padding: 16px;
}

.td-mapping-column.is-single-detail .td-mapping-card-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.td-mapping-column.is-single-detail .td-mapping-card {
    margin-bottom: 0;
}

.td-mapping-column-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    padding: 13px 14px;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    background: rgba(255,255,255,0.03);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), 0 8px 18px rgba(15, 23, 42, 0.18);
    text-transform: none;
}

.td-mapping-column-title--characters {
    border: 1px solid rgba(96, 165, 250, 0.38);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.92), rgba(59, 130, 246, 0.66));
    color: #eff6ff;
}

.td-mapping-column-title--scenes {
    border: 1px solid rgba(52, 211, 153, 0.38);
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.92), rgba(16, 185, 129, 0.66));
    color: #ecfdf5;
}

.td-mapping-column-title--props {
    border: 1px solid rgba(250, 204, 21, 0.4);
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.94), rgba(245, 158, 11, 0.72));
    color: #fff7ed;
}

.td-mapping-column-label {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    gap: 10px;
    letter-spacing: 0;
}

.td-mapping-column-label i {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    background: rgba(255,255,255,0.18);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}

.td-mapping-column-count {
    min-width: 48px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.28);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.14);
}

.td-mapping-card {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 16px;
    padding: 13px;
    background:
        radial-gradient(circle at top right, rgba(255,255,255,0.055), transparent 28%),
        rgba(255,255,255,0.026);
    margin-bottom: 11px;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.td-mapping-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(148, 163, 184, 0.24);
}

.td-mapping-card:hover {
    transform: translateY(-2px);
    border-color: rgba(96,165,250,0.30);
    box-shadow: 0 14px 30px rgba(2, 6, 23, 0.28);
}

.td-mapping-card--characters {
    border-color: rgba(96, 165, 250, 0.16);
}

.td-mapping-card--characters::before {
    background: linear-gradient(90deg, #38bdf8, rgba(59, 130, 246, 0.2));
}

.td-mapping-card--scenes {
    border-color: rgba(52, 211, 153, 0.16);
}

.td-mapping-card--scenes::before {
    background: linear-gradient(90deg, #34d399, rgba(16, 185, 129, 0.2));
}

.td-mapping-card--props {
    border-color: rgba(250, 204, 21, 0.16);
}

.td-mapping-card--props::before {
    background: linear-gradient(90deg, #facc15, rgba(245, 158, 11, 0.2));
}

.td-mapping-kind-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.td-mapping-kind-badge--characters {
    background: rgba(59, 130, 246, 0.14);
    color: #93c5fd;
}

.td-mapping-kind-badge--scenes {
    background: rgba(16, 185, 129, 0.14);
    color: #86efac;
}

.td-mapping-kind-badge--props {
    background: rgba(245, 158, 11, 0.14);
    color: #fcd34d;
}

.td-mapping-name {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 8px;
    line-height: 1.45;
    word-break: break-word;
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.td-asset-id-badge {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    font-family: monospace;
    color: #a78bfa;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 4px;
    padding: 1px 5px;
    line-height: 1.6;
}

.td-mapping-prompt-flag {
    display: inline-flex;
    align-items: center;
    margin-bottom: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.14);
    border: 1px solid rgba(96, 165, 250, 0.24);
    color: #93c5fd;
    font-size: 11px;
    font-weight: 700;
}

.td-mapping-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 220px;
    overflow: auto;
    padding-right: 2px;
}

.td-asset-thumb {
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.72), rgba(30, 41, 59, 0.52)),
        linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px),
        linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 100% 100%, 20px 20px, 20px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 13px;
    margin-bottom: 10px;
    overflow: hidden;
}

.td-asset-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.td-asset-thumb.has-image {
    cursor: pointer;
    position: relative;
    transition: opacity 0.2s;
}

.td-asset-thumb.has-image:hover {
    opacity: 0.85;
}

.td-asset-thumb.has-image:hover .td-thumb-download-btn {
    opacity: 1;
}

.td-thumb-download-btn {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    z-index: 2;
}

.td-thumb-download-btn:hover {
    background: rgba(102,126,234,0.75);
}

.td-asset-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.td-mapping-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.td-mapping-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    padding: 4px 10px;
}

.td-mapping-action-btn--library {
    font-weight: 600;
}

.td-mapping-action-btn--characters {
    border-color: rgba(96, 165, 250, 0.28);
    color: #bfdbfe;
}

.td-mapping-action-btn--scenes {
    border-color: rgba(52, 211, 153, 0.28);
    color: #a7f3d0;
}

.td-mapping-action-btn--props {
    border-color: rgba(250, 204, 21, 0.28);
    color: #fde68a;
}

.td-debug-box {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255,255,255,0.035);
    border: 1px dashed rgba(255,255,255,0.10);
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
}

.td-debug-box .fa-spinner {
    font-size: 14px;
    vertical-align: middle;
}

@keyframes tdStatusPulse {
    0%, 100% { border-color: rgba(255,255,255,0.10); }
    50% { border-color: rgba(99,139,255,0.35); }
}

.td-debug-box.analyzing {
    animation: tdStatusPulse 2s ease-in-out infinite;
}

.td-mapping-status {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(245,158,11,0.12);
    color: #fcd34d;
    font-size: 12px;
    margin-bottom: 10px;
}

.td-mapping-status.mapped {
    background: rgba(34,197,94,0.12);
    color: #86efac;
}

.td-auto-convert-note {
    margin: 2px 0 18px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(245,158,11,0.24);
    background: rgba(245,158,11,0.08);
    color: #fcd34d;
    line-height: 1.6;
    animation: fadeIn 0.22s ease;
}

.td-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 3000;
    padding: 24px;
}

.td-modal-panel {
    width: min(980px, 100%);
    margin: 0 auto;
    background: linear-gradient(180deg, rgba(20,20,22,0.98), rgba(15,15,18,1));
    border: 1px solid var(--border-base);
    border-radius: 24px;
    padding: 22px;
    box-shadow: var(--shadow-lg);
}

.td-modal-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.td-modal-head h3 {
    color: var(--text-primary);
}

.td-modal-close-x {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(148, 163, 184, 0.08);
    color: #94a3b8;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.td-modal-close-x:hover {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

.td-modal .modal-body label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
}

.td-library-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.td-library-tab {
    border: 1px solid var(--border-base);
    border-radius: 999px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.03);
    color: var(--text-primary);
    cursor: pointer;
}

.td-library-tab.active {
    border-color: rgba(139, 92, 246, 0.55);
    background: linear-gradient(180deg, rgba(124,58,237,0.18), rgba(124,58,237,0.06));
}

.td-library-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.td-library-box {
    border: 1px solid var(--border-base);
    border-radius: 18px;
    background: rgba(255,255,255,0.03);
    padding: 16px;
}

.td-library-list {
    display: grid;
    gap: 10px;
    max-height: 520px;
    overflow-y: auto;
    padding-right: 6px;
}

.td-library-item {
    border: 1px solid var(--border-base);
    border-radius: 14px;
    padding: 12px;
    background: rgba(255,255,255,0.02);
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
}

.td-library-list::-webkit-scrollbar {
    width: 8px;
}

.td-library-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.18);
    border-radius: 999px;
}

.td-storyboard-list {
    display: grid;
    gap: 14px;
    margin-bottom: 18px;
}

.td-storyboard-card {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(96, 165, 250, 0.16);
    border-radius: 20px;
    background:
        linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px),
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.12), transparent 26%),
        linear-gradient(180deg, rgba(255,255,255,0.048), rgba(255,255,255,0.024));
    background-size: 34px 34px, 100% 100%, 100% 100%;
    padding: 18px;
    box-shadow: 0 18px 42px rgba(2, 6, 23, 0.28);
}

.td-storyboard-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(180deg, #38bdf8, #22c55e);
}

.td-storyboard-card > * {
    position: relative;
    z-index: 1;
}

.td-storyboard-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.td-storyboard-title-block {
    flex: 1 1 520px;
    min-width: 0;
}

.td-storyboard-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.td-storyboard-head-right {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.td-storyboard-state {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(148, 163, 184, 0.10);
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.td-storyboard-state.is-ready,
.td-storyboard-state.is-done {
    border-color: rgba(34, 197, 94, 0.24);
    background: rgba(34, 197, 94, 0.14);
    color: #86efac;
}

.td-storyboard-state.is-active {
    border-color: rgba(96, 165, 250, 0.26);
    background: rgba(59, 130, 246, 0.14);
    color: #93c5fd;
}

.td-storyboard-state.is-failed {
    border-color: rgba(248, 113, 113, 0.28);
    background: rgba(248, 113, 113, 0.12);
    color: #fca5a5;
}

.td-storyboard-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.td-collapse-btn {
    min-width: 96px;
}

.td-storyboard-title {
    font-weight: 900;
    color: #f8fafc;
    font-size: 17px;
    line-height: 1.4;
    letter-spacing: 0;
}

.td-storyboard-segment {
    display: inline-flex;
    margin-top: 3px;
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.5;
}

.td-storyboard-text {
    color: #dbe4f0;
    line-height: 1;
    margin-bottom: 12px;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid rgba(148, 163, 184, 0.10);
    border-radius: 14px;
    background: rgba(2, 6, 23, 0.22);
    padding: 4px 10px;
}

.td-storyboard-text.is-expanded {
    max-height: 420px;
    overflow: auto;
    padding: 0 10px 6px 10px;
}

.td-text-preview {
    display: inline;
}

.td-text-full {
    display: block;
    white-space: pre-wrap;
}

.td-text-toggle-btn {
    display: inline-block;
    float: right;
    margin-top: 2px;
    margin-left: 8px;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.15);
    color: #94a3b8;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.td-text-toggle-btn:hover {
    background: rgba(148, 163, 184, 0.16);
    color: #cbd5e1;
    border-color: rgba(148, 163, 184, 0.25);
}

.td-text-toggle-btn i {
    margin-right: 4px;
    font-size: 10px;
}

.td-storyboard-editor {
    width: 100%;
    min-height: 116px;
    padding: 14px 16px;
    margin-bottom: 12px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.03);
    color: #e4e4e7;
    font: inherit;
    line-height: 1.75;
    resize: vertical;
    outline: none;
    transition: border-color var(--trans-normal), box-shadow var(--trans-normal), background var(--trans-normal);
}

.td-storyboard-editor:focus {
    border-color: rgba(76, 133, 240, 0.42);
    box-shadow: 0 0 0 4px rgba(43, 109, 229, 0.14);
    background: rgba(255,255,255,0.045);
}

.td-card-asset-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.03);
}

.td-card-asset-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
}

.td-card-asset-item.is-ready {
    border: 1px solid rgba(34, 197, 94, 0.22);
    background: rgba(34, 197, 94, 0.14);
    color: #86efac;
}

.td-card-asset-item.is-pending {
    border: 1px solid rgba(239, 68, 68, 0.24);
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
}

.td-card-asset-item.is-empty {
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(148, 163, 184, 0.12);
    color: #cbd5e1;
}

.td-storyboard-editor.is-readonly {
    color: #d4d4d8;
    background: rgba(255,255,255,0.02);
    border-color: rgba(255,255,255,0.06);
    cursor: default;
}

.td-storyboard-actions .is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.td-storyboard-assets {
    margin-top: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255,255,255,0.035);
    border: 1px dashed rgba(255,255,255,0.10);
}

.td-storyboard-assets-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.td-tag-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.td-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(96, 165, 250, 0.18);
    background: rgba(59, 130, 246, 0.10);
    color: #bfdbfe;
    font-size: 12px;
    font-weight: 700;
}

.td-tag.asset {
    background: rgba(255,255,255,0.08);
    color: var(--text-secondary);
}

/* ── Card pipeline ── */

.td-card-asset-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 12px;
    margin: 10px 0 12px;
    border: 1px solid rgba(148, 163, 184, 0.10);
    border-radius: 14px;
    background: rgba(255,255,255,0.035);
    font-size: 12px;
    color: var(--text-secondary);
}

.td-card-pipeline-status {
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 12px;
    margin: 8px 0;
    word-break: break-word;
    line-height: 1.5;
    border: 1px solid rgba(255,255,255,0.08);
}

.td-mapping-error {
    font-size: 11px;
    color: #fca5a5;
    background: rgba(248,113,113,0.08);
    padding: 6px 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    line-height: 1.5;
    word-break: break-word;
}

.td-pipeline-active {
    background: rgba(96,165,250,0.12);
    color: #93c5fd;
}

.td-pipeline-active .fa-spinner {
    font-size: 12px;
    vertical-align: middle;
}

.td-pipeline-done {
    background: rgba(34,197,94,0.12);
    color: #86efac;
}

.td-pipeline-failed {
    background: rgba(248,113,113,0.12);
    color: #fca5a5;
}

.td-card-video {
    width: 100%;
    border-radius: 12px;
    margin: 0;
    background: #000;
}

.td-card-media-row {
    display: grid;
    grid-template-columns: minmax(168px, 220px) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    margin: 10px 0;
}

.td-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.td-card-actions--inline {
    margin-top: 0;
}

.td-card-actions--asset-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 0;
    align-items: center;
    gap: 7px;
    padding: 4px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 14px;
    background: rgba(2, 6, 23, 0.22);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.td-batch-video-btn {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
    background: linear-gradient(180deg, #2f7cf6, #1d5ed8);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.16), 0 12px 24px rgba(37, 99, 235, 0.22);
}

.td-batch-video-btn:disabled {
    border-color: rgba(251, 146, 60, 0.82);
    color: #fff7ed;
    background:
        radial-gradient(circle at 18% 0%, rgba(255,255,255,0.22), transparent 34%),
        linear-gradient(135deg, #f97316 0%, #dc2626 58%, #991b1b 100%);
    box-shadow:
        0 0 0 3px rgba(248, 113, 113, 0.18),
        0 12px 26px rgba(220, 38, 38, 0.34),
        inset 0 1px 0 rgba(255,255,255,0.18);
    cursor: not-allowed;
}

.td-batch-video-btn:disabled i {
    background: rgba(255,255,255,0.20);
    color: #fff7ed;
}

.ld-batch-video-btn {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
    background: linear-gradient(180deg, #2f7cf6, #1d5ed8);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.16), 0 12px 24px rgba(37, 99, 235, 0.22);
}

.ld-batch-video-btn:disabled {
    border-color: rgba(251, 146, 60, 0.82);
    color: #fff7ed;
    background:
        radial-gradient(circle at 18% 0%, rgba(255,255,255,0.22), transparent 34%),
        linear-gradient(135deg, #f97316 0%, #dc2626 58%, #991b1b 100%);
    box-shadow:
        0 0 0 3px rgba(248, 113, 113, 0.18),
        0 12px 26px rgba(220, 38, 38, 0.34),
        inset 0 1px 0 rgba(255,255,255,0.18);
    cursor: not-allowed;
}

.ld-batch-video-btn:disabled i {
    background: rgba(255,255,255,0.20);
    color: #fff7ed;
}

.td-card-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    padding: 7px 13px;
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.td-card-btn:not(:disabled):hover {
    transform: translateY(-1px);
}

.td-card-btn--video {
    min-width: 118px;
    min-height: 38px;
    padding: 9px 18px;
    border: 1px solid rgba(165, 243, 252, 0.72);
    border-color: rgba(165, 243, 252, 0.72);
    border-radius: 12px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 950;
    background:
        radial-gradient(circle at 18% 0%, rgba(255,255,255,0.36), transparent 34%),
        linear-gradient(135deg, #06b6d4 0%, #2563eb 52%, #1d4ed8 100%);
    box-shadow:
        0 0 0 3px rgba(34, 211, 238, 0.13),
        0 14px 30px rgba(37, 99, 235, 0.38),
        inset 0 1px 0 rgba(255,255,255,0.26);
}

.td-card-btn--video i {
    width: 21px;
    height: 21px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(255,255,255,0.18);
    color: #ecfeff;
    font-size: 11px;
}

.td-card-btn--video:not(:disabled):hover {
    border-color: rgba(236, 254, 255, 0.92);
    background:
        radial-gradient(circle at 18% 0%, rgba(255,255,255,0.42), transparent 34%),
        linear-gradient(135deg, #22d3ee 0%, #2f7cf6 52%, #1d4ed8 100%);
    box-shadow:
        0 0 0 4px rgba(34, 211, 238, 0.18),
        0 18px 34px rgba(37, 99, 235, 0.46),
        inset 0 1px 0 rgba(255,255,255,0.30);
}

.td-card-btn--video.is-loading,
.td-card-btn--video.is-loading:disabled {
    opacity: 1;
    border-color: rgba(125, 211, 252, 0.9);
    color: #eff6ff;
    background:
        linear-gradient(90deg, rgba(255,255,255,0.24), transparent 34%, rgba(255,255,255,0.18) 68%, transparent),
        linear-gradient(135deg, #0891b2 0%, #2563eb 54%, #4f46e5 100%);
    background-size: 220% 100%, 100% 100%;
    box-shadow:
        0 0 0 3px rgba(96, 165, 250, 0.20),
        0 16px 34px rgba(37, 99, 235, 0.44),
        inset 0 1px 0 rgba(255,255,255,0.24);
    cursor: not-allowed;
    animation: tdVideoButtonLoading 1.05s ease-in-out infinite;
}

.td-card-btn--video.is-loading i {
    background: rgba(255,255,255,0.22);
    color: #eff6ff;
}

.td-card-btn--video:disabled {
    opacity: 1;
    border-color: rgba(251, 146, 60, 0.82);
    color: #fff7ed;
    background:
        radial-gradient(circle at 18% 0%, rgba(255,255,255,0.22), transparent 34%),
        linear-gradient(135deg, #f97316 0%, #dc2626 58%, #991b1b 100%);
    box-shadow:
        0 0 0 3px rgba(248, 113, 113, 0.18),
        0 12px 26px rgba(220, 38, 38, 0.34),
        inset 0 1px 0 rgba(255,255,255,0.18);
    cursor: not-allowed;
}

.td-card-btn--video.is-done {
    opacity: 1;
    border-color: rgba(74, 222, 128, 0.60);
    color: #f0fdf4;
    background:
        radial-gradient(circle at 15% 0%, rgba(255,255,255,0.20), transparent 38%),
        linear-gradient(135deg, #15803d 0%, #16a34a 52%, #166534 100%);
    box-shadow:
        0 0 0 3px rgba(74, 222, 128, 0.14),
        0 10px 24px rgba(21, 128, 61, 0.30),
        inset 0 1px 0 rgba(255,255,255,0.18);
    pointer-events: none;
    cursor: default;
}

.td-card-btn--video.is-done i {
    background: rgba(255,255,255,0.20);
    color: #bbf7d0;
}


    0% { background-position: 0% 50%, 0 0; }
    50% { background-position: 100% 50%, 0 0; }
    100% { background-position: 0% 50%, 0 0; }
}

.td-card-btn--video:disabled i {
    background: rgba(255,255,255,0.20);
    color: #fff7ed;
}

.td-card-btn--edit {
    border-color: rgba(251, 191, 36, 0.55);
    color: #fef3c7;
    background:
        linear-gradient(135deg, rgba(120, 53, 15, 0.60) 0%, rgba(180, 83, 9, 0.55) 50%, rgba(120, 53, 15, 0.60) 100%);
    box-shadow:
        0 0 0 1px rgba(251, 191, 36, 0.18),
        0 6px 16px rgba(245, 158, 11, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    animation: tdEditBtnPulse 2.4s ease-in-out infinite;
}

@keyframes tdEditBtnPulse {
    0%, 100% { box-shadow: 0 0 0 1px rgba(251,191,36,0.18), 0 6px 16px rgba(245,158,11,0.22), inset 0 1px 0 rgba(255,255,255,0.12); }
    50%       { box-shadow: 0 0 0 3px rgba(251,191,36,0.30), 0 8px 22px rgba(245,158,11,0.40), inset 0 1px 0 rgba(255,255,255,0.16); }
}

.td-card-btn--cancel {
    border-color: rgba(148, 163, 184, 0.20);
    color: #dbeafe;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.88));
}

.td-card-btn--edit:not(:disabled):hover {
    border-color: rgba(251, 191, 36, 0.80);
    background:
        linear-gradient(135deg, rgba(180, 83, 9, 0.75) 0%, rgba(217, 119, 6, 0.70) 50%, rgba(180, 83, 9, 0.75) 100%);
    box-shadow:
        0 0 0 3px rgba(251, 191, 36, 0.25),
        0 10px 24px rgba(245, 158, 11, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.18);
    animation: none;
}

.td-card-btn--cancel:not(:disabled):hover {
    border-color: rgba(147, 197, 253, 0.40);
    background:
        linear-gradient(180deg, rgba(51, 65, 85, 0.94), rgba(15, 23, 42, 0.90));
}

.td-card-btn--save {
    border-color: rgba(74, 222, 128, 0.38);
    color: #052e16;
    background: linear-gradient(180deg, #86efac, #22c55e);
    box-shadow: 0 9px 18px rgba(34, 197, 94, 0.20), inset 0 1px 0 rgba(255,255,255,0.22);
}

.td-card-failed {
    border-color: rgba(248,113,113,0.3) !important;
}

.td-card-failed::before {
    background: linear-gradient(180deg, #ef4444, #f97316);
}

.td-tail-frame {
    position: relative;
    padding: 10px;
    border: 1px solid rgba(56, 189, 248, 0.24);
    border-radius: 14px;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.86), rgba(2, 6, 23, 0.66));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.td-card-media-row .td-tail-frame::after {
    content: '';
    position: absolute;
    top: 26px;
    right: -8px;
    width: 14px;
    height: 14px;
    border-top: 1px solid rgba(56, 189, 248, 0.24);
    border-right: 1px solid rgba(56, 189, 248, 0.24);
    background: rgba(15, 23, 42, 0.86);
    transform: rotate(45deg);
}

.td-tail-frame-title {
    margin-bottom: 8px;
    color: #7dd3fc;
    font-size: 11px;
    font-weight: 900;
}

.td-tail-frame img {
    width: 100%;
    display: block;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
}

.td-tail-frame-preview {
    position: relative;
    width: 100%;
    display: block;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #ffffff;
    cursor: zoom-in;
    overflow: hidden;
}

.td-tail-frame-preview span {
    position: absolute;
    inset: auto 8px 8px 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 28px;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 999px;
    background: rgba(2, 6, 23, 0.72);
    color: #e0f2fe;
    font-size: 11px;
    font-weight: 900;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.td-tail-frame-preview::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 42%, rgba(2, 6, 23, 0.62));
    opacity: 0;
    transition: opacity 0.16s ease;
}

.td-tail-frame-preview:hover span,
.td-tail-frame-preview:hover::before,
.td-tail-frame-preview:focus-visible span,
.td-tail-frame-preview:focus-visible::before {
    opacity: 1;
    transform: translateY(0);
}

.td-result-panel {
    border: 1px solid rgba(34,197,94,0.16);
    border-radius: 22px;
    background: radial-gradient(circle at top left, rgba(34,197,94,0.08), transparent 28%), linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.025));
    padding: 18px;
    margin-bottom: 18px;
    box-shadow: 0 14px 32px rgba(0,0,0,0.16);
}

.td-result-status {
    display: inline-flex;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(245,158,11,0.12);
    color: #fcd34d;
    font-size: 12px;
    margin-bottom: 14px;
}

.td-timeline {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.td-timeline-item {
    border: 1px solid var(--border-base);
    border-radius: 14px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.03);
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.td-timeline-item.active,
.td-timeline-item.done {
    border-color: rgba(34,197,94,0.28);
    transform: translateY(-1px);
}

.td-timeline-item.done {
    background: rgba(34,197,94,0.08);
}

.td-timeline-kicker {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.td-timeline-title {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 13px;
}

.td-mock-player {
    aspect-ratio: 16 / 9;
    border-radius: 16px;
    border: 1px dashed var(--border-light);
    background: rgba(0,0,0,0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #cbd5e1;
    padding: 20px;
}

.td-reference-modal {
    position: fixed;
    inset: 0;
    z-index: 10020;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background:
        linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px),
        rgba(4, 7, 14, 0.78);
    background-size: 42px 42px, 42px 42px, 100% 100%;
    backdrop-filter: blur(12px);
}

.td-reference-modal[hidden] {
    display: none !important;
}

.td-reference-panel {
    width: min(1180px, 96vw);
    height: min(820px, 90vh);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 22px;
    background:
        radial-gradient(circle at 88% 8%, rgba(56,189,248,0.16), transparent 28%),
        linear-gradient(135deg, rgba(18,20,31,0.98), rgba(9,11,18,0.98));
    box-shadow: 0 24px 80px rgba(0,0,0,0.45);
}

.td-reference-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 24px 28px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.td-reference-head h3 {
    margin: 0;
    color: #f8fafc;
    font-size: 24px;
    font-weight: 800;
    line-height: 1.25;
    word-break: break-word;
}

.td-reference-close {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}

.td-reference-layout {
    min-height: 0;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    flex: 1;
}

.td-reference-toc {
    overflow: auto;
    padding: 18px 14px 18px 18px;
    background: rgba(255,255,255,0.025);
    border-right: 1px solid rgba(255,255,255,0.08);
}

.td-reference-toc a,
.td-reference-toc span {
    display: block;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 12px;
    color: #9ca3af;
    text-decoration: none;
    font-size: 13px;
    line-height: 1.5;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.td-reference-toc a:hover {
    background: rgba(56,189,248,0.08);
    border-color: rgba(56,189,248,0.18);
    color: #e0f2fe;
    transform: translateX(2px);
}

.td-reference-content {
    overflow: auto;
    padding: 34px 42px 48px;
    scroll-behavior: smooth;
}

.td-reference-section {
    max-width: 840px;
    margin: 0 auto 34px;
    padding: 28px 30px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px;
    background: rgba(255,255,255,0.032);
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.td-reference-section h4 {
    margin: 0 0 20px;
    color: #f8fafc;
    font-size: 28px;
    font-weight: 900;
    line-height: 1.35;
    padding: 16px 18px;
    border: 1px solid rgba(56,189,248,0.28);
    border-left: 6px solid #38bdf8;
    border-radius: 16px;
    background: linear-gradient(90deg, rgba(56,189,248,0.16), rgba(124,58,237,0.08));
}

.td-reference-section p {
    margin: 0 0 10px;
    padding: 0;
    color: #cbd5e1;
    font-size: 14px;
    line-height: 1.85;
    white-space: pre-wrap;
    word-break: break-word;
}

.td-reference-state {
    padding: 28px;
    color: var(--text-secondary);
    text-align: center;
}

@media (max-width: 900px) {
    .td-project-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .td-stepbar,
    .td-mapping-grid,
    .td-library-layout,
    .td-style-grid {
        grid-template-columns: 1fr;
    }

    .td-stage3-hero,
    .td-step2-command,
    .td-detail-switcher {
        grid-template-columns: 1fr;
    }

    .td-stage3-hero {
        padding: 18px;
    }

    .td-step2-flow {
        grid-template-columns: 1fr;
    }

    .td-step2-flow-line {
        width: 2px;
        height: 18px;
        justify-self: center;
    }

    .td-step2-actions,
    .td-section-action-row,
    .td-step2-footer-actions {
        justify-content: flex-start;
    }

    .td-auto-flow-actions,
    .td-asset-flow-actions {
        width: 100%;
        flex-direction: column;
    }

    .td-auto-flow-btn,
    .td-asset-flow-btn {
        width: 100%;
    }

    .td-auto-flow-btn:not(:last-child)::after,
    .td-asset-flow-btn:not(:last-child)::after {
        top: auto;
        right: 50%;
        bottom: -10px;
        transform: translateX(50%) rotate(90deg);
    }

    .td-step2-action-btn,
    .td-step2-generate-btn,
    .td-section-generate-btn,
    .td-add-asset-btn,
    .td-video-size-control {
        width: 100%;
    }

    .td-video-size-control select {
        flex: 1;
        width: auto;
    }

    .td-step2-section-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .td-storyboard-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .td-storyboard-head-right {
        justify-content: flex-start;
    }

    .td-card-media-row {
        grid-template-columns: 1fr;
    }

    .td-card-media-row .td-tail-frame::after {
        display: none;
    }

    .td-upload-split {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .td-auto-upload-stack {
        grid-template-columns: 1fr;
    }

    .td-upload-divider {
        display: none;
    }

    .td-upload-pane-title--manual,
    .td-upload-chip-row--manual {
        text-align: left;
        justify-content: flex-start;
    }

    .td-upload-chip--manual {
        min-width: 0;
        width: calc(50% - 7px);
    }

    .td-manual-upload-grid {
        grid-template-columns: 1fr;
    }

    .td-reference-modal {
        padding: 12px;
    }

    .td-reference-panel {
        width: 96vw;
        height: 92vh;
        border-radius: 18px;
    }

    .td-reference-layout {
        grid-template-columns: 1fr;
    }

    .td-reference-toc {
        max-height: 120px;
        border-right: 0;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }

    .td-reference-content {
        padding: 20px;
    }

    .td-reference-section {
        padding: 20px 18px;
        border-radius: 14px;
    }

    .td-reference-section h4 {
        font-size: 18px;
    }

    .td-project-pill--split,
    .td-project-pill--editor {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .td-modal {
        padding: 12px;
    }
}
