:root {
    --bg-dark: #0f172a;
    --bg-gradient: radial-gradient(circle at top center, #1e293b 0%, #0f172a 100%);
    --panel-bg: rgba(30, 41, 59, 0.7);
    --panel-border: rgba(255, 255, 255, 0.08);
    --primary: #6366f1;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --primary-hover: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --text-main: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --surface-bg: #1e293b;
    --input-bg: rgba(0, 0, 0, 0.2);
    --hover-bg: rgba(255, 255, 255, 0.05);
    --hover-bg-strong: rgba(255, 255, 255, 0.1);
    --card-bg: rgba(255, 255, 255, 0.03);
    --border-strong: rgba(255, 255, 255, 0.15);
    --input-focus-bg: rgba(0, 0, 0, 0.3);
    --scrollbar-thumb: rgba(255, 255, 255, 0.1);
    --scrollbar-thumb-hover: rgba(255, 255, 255, 0.2);
    
    /* New Theme Variables */
    --tab-bg: rgba(0,0,0,0.2);
    --tab-item-hover: rgba(255,255,255,0.05);
    --tab-badge-bg: rgba(255,255,255,0.2);
    --tab-badge-active-bg: rgba(255,255,255,0.25);
    --upload-bg: rgba(255,255,255,0.02);
    --upload-border: rgba(255,255,255,0.15);
    --placeholder-color: rgba(255,255,255,0.3);
    --separator: rgba(255, 255, 255, 0.05);
    --action-btn-bg: rgba(255, 255, 255, 0.05);
    --action-btn-hover: rgba(255, 255, 255, 0.1);
    
    --badge-queued: #facc15;
    --badge-processing: #60a5fa;
    --badge-completed: #34d399;
    --badge-failed: #f87171;

    --item-bg: rgba(255,255,255,0.03);
    --item-hover-bg: rgba(255,255,255,0.06);
    --item-hover-border: rgba(255,255,255,0.1);
    --btn-secondary-bg: rgba(255,255,255,0.05);
    --spinner-track: rgba(255,255,255,0.1);

    --batch-card-bg: rgba(255,255,255,0.02);
    --batch-card-hover: rgba(255,255,255,0.04);
    --batch-card-border-hover: rgba(255,255,255,0.15);
    --video-card-bg: #000;
    --video-wrapper-bg: #0f172a;
    --video-info-border: rgba(255, 255, 255, 0.05);

    --badge-processing-bg: rgba(59,130,246,0.15);
    --badge-processing-border: rgba(59,130,246,0.2);
    --badge-completed-bg: rgba(16, 185, 129, 0.15);
    --badge-completed-border: rgba(16, 185, 129, 0.2);
    --badge-failed-bg: rgba(239,68,68,0.15);
    --badge-failed-border: rgba(239,68,68,0.2);

    --progress-text: #60a5fa;
}

[data-theme="light"] {
    --bg-dark: #f8fafc;
    --bg-gradient: radial-gradient(circle at top center, #e2e8f0 0%, #f1f5f9 100%);
    --panel-bg: rgba(255, 255, 255, 0.7);
    --panel-border: rgba(0, 0, 0, 0.1);
    --text-main: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --surface-bg: #ffffff;
    --input-bg: rgba(0, 0, 0, 0.05);
    --hover-bg: rgba(0, 0, 0, 0.05);
    --hover-bg-strong: rgba(0, 0, 0, 0.1);
    --card-bg: rgba(0, 0, 0, 0.03);
    --border-strong: rgba(0, 0, 0, 0.15);
    --input-focus-bg: rgba(0, 0, 0, 0.08);
    --scrollbar-thumb: rgba(0, 0, 0, 0.15);
    --scrollbar-thumb-hover: rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05);

    /* New Theme Variables */
    --tab-bg: rgba(0,0,0,0.05);
    --tab-item-hover: rgba(0,0,0,0.05);
    --tab-badge-bg: rgba(0,0,0,0.1);
    --tab-badge-active-bg: rgba(255,255,255,0.4);
    --upload-bg: rgba(0,0,0,0.02);
    --upload-border: rgba(0,0,0,0.15);
    --placeholder-color: rgba(0,0,0,0.4);
    --separator: rgba(0, 0, 0, 0.1);
    --action-btn-bg: rgba(0, 0, 0, 0.05);
    --action-btn-hover: rgba(0, 0, 0, 0.1);

    --badge-queued: #d97706;
    --badge-processing: #2563eb;
    --badge-completed: #059669;
    --badge-failed: #dc2626;

    --item-bg: rgba(0,0,0,0.02);
    --item-hover-bg: rgba(0,0,0,0.05);
    --item-hover-border: rgba(0,0,0,0.1);
    --btn-secondary-bg: rgba(0,0,0,0.05);
    --spinner-track: rgba(0,0,0,0.1);

    --batch-card-bg: #ffffff;
    --batch-card-hover: #f8fafc;
    --batch-card-border-hover: rgba(0,0,0,0.1);
    --video-card-bg: #f1f5f9;
    --video-wrapper-bg: #e2e8f0;
    --video-info-border: rgba(0, 0, 0, 0.05);

    --badge-processing-bg: rgba(37, 99, 235, 0.1);
    --badge-processing-border: rgba(37, 99, 235, 0.2);
    --badge-completed-bg: rgba(5, 150, 105, 0.1);
    --badge-completed-border: rgba(5, 150, 105, 0.2);
    --badge-failed-bg: rgba(220, 38, 38, 0.1);
    --badge-failed-border: rgba(220, 38, 38, 0.2);

    --video-status-bg: rgba(255,255,255,0.85);
    --progress-text: #2563eb;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    background-image: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

.container { 
    max-width: 1600px; 
    margin: 0 auto; 
    padding: 24px; 
    height: 100vh;
    display: flex;
    flex-direction: column;
}

h1 {
    text-align: center; 
    margin-bottom: 24px; 
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: var(--primary-gradient);
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 10px rgba(99, 102, 241, 0.2);
    flex-shrink: 0;
}

h2 { font-size: 1.1rem; font-weight: 600; color: var(--text-main); letter-spacing: -0.01em; }
h3 { font-size: 0.95rem; font-weight: 500; color: var(--text-secondary); }

/* Settings Button */
.settings-btn, .theme-btn {
    position: absolute; top: 24px; right: 24px;
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--hover-bg);
    border: 1px solid var(--panel-border);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: var(--transition);
    color: var(--text-secondary);
    z-index: 100;
}
.theme-btn {
    right: 76px; /* 24 + 40 + 12 gap */
}
.settings-btn:hover, .theme-btn:hover { 
    background: var(--hover-bg-strong); 
    color: var(--text-main);
}
.settings-btn:hover {
    transform: rotate(90deg); 
}
.theme-btn:hover {
    transform: rotate(15deg);
}

/* Modal */
.modal {
    display: none; position: fixed; top: 0; left: 0;
    width: 100%; height: 100%; 
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(8px);
    z-index: 1000; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.3s ease;
}
.modal.active { display: flex; opacity: 1; }
.modal-content { 
    background: var(--surface-bg); 
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg); 
    width: 90%; max-width: 400px; 
    box-shadow: var(--shadow-lg);
    transform: scale(0.95); transition: transform 0.3s ease;
    /* 修复动画可能导致的渲染问题 */
    backface-visibility: hidden;
}
.modal.active .modal-content { 
    transform: scale(1); 
    /* 确保动画结束时的状态稳定 */
    animation: modalSlideIn 0.3s ease forwards;
}

