/* =============================================================================
   CONNECTION STATUS BANNER
   ============================================================================= */

.connection-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    padding: 8px 16px;
    text-align: center;
    font-size: 0.85em;
    font-weight: 600;
    backdrop-filter: blur(var(--tc-glass-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur)) saturate(140%);
    transition: opacity 0.3s ease, background 0.3s ease;
}

.connection-banner.disconnected {
    background: rgba(220, 38, 38, 0.85);
    color: #fff;
    border-bottom: 1px solid rgba(239, 68, 68, 0.3);
}

.connection-banner.connected {
    background: rgba(22, 163, 74, 0.85);
    color: #fff;
    border-bottom: 1px solid rgba(34, 197, 94, 0.3);
}

/* =============================================================================
   SYSTEM STATUS BADGE
   ============================================================================= */

.top-bar-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.header-stats-strip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
    white-space: nowrap;
}

.header-stat {
    font-variant-numeric: tabular-nums;
}

.header-stats-sep {
    opacity: 0.6;
}

@media (max-width: 480px) {
    .header-stats-strip {
        display: none;
    }
}

.system-status-badge {
    font-size: 0.8em;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: var(--tc-radius-md);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--tc-glass-bg);
    backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    border: var(--tc-glass-border);
    transition: all 0.2s ease;
}

.system-status-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-ready {
    color: #4ade80;
}

.status-ready::before {
    background: #4ade80;
}

.status-generating {
    color: #fbbf24;
}

.status-generating::before {
    background: #fbbf24;
    animation: pulse 1.5s infinite;
}

.status-busy {
    color: #f87171;
}

.status-busy::before {
    background: #f87171;
}

/* =============================================================================
   HEADER QUEUE BAR (video generation queue)
   ============================================================================= */

.header-queue-bar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
    white-space: nowrap;
}

.header-queue-label {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #94a3b8);
}

.header-queue-track {
    width: 64px;
    height: 6px;
    border-radius: 3px;
    background: var(--tc-glass-bg);
    overflow: hidden;
    flex-shrink: 0;
}

.header-queue-fill {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--tc-primary, #3B82F6), var(--tc-success, #14b8a6));
    transition: width 0.35s ease;
}

