/* storyboard.css - Production Version (Refined) */
/* (CSS Variables now inherited from App.css to ensure global UI consistency) */
/* Scoped layout for the root storyboard page */

/* Override body for deeper glassmorphism contrast */
body {
    background: #0a0a0a !important;
}

.storyboard-root {
    background-color: transparent; /* inherit from body */
    height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- Header Redesign --- */
/* --- Header Redesign --- */
.app-header {
    height: 60px;
    background-color: #0a0a0a;
    display: flex;
    align-items: center;
    padding: 0 20px;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
}

.header-left {
    display: flex;
    align-items: center;
}

.logo-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.2s;
    letter-spacing: -0.01em;
}

.logo-text:hover {
    color: var(--accent-blue);
}

.project-title-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 30px;
    padding-left: 30px;
    border-left: 1px solid var(--border-subtle);
}

#projectTitle {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
    outline: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
    color: var(--text-primary);
}

#projectTitle:focus,
#projectTitle:hover {
    border-bottom-color: var(--border-subtle);
}

.edit-icon {
    font-size: 1rem;
    color: var(--text-secondary);
    opacity: 0.5;
    cursor: pointer;
}

.passport-nav {
    display: flex;
    gap: 12px;
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: var(--bg-panel-subtle);
    box-shadow: 0 0 8px var(--bg-panel);
}

/* --- Director Grid Layout --- */
.director-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    grid-template-rows: 1fr 14px 1fr;
    /* Ensure rows are balanced */
    row-gap: 6px;
    column-gap: 16px;
    height: calc(100vh - 60px);
    width: 100%;
    padding: 16px;
    padding-top: 16px;
    /* Equal top/bottom padding for balance */
    box-sizing: border-box;
}

.pane {
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-sm);
    z-index: 10;
    background: rgba(18, 24, 40, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.pane-content {
    padding: 15px;
    flex: 1;
    overflow-y: auto;
}

/* Script Pane */
.script-pane .pane-content {
    background: transparent;
    font-family: 'Inter', -apple-system, sans-serif;
    line-height: 1.5;
    font-size: 1.05rem;
    color: var(--text-primary) !important;
    padding: 32px 40px;
    white-space: pre-wrap;
}


.script-pane .pane-content * {
    color: var(--text-primary) !important;
}    /* Force all children to be white */

/* Screenplay Formatting Classes */
.scene-heading {
    font-weight: bold;
    text-transform: uppercase;
    text-align: center;
    /* USER REQUEST: Center Scene Headings */
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--text-primary);
    font-family: 'Courier Prime', 'Courier New', monospace;
}

.dialogue-center {
    text-align: center;
    font-style: italic;
    color: var(--text-primary);
    font-family: 'Courier Prime', 'Courier New', monospace;
    margin-bottom: 10px;
}

.action {
    margin-bottom: 15px;
    color: var(--text-primary);
    font-family: 'Courier Prime', 'Courier New', monospace;
}

.character {
    margin-top: 15px;
    margin-left: 37%;
    /* Approx 3.7 inches */
    margin-bottom: 0;
    font-weight: bold;
    text-transform: uppercase;
    color: var(--text-primary);
    width: 30%;
    font-family: 'Courier Prime', 'Courier New', monospace;
}

.parenthetical {
    margin-left: 32%;
    /* Approx 3.0 inches */
    margin-bottom: 0;
    color: var(--text-primary);
    font-family: 'Courier Prime', 'Courier New', monospace;
}

.dialogue {
    margin-left: 25%;
    margin-right: 25%;
    margin-bottom: 15px;
    color: var(--text-primary);
    white-space: pre-wrap;
    font-family: 'Courier Prime', 'Courier New', monospace;
}

.transition {
    text-align: right;
    text-transform: uppercase;
    margin-top: 20px;
    margin-bottom: 20px;
    margin-right: 10%;
    color: var(--text-primary);
    font-family: 'Courier Prime', 'Courier New', monospace;
}

/* Timeline Pane */
.timeline-pane {
    grid-column: 1 / -1;
    grid-row: 2 / 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.timeline-container {
    height: 100%;
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    padding: 0 10px;
    display: flex;
    align-items: center;
}

.timeline-track {
    display: flex;
    height: 12px;
    /* Thinner track */
    width: 100%;
    gap: 4px;
    align-items: center;
}

.timeline-scene {
    height: 100%;
    background: rgba(255, 255, 255, 0.1); 
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 40px; /* вытянутые кирпичики */
    position: relative;
    opacity: 1; /* Полная видимость */
}
.timeline-scene--full { width: 100%; }

.timeline-scene.empty {
    background: rgba(255, 255, 255, 0.05); /* Легкий контур для пустых */
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0.5;
    cursor: default;
}

.timeline-scene.draft {
    background: rgba(255, 255, 255, 0.15); /* Чуть ярче для черновиков */
}

.timeline-scene.active {
    background: rgba(255, 255, 255, 0.2) !important;
    border: 2px solid rgba(255, 255, 255, 0.8) !important;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.15);
}

.timeline-scene:hover:not(.empty) {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.9);
}

.playhead-marker {
    position: absolute;
    top: -5px;
    bottom: -5px;
    width: 2px;
    background: white;
    box-shadow: 0 0 4px var(--border-highlight);
    z-index: 10;
    pointer-events: none;
}

/* Tooltip Styles */
.selection-tooltip {
    position: absolute;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--accent-blue);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: none;
    animation: fadeIn 0.2s ease;
}

.selection-tooltip:hover {
    background: var(--accent-blue);
    color: var(--text-primary);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

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

/* Storyboard Pane */
.chat-pane {
    grid-area: 1 / 1 / 2 / 2;
}

.script-pane {
    grid-area: 1 / 2 / 2 / 3;
}

.storyboard-pane {
    grid-area: 3 / 1 / 4 / 3;
    display: flex;
    flex-direction: column;
}

/* Storyboard Table */
.storyboard-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-primary);
    font-size: 0.9rem;
    table-layout: fixed;
    /* CRITICAL: Force strict widths */
}

.storyboard-table th {
    background: var(--bg-surface);
    text-align: left;
    padding: 8px 12px;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-subtle);
    position: sticky;
    top: 0;
}

/* Image Columns: Strict Fixed Width */
.img-col-fixed {
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    padding: 12px 6px 12px 0 !important;
    /* Zero LEFT padding to kill gap */
}

/* Text Columns: Weighted Widths for Fixed Layout */
.action-cell {
}

.camera-cell {
    color: var(--accent-blue) !important;
    font-style: normal !important;
}

.audio-cell {
    font-style: italic !important;
    color: var(--text-primary) !important;
}

.comments-cell {
}

/* Dialogue Styling for Script Editor */
#scriptEditor .dialogue {
    font-style: italic !important;
    text-align: center;
    color: var(--text-secondary);
}

#scriptEditor .camera {
    font-style: normal !important;
    color: var(--accent-blue) !important;
}

#scriptEditor .sound {
    font-style: italic !important;
    color: var(--text-primary);
}

.storyboard-table td {
    padding: 12px 6px 12px 2px;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: top;
    word-break: break-word; /* CRITICAL: Force wrap for long nonsense words causing width squash */
    overflow-wrap: anywhere;
}

/* Target the second column (Image) specifically to remove left padding */
.storyboard-table td:nth-child(2) {
    padding-left: 0 !important;
}