@keyframes modalSlideIn {
    from { transform: scale(0.95) translateY(10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 20px; border-bottom: 1px solid var(--panel-border); 
}
.close-btn { font-size: 24px; cursor: pointer; color: var(--text-secondary); transition: var(--transition); }
.close-btn:hover { color: var(--text-main); }
.modal-body { padding: 24px; }
.modal-footer { padding: 20px; border-top: 1px solid var(--panel-border); text-align: right; }

/* Main Layout */
.main-content { 
    display: grid; 
    grid-template-columns: 360px 1fr; 
    gap: 24px; 
    flex: 1;
    min-height: 0; /* Important for nested scrolling */
    transition: grid-template-columns 0.3s ease;
}


.left-panel, .right-panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg); 
    padding: 24px;
    backdrop-filter: blur(20px);
    display: flex; flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.left-panel { overflow-y: auto; }

/* Common Header Styles */
.panel-header, .settings-header { 
    display: flex; justify-content: space-between; align-items: center; 
    margin-bottom: 20px; flex-shrink: 0;
}

/* Tabs */
.record-tabs {
    display: flex; gap: 4px; margin-bottom: 20px;
    background: var(--tab-bg);
    padding: 4px; border-radius: var(--radius-md);
    flex-shrink: 0;
}
.tab-btn {
    flex: 1; padding: 8px 12px; border: none;
    background: transparent; color: var(--text-secondary);
    font-size: 0.85rem; font-weight: 500; cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.tab-btn:hover { color: var(--text-main); background: var(--tab-item-hover); }
.tab-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.tab-btn span {
    background: var(--tab-badge-bg);
    padding: 1px 6px; border-radius: 10px;
    font-size: 0.75rem;
}
.tab-btn.active span { background: var(--tab-badge-active-bg); color: #fff; }

/* Mode Toggle */
.mode-toggle { 
    display: flex; gap: 4px; 
    background: var(--tab-bg); 
    padding: 4px; border-radius: var(--radius-md); 
}
.mode-btn {
    padding: 6px 14px; border: none; border-radius: var(--radius-sm);
    background: transparent; color: var(--text-secondary); 
    font-size: 0.8rem; font-weight: 600;
    cursor: pointer; transition: var(--transition);
}
.mode-btn.active { background: #334155; color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.mode-btn:hover:not(.active) { color: var(--text-main); }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-group label { 
    display: block; margin-bottom: 8px; 
    font-size: 0.85rem; font-weight: 500; 
    color: var(--text-secondary); 
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

input, textarea, select {
    width: 100%; padding: 12px 16px;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md); 
    background-color: var(--input-bg);
    color: var(--text-main); 
    font-size: 0.95rem; font-family: inherit;
    transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}
input:focus, textarea:focus, select:focus {
    outline: none; 
    border-color: var(--primary);
    background-color: var(--input-focus-bg);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}
input::placeholder, textarea::placeholder { color: var(--placeholder-color); }

textarea { resize: vertical; min-height: 100px; line-height: 1.6; }
#prompt { min-height: 240px; }

select {
    cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 16px center;
    background-color: var(--input-bg);
}
select option { background: var(--surface-bg); color: var(--text-main); }
select:focus {
    background-color: var(--input-focus-bg);
}

.form-group label.audio-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    background: var(--input-bg);
    margin-bottom: 0;
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 500;
}

.switch-control {
    display: inline-flex;
    align-items: center;
    margin: 0;
    cursor: pointer;
}

.switch-control input,
.audio-toggle-row input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
}

.switch-track {
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.25);
    border: 1px solid var(--panel-border);
    transition: var(--transition);
}