.header-queue-bar.status-queued .header-queue-fill {
    background: linear-gradient(90deg, var(--tc-warning, #f59e0b), #fbbf24);
    transition: width 0.35s ease;
}

.header-queue-bar.status-countdown .header-queue-fill {
    background: linear-gradient(90deg, #38bdf8, #818cf8);
    transition: width 0.8s ease;
}

.header-queue-bar.status-countdown .header-queue-text {
    color: #38bdf8;
    animation: pulse 1s infinite;
}

.header-queue-bar.status-generating .header-queue-fill {
    background: linear-gradient(90deg, var(--tc-success, #14b8a6), #22c55e);
    transition: width 0.5s ease;
}

.header-queue-text {
    font-variant-numeric: tabular-nums;
    min-width: 4em;
    font-weight: 500;
}

.header-queue-bar.status-idle .header-queue-text {
    color: var(--text-muted, #94a3b8);
}

.header-queue-bar.status-queued .header-queue-text {
    color: #fbbf24;
}

.header-queue-bar.status-generating .header-queue-text {
    color: #4ade80;
}


@media (max-width: 600px) {
    .header-queue-bar .header-queue-label {
        display: none;
    }
    .header-queue-track {
        width: 48px;
    }
}

/* =============================================================================
   RUN SUMMARY
   ============================================================================= */

.run-summary {
    margin-top: 16px;
    padding: 16px;
    background: var(--tc-glass-bg);
    backdrop-filter: blur(var(--tc-glass-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur)) saturate(140%);
    border-radius: var(--tc-radius-md);
    border: var(--tc-glass-border);
    border-left: 4px solid var(--tc-primary, #3B82F6);
    box-shadow: var(--tc-shadow-md);
    transition: all 0.2s ease;
}

.run-summary-header {
    font-size: 0.85em;
    font-weight: 600;
    color: #a5b4fc;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.run-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.run-summary-item {
    text-align: center;
}

.run-summary-item .label {
    display: block;
    font-size: 0.75em;
    color: #94a3b8;
    margin-bottom: 4px;
}

.run-summary-item .value {
    display: block;
    font-size: 1.1em;
    font-weight: 600;
    color: #e2e8f0;
}

.run-summary-timings {
    margin-top: 8px;
    font-size: 0.8em;
    color: #94a3b8;
    text-align: center;
}

.run-summary-warnings {
    margin-top: 6px;
    font-size: 0.8em;
    color: var(--tc-warning, #f59e0b);
    text-align: center;
}

/* Audiobook drag-and-drop highlight */
.book-drag-over {
    outline: 2px dashed var(--tc-primary, #3B82F6) !important;
    outline-offset: -4px;
    background: rgba(59, 130, 246, 0.05) !important;
}

/* -------------------------------------------------------------------------
   Segment Preview Modal
   ----------------------------------------------------------------------- */
.segment-preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.segment-preview-overlay[hidden] {
    display: none;
}

.segment-preview-dialog {
    background: var(--tc-glass-bg);
    backdrop-filter: blur(var(--tc-glass-blur-heavy)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-heavy)) saturate(140%);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-lg);
    width: 100%;
    max-width: 680px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--tc-shadow-lg);
}

.segment-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: var(--tc-glass-border);
}

.segment-preview-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #e2e8f0;
}

.segment-preview-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--tc-radius-sm);
    transition: all 0.2s ease;
}

.segment-preview-close:hover {
    color: #e2e8f0;
    background: var(--tc-glass-bg-hover);
}

.segment-preview-hint {
    margin: 0;
    padding: 10px 20px;
    font-size: 0.82rem;
    color: #94a3b8;
}

.segment-preview-list {
    overflow-y: auto;
    padding: 8px 20px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.segment-preview-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.segment-preview-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--tc-primary, #3B82F6);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.segment-preview-textarea {
    width: 100%;
    background: var(--tc-glass-bg-input);
    backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-sm);
    color: #e2e8f0;
    font-size: 0.88rem;
    line-height: 1.5;
    padding: 8px 10px;
    resize: vertical;
    min-height: 64px;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.segment-preview-textarea:focus {
    outline: none;
    border: var(--tc-glass-border-hover);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.segment-preview-footer {
    padding: 12px 20px 16px;
    border-top: var(--tc-glass-border);
    display: flex;
    gap: 10px;
    align-items: center;
}

.segment-preview-footer .btn-generate {
    flex: 1;
}

/* ===== Scene Placeholder Thumbnails ===== */
.scene-card-placeholder .placeholder-video {
    position: relative;
    aspect-ratio: 16/9;
    background: var(--tc-glass-bg-input);
    overflow: hidden;
    border-radius: var(--tc-radius-sm);
}

.placeholder-shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.06) 50%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.6s infinite;
}

@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}

.placeholder-label {
    position: absolute;
    bottom: 8px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.scene-progress-pct {
    display: none;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
    z-index: 2;
    border-radius: var(--tc-radius-sm);
    letter-spacing: -1px;
}

.scene-progress-failed {
    color: var(--tc-danger, #ef4444);
    font-size: 1.5rem;
    letter-spacing: 0;
    background: rgba(0,0,0,0.5);
}

.scene-card-failed {
    opacity: 0.6;
}

/* ===== Video Playback Modal ===== */
.video-modal-content {
    max-width: 860px;
    width: 92vw;
    background: var(--tc-glass-bg);
    backdrop-filter: blur(var(--tc-glass-blur-heavy)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-heavy)) saturate(140%);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-lg);
    box-shadow: var(--tc-shadow-lg);
}

.video-modal-body {
    padding: 16px;
}

.video-modal-body video {
    width: 100%;
    border-radius: var(--tc-radius-sm);
    background: #000;
    max-height: 70vh;
    display: block;
}

/* ===== Generation Summary -- Scene Prompts ===== */
.run-summary-scenes {
    margin-top: 12px;
    border-top: var(--tc-glass-border);
    padding-top: 10px;
}

.run-summary-scenes-heading {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--tc-primary, #3B82F6);
    margin-bottom: 8px;
}

.run-summary-scene-row {
    display: flex;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.05);
    align-items: flex-start;
}

.run-summary-scene-row:last-child {
    border-bottom: none;
}

.run-summary-scene-num {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--tc-primary, #3B82F6);
    width: 52px;
    padding-top: 2px;
}

.run-summary-scene-body {
    flex: 1;
    min-width: 0;
}