/* Target the first column to remove right padding and force fixed width */
.storyboard-table td:first-child {
    padding: 12px 0 12px 0 !important;
    /* Zero horizontal padding */
    width: 38px !important;
    /* Fixed width */
    overflow: visible;
    min-width: 38px !important;
    max-width: 38px !important;
}

.storyboard-table tr:hover {
    background: var(--bg-panel-subtle);
}

.shot-number {
    font-weight: bold;
    color: var(--text-secondary);
    min-width: 20px;
    text-align: center;
    padding: 2px 4px;
    transition: background 0.2s;
    border-radius: 4px;
    line-height: 1;
    font-size: 1.1rem;
}

.shot-size-select {
    background: transparent;
    color: var(--accent-blue);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 2px 6px;
}

.shot-visual-placeholder {
    width: 160px;
    height: 90px;
    background: var(--bg-panel-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.shot-visual-placeholder:hover {
    background: var(--bg-panel-subtle);
    border-color: var(--border-highlight);
    color: var(--text-primary);
}

/* Old Modals Removed - using .lightbox and .glass-panel from style.css now */

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group textarea,
.char-name-input,
.char-desc-input,
.char-arc-input,
.char-voice-input {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.char-desc-input,
.char-arc-input {
    min-height: 90px;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px var(--bg-panel);
}

.large-textarea {
    min-height: 200px;
    resize: vertical;
}

/* Image Upload */
.image-upload-box {
    width: 100%;
    max-width: 150px;
    height: 150px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-panel-subtle);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    background: var(--bg-deep);
    transition: all 0.2s;
}

.image-upload-box:hover {
    border-color: var(--accent-blue);
    background: var(--bg-panel-subtle);
}

.image-upload-box span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.image-upload-box input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.image-upload-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

/* Character 3-Panel Layout Extras */
.char-gen-layout input:focus,
.char-gen-layout textarea:focus {
    outline: none;
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 0 2px var(--bg-panel);
}

.char-upload-ref-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 6px;
    background: var(--bg-panel-subtle);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.char-upload-ref-btn:hover {
    background: var(--bg-panel-hover);
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.ref-slot:hover {
    border-color: var(--accent-blue) !important;
    background: var(--bg-panel-subtle) !important;
    color: var(--accent-blue) !important;
}

.char-gen-gallery img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
}

/* --- Round 2 Refinements --- */

/* 1. Timeline (Cleaner) */
/* 1. Timeline (Cleaner - Spacer) */
/* Removed redundant timeline-pane to avoid margin spacing overriding */

/* 2. Merged Column (Number + Size) */
.col-merged-num-size {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 2px;
    /* Strict 38px Width */
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    /* Ensure no background interference */
    background: transparent !important;
    padding: 4px 0 !important;
    /* Vertical padding only */
    margin: 0 !important;
    overflow: visible;
    /* Allow drop-down to spill if needed, but text wraps */
    position: relative;
}

/* Target the first column to remove right padding and force fixed width */
.storyboard-table td:first-child {
    padding: 12px 0 12px 0 !important;
    /* Zero horizontal padding */
    width: 38px !important;
    /* Fixed width */
    overflow: visible;
    min-width: 38px !important;
    max-width: 38px !important;
    border-bottom: none !important;
    /* Remove "underline" (row border) */
}


.col-merged-num-size .cyber-select {
    width: 100%;
    font-size: 0.75rem;
    /* Slightly smaller to fit long words */
    padding: 0;
    text-align: center;
    background: transparent;
    border: none;
    color: var(--accent-blue);
    appearance: none;
    /* Remove default arrow */
    -webkit-appearance: none;
    outline: none;
    cursor: pointer;
    font-weight: 500;
    /* Ensure full centered text */
    text-align-last: center;
    line-height: 1.1;
    white-space: normal;
    /* Allow wrapping for "Ext. CloseUp" */
    height: auto;
}

.col-merged-num-size .cyber-select:hover {
    text-decoration: none;
    /* Remove hover underline */
    opacity: 0.8;
}

.col-merged-num-size .cyber-select option {
    background: var(--bg-surface);
    color: var(--text-primary);
}

/* 3. Placeholders */
.visual-preview,
.overhead-preview {
    width: 100%;
    height: 68px;
    /* Reduced height for smaller width (120px) */
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.7rem;
    /* Smaller text */
    background: var(--bg-panel-subtle);
    cursor: pointer;
    transition: all 0.2s;
}

.visual-preview:hover,
.overhead-preview:hover {
    border-color: var(--border-highlight);
    background: var(--bg-panel-subtle);
    color: var(--text-primary);
}

.visual-preview span,
.overhead-preview span {
    display: inline-block;
    text-align: center;
    color: inherit;
    font-weight: 500;
}


/* 5. Buttons (Scoped to Storyboard) */
.storyboard-root .nav-btn,
.storyboard-root .add-btn,
.storyboard-root .primary-btn,
.storyboard-root .small-btn {
    background: transparent;
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    text-transform: none;
    /* Ensure no uppercase enforcement */
}

.nav-btn:hover,
.add-btn:hover,
.primary-btn:hover,
.small-btn:hover {
    background: var(--bg-panel-subtle);
    box-shadow: 0 0 10px var(--bg-panel);
    color: #fff;
}

/* Ensure + Add Shot is visible */
#addShotBtn {
    background: var(--accent-blue);
    color: var(--text-primary);
    font-weight: bold;
}

#addShotBtn:hover {
    background: var(--border-highlight);
    /* Darker blue */
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

/* Corner In-Table Add Shot Button */
.corner-insert-btn {
    position: absolute;
    bottom: -6px;
    left: -4px;
    width: 16px;
    height: 16px;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
}

.col-merged-num-size:hover .corner-insert-btn {
    opacity: 1;
}

.corner-insert-btn:hover {
    color: var(--accent-blue);
    transform: scale(1.2);
}

.add-shot-row-btn {
    background: var(--bg-panel-subtle);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    padding: 8px 32px;
    border-radius: var(--radius-sm); /* Standard Dark Glass radius */
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    width: auto;
    min-width: 200px;
    margin: 10px auto; /* Centers the button inside td */
    display: inline-block;
    transition: all 0.2s;
}

.add-shot-row-btn:hover {
    border-color: var(--border-highlight);
    color: var(--text-primary);
    background: var(--bg-panel-subtle);
}

/* Character Item */
.character-item {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-subtle);
    padding: 20px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    width: 100%;
    position: relative;
    text-align: left;
}

.char-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.char-reference {
    flex-shrink: 0;
    width: 150px;
}

/* Buttons */
.add-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.add-btn:hover {
    background: var(--accent-blue);
    color: var(--text-primary);
}