.switch-track::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    top: 2px;
    left: 2px;
    border-radius: 50%;
    background: var(--text-secondary);
    transition: var(--transition);
}

.switch-control input:checked + .switch-track,
.audio-toggle-row input:checked + .switch-track {
    background: var(--primary);
    border-color: var(--primary);
}

.switch-control input:checked + .switch-track::after,
.audio-toggle-row input:checked + .switch-track::after {
    transform: translateX(20px);
    background: #fff;
}

/* Upload Area */
.upload-area, .upload-area-small {
    position: relative; 
    border: 2px dashed var(--upload-border);
    border-radius: var(--radius-md); 
    padding: 32px 20px; 
    text-align: center;
    cursor: pointer; transition: var(--transition);
    background: var(--upload-bg);
}
.upload-area-small { padding: 20px; }
.upload-area:hover, .upload-area-small:hover { 
    border-color: var(--primary); 
    background: rgba(99, 102, 241, 0.05); 
}
.upload-placeholder p, .upload-placeholder-small p { 
    margin-top: 12px; font-size: 0.9rem; color: var(--text-muted); 
}
.upload-placeholder .upload-hint {
    margin-top: 4px;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.preview-image, .preview-video { 
    max-width: 100%; max-height: 200px; 
    border-radius: var(--radius-sm); 
    box-shadow: var(--shadow-md);
}

/* Buttons */
.btn {
    padding: 12px 24px; border: none; border-radius: var(--radius-md);
    font-size: 0.95rem; font-weight: 600; letter-spacing: 0.01em;
    cursor: pointer; transition: var(--transition);
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary, .btn-generate { 
    background: var(--primary-gradient); 
    color: #fff; 
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover, .btn-generate:hover { 
    background: var(--primary-hover);
    transform: translateY(-1px); 
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4); 
}
.btn-generate { width: 100%; padding: 16px; font-size: 1.05rem; margin-top: 10px; }
.btn-generate:disabled { 
    opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; 
    filter: grayscale(1);
}

.btn-clear-small {
    padding: 6px 12px; font-size: 0.8rem;
    background: rgba(239,68,68,0.1); color: #f87171; 
    border-radius: var(--radius-sm);
    border: 1px solid rgba(239,68,68,0.2);
}
.btn-clear-small:hover { background: rgba(239,68,68,0.2); }

.btn-refresh-small {
    padding: 6px 12px; font-size: 0.8rem;
    background: rgba(99, 102, 241, 0.12); color: #a5b4fc;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(99, 102, 241, 0.25);
}
.btn-refresh-small:hover { background: rgba(99, 102, 241, 0.22); }
.btn-refresh-small:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
}

/* Enhance Button */
.prompt-input-wrapper {
    position: relative;
}

.prompt-input-wrapper textarea {
    padding-right: 48px; /* Prevent text from going under the button */
}

.clear-prompt-btn {
    position: absolute; right: 8px; top: 48px;
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    background: rgba(239, 68, 68, 0.1); 
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger); 
    cursor: pointer; transition: var(--transition);
    display: flex; align-items: center; justify-content: center;
}
.clear-prompt-btn:hover { background: var(--danger); color: #fff; }

.enhance-btn {
    position: absolute; right: 8px; top: 8px;
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    background: rgba(99, 102, 241, 0.1); 
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: var(--primary); 
    cursor: pointer; transition: var(--transition);
    display: flex; align-items: center; justify-content: center;
}
.enhance-btn:hover { background: var(--primary); color: #fff; }

.paste-prompt-btn {
    position: absolute; right: 8px; top: 88px;
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    background: rgba(16, 185, 129, 0.1); 
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--success); 
    cursor: pointer; transition: var(--transition);
    display: flex; align-items: center; justify-content: center;
}
.paste-prompt-btn:hover { background: var(--success); color: #fff; }

.copy-prompt-btn {
    position: absolute; right: 8px; top: 128px;
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    background: rgba(245, 158, 11, 0.1); 
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #f59e0b; 
    cursor: pointer; transition: var(--transition);
    display: flex; align-items: center; justify-content: center;
}
.copy-prompt-btn:hover { background: #f59e0b; color: #fff; }

/* Batch List & Cards */
.batch-list { flex: 1; overflow-y: auto; padding-right: 4px; }
.batch-card {
    background: var(--batch-card-bg);
    border-radius: var(--radius-md); 
    margin-bottom: 16px;
    border: 1px solid var(--panel-border);
    overflow: hidden;
    transition: var(--transition);
}
.batch-card:hover { border-color: var(--batch-card-border-hover); background: var(--batch-card-hover); }
.batch-card.expanded { border-color: rgba(99, 102, 241, 0.4); background: rgba(99, 102, 241, 0.02); }

.batch-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px; cursor: pointer;
}

.batch-info { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.batch-meta { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.batch-prompt {
    font-size: 0.9rem; color: var(--text-main);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    position: relative;
    padding-right: 8px;
}
.batch-prompt:hover {
    /* overflow: visible; */
    /* 移除 overflow: visible 以防止文字遮挡右侧内容 */
}
.batch-prompt-overlay {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    background: var(--surface-bg);
    border: 1px solid var(--primary);
    border-radius: 4px;
    padding: 2px 4px;
    display: none;
    align-items: center;
    gap: 4px;
    z-index: 10;
    box-shadow: var(--shadow-md);
}
.batch-prompt:hover .batch-prompt-overlay {
    display: flex;
}
.prompt-opt-btn {
    background: var(--action-btn-bg);
    border: 1px solid var(--panel-border);
    color: var(--text-main);
    border-radius: 3px;
    padding: 2px 8px;
    font-size: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
}
.prompt-opt-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.batch-toggle { color: var(--text-muted); transition: var(--transition); }
.batch-card.expanded .batch-toggle { transform: rotate(90deg); color: var(--primary); }

.batch-seq {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--panel-border);
    background: rgba(255,255,255,0.03);
    flex-shrink: 0;
}

.batch-status {
    padding: 4px 10px; border-radius: 20px; 
    font-size: 0.7rem; font-weight: 600; letter-spacing: 0.02em;
    text-transform: uppercase;
}
.batch-status.processing { background: var(--badge-processing-bg); color: var(--badge-processing); border: 1px solid var(--badge-processing-border); }
.batch-status.completed { background: var(--badge-completed-bg); color: var(--badge-completed); border: 1px solid var(--badge-completed-border); }
.batch-status.failed { background: var(--badge-failed-bg); color: var(--badge-failed); border: 1px solid var(--badge-failed-border); }

.batch-opt-btn {
    opacity: 0; transform: translateX(10px);
    background: transparent; border: none; color: var(--text-muted);
    padding: 6px; cursor: pointer; transition: var(--transition);
    margin-left: 2px;
}
.batch-card:hover .batch-opt-btn { opacity: 1; transform: translateX(0); }
.batch-opt-btn:hover { color: var(--primary); background: rgba(99, 102, 241, 0.1); border-radius: 4px; }
.batch-opt-btn.delete:hover { color: var(--danger); background: rgba(239,68,68,0.1); }

/* Video Grid */
.batch-videos { padding: 0 16px 20px; animation: slideDown 0.3s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.video-grid {
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 16px;
}

.video-card {
    background: var(--video-card-bg); border-radius: var(--radius-md);
    overflow: hidden; transition: var(--transition);
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}
.video-card:hover { transform: translateY(-4px); box-shadow: 0 10px 20px rgba(0,0,0,0.4); }

.task-seq {
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--panel-border);
    background: rgba(255,255,255,0.03);
}

.video-wrapper {
    position: relative; aspect-ratio: 16/9; background: var(--video-wrapper-bg);
    display: flex; align-items: center; justify-content: center;
}
.video-wrapper.portrait { aspect-ratio: 9/16; }
.video-wrapper img, .video-wrapper video { 
    width: 100%; height: 100%; object-fit: contain; 
}

/* Video Info - Compact Classic Style */
.video-info {
    padding: 6px 10px;
    background: transparent;
    border-top: 1px solid var(--separator);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 32px;
}

.status-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
}
/* Remove pill/badge background style, use text color only */
.status-badge.queued { color: var(--badge-queued); }
.status-badge.processing { color: var(--badge-processing); }
.status-badge.completed { color: var(--badge-completed); }
.status-badge.failed { color: var(--badge-failed); }

.task-id {
    font-family: 'JetBrains Mono', Consolas, Monaco, monospace;
    font-size: 0.7rem;
    color: #64748b; /* Slate 500 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.6;
    flex: 1;
    text-align: right;
    max-width: 120px;
}

/* Banana Preview */
.banana-preview-container {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px; margin-top: 16px;
}
.banana-preview-item {
    position: relative; aspect-ratio: 1; border-radius: var(--radius-md);
    overflow: hidden; border: 2px solid var(--panel-border);
    transition: var(--transition);
}
.banana-preview-item img {
    width: 100%; height: 100%; object-fit: cover;
}
.banana-preview-item:hover { border-color: var(--primary); transform: scale(1.05); }
.banana-preview-remove {
    position: absolute; top: 4px; right: 4px;
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--danger); color: white; border: none;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 12px;
}

/* Empty State */
.empty-state, .empty-state-small { 
    text-align: center; padding: 60px 20px; color: var(--text-muted); 
    display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.empty-state svg { opacity: 0.5; color: var(--text-secondary); }

/* Responsive */
@media (max-width: 1200px) {
    .main-content { grid-template-columns: 320px 1fr; gap: 20px; }
}

@media (max-width: 960px) {
    .container { padding: 16px; height: auto; }
    .main-content { grid-template-columns: 1fr; display: flex; flex-direction: column; }
    /* 在移动端限制列表高度，防止页面过长 */
.left-panel { order: 1; }
    .right-panel { order: 3; } /* 移除强制的 min-height: 500px */
    .batch-list { max-height: 500px; min-height: 200px; } /* 限制生成记录列表高度 */
    .video-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

/* Animations */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
    width: 24px; height: 24px;
    border: 2px solid var(--spinner-track);
    border-top-color: var(--primary); border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Video Status Overlays */
.video-status { 
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: var(--video-status-bg); backdrop-filter: blur(2px);
    gap: 12px;
    padding: 16px;
    text-align: center;
}

.video-status .progress-text {
    color: var(--progress-text);
    font-weight: 500;
}

.video-status span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    /* 允许文本换行 */
    white-space: normal; 
    word-break: break-word;
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Download Button Overlay */
.download-btn-overlay {
    position: absolute; bottom: 12px; right: 12px;
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: var(--transition); opacity: 0; z-index: 10;
}
.video-wrapper:hover .download-btn-overlay { opacity: 1; }
.download-btn-overlay:hover { 
    background: var(--primary); border-color: var(--primary); 
    transform: scale(1.1); 
}

/* Video Modal */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Clear Dropdown */
.dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 0.9rem;
    transition: var(--transition);
}
.dropdown-item:hover {
    background: var(--item-hover-bg);
}

.video-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    z-index: 10000;
}

.video-modal-content.portrait {
    height: 90vh;
    width: auto;
    aspect-ratio: 9/16;
}

.video-modal-content video,
.video-modal-content img {
    width: 100%;
    height: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.video-modal-close {
    position: absolute; top: -50px; right: 0;
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255,255,255,0.1); border: none;
    color: #fff; font-size: 24px; cursor: pointer;
    transition: var(--transition); display: flex; align-items: center; justify-content: center;
}
.video-modal-close:hover { background: rgba(255,255,255,0.2); transform: rotate(90deg); }

/* Download Btn Modal */
.download-btn-modal {
    position: absolute; bottom: 24px; right: 24px;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    color: #fff; cursor: pointer;
    display: flex; align-items: center; gap: 10px;
    transition: var(--transition);
    backdrop-filter: blur(10px);
    font-size: 0.95rem; font-weight: 500;
}
.download-btn-modal:hover { background: var(--primary); border-color: var(--primary); }

/* Remove Image Button */
.remove-image-btn {
    position: absolute; top: 10px; right: 10px;
    width: 30px; height: 30px; border-radius: 50%;
    background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.2);
    color: #fff; font-size: 16px; cursor: pointer; transition: var(--transition);
}
.remove-image-btn:hover { background: var(--danger); border-color: var(--danger); }

#removeImageBtn {
    width: auto;
    min-width: 48px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
}

/* Video Actions */
.video-actions {
    display: flex;
    gap: 8px;
    padding: 8px 10px 0;
    margin-top: 4px;
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--action-btn-bg);
    border: 1px solid var(--panel-border);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.action-btn:hover {
    background: var(--action-btn-hover);
    color: var(--text-main);
    border-color: var(--border-strong);
}

.action-btn svg {
    opacity: 0.8;
}