.run-summary-scene-desc {
    font-size: 0.82rem;
    color: var(--text, #e2e8f0);
    line-height: 1.45;
    word-break: break-word;
}

.run-summary-scene-motion {
    font-size: 0.74rem;
    color: var(--text-muted, #94a3b8);
    margin-top: 3px;
    font-style: italic;
}

/* ========================================================================
   GENERATION HISTORY PANEL
   ======================================================================== */

.history-panel {
    margin-top: 24px;
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-lg);
    background: var(--tc-glass-bg);
    backdrop-filter: blur(var(--tc-glass-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur)) saturate(140%);
    overflow: hidden;
    box-shadow: var(--tc-shadow-md);
}

.history-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: var(--tc-glass-bg);
    border-bottom: var(--tc-glass-border);
    user-select: none;
}

.history-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary, #e2e8f0);
}

.history-count {
    font-size: 0.78rem;
    color: var(--text-muted, #94a3b8);
}

.history-toggle {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
    transition: transform 0.2s ease;
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-muted, #94a3b8);
    font-size: 0.85rem;
}

.history-loading {
    padding: 20px;
    text-align: center;
    color: var(--text-muted, #94a3b8);
    font-size: 0.85rem;
}

/* History Card (list item) */
.history-card {
    padding: 10px 18px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.06);
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-card:hover {
    background: var(--tc-glass-bg-hover);
}

.history-card.selected {
    background: var(--tc-glass-bg-active);
    border-left: 3px solid var(--tc-primary, #3B82F6);
    box-shadow: inset 0 0 12px rgba(59, 130, 246, 0.05);
}

.history-card-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.history-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.history-status-dot.success { background: var(--tc-success, #14b8a6); }
.history-status-dot.error { background: var(--tc-danger, #ef4444); }
.history-status-dot.warning { background: var(--tc-warning, #f59e0b); }

.history-date {
    font-size: 0.8rem;
    color: var(--text-muted, #94a3b8);
    min-width: 100px;
}

.history-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--tc-radius-sm);
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-quality {
    font-size: 0.75rem;
    color: var(--text-secondary, #cbd5e1);
}

.history-time {
    font-size: 0.78rem;
    color: var(--text-secondary, #cbd5e1);
    font-variant-numeric: tabular-nums;
}

.history-segments {
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
    margin-left: auto;
}

.history-copy-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 2px 6px;
    border-radius: var(--tc-radius-sm);
    flex-shrink: 0;
    transition: all 0.2s ease;
    line-height: 1;
}

.history-copy-btn:hover {
    background: var(--tc-glass-bg-hover);
    border-color: rgba(148, 163, 184, 0.15);
    color: var(--tc-primary, #3B82F6);
}

.history-copy-detail-btn {
    margin-top: 10px;
    margin-left: 8px;
    font-size: 0.78rem;
    padding: 5px 14px;
}

.history-delete-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 2px 6px;
    border-radius: var(--tc-radius-sm);
    flex-shrink: 0;
    transition: all 0.2s ease;
    line-height: 1;
}

.history-delete-btn:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.history-delete-detail {
    margin-left: auto;
    font-size: 0.78rem;
    padding: 4px 12px;
}

/* ─── Post-Processing Step Tracker ─── */
.post-steps-tracker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: 10px 0 6px;
    padding: 10px 14px;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: var(--tc-radius-md, 8px);
}

.post-step {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #475569;
    transition: color 0.3s ease;
}

.post-step-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #334155;
    flex-shrink: 0;
    transition: all 0.3s ease;
    position: relative;
}

.post-step.active .post-step-icon {
    border-color: var(--tc-primary, #3B82F6);
    background: rgba(59, 130, 246, 0.15);
    animation: postStepPulse 1.2s ease-in-out infinite;
}

.post-step.active .post-step-label {
    color: #e2e8f0;
    font-weight: 600;
}

.post-step.done .post-step-icon {
    border-color: #22c55e;
    background: #22c55e;
}

.post-step.done .post-step-icon::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 4px;
    width: 4px;
    height: 7px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.post-step.done .post-step-label {
    color: #94a3b8;
}

@keyframes postStepPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.3); }
    50% { box-shadow: 0 0 0 4px rgba(59, 130, 246, 0); }
}

@media (max-width: 500px) {
    .post-steps-tracker {
        flex-direction: column;
        gap: 4px;
    }
}

/* Error Details Card (shown on generation failure) */
.error-details-card {
    margin-top: 12px;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--tc-radius-md);
    overflow: hidden;
    backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
}
.error-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: rgba(239, 68, 68, 0.08);
    border-bottom: 1px solid rgba(239, 68, 68, 0.15);
}
.error-details-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--tc-danger, #ef4444);
}
.error-copy-btn {
    font-size: 0.75rem;
    padding: 4px 12px;
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--tc-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}
.error-copy-btn:hover {
    background: rgba(239, 68, 68, 0.25);
}
.error-copy-btn.copied {
    background: rgba(20, 184, 166, 0.15);
    color: #86efac;
    border-color: rgba(20, 184, 166, 0.2);
}
.error-details-content {
    padding: 12px 14px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.78rem;
    line-height: 1.5;
    color: #fca5a5;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
    margin: 0;
}

/* History Detail View */
.history-detail {
    padding: 18px;
    border-top: var(--tc-glass-border);
    max-height: 600px;
    overflow-y: auto;
}

.history-detail-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: var(--tc-glass-border);
    flex-wrap: wrap;
}

.history-back-btn {
    background: var(--tc-glass-bg);
    border: var(--tc-glass-border);
    color: var(--text-secondary, #cbd5e1);
    padding: 4px 12px;
    border-radius: var(--tc-radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    transition: all 0.2s ease;
}

.history-back-btn:hover {
    background: var(--tc-glass-bg-hover);
    border: var(--tc-glass-border-hover);
}

.history-detail-section {
    margin-bottom: 18px;
}

.history-detail-section h4 {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--tc-primary, #3B82F6);
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 6px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 8px;
    border-radius: var(--tc-radius-sm);
    background: var(--tc-glass-bg);
    transition: all 0.2s ease;
}

.setting-row:hover {
    background: var(--tc-glass-bg-hover);
}

.setting-label {
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
}

.setting-value {
    font-size: 0.78rem;
    color: var(--text-primary, #e2e8f0);
    font-weight: 500;
}

.history-reuse-btn {
    margin-top: 10px;
    font-size: 0.78rem;
    padding: 5px 14px;
}

/* Narrative block */
.history-narrative {
    font-size: 0.82rem;
    color: var(--text-secondary, #cbd5e1);
    line-height: 1.6;
    white-space: pre-wrap;
    background: var(--tc-glass-bg-input);
    backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    padding: 12px;
    border-radius: var(--tc-radius-md);
    border: var(--tc-glass-border);
    max-height: 200px;
    overflow-y: auto;
}

/* Scene entries */
.history-scene {
    padding: 10px 12px;
    margin-bottom: 6px;
    background: var(--tc-glass-bg);
    backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    border-radius: var(--tc-radius-sm);
    border: var(--tc-glass-border);
    border-left: 3px solid var(--tc-primary, #3B82F6);
    transition: all 0.2s ease;
}

.history-scene:hover {
    background: var(--tc-glass-bg-hover);
}

.history-scene-num {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--tc-primary, #3B82F6);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.history-scene-desc {
    font-size: 0.82rem;
    color: var(--text-primary, #e2e8f0);
    line-height: 1.5;
}

.history-scene-motion {
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
    margin-top: 4px;
    font-style: italic;
}

.history-scene-dialogue {
    font-size: 0.78rem;
    color: #60a5fa;
    margin-top: 4px;
}

/* Segment details */
.history-segment-detail {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px;
    font-size: 0.78rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.05);
    transition: all 0.2s ease;
}

.history-segment-detail:hover {
    background: var(--tc-glass-bg-hover);
}

.history-segment-detail .seg-num {
    font-weight: 700;
    color: var(--tc-primary, #3B82F6);
    min-width: 28px;
}

.history-segment-detail .seg-file {
    color: var(--text-secondary, #cbd5e1);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-segment-detail .seg-dur {
    color: var(--text-muted, #94a3b8);
    font-variant-numeric: tabular-nums;
}

/* Timing bars */
.history-timing-bars {
    margin-top: 10px;
}

.timing-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.timing-label {
    font-size: 0.72rem;
    color: var(--text-muted, #94a3b8);
    min-width: 42px;
}

.timing-bar-track {
    flex: 1;
    height: 6px;
    background: var(--tc-glass-bg);
    border-radius: 3px;
    overflow: hidden;
}

.timing-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--tc-primary, #3B82F6), var(--tc-success, #14b8a6));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.timing-value {
    font-size: 0.72rem;
    color: var(--text-secondary, #cbd5e1);
    min-width: 40px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Warnings */
.history-warning {
    font-size: 0.78rem;
    color: var(--tc-warning, #f59e0b);
    padding: 6px 10px;
    background: rgba(245, 158, 11, 0.06);
    border: 1px solid rgba(245, 158, 11, 0.12);
    border-radius: var(--tc-radius-sm);
    margin-bottom: 4px;
    backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
}

/* Load More button */
#loadMoreHistory {
    display: block;
    width: calc(100% - 36px);
    margin: 12px 18px;
    text-align: center;
    font-size: 0.8rem;
}

/* -- AI Evaluation Styles -- */
.history-eval-section {
    border-top: var(--tc-glass-border);
    padding-top: 12px;
}
.history-eval-section h4 {
    color: #a78bfa;
}
.eval-subsection {
    margin-bottom: 14px;
    padding: 10px 12px;
    background: var(--tc-glass-bg);
    backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-md);
    transition: all 0.2s ease;
}
.eval-subsection:hover {
    background: var(--tc-glass-bg-hover);
}
.eval-subsection h5 {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary, #e2e8f0);
    margin: 0 0 6px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.eval-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
}
.eval-fast { background: rgba(20, 184, 166, 0.15); color: var(--tc-success, #14b8a6); }
.eval-avg { background: rgba(245, 158, 11, 0.15); color: var(--tc-warning, #f59e0b); }
.eval-slow { background: rgba(239, 68, 68, 0.15); color: var(--tc-danger, #ef4444); }
.eval-drift-low { background: rgba(20, 184, 166, 0.15); color: var(--tc-success, #14b8a6); }
.eval-drift-med { background: rgba(245, 158, 11, 0.15); color: var(--tc-warning, #f59e0b); }
.eval-drift-high { background: rgba(239, 68, 68, 0.15); color: var(--tc-danger, #ef4444); }
.eval-running {
    background: rgba(96, 165, 250, 0.15);
    color: #60a5fa;
    animation: pulse 1.5s infinite;
}
.eval-score { font-weight: 700; font-size: 0.85rem; }
.eval-tips {
    margin: 6px 0 0 0;
    padding-left: 18px;
    font-size: 0.78rem;
    color: var(--text-secondary, #94a3b8);
}
.eval-tips li { margin-bottom: 4px; }
.eval-comparison {
    font-size: 0.78rem;
    color: var(--text-secondary, #94a3b8);
    margin: 4px 0;
}
.eval-strengths {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 6px 0;
}
.eval-strength-tag {
    font-size: 0.7rem;
    padding: 2px 8px;
    background: rgba(20, 184, 166, 0.12);
    color: #5eead4;
    border-radius: 10px;
}
.eval-rec-list {
    font-size: 0.8rem;
    padding-left: 20px;
    margin: 6px 0 0 0;
    color: var(--text-primary, #e2e8f0);
}
.eval-rec-list li { margin-bottom: 6px; }
.eval-drift-explanation {
    font-size: 0.78rem;
    color: var(--text-secondary, #94a3b8);
    margin: 4px 0;
}
.eval-flagged {
    font-size: 0.75rem;
    color: var(--tc-warning, #f59e0b);
    margin: 4px 0;
}
.eval-loading, .eval-failed, .eval-none {
    font-size: 0.8rem;
    color: var(--text-muted, #94a3b8);
    padding: 8px 0;
}
/* List view eval badges */
.history-eval-badge {
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: var(--tc-radius-sm);
}
.history-eval-score {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted, #94a3b8);
}

/* =============================================================================
   CONTINUE VIDEO BANNER
   ============================================================================= */

.continue-video-banner[hidden] {
    display: none !important;
}

.continue-video-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    margin-bottom: 12px;
    border-radius: var(--tc-radius-md, 10px);
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.18), rgba(99, 110, 255, 0.12));
    border: 1px solid rgba(108, 92, 231, 0.35);
    animation: continueBannerSlideIn 0.3s ease-out;
}

@keyframes continueBannerSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.continue-video-banner-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.continue-video-banner-text {
    font-size: 0.88rem;
    font-weight: 600;
    color: #c4b5fd;
    flex: 1;
}

.continue-video-banner-cancel {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--tc-radius-sm, 6px);
    color: #94a3b8;
    font-size: 0.78rem;
    padding: 4px 12px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.continue-video-banner-cancel:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

/* Mobile */
@media (max-width: 768px) {
    .segment-preview-dialog { max-width: 95vw; }
    .video-modal-content { width: 95vw; max-width: 95vw; }
    .history-settings-grid { grid-template-columns: 1fr; }
    .run-summary-grid { grid-template-columns: 1fr; }
    .history-detail { padding: 12px; }
}

@media (max-width: 480px) {
    .segment-preview-dialog { max-width: 98vw; padding: 12px; }
    .history-detail { padding: 8px; }
}