.small-btn {
    background: transparent;
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.small-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Dropdown */
.dropdown-content a:hover {
    background-color: var(--bg-surface);
}

/* --- Print / PDF Export Styles --- */
@media print {

    /* Reset Page */
    @page {
        margin: 1cm;
        size: A4;
    }

    body {
        background: white !important;
        color: black !important;
        height: auto !important;
        overflow: visible !important;
        display: block !important;
    }

    /* Hide UI Elements */
    .app-header,
    .chat-pane,
    .timeline-pane,
    .pane-controls-overlay,
    .add-shot-row-btn,
    #addShotBtn,
    .lightbox,
    .chat-input-area,
    .selection-tooltip,
    .nav-btn,
    .header-right {
        display: none !important;
    }

    /* Reset Grid */
    .director-grid {
        display: block !important;
        height: auto !important;
        padding: 0 !important;
        overflow: visible !important;
    }

    /* Pane Resets */
    .pane {
        border: none !important;
        box-shadow: none !important;
        background: white !important;
        height: auto !important;
        overflow: visible !important;
        margin-bottom: 2rem !important;
        display: block !important;
    }

    .pane-content {
        overflow: visible !important;
        padding: 0 !important;
    }

    /* Script Styling */
    .script-pane {
        display: block !important;
        /* Ensure it is visible */
        margin-bottom: 40px !important;
    }

    .script-pane .pane-content {
        background: white !important;
        color: black !important;
        padding: 0 !important;
    }

    .script-pane .pane-content * {
        color: black !important;
    }

    .scene-heading,
    .action,
    .character,
    .dialogue,
    .parenthetical,
    .transition {
        color: black !important;
    }

    /* Storyboard Table Styling */
    .storyboard-pane {
        background: white !important;
        display: block !important;
    }

    .storyboard-table {
        color: black !important;
        border: 1px solid #ccc !important;
        width: 100% !important;
    }

    .storyboard-table th {
        background: #f0f0f0 !important;
        color: black !important;
        border-bottom: 1px solid #000 !important;
        position: static !important;
        /* No sticky in print */
    }

    .storyboard-table td {
        border-bottom: 1px solid #ddd !important;
        page-break-inside: avoid !important;
        color: black !important;
    }

    .shot-number {
        color: black !important;
    }

    .audio-cell {
        color: #333 !important;
    }

    /* Previews */
    .visual-preview,
    .overhead-preview {
        border: 1px solid #999 !important;
        color: #666 !important;
        background: #f9f9f9 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Inputs in Print */
    .cyber-select {
        color: black !important;
        border: none !important;
        appearance: none !important;
    }
}

/* --- Generation Modal Styles --- */
.modal-gen-layout {
    /* Full screen overlay handled by .modal base class */
    z-index: 2000;
    /* Higher than other modals */
}

.gen-content {
    width: 95vw !important;
    height: auto !important;
    max-height: 95vh !important;
    max-width: 1400px !important;
    display: flex;
    flex-direction: column;
    padding: 0 !important;
    background: rgba(0, 0, 0, 0.75) !important;
    backdrop-filter: blur(16px) !important;
    border-radius: 16px !important;
    border: 1px solid var(--accent-blue) !important;
    box-shadow: 0 0 50px var(--bg-panel) !important;
    overflow: hidden;
    position: relative !important;
}

/* Header */
.gen-header {
    position: relative;
    top: auto;
    right: auto;
    width: 100%;
    height: auto;
    background: transparent;
    padding: 16px 24px 8px 24px;
    z-index: 50;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row-reverse;
}

.gen-header h2 {
    display: block;
    font-size: 1.1rem;
    color: #94a3b8;
    font-weight: 500;
    text-transform: uppercase;
    margin: 0;
    letter-spacing: 1px;
}

/* Picture 3 Style Badge */
.shot-info-display {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: #60a5fa;
    background: rgba(15, 23, 42, 0.8);
    /* Darker bg for overlay visibility */
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 6px 16px;
    border-radius: 8px;
    letter-spacing: 0.5px;
    backdrop-filter: blur(4px);
    pointer-events: auto;
    /* Re-enable clicks if needed */
}

/* Workspace (3 Columns) */
.gen-workspace {
    flex: 1;
    display: flex;
    overflow: hidden;
    padding: 4px 24px 24px 24px;
    gap: 16px;
    align-items: flex-start;
    container-type: inline-size;
    margin-top: 20px;
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06)); 
    width: 100%; 
    background: var(--bg-surface-elevated, #0a0e1a); 
    height: auto; 
    border-radius: 12px; 
}

/* Panel Scrollbar Hiding */
.gen-panel {
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE */
    overflow-y: auto;
    padding: 20px;
}

.gen-panel::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}


/* Left: Prompt & Settings */
.gen-left {
    width: 280px;
    flex-shrink: 0;
    height: 100%;
    max-height: 100%;
    border-right: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    justify-content: stretch;
    gap: 12px;
    padding: 0;
    margin: 0;
}

.video-prompt-textarea {
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    line-height: 1.5;
    transition: all var(--transition-fast);
}
.video-prompt-textarea:focus {
    border-color: var(--border-glow) !important;
    background: rgba(0, 0, 0, 0.6) !important;
    box-shadow: 0 0 15px var(--bg-panel-subtle) !important;
}

/* Input Group: Container for Label + Input */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    /* Tiny gap between Label and Input */
    width: 100%;
}

.gen-left .input-group:first-child {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.gen-left .input-group:first-child textarea {
    flex: 1;
    min-height: 120px;
}

/* Prompt Header (Label + Tools) */
.prompt-header {
    display: none !important;
    /* User Request: Remove PROMPT word & lift up */
}

.prompt-label,
.setting-label {
    display: none !important;
    /* User Request: Remove Aspect/Model Labels */
}

/* Ensure Tool Buttons are perfectly row-aligned */
.prompt-tools-bottom {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    /* Align right */
    gap: 8px;
    margin-top: 4px;
    /* Reduced from 8px to group closer */
    /* User Request: 4px gap + 8px margin = 12px Total */
    width: 100%;
}

.prompt-tools {
    display: none;
    /* Hide old container if present */
}

/* Tool Icons - UNIFIED BLUE STYLE */
.tool-icon-btn {
    width: 26px;
    /* Compact */
    height: 26px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.5);
    /* Matching Overlay Style */
    color: var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.tool-icon-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: #60a5fa;
    color: #60a5fa;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

/* Inputs */
#genPrompt {
    width: 100%;
    height: 180px;
    max-height: 300px;
    background: rgba(15, 23, 42, 0.6) !important;
    border: 1px solid var(--bg-panel) !important;
    border-radius: 12px;
    color: var(--text-primary);
    padding: 16px;
    resize: vertical;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    line-height: 1.5;
    transition: all 0.2s;
    margin: 0;
    min-height: 100px;
}

#genPrompt:focus {
    border-color: var(--border-subtle) !important;
    background: rgba(15, 23, 42, 0.8) !important;
    box-shadow: 0 0 0 1px var(--border-subtle);
    outline: none;
}



/* Dropdowns */
.select-input,
.cyber-select {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--bg-panel);
    color: var(--text-primary);
    padding: 12px;
    border-radius: 10px;
    outline: none;
    font-size: 0.9rem;
    appearance: none;
    cursor: pointer;
    transition: all 0.2s;
    margin: 0;
}

.select-input:focus,
.cyber-select:focus {
    border-color: var(--border-subtle);
    background: rgba(15, 23, 42, 0.8);
}



/* Action Buttons Container - Remove excess margin */
.action-buttons {
    margin-top: 0;
    width: 100%;
}

.kbd-shortcut {
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    margin-left: 8px;
    color: var(--primary-glow);
}

/* Center: Viewport */
.gen-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: radial-gradient(circle at center, rgba(14, 165, 233, 0.03) 0%, transparent 60%);
    position: relative;
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06)); 
    aspect-ratio: 16/9; 
    margin: 0 auto; 
    border-radius: 8px; 
    overflow: hidden; 
}

.viewport-placeholder {
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px dashed var(--bg-panel);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

#genMainImage {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 12px;
}

/* Viewport Actions Overlay / Bar */
#genMainImage[src=""] ~ #viewportActionsBar {
    display: none !important;
}

.viewport-overlay-actions {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 8px;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    pointer-events: none;
}

/* Show on hover of the viewport container (for old overlayactions if any) */
.viewport-placeholder:hover .viewport-overlay-actions {
    opacity: 1;
    pointer-events: auto;
}

/* STRICT MATCH: Main Page .btn-ref-icon style */
.overlay-icon-btn {
    width: 34px !important;
    /* Exact match from style.css */
    height: 34px !important;
    /* Exact match from style.css */
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.1) !important;
    /* Blue Tint */
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    /* Blue Outline */
    color: var(--border-subtle) !important;
    /* Accent Blue */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
    padding: 0;
}

.overlay-icon-btn:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    color: #60a5fa !important;
    /* Lighter blue on hover */
    border-color: #60a5fa !important;
}

/* Specific Style for "Use as Shot" (First button) */
/* Specific Style for "Use as Shot" (First button) - NOW UNIFIED BLUE */
#useImageBtn {
    /* Removed Green Tint - Now uses default blue style */
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    color: var(--border-subtle) !important;
}

#useImageBtn:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.25);
    color: #60a5fa !important;
    border-color: #60a5fa !important;
}

/* Right: Refs */
.gen-right {
    width: 270px;
    flex-shrink: 0;
    height: 100%;
    max-height: 100%;
    border-left: none;
    background: transparent;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Reference Grid */
.ref-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(4, 1fr);
    /* 4 Equal Rows */
    gap: 12px;
    /* Standardize Gap: 12px Vertical/Horizontal */
    width: 100%;
    height: 100%;
    flex: 1;
}

/* Reference Slot */
.ref-slot {
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    /* Fill the Grid Cell */
    background: rgba(15, 23, 42, 0.6);
    border: 1px dashed var(--bg-panel);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s;
    cursor: pointer;
    overflow: hidden;
}

/* Empty State: Hove effect */
.ref-slot.empty:hover {
    background: rgba(15, 23, 42, 0.8);
    border-color: var(--border-subtle);
    color: #60a5fa;
    /* Make +Ref blue on hover */
}

/* Filled State */
.ref-slot.filled {
    border: 1px solid var(--bg-panel);
    /* Solid border for image */
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Selected State */
.ref-slot.selected {
    border: 2px solid var(--border-subtle) !important;
    /* Blue active border */
}

/* Text Label */
.slot-label {
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
    pointer-events: none;
    /* Let clicks pass to the slot */
}

/* --- Reference Slot Actions --- */
.slot-actions {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    /* Dim background on hover */
    display: flex;
    /* Flex to center buttons */
    align-items: center;
    justify-content: center;
    gap: 12px;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    border-radius: 12px;
    backdrop-filter: blur(2px);
    pointer-events: none;
    /* Allow clicks to pass through when hidden */
    z-index: 5;
}

/* Only show actions when FILLED and HOVERED */
.ref-slot.filled:hover .slot-actions {
    opacity: 1;
    pointer-events: auto;
    /* Catch clicks on buttons */
}

/* Hide the old use button, we just click the slot itself now */
.btn-use {
    display: none !important;
}

/* Ensure actions are NEVER visible on empty slots */
.ref-slot.empty .slot-actions {
    display: none !important;
}

/* Button Styling - UNIFIED BLUE STYLE */
.slot-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    background: rgba(255, 255, 255, 0.1) !important;
    color: var(--border-subtle) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    backdrop-filter: blur(4px);
}

.slot-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
    border-color: #60a5fa !important;
    color: #60a5fa !important;
    background: rgba(255, 255, 255, 0.25) !important;
}

.btn-use:hover {
    /* Unified Blue Override */
    border-color: #60a5fa !important;
    color: #60a5fa !important;
    background: rgba(255, 255, 255, 0.25) !important;
}

.btn-delete:hover {
    /* Unified Blue Override */
    border-color: #60a5fa !important;
    color: #60a5fa !important;
    background: rgba(255, 255, 255, 0.25) !important;
}

.image-upload-compact:hover {
    border-color: var(--accent-blue);
    background: var(--bg-panel-subtle);
}

.image-upload-compact input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.image-upload-compact span {
    color: var(--text-secondary);
    font-size: 0.8rem;
    pointer-events: none;
    z-index: 1;
}

.char-chip img {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid var(--border-subtle);
}

/* Bottom: Gallery */
.gen-gallery-panel {
    height: auto;
    min-height: 120px;
    padding: 4px 24px 24px 24px;
    background: transparent;
    display: flex;
    flex-direction: column;
}

.gen-gallery-grid {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.gallery-thumb {
    width: 160px;
    height: 90px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    flex-shrink: 0;
    position: relative;
}

.gallery-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none; /* Let clicks pass to the overlay */
}

.gallery-thumb video::-webkit-media-controls {
    display: none !important;
}

.gallery-thumb-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.gallery-thumb:hover .gallery-thumb-overlay {
    opacity: 1;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-thumb:hover {
    border-color: var(--text-secondary);
}

.gallery-thumb.selected {
    border-color: var(--accent-blue);
}

.delete-shot-btn {
    position: absolute;
    top: -5px;
    left: -5px;
    width: 16px;
    height: 16px;
    background: transparent;
    color: var(--text-primary);
    font-size: 12px;
    line-height: 14px;
    text-align: center;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    z-index: 10;
}

tr:hover .delete-shot-btn {
    display: block;
}


.inline-add-btn {
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-blue);
    color: var(--text-primary);
    border: 2px solid var(--bg-surface);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s, transform 0.2s;
    line-height: 1;
}

tr:hover .inline-add-btn {
    display: flex;
    opacity: 1;
}

.inline-add-btn:hover {
    background: var(--accent-light);
    transform: translateX(-50%) scale(1.1);
}


.shot-number:hover,
.shot-number:focus {
    background: var(--bg-panel);
    outline: none;
}


.char-delete-btn {
    position: absolute; 
    top: -10px; 
    right: 0; 
    color: var(--text-primary); 
    background: rgba(0,0,0,0.5); 
    width: 24px; 
    height: 24px; 
    padding: 0; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    border-radius: 50%; 
    opacity: 0.5; 
    transition: opacity 0.2s; 
    z-index: 10; 
    border: none; 
    cursor: pointer;
}
.char-delete-btn:hover {
    opacity: 1;
}

.char-divider {
    border: 0; 
    border-top: 1px solid var(--border-subtle); 
    margin: 0 0 20px 0;
}

.char-inner-container {
    display: block; 
    width: 100%;
}



.char-prompt-container {
    flex: 1; 
    min-height: 250px; 
    display: flex; 
    flex-direction: column; 
    background: var(--bg-color); 
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06)); 
    border-radius: 8px; 
    overflow: hidden;
}

.char-gen-prompt-field {
    flex: 1; 
    min-height: 120px; 
    background: transparent; 
    border: none; 
    padding: 15px; 
    color: var(--text-primary, #fff); 
    resize: none; 
    outline: none; 
    font-size: 0.95rem; 
    line-height: 1.4;
}

.char-tools-bar {
    display: flex; 
    justify-content: flex-end; 
    gap: 8px; 
    padding: 8px 12px; 
    border-top: 1px solid var(--border-subtle, rgba(255,255,255,0.06)); 
    background: rgba(0,0,0,0.2);
}


.char-model-select {
    width: 100%; 
    background: var(--bg-surface, #131722); 
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06)); 
    color: var(--text-primary); 
    padding: 10px; 
    border-radius: 6px; 
    font-size: 0.9rem; 
    outline: none; 
    margin: 0;
}

.char-run-btn-style {
    width: 100%; 
    background: var(--accent-blue, var(--border-subtle)); 
    color: var(--text-primary); 
    border: none; 
    padding: 12px; 
    border-radius: 6px; 
    font-weight: 600; 
    font-size: 0.95rem; 
    cursor: pointer; 
    transition: opacity 0.2s; 
    margin: 0;
}

.char-ref-preview-style {
    display: none; 
    align-items: flex-start; 
    flex-wrap: wrap; 
    gap: 8px; 
    background: transparent; 
    border: none; 
    border-radius: 6px; 
    padding: 8px; 
    margin-top: 4px;
}


.char-viewport-style {
    width: 100%; 
    height: 100%; 
    display: flex; 
    align-items: center; 
    justify-content: center;
}

.char-viewport-placeholder {
    color: var(--text-secondary, #8e9bb0); 
    font-size: 1rem;
}

.char-viewport-tools-style {
    position: absolute; 
    bottom: 10px; 
    right: 10px; 
    display: flex; 
    gap: 8px;
}



.char-details-header {
    font-size: 0.8rem; 
    font-weight: 600; 
    color: var(--text-secondary, #8e9bb0); 
    text-transform: uppercase;
}

.char-input-field {
    width: 100%; 
    background: rgba(0,0,0,0.2); 
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06)); 
    border-radius: 6px; 
    padding: 12px; 
    color: var(--text-primary); 
    font-size: 0.9rem; 
    outline: none;
}

.char-textarea-field {
    width: 100%; 
    flex: 1; 
    min-height: 160px; 
    background: rgba(0,0,0,0.2); 
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06)); 
    border-radius: 6px; 
    padding: 12px; 
    color: var(--text-primary); 
    font-size: 0.9rem; 
    resize: none; 
    outline: none; 
    line-height: 1.4; 
    margin: 0;
}

.char-gen-gallery-style {
    display: flex; 
    flex-wrap: wrap; 
    gap: 8px; 
    margin-top: 15px; 
    padding-bottom: 5px;
}

/* ─── Е.1: Shared char/loc card classes ───────────────────────────────────── */

/* Card wrapper (character-item / location-item) */
.character-item,
.location-item {
    border: none;
    background: transparent;
    padding: 0;
    margin-bottom: 30px;
    position: relative;
    text-align: left;
    width: 100%;
}

/* Delete button shared (char + loc) */
.loc-delete-btn {
    position: absolute;
    top: -10px;
    right: 0;
    color: white;
    background: rgba(0,0,0,0.5);
    width: 24px;
    height: 24px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    opacity: 0.5;
    transition: opacity 0.2s;
    z-index: 10;
    border: none;
    cursor: pointer;
}
.loc-delete-btn:hover { opacity: 1; }

/* Card divider */
.card-divider {
    border: 0;
    border-top: 1px solid var(--border-subtle);
    margin: 0 0 20px 0;
}

/* Gen workspace card variant (inside char/loc panels) */
.gen-workspace-card {
    display: flex;
    gap: 20px;
    align-items: stretch;
    height: auto;
    width: 100%;
    background: var(--bg-surface-elevated, #0a0e1a);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    margin-top: 20px;
}

/* Prompt container (left side textarea wrapper) */
.prompt-container {
    flex: 1;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    border-radius: 8px;
    overflow: hidden;
}

/* Gen prompt textarea */
.gen-prompt-textarea {
    flex: 1;
    height: 100%;
    min-height: 120px;
    background: transparent;
    border: none;
    padding: 15px;
    color: var(--text-primary, #fff);
    resize: none;
    outline: none;
    font-size: 0.95rem;
    line-height: 1.4;
}

/* Run / Generate button */
.run-btn {
    width: 100%;
    background: var(--accent-blue, #3b82f6);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: opacity 0.2s;
    margin: 0;
}
.run-btn:hover { opacity: 0.85; }

/* Model select inside card */
.card-model-select {
    width: 100%;
    background: var(--bg-surface, #131722);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    color: white;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
    margin: 0;
}

/* Ref preview strip */
.ref-preview-strip {
    display: none;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 8px;
    margin-top: 4px;
}

/* Single ref thumb */
.ref-thumb {
    position: relative;
    display: inline-block;
}
.ref-thumb img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border-subtle);
}

/* Remove ref button on thumbnail */
.remove-ref-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

/* Viewport (center column) */
.card-viewport {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.card-viewport-placeholder {
    color: var(--text-secondary, #8e9bb0);
    font-size: 1rem;
}
.card-viewport-tools {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
}

/* Generated image inside viewport */
.card-img-preview {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: zoom-in;
}

/* Details section (right column) */
.card-details-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary, #8e9bb0);
    text-transform: uppercase;
}
.card-input-field {
    width: 100%;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    border-radius: 6px;
    padding: 12px;
    color: white;
    font-size: 0.9rem;
    outline: none;
}
.card-textarea-field {
    width: 100%;
    flex: 1;
    min-height: 160px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    border-radius: 6px;
    padding: 12px;
    color: white;
    font-size: 0.9rem;
    resize: none;
    outline: none;
    line-height: 1.4;
    margin: 0;
}

/* Gallery strip (bottom of card) */
.card-gallery-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
    padding-bottom: 5px;
}

/* Gallery item */
.card-gallery-item {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
}
.card-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: zoom-in;
}
.card-gallery-item:hover .card-gallery-overlay { opacity: 1; pointer-events: auto; }

/* Gallery item overlay */
.card-gallery-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    justify-content: center;
    align-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

/* Gallery item delete button */
.gallery-delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 10;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Project card (load modal) */
.project-card {
    display: flex;
    flex-direction: column;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}
.project-card:hover {
    background: rgba(255,255,255,0.08);
    border-color: var(--accent-blue);
}


/* --- Utility classes (extracted from inline styles) --- */
.w-full      { width: 100%; }
.pt-10       { padding-top: 10px; }
.mb-1rem     { margin-bottom: 1rem; }
.flex-grow   { flex: 1; min-width: 100px; }
.form-label  { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 5px; display: block; }
.hidden      { display: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.export-dropdown-wrapper { position: relative; display: inline-block; }

/* ============================================================
   EXTRACTED INLINE STYLES — storyboard.html modals
   Pixel-perfect 1:1 match with previous inline styles.
   ============================================================ */

/* --- Shared Modal Styles --- */
.modal-panel-sm {
    max-width: 900px; width: 90%; position: relative;
    border-color: var(--accent-blue);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
    max-height: 85vh; overflow-y: auto;
}
.modal-panel-md {
    max-width: 800px; width: 90%; position: relative;
    border-color: var(--accent-blue);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
    max-height: 85vh; overflow-y: auto;
}
.modal-panel-lg {
    max-width: 1650px; width: 95vw; position: relative;
    border-color: var(--accent-blue);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
    max-height: 90vh; overflow-y: auto;
}
.modal-panel-settings {
    max-width: 500px; width: 90%; position: relative;
    border-color: var(--accent-blue);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
}
.modal-heading {
    color: var(--text-primary);
    display: flex; align-items: center; gap: 8px;
    margin: 0; border: none; padding: 0;
}
.modal-heading--accent {
    color: var(--accent-blue);
    display: flex; align-items: center; gap: 8px;
}
.modal-divider {
    border: 0; border-top: 1px solid var(--border-subtle); margin: 20px 0;
}

/* --- Form inputs dark bg --- */
.input-dark-bg {
    background: rgba(0, 0, 0, 0.5);
}

/* --- Moodboard --- */
.moodboard-grid {
    display: flex; gap: 10px; flex-wrap: wrap;
}

/* --- Header --- */
.logo-link {
    text-decoration: none; color: inherit; margin-right: 20px;
}
.main-nav--spaced {
    margin-right: 20px;
}
.project-actions {
    display: flex; gap: 8px; margin-left: 16px;
}

/* --- Entity (Character / Location) Shared Styles --- */
.entity-panel-header {
    margin-bottom: 1rem;
    display: flex; align-items: center; justify-content: space-between;
}
.entity-api-usage {
    display: flex; gap: 15px; font-size: 11px;
    align-items: center; margin-left: auto; margin-right: 20px;
}
.entity-item {
    border: none; background: transparent; padding: 0; margin-bottom: 30px;
}
.entity-workspace {
    display: flex; gap: 20px; align-items: stretch; height: auto; width: 100%;
    background: var(--bg-surface-elevated, #0a0e1a);
    padding: 20px; border-radius: 12px;
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    margin-top: 20px;
}
.entity-gen-left {
    width: 380px; flex-shrink: 0;
    display: flex; flex-direction: column; gap: 12px;
}
.entity-prompt-box {
    flex: 1; min-height: 250px;
    display: flex; flex-direction: column;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    border-radius: 8px; overflow: hidden;
}
.entity-prompt-textarea {
    flex: 1; min-height: 120px;
    background: transparent; border: none;
    padding: 15px; color: var(--text-primary, #fff);
    resize: none; outline: none;
    font-size: 0.95rem; line-height: 1.4;
}
.entity-prompt-toolbar {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    background: rgba(0,0,0,0.2);
}
.entity-model-select {
    width: 100%;
    background: var(--bg-surface, #131722);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    color: white; padding: 10px; border-radius: 6px;
    font-size: 0.9rem; outline: none; margin: 0;
}
.entity-run-btn {
    width: 100%;
    background: var(--accent-blue, #3b82f6); color: white;
    border: none; padding: 12px; border-radius: 6px;
    font-weight: 600; font-size: 0.95rem;
    cursor: pointer; transition: opacity 0.2s; margin: 0;
}
.entity-run-btn:hover { opacity: 0.85; }
.entity-ref-preview {
    display: none; align-items: center; gap: 8px;
    background: transparent; border: none;
    border-radius: 6px; padding: 8px; margin-top: 4px;
}
.entity-ref-preview img {
    width: 40px; height: 40px;
    object-fit: cover; border-radius: 4px;
}
.entity-ref-preview span {
    font-size: 0.8rem; color: #8e9bb0;
    flex: 1; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
}
.entity-remove-ref-btn {
    color: #ff4a4a; padding: 2px; cursor: pointer;
}
.entity-gen-center {
    flex: 1; aspect-ratio: 16/9;
    margin: 0 auto;
    display: flex; align-items: center; justify-content: center;
    background: #000; border-radius: 8px;
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    overflow: hidden; position: relative;
}
.entity-viewport {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
}
.entity-viewport-placeholder {
    color: var(--text-secondary, #8e9bb0); font-size: 1rem;
}
.entity-viewport-tools {
    position: absolute; bottom: 10px; right: 10px;
    display: flex; gap: 8px;
}
.overlay-icon-btn {
    display: none;
    background: rgba(0,0,0,0.6); color: white;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px; padding: 6px; cursor: pointer;
}
.overlay-icon-btn--centered {
    display: none;
    align-items: center; justify-content: center;
    background: rgba(0,0,0,0.6); color: white;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px; padding: 6px; cursor: pointer;
}
.overlay-icon-btn--visible {
    display: flex;
    align-items: center; justify-content: center;
    background: rgba(0,0,0,0.6); color: white;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px; padding: 6px; cursor: pointer;
}
.tool-icon-btn {
    background: none; border: none; cursor: pointer;
    color: var(--text-secondary, #8e9bb0);
    transition: color 0.2s; padding: 4px;
}
.tool-icon-btn:hover { color: var(--text-primary); }
.btn-icon-styled { pointer-events: auto; padding: 4px; }
.card-gallery-item--active { border-color: var(--accent-blue) !important; }
.card-gallery-item-img {
    width: 100%; height: 100%;
    object-fit: cover; cursor: zoom-in;
}
.card-gallery-item:hover .card-gallery-overlay,
.char-gallery-item:hover .char-gallery-overlay,
.loc-gallery-item:hover .loc-gallery-overlay { opacity: 1; pointer-events: auto; }
.entity-gen-right {
    width: 340px; flex-shrink: 0;
    display: flex; flex-direction: column; gap: 12px;
}
.entity-section-label {
    font-size: 0.8rem; font-weight: 600;
    color: var(--text-secondary, #8e9bb0);
    text-transform: uppercase;
}
.entity-text-input {
    width: 100%;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    border-radius: 6px; padding: 12px;
    color: white; font-size: 0.9rem; outline: none;
}
.entity-textarea {
    width: 100%; flex: 1; min-height: 160px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    border-radius: 6px; padding: 12px;
    color: white; font-size: 0.9rem;
    resize: none; outline: none; line-height: 1.4;
}
.entity-textarea--last { margin: 0; }
.entity-text-input:focus,
.entity-textarea:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15);
}

/* --- Load Project Modal --- */
.load-project-header {
    margin-bottom: 1rem;
    display: flex; justify-content: space-between; align-items: center;
}
.load-project-actions {
    display: flex; gap: 8px; align-items: center;
}
.load-project-folder-btn {
    width: 32px; height: 32px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    color: var(--accent-blue);
}
.project-list-container {
    display: flex; flex-direction: column; gap: 8px;
}
.project-list-loading {
    text-align: center; color: var(--text-secondary); padding: 20px;
}

/* --- Main Layout Panes --- */
.pane-content--flex {
    display: flex; flex-direction: column; height: 100%;
}
.chat-messages-scroll {
    flex: 1; overflow-y: auto; overflow-x: hidden;
    word-wrap: break-word; overflow-wrap: break-word; word-break: break-word;
    padding-bottom: 10px;
}
.chat-placeholder {
    opacity: 0.5; text-align: center; margin-top: 50%;
}
.chat-input-area {
    position: relative;
    border-top: 1px solid var(--border-subtle); padding-top: 10px;
}
.chat-controls {
    display: flex; justify-content: flex-end; margin-bottom: 5px;
}
.deep-think-btn {
    display: flex; align-items: center; gap: 4px;
    font-size: 0.75rem;
    border-color: var(--border-subtle); color: var(--text-secondary);
}
.chat-textarea {
    width: 100%; background: transparent; border: none;
    color: var(--text-primary); resize: none; outline: none;
    font-family: inherit; min-height: 40px;
}

/* --- Script Pane --- */
.pane-controls-overlay {
    position: absolute; top: 10px; right: 10px;
    z-index: 10; display: flex; gap: 8px;
}
.export-dropdown {
    display: none; position: absolute; right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 8px; z-index: 100;
    min-width: 140px; padding: 5px 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.export-section-label {
    padding: 4px 12px; font-size: 0.7rem;
    color: var(--text-muted); text-transform: uppercase;
    font-weight: 600; letter-spacing: 0.05em; margin-bottom: 2px;
}
.export-link {
    display: block; padding: 6px 12px;
    color: var(--text-primary); text-decoration: none;
    font-size: 0.85rem; transition: background 0.2s;
}
.export-link:hover { background: var(--bg-panel-subtle); }
.export-divider {
    border-top: 1px solid var(--border-subtle); margin: 6px 0;
}

/* --- Timeline --- */
.timeline-scroll { overflow: hidden; }

/* --- Colgroup widths (semantic classes for <col>) --- */
.col-number   { width: 60px; }
.col-visual   { width: 120px; }
.col-action   { width: 30%; }
.col-camera   { width: 15%; }
.col-audio    { width: 15%; }
.col-video    { width: 120px; }
.col-comments { width: auto; }

/* --- Settings Modal --- */
.settings-content {
    display: flex; flex-direction: column; gap: 16px;
}
.settings-reset-btn {
    width: 100%; text-align: left; justify-content: flex-start;
}
.settings-save-btn {
    margin-top: 8px; width: 100%; justify-content: center;
}

/* --- Generation Modal (genModal) --- */
.gen-api-usage {
    display: flex; gap: 15px; font-size: 11px; align-items: center;
}
.gen-keyframes-gallery {
    display: flex; gap: 8px; overflow-x: auto;
    padding: 10px 24px 0 24px;
    min-height: 100px; align-items: center;
}
.gen-prompt-textarea {
    flex: 1; min-height: 160px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-subtle);
    border-radius: 12px; padding: 12px;
    color: var(--text-primary);
    font-family: var(--font-main); font-size: 0.95rem;
    resize: none; outline: none; margin-bottom: 15px;
}
.viewport-actions-bar {
    position: absolute; bottom: 16px; left: 50%;
    transform: translateX(-50%);
    display: flex; gap: 10px;
    background: rgba(0, 0, 0, 0.85);
    padding: 8px 12px; border-radius: 12px;
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(8px);
    z-index: 30;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.btn-action-approve {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.2); color: #60a5fa;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 6px; cursor: pointer;
}
.btn-action-default {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 6px; cursor: pointer;
    background: rgba(255,255,255,0.05); color: white;
    border: 1px solid rgba(255,255,255,0.1);
}
.btn-action-icon {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; padding: 0;
    border-radius: 6px; cursor: pointer;
    background: rgba(255,255,255,0.05); color: white;
    border: 1px solid rgba(255,255,255,0.1);
}
.action-btn-label { font-size: 0.85rem; }
.action-btn-label--bold { font-size: 0.85rem; font-weight: 500; }
.viewport-divider {
    width: 1px; background: rgba(255,255,255,0.1); margin: 0 4px;
}

/* --- Video Generation Modal --- */
.video-modal-content {
    max-width: 1200px; width: 95%; padding: 0;
    overflow: hidden; display: flex; flex-direction: column;
    background: rgba(15, 20, 31, 0.95);
}
.video-modal-workspace {
    padding: 20px; display: flex; gap: 20px;
    overflow-y: auto; flex: 1;
}
.video-modal-left {
    flex: 1; display: flex; flex-direction: column; gap: 10px;
}
.video-modal-right {
    width: 320px; flex-shrink: 0;
    display: flex; flex-direction: column; gap: 20px;
}
.video-modal-right--narrow { width: 280px; }
.video-settings-group {
    display: flex; flex-direction: column; gap: 15px;
}
.video-prompt-label {
    font-size: 0.9rem; color: var(--text-color);
    font-weight: 600; display: block;
}
.video-prompt-textarea {
    resize: none; flex: 1; min-height: 400px;
    padding: 15px; background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
    border-radius: 8px; color: white; outline: none;
    font-size: 1.05rem; line-height: 1.5;
    font-family: 'Inter', sans-serif;
}
.video-prompt-textarea--short { min-height: 200px; }
.video-generate-btn {
    width: 100%; flex-shrink: 0; padding: 12px;
    background: linear-gradient(135deg, #4A9EFF 0%, #3B82F6 100%);
    color: white; border: none; border-radius: 8px;
    font-weight: 600; cursor: pointer;
    display: flex; justify-content: center; align-items: center; gap: 8px;
}
.video-options-wrapper { margin-top: -5px; }
.video-options-hidden { display: none; gap: 10px; flex-wrap: wrap; }
.video-options-flex { display: flex; gap: 10px; flex-wrap: wrap; }

/* --- Kling Motion Control --- */
.motion-options { display: none; flex-direction: column; gap: 10px; margin-top: 10px; }
.motion-upload-box {
    display: flex; flex-direction: column; padding: 10px;
    background: rgba(0,0,0,0.3);
    border: 1px dashed var(--border-subtle);
    border-radius: 8px; text-align: center;
    cursor: pointer; position: relative;
}
.motion-file-input {
    position: absolute; width: 100%; height: 100%;
    top: 0; left: 0; opacity: 0; cursor: pointer; z-index: 2;
}
.motion-file-name {
    color: var(--text-primary); pointer-events: none; z-index: 1;
}
.motion-flex-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* --- Voice Generation Modal --- */
.voice-modal-content {
    max-width: 800px; width: 95%; padding: 0;
    overflow: hidden; display: flex; flex-direction: column;
    background: rgba(15, 20, 31, 0.95); z-index: 10;
}
.voice-enhance-btn {
    padding: 4px 10px; font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.15); color: #3b82f6;
    border: 1px solid rgba(59,130,246,0.3);
    border-radius: 4px;
    display: flex; align-items: center; gap: 6px;
    cursor: pointer; transition: all 0.2s;
}
.voice-enhance-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}
.voice-prompt-header {
    display: flex; justify-content: space-between; align-items: center;
}
.voice-generate-btn {
    width: 100%; flex-shrink: 0; padding: 12px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white; border: none; border-radius: 8px;
    font-weight: 600; cursor: pointer;
    display: flex; justify-content: center; align-items: center; gap: 8px;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}
.voice-loader {
    display: none; text-align: center;
    color: var(--text-secondary); font-size: 0.85rem; margin-top: 5px;
}
.voice-spinner {
    display: inline-block;
    border: 2px solid rgba(255,255,255,0.1);
    border-left-color: white;
    border-radius: 50%; width: 14px; height: 14px;
    animation: spin 1s linear infinite;
    vertical-align: middle; margin-right: 5px;
}
.voice-stability-slider { width: 100%; cursor: pointer; }

/* --- Image Viewer Lightbox --- */
.image-viewer-lightbox { z-index: 4000; }
.image-viewer-container {
    position: relative; max-width: 90vw; max-height: 90vh;
    display: flex; justify-content: center; align-items: center;
    pointer-events: none;
}
.image-viewer-img {
    max-width: 100%; max-height: 100%;
    object-fit: contain; border-radius: 12px;
    pointer-events: auto;
}

/* --- Add button spacing --- */
.add-entity-btn { margin-top: 15px; }
.settings-endpoint-spacing { margin-top: 8px; }
.settings-apikey-spacing { margin-bottom: 8px; }

/* ── Storyboard table — extracted from inline styles (Phase 3) ──────────── */
.sb-empty-state {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}
.sb-add-row-cell {
    padding: 10px;
    text-align: center;
}
.sb-video-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}
.sb-video-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    opacity: 0.8;
}
.sb-video-label {
    position: relative;
    z-index: 2;
}
.sb-audio-wrapper {
    padding: 0;
    position: relative;
    vertical-align: top;
}
.sb-audio-editable {
    width: 100%;
    height: 100%;
    min-height: 80px;
    box-sizing: border-box;
    border: none;
    outline: none;
    background: transparent;
    padding: 10px;
}
.sb-voice-btn {
    padding: 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}
.sb-voice-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}
.sb-volume-slider {
    writing-mode: vertical-lr;
    direction: rtl;
    width: 4px;
    height: 60px;
    accent-color: #94a3b8;
    cursor: pointer;
    padding: 0;
    margin: 0;
    appearance: slider-vertical;
    -webkit-appearance: slider-vertical;
}
.vol-dropdown-container {
    position: relative;
    display: inline-block;
}
.vol-dropdown {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    padding: 8px;
    background: rgba(15, 20, 31, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    display: none;
    flex-direction: column;
    align-items: center;
    z-index: 100;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

/* ── Session restore overlay ─────────────────────────────────────────────── */
.session-restore-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.8);
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    flex-direction: column;
    color: white;
    backdrop-filter: blur(8px);
    font-family: inherit;
}
.session-restore__title { margin-bottom: 20px; }
.session-restore__desc {
    margin-bottom: 30px;
    color: var(--text-secondary);
    text-align: center;
    max-width: 400px;
}
.session-restore__btn {
    padding: 12px 24px;
    font-size: 1.1rem;
    cursor: pointer;
}
.session-restore__spinner {
    width: 20px; height: 20px;
    display: inline-block;
    vertical-align: middle;
}

/* ── Project card (load modal) ───────────────────────────────────────────── */
.project-card {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}
.project-card:hover {
    border-color: var(--accent-blue);
    transform: translateY(-2px);
}
.project-card__cover {
    width: 100%; height: 120px;
    object-fit: cover;
    background: var(--bg-panel-subtle);
}
.project-card__name {
    padding: 10px;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.project-card__delete {
    position: absolute;
    top: 8px; right: 8px;
    background: rgba(0,0,0,0.7);
    color: var(--color-danger);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    width: 26px; height: 26px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    z-index: 10;
}
.project-card__delete:hover {
    background: var(--color-danger);
    color: white;
}

/* ── Project list grid ───────────────────────────────────────────────────── */
.project-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    padding: 10px;
}

/* ── API usage badge ─────────────────────────────────────────────────────── */
.api-usage-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: inherit;
}
.api-usage-badge--over {
    color: var(--color-danger);
    background-color: var(--color-danger-bg);
    border: 1px solid var(--color-danger-border);
}
.api-usage-badge--ok {
    color: var(--color-muted);
    background-color: rgba(255,255,255,0.05);
}

/* ── Chat sidebar messages ───────────────────────────────────────────────── */
.chat-msg-user {
    margin-top: 10px;
    color: #fff;
    background: transparent;
    padding: 0;
}
.chat-msg-ai {
    margin-top: 5px;
    color: var(--accent-blue, #3b82f6);
}
.chat-msg-processing {
    margin-top: 10px;
    color: var(--text-secondary, #8e9bb0);
    font-style: italic;
}
.chat-msg-error {
    color: var(--color-danger, #ef4444);
}

/* ── Deep Think button active state ──────────────────────────────────────── */
.deep-think-btn--active {
    color: var(--accent-blue) !important;
    border-color: var(--accent-blue) !important;
    background: var(--color-accent-blue-subtle) !important;
}

/* ── Input highlight flash ───────────────────────────────────────────────── */
.input-highlight { border-color: var(--accent-blue) !important; }

/* ── Ref context menu ────────────────────────────────────────────────────── */
.ref-context-menu {
    position: absolute;
    border: 1px solid var(--accent-blue);
    border-radius: 8px;
    padding: 8px;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 200px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    background: var(--bg-panel, #1a1a2e);
}

/* ── Zoomable image cursor ───────────────────────────────────────────────── */
.zoomable { cursor: zoom-in; }

/* ── Ref picker menu options ─────────────────────────────────────────────── */
.ref-menu-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 4px 0;
}
.ref-menu-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    padding: 0 10px;
    margin-bottom: 4px;
    font-weight: bold;
    letter-spacing: 0.5px;
}
.ref-menu-option {
    border: none;
    width: 100%;
    text-align: left;
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 6px 10px;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
}
.ref-menu-option:hover { background: rgba(255,255,255,0.08); }
.ref-menu-option--char { color: var(--accent-blue); }
.ref-menu-option--loc { color: var(--color-accent-purple); }
.ref-menu-option--upload { color: white; }
.ref-menu-thumb {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-deep);
    flex-shrink: 0;
}
.ref-menu-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Entity manager (char/loc) inline input ──────────────────────────────── */
.entity-url-input {
    width: 100%;
    padding: 5px 10px;
    margin-top: 5px;
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-element);
    color: var(--text-primary);
    font-size: 0.82rem;
}

/* ── Gallery item selection ──────────────────────────────────────────────── */
.gallery-item-selected { border: 2px solid var(--accent-blue) !important; }
.gallery-item-deselected { border: 2px solid transparent !important; }

/* ── PDF export container ────────────────────────────────────────────────── */
.pdf-export-container {
    background: #FFFFFF;
    color: #000000;
    padding: 40px;
    font-family: 'Courier New', Courier, monospace;
    width: 800px;
}
.pdf-export-container, .pdf-export-container * {
    color: #000000 !important;
    text-shadow: none !important;
}

/* ── Video keyframe thumb ────────────────────────────────────────────────── */
.vkf-thumb { position: relative; }
.vkf-thumb--selected { border: 2px solid #3b82f6 !important; }
.vkf-thumb--deselected { border: 1px solid transparent !important; }

/* ── Voice generation helpers ────────────────────────────────────────────── */
.voice-enhance-flash {
    transition: background 0.3s ease;
    background: rgba(255, 255, 255, 0.2) !important;
}
.btn-disabled-dim { opacity: 0.5; }
.img-error-dim { opacity: 0.2; }
.vkf-debug-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.8);
    color: #f87171;
    font-size: 9px;
    word-break: break-all;
    z-index: 99;
    line-height: 1;
    pointer-events: none;
    min-height: 10px;
}

/* ── Video play icon (centered overlay) ──────────────────────────────────── */
.video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
    transition: transform 0.2s ease;
}
.gallery-thumb:hover .video-play-icon {
    transform: translate(-50%, -50%) scale(1.1);
}

/* ── Gallery wrap mode ───────────────────────────────────────────────────── */
.gallery-wrap-mode {
    flex-wrap: wrap;
    overflow-x: visible;
}

/* ── Button success flash ────────────────────────────────────────────────── */
.btn-success-flash { background: rgba(76, 175, 80, 0.9) !important; }
