/* ============================================================
   CINEMA STUDIO NLE — Loki AI Dashboard
   Higgsfield-inspired non-linear editor with AI generation
   ============================================================ */

/* ==================== BASE LAYOUT ==================== */
.tab-page[data-page="cinema"] {
    position: fixed !important;
    top: 56px !important;
    left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: 100vw !important;
    height: calc(100vh - 56px) !important;
    overflow: hidden !important;
    padding: 0 !important; margin: 0 !important;
    max-width: none !important;
    z-index: 100;
}

.cinema-page {
    display: flex; flex-direction: column;
    height: 100%; width: 100%;
    background: #060609;
    overflow: hidden;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    color: #d0d0d8;
}

/* Film grain overlay */
.cinema-page::before {
    content: '';
    position: absolute; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
    background-size: 200px;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.4;
    mix-blend-mode: screen;
}

/* ==================== 4-PANEL GRID ==================== */
.cinema-workspace {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.cinema-top {
    display: flex;
    flex: 1.2;
    min-height: 200px;
    overflow: hidden;
}

/* ==================== LEFT: MEDIA BROWSER ==================== */
.cinema-media-browser {
    width: 240px;
    min-width: 200px;
    background: #08080c;
    border-right: 1px solid rgba(92,232,154,0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cinema-mb-header {
    padding: 10px 12px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cinema-mb-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(92,232,154,0.5);
}

.cinema-mb-tabs {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.cinema-mb-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    background: none;
    border: none;
    border-radius: 5px;
    color: rgba(255,255,255,0.6);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: 'Outfit', sans-serif;
    text-align: left;
}
.cinema-mb-tab:hover { background: rgba(255,255,255,0.03); color: rgba(255,255,255,0.6); }
.cinema-mb-tab.active { background: rgba(92,232,154,0.08); color: #5ce89a; }
.cinema-mb-tab svg { opacity: 0.4; flex-shrink: 0; }
.cinema-mb-tab.active svg { opacity: 1; stroke: #5ce89a; }

.cinema-mb-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(92,232,154,0.1) transparent;
}
.cinema-mb-content::-webkit-scrollbar { width: 3px; }
.cinema-mb-content::-webkit-scrollbar-thumb { background: rgba(92,232,154,0.15); border-radius: 3px; }

.cinema-mb-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
}

.cinema-mb-thumb {
    aspect-ratio: 16/9;
    border-radius: 4px;
    overflow: hidden;
    cursor: grab;
    position: relative;
    border: 1px solid rgba(255,255,255,0.04);
    transition: all 0.15s;
    background: rgba(255,255,255,0.02);
}
.cinema-mb-thumb:hover { border-color: rgba(92,232,154,0.2); transform: scale(1.02); }
.cinema-mb-thumb img, .cinema-mb-thumb video { width: 100%; height: 100%; object-fit: cover; }
.cinema-mb-thumb-label {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 2px 4px;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cinema-mb-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px;
    margin-top: 6px;
    background: none;
    border: 1px dashed rgba(92,232,154,0.12);
    border-radius: 5px;
    color: rgba(92,232,154,0.4);
    font-size: 12px;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.15s;
}
.cinema-mb-upload-btn:hover { border-color: rgba(92,232,154,0.3); color: #5ce89a; }

/* ==================== CENTER: VIDEO PREVIEW ==================== */
.cinema-preview {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0a0a0e;
    min-width: 0;
    position: relative;
    /* Mint edge glow — matches the prompt bar treatment so the two frames feel like a pair */
    border: 1px solid rgba(92,232,154,0.22);
    border-radius: 10px;
    margin: 8px;
    box-shadow:
        0 0 12px rgba(92,232,154,0.18),
        0 0 3px rgba(92,232,154,0.3),
        0 4px 24px rgba(0,0,0,0.4);
    overflow: hidden;
}
/* Preview header — absolutely-positioned tool buttons top-right */
.cinema-preview-header {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 4;
    display: flex;
    gap: 6px;
    pointer-events: auto;
}
.cinema-preview-tool {
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(10,10,14,0.72);
    backdrop-filter: blur(12px);
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    transition: all 0.15s ease;
}
.cinema-preview-tool:hover {
    border-color: rgba(92,232,154,0.35);
    background: rgba(10,10,14,0.9);
    color: #5ce89a;
    transform: translateY(-1px);
}
.cinema-preview-tool[aria-pressed="true"] {
    border-color: rgba(92,232,154,0.5);
    background: rgba(92,232,154,0.12);
    color: #5ce89a;
    box-shadow: 0 0 0 1px rgba(92,232,154,0.12), 0 0 14px -4px rgba(92,232,154,0.35);
}
/* Edit Mode button — mint accent so it reads as the power feature */
.cinema-preview-tool--edit {
    color: #5ce89a;
    border-color: rgba(92,232,154,0.28);
    background: rgba(92,232,154,0.06);
}
.cinema-preview-tool--edit:hover {
    color: #9effc4;
    border-color: rgba(92,232,154,0.55);
    background: rgba(92,232,154,0.14);
    box-shadow: 0 0 0 1px rgba(92,232,154,0.14), 0 0 16px -4px rgba(92,232,154,0.5);
}
.cinema-preview-tool--edit[aria-pressed="true"] {
    color: #06180d;
    background: linear-gradient(180deg, #3fd47e, #1f9a54);
    border-color: rgba(10,30,16,0.6);
    box-shadow: 0 0 0 1px rgba(92,232,154,0.14), 0 0 18px -4px rgba(92,232,154,0.55);
}

/* ==================== IN-FRAME EDIT PANEL (Wan 2.7) ==================== */
.cin-edit-panel {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 6;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(6,8,12,0.96), rgba(10,10,14,0.92));
    backdrop-filter: blur(18px) saturate(1.3);
}
.cinema-preview.editing .cin-edit-panel { display: flex; }
/* Hide the other preview children while editing so it OWNS the frame */
.cinema-preview.editing .cinema-preview-viewport > video,
.cinema-preview.editing .cinema-preview-viewport > img,
.cinema-preview.editing .cinema-preview-viewport > .cinema-preview-empty,
.cinema-preview.editing .cinema-preview-viewport > #cinStoryboardGrid {
    display: none !important;
}

.cin-edit-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 8px;
    border-bottom: 1px solid rgba(92,232,154,0.08);
    flex-shrink: 0;
}
.cin-edit-panel-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cin-edit-panel-sub {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: rgba(92,232,154,0.6);
    letter-spacing: 2.2px;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cin-edit-panel-actions { display: inline-flex; gap: 6px; align-items: center; }

.cin-edit-src-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid rgba(92,232,154,0.22);
    background: rgba(92,232,154,0.06);
    color: #5ce89a;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.cin-edit-src-btn:hover { background: rgba(92,232,154,0.14); border-color: rgba(92,232,154,0.45); }
.cin-edit-src-btn input[type="file"] { display: none; }

.cin-edit-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.02);
    color: rgba(255,255,255,0.65);
    cursor: pointer;
    transition: all 0.15s;
}
.cin-edit-close:hover { border-color: rgba(255,120,120,0.35); color: rgba(255,140,140,0.9); background: rgba(255,60,60,0.05); }

.cin-edit-panel-stage {
    flex: 1;
    min-height: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.cin-edit-panel-stage video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.cin-edit-empty {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: rgba(255,255,255,0.35);
    letter-spacing: 0.6px;
    text-align: center;
    padding: 24px;
    line-height: 1.6;
}

.cin-edit-panel-controls {
    padding: 10px 14px 12px;
    border-top: 1px solid rgba(255,255,255,0.04);
    background: rgba(14,14,20,0.7);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cin-edit-panel-controls textarea {
    width: 100%;
    box-sizing: border-box;
    resize: none;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(92,232,154,0.14);
    border-radius: 8px;
    padding: 7px 11px;
    color: #e8e8ec;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
    min-height: 36px;
    max-height: 80px;
}
.cin-edit-panel-controls textarea:focus { border-color: rgba(92,232,154,0.4); }
.cin-edit-panel-controls textarea::placeholder { color: rgba(255,255,255,0.28); font-style: italic; }

.cin-edit-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.cin-edit-row .cinema-ctrl-select {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    padding: 4px 8px;
    color: rgba(255,255,255,0.75);
    font-size: 12px;
    cursor: pointer;
}
.cin-edit-row input[type="number"] {
    width: 70px;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.02);
    color: #e8e8ec;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    outline: none;
}
.cin-edit-row input[type="number"]::placeholder { color: rgba(255,255,255,0.3); }

.cin-edit-ref-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 999px;
    border: 1px dashed rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.015);
    color: rgba(255,255,255,0.55);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    cursor: pointer;
}
.cin-edit-ref-btn:hover { border-color: rgba(92,232,154,0.28); color: #5ce89a; }
.cin-edit-ref-btn input[type="file"] { display: none; }

.cin-edit-row .cinema-generate-btn { margin-left: auto; }

.cin-edit-status {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: rgba(255,255,255,0.35);
    letter-spacing: 0.5px;
    min-height: 12px;
}
/* Fullscreen host treatment */
.cinema-preview:fullscreen {
    background: #000;
    padding: 0;
}
.cinema-preview:fullscreen .cinema-preview-viewport {
    flex: 1;
}
/* Storyboard grid mode — replaces the single clip/player with a thumbnail grid */
.cinema-preview.storyboard .cinema-preview-viewport > video,
.cinema-preview.storyboard .cinema-preview-viewport > img,
.cinema-preview.storyboard .cinema-preview-viewport > .cinema-preview-empty {
    display: none !important;
}
.cinema-preview.storyboard #cinStoryboardGrid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    padding: 14px;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    align-content: start;
    background: #060609;
}
.cin-sb-card {
    position: relative;
    aspect-ratio: 16/9;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.025);
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.15s ease;
}
.cin-sb-card:hover { border-color: rgba(92,232,154,0.35); transform: translateY(-1px); }
.cin-sb-card.selected { border-color: #5ce89a; box-shadow: 0 0 0 1px #5ce89a, 0 0 16px -4px rgba(92,232,154,0.55); }
.cin-sb-card img, .cin-sb-card video {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.cin-sb-card-label {
    position: absolute;
    left: 6px; right: 6px; bottom: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: rgba(255,255,255,0.75);
    background: linear-gradient(180deg, transparent, rgba(0,0,0,0.75));
    padding: 14px 6px 4px;
    border-radius: 0 0 4px 4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cin-sb-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: rgba(255,255,255,0.3);
    letter-spacing: 0.5px;
}

.cinema-preview-viewport {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

.cinema-preview-viewport video,
.cinema-preview-viewport img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cinema-preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: rgba(255,255,255,0.42);
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* ===== Generating overlay — centered, layered rings + gem + progress bar ===== */
.cin-preview-gen {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% 45%, rgba(92,232,154,0.08) 0%, rgba(0,0,0,0.94) 72%);
    z-index: 5;
    pointer-events: none;
}
.cin-preview-gen-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    padding: 24px 40px;
    max-width: 82%;
    text-align: center;
}
.cin-preview-gen-stage {
    position: relative;
    width: 240px;
    height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cin-preview-gen-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(92,232,154,0.35);
    box-shadow: 0 0 18px rgba(92,232,154,0.18) inset;
    animation: cinGenRingPulse 3.4s ease-in-out infinite;
}
.cin-preview-gen-ring-1 { width: 110px; height: 110px; animation-delay: 0s; border-color: rgba(92,232,154,0.55); }
.cin-preview-gen-ring-2 { width: 170px; height: 170px; animation-delay: 0.5s; border-color: rgba(92,232,154,0.32); }
.cin-preview-gen-ring-3 { width: 236px; height: 236px; animation-delay: 1.0s; border-color: rgba(92,232,154,0.16); }
@keyframes cinGenRingPulse {
    0%   { transform: scale(0.88); opacity: 0.15; }
    50%  { transform: scale(1.00); opacity: 1;    }
    100% { transform: scale(1.12); opacity: 0.05; }
}
.cin-preview-gen-orbit {
    position: absolute;
    width: 196px;
    height: 196px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, rgba(92,232,154,0) 0deg, rgba(92,232,154,0.45) 90deg, rgba(92,232,154,0.9) 130deg, rgba(92,232,154,0.45) 170deg, rgba(92,232,154,0) 260deg);
    -webkit-mask: radial-gradient(circle, transparent 62%, black 63%, black 70%, transparent 71%);
            mask: radial-gradient(circle, transparent 62%, black 63%, black 70%, transparent 71%);
    animation: cinGenOrbit 3s linear infinite;
    opacity: 0.95;
}
@keyframes cinGenOrbit {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
.cin-preview-gen-gem-wrap {
    position: relative;
    z-index: 2;
    animation: cinGenGemFloat 4.2s ease-in-out infinite;
}
@keyframes cinGenGemFloat {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50%      { transform: translateY(-3px) rotate(2deg); }
}
.cin-preview-gen-gem {
    filter: drop-shadow(0 0 16px rgba(92,232,154,0.6)) drop-shadow(0 0 32px rgba(92,232,154,0.3));
    animation: cinGenGemPulse 2.4s ease-in-out infinite;
}
@keyframes cinGenGemPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.08); filter: drop-shadow(0 0 22px rgba(92,232,154,0.85)) drop-shadow(0 0 44px rgba(92,232,154,0.45)); }
}
.cin-preview-gen-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #5ce89a;
    text-shadow: 0 0 10px rgba(92,232,154,0.55);
    position: relative;
    z-index: 1;
    animation: cinGenLabelBlink 1.8s ease-in-out infinite;
}
@keyframes cinGenLabelBlink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.55; }
}
.cin-preview-gen-prompt {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: rgba(255,255,255,0.6);
    max-width: 520px;
    position: relative;
    z-index: 1;
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.cin-preview-gen-bar {
    width: 240px;
    height: 2px;
    border-radius: 2px;
    background: rgba(255,255,255,0.06);
    overflow: hidden;
    position: relative;
    z-index: 1;
}
.cin-preview-gen-bar-fill {
    position: absolute;
    top: 0;
    left: -40%;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, rgba(92,232,154,0) 0%, rgba(92,232,154,0.8) 50%, rgba(92,232,154,0) 100%);
    animation: cinGenBarSweep 1.6s ease-in-out infinite;
}
@keyframes cinGenBarSweep {
    from { left: -40%; }
    to   { left: 100%; }
}

/* ===== Cinema prompt: pinned character chips ===== */
.cin-ref-chips {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 6px 8px 4px;
    border-bottom: 1px solid rgba(92,232,154,0.05);
}
.cin-add-char-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 999px;
    border: 1px dashed rgba(92,232,154,0.35);
    background: rgba(92,232,154,0.04);
    color: rgba(92,232,154,0.85);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.15s;
}
.cin-add-char-btn:hover {
    background: rgba(92,232,154,0.12);
    border-color: rgba(92,232,154,0.6);
    color: #5ce89a;
}
.cin-char-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 4px 3px 3px;
    border-radius: 999px;
    border: 1px solid rgba(92,232,154,0.3);
    background: rgba(92,232,154,0.08);
    color: #e8e8ec;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    max-width: 220px;
}
.cin-char-chip img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.cin-char-chip-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cin-char-chip-x {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.55);
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    padding: 0;
    margin-left: 2px;
    transition: all 0.12s;
}
.cin-char-chip-x:hover {
    background: rgba(239,68,68,0.2);
    color: #ef4444;
}

/* Character picker popover */
.cin-char-picker {
    position: fixed;
    z-index: 10050;
    min-width: 240px;
    max-width: 320px;
    max-height: 360px;
    overflow: auto;
    background: rgba(14,16,20,0.96);
    border: 1px solid rgba(92,232,154,0.22);
    border-radius: 10px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.55), 0 0 24px rgba(92,232,154,0.1);
    padding: 6px;
    backdrop-filter: blur(12px);
}
.cin-char-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s;
}
.cin-char-picker-row:hover { background: rgba(92,232,154,0.08); }
.cin-char-picker-row img {
    width: 30px; height: 30px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.cin-char-picker-row .cin-char-picker-initial {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: rgba(92,232,154,0.1);
    color: #5ce89a;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.cin-char-picker-row .cin-char-picker-name {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: #e8e8ec;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cin-char-picker-empty {
    padding: 18px 12px;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: rgba(255,255,255,0.4);
}

/* ===== Session tile — in-progress placeholder shown inside the right gallery ===== */
.cin-session-tile--generating .cin-tile-gen {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% 45%, rgba(92,232,154,0.1) 0%, rgba(0,0,0,0.88) 75%);
}
.cin-tile-gen-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(92,232,154,0.5);
    animation: cinGenRingPulse 3s ease-in-out infinite;
}
.cin-tile-gen-ring-1 { width: 40px; height: 40px; animation-delay: 0s; }
.cin-tile-gen-ring-2 { width: 70px; height: 70px; animation-delay: 0.6s; border-color: rgba(92,232,154,0.25); }
.cin-tile-gen-gem {
    filter: drop-shadow(0 0 8px rgba(92,232,154,0.75));
    animation: cinGenGemPulse 2.2s ease-in-out infinite;
}
.cin-tile-gen-caption {
    position: absolute;
    top: 6px;
    left: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(0,0,0,0.55);
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: #5ce89a;
}
.cin-tile-gen-prompt {
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: 5px;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    line-height: 1.3;
    color: rgba(255,255,255,0.72);
    font-style: italic;
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.6) 100%);
    padding: 10px 2px 2px;
    text-align: left;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}
.cin-session-live-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #5ce89a;
    box-shadow: 0 0 6px rgba(92,232,154,0.8);
    animation: cinSessionLiveDot 1.2s ease-in-out infinite;
}
@keyframes cinSessionLiveDot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.4); opacity: 0.4; }
}

/* ===== Inpaint modal ===== */
.cin-inpaint-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(8px);
}
.cin-inpaint-shell {
    width: min(880px, 92vw);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    background: rgba(14,16,20,0.96);
    border: 1px solid rgba(92,232,154,0.22);
    border-radius: 14px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.7), 0 0 40px rgba(92,232,154,0.12);
    overflow: hidden;
}
.cin-inpaint-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.cin-inpaint-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #5ce89a;
    flex: 1;
}
.cin-inpaint-close {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cin-inpaint-close:hover { color: #5ce89a; border-color: rgba(92,232,154,0.3); }
.cin-inpaint-canvas-wrap {
    position: relative;
    background: #000;
    flex: 1;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.cin-inpaint-canvas-stack {
    position: relative;
    display: inline-block;
    max-width: 100%;
    max-height: 60vh;
}
.cin-inpaint-src, .cin-inpaint-mask {
    display: block;
    max-width: 100%;
    max-height: 60vh;
    border-radius: 8px;
}
.cin-inpaint-mask {
    position: absolute;
    inset: 0;
    mix-blend-mode: screen;
    cursor: crosshair;
    touch-action: none;
}
.cin-inpaint-controls {
    display: grid;
    grid-template-columns: 1fr auto auto auto auto;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    align-items: center;
}
.cin-inpaint-controls input[type=text] {
    grid-column: 1 / 2;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    color: #e8e8ec;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    outline: none;
}
.cin-inpaint-controls input[type=text]:focus { border-color: rgba(92,232,154,0.35); }
.cin-inpaint-brush {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: rgba(255,255,255,0.55);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.cin-inpaint-brush input[type=range] { width: 90px; accent-color: #5ce89a; }
.cin-inpaint-btn {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid rgba(92,232,154,0.25);
    background: rgba(92,232,154,0.08);
    color: #5ce89a;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    cursor: pointer;
}
.cin-inpaint-btn:hover { background: rgba(92,232,154,0.16); }
.cin-inpaint-btn.cin-inpaint-btn-ghost {
    border-color: rgba(255,255,255,0.08);
    background: transparent;
    color: rgba(255,255,255,0.6);
}
.cin-inpaint-btn.cin-inpaint-btn-primary {
    background: linear-gradient(135deg, rgba(92,232,154,0.28), rgba(61,184,124,0.38));
    color: #0f1014;
    border-color: rgba(92,232,154,0.6);
    box-shadow: 0 0 18px rgba(92,232,154,0.4);
}
.cin-inpaint-btn.cin-inpaint-btn-primary:hover { filter: brightness(1.1); }
.cin-inpaint-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
/* Stage holds the gem + orbital ring */
.cinema-preview-empty .cin-idle-stage {
    position: relative;
    width: 110px;
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Soft mint glow behind gem */
.cinema-preview-empty .cin-idle-glow {
    position: absolute;
    inset: 30%;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, rgba(92,232,154,0.32) 0%, rgba(92,232,154,0.08) 45%, transparent 70%);
    filter: blur(10px);
    animation: cinIdlePulse 5.5s ease-in-out infinite;
    pointer-events: none;
}
/* Orbital conic-gradient rings */
.cinema-preview-empty .cin-idle-orbit {
    position: absolute;
    inset: 6%;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        rgba(92,232,154,0)     0deg,
        rgba(92,232,154,0)    70deg,
        rgba(92,232,154,0.55) 110deg,
        rgba(168,255,204,0.9) 135deg,
        rgba(92,232,154,0.55) 160deg,
        rgba(92,232,154,0)    200deg,
        rgba(92,232,154,0)   360deg
    );
    -webkit-mask: radial-gradient(circle, transparent 42%, #000 44%, #000 47%, transparent 49%);
            mask: radial-gradient(circle, transparent 42%, #000 44%, #000 47%, transparent 49%);
    animation: cinIdleOrbit 12s linear infinite;
    pointer-events: none;
}
.cinema-preview-empty .cin-idle-orbit-2 {
    inset: 18%;
    animation-duration: 18s;
    animation-direction: reverse;
    opacity: 0.55;
    -webkit-mask: radial-gradient(circle, transparent 40%, #000 42%, #000 44%, transparent 46%);
            mask: radial-gradient(circle, transparent 40%, #000 42%, #000 44%, transparent 46%);
}
/* The faceted gem */
.cinema-preview-empty .cin-idle-gem {
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 0 12px rgba(92,232,154,0.55)) drop-shadow(0 0 2px rgba(255,255,255,0.35));
    animation: cinIdleGem 5.5s ease-in-out infinite;
}
/* Faint film-strip texture — sprocket holes top + bottom (smaller) */
.cinema-preview-empty .cin-idle-film {
    position: absolute;
    left: 0; right: 0;
    height: 6px;
    background-image: repeating-linear-gradient(
        90deg,
        transparent 0,
        transparent 6px,
        rgba(255,255,255,0.08) 6px,
        rgba(255,255,255,0.08) 10px
    );
    opacity: 0.45;
    pointer-events: none;
}
.cinema-preview-empty .cin-idle-film-top    { top: 6px;    }
.cinema-preview-empty .cin-idle-film-bot    { bottom: 6px; }
/* Captions — Unbounded display font for Cinema identity */
.cinema-preview-empty .cin-idle-caption {
    font-family: 'Unbounded', 'Space Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 300;
    color: rgba(255,255,255,0.7);
    letter-spacing: 0.8px;
    margin-top: 2px;
}
.cinema-preview-empty .cin-idle-sub {
    font-family: 'Unbounded', 'Space Grotesk', sans-serif;
    font-size: 10px;
    font-weight: 700;
    color: rgba(92,232,154,0.5);
    letter-spacing: 5px;
    text-transform: uppercase;
    margin-top: -2px;
}

@keyframes cinIdleOrbit {
    0%   { transform: rotate(0deg);   }
    100% { transform: rotate(360deg); }
}
@keyframes cinIdlePulse {
    0%, 100% { opacity: 0.7; transform: scale(1);    }
    50%      { opacity: 1;   transform: scale(1.12); }
}
@keyframes cinIdleGem {
    0%, 100% { transform: rotate(0deg)   scale(1);    }
    45%      { transform: rotate(-6deg)  scale(1.04); }
    55%      { transform: rotate(-6deg)  scale(1.04); }
}

/* Transport controls */
.cinema-transport {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(8,8,12,0.9);
    border-top: 1px solid rgba(255,255,255,0.04);
}

.cinema-transport-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.65);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.cinema-transport-btn:hover { color: #5ce89a; background: rgba(92,232,154,0.06); }
.cinema-transport-btn.active { color: #5ce89a; }

.cinema-transport-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: rgba(255,255,255,0.65);
    letter-spacing: 0.5px;
    min-width: 120px;
    text-align: center;
}

.cinema-transport-seek {
    flex: 1;
    height: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.cinema-transport-seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #5ce89a;
    box-shadow: 0 0 6px rgba(92,232,154,0.4);
}

/* ==================== RIGHT: PROPERTIES PANEL ==================== */
.cinema-properties {
    width: 260px;
    min-width: 220px;
    background: #08080c;
    border-left: 1px solid rgba(92,232,154,0.06);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(92,232,154,0.1) transparent;
}
.cinema-properties::-webkit-scrollbar { width: 3px; }
.cinema-properties::-webkit-scrollbar-thumb { background: rgba(92,232,154,0.15); border-radius: 3px; }

.cinema-prop-section {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.cinema-prop-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(92,232,154,0.4);
    margin-bottom: 10px;
}

.cinema-prop-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.cinema-prop-label {
    font-size: 13px;
    color: rgba(255,255,255,0.65);
    font-weight: 500;
    min-width: 70px;
}

.cinema-prop-slider {
    flex: 1;
    height: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    margin: 0 8px;
}
.cinema-prop-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #5ce89a;
    box-shadow: 0 0 4px rgba(92,232,154,0.3);
}

.cinema-prop-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: rgba(92,232,154,0.5);
    min-width: 30px;
    text-align: right;
}

/* ==================== BOTTOM: TIMELINE ==================== */
.cinema-timeline-container {
    flex: 0 0 400px; /* taller default — raised prompt area, 6 tracks fit comfortably */
    min-height: 160px;
    max-height: 70vh;
    background: #0a0a0e;
    border-top: 1px solid rgba(92,232,154,0.06);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden; /* clip the playhead so it can't visually escape into the prompt bar */
    /* Prompt bar is narrow/centered and absolutely positioned — it floats over
       the timeline; no padding reservation needed so tracks fill to bottom. */
}

/* Resize handle at top of timeline */
.cinema-timeline-resize {
    height: 4px;
    cursor: ns-resize;
    background: transparent;
    position: relative;
}
.cinema-timeline-resize:hover { background: rgba(92,232,154,0.15); }
.cinema-timeline-resize::after {
    content: '';
    position: absolute;
    left: 50%; top: 1px;
    transform: translateX(-50%);
    width: 30px; height: 2px;
    border-radius: 1px;
    background: rgba(255,255,255,0.08);
}

.cinema-timeline-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: rgba(8,8,12,0.9);
    border-bottom: 1px solid rgba(255,255,255,0.03);
    flex-shrink: 0;
}

.cinema-tl-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 4px;
    color: rgba(255,255,255,0.6);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    padding: 3px 8px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 4px;
}
.cinema-tl-btn:hover { border-color: rgba(92,232,154,0.2); color: #5ce89a; }

.cinema-tl-zoom {
    width: 80px;
    height: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.cinema-tl-zoom::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #5ce89a;
}

/* Timeline body */
.cinema-timeline {
    flex: 1;
    overflow: auto;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: rgba(92,232,154,0.08) transparent;
}

/* Time ruler */
.cinema-tl-ruler {
    height: 22px;
    background: linear-gradient(180deg, rgba(92,232,154,0.045), rgba(8,8,12,0.85));
    border-bottom: 1px solid rgba(92,232,154,0.1);
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: flex-end;
}
.cinema-tl-ruler-mark {
    position: absolute;
    bottom: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: rgba(255,255,255,0.5);
    transform: translateX(-50%);
}
.cinema-tl-ruler-mark::after {
    content: '';
    position: absolute;
    bottom: -1px; left: 50%;
    width: 1px; height: 6px;
    background: rgba(255,255,255,0.08);
}

/* Tracks — subtle zebra banding + left type-accent so the rows are visually distinct */
.cinema-tl-track {
    display: flex;
    height: 48px;
    min-height: 48px;
    border-bottom: 1px solid rgba(92,232,154,0.06);
    position: relative;
}
.cinema-tl-track:nth-child(even)         { background: rgba(255,255,255,0.015); }
.cinema-tl-track:nth-child(odd)          { background: rgba(92,232,154,0.015); }
.cinema-tl-track:hover                   { background: rgba(92,232,154,0.035); }
/* Type-based left accent stripe — tells you at a glance what track you're on */
.cinema-tl-track[data-track-id^="v"]::before,
.cinema-tl-track[data-track-id^="a"]::before,
.cinema-tl-track[data-track-id^="fx"]::before {
    content: '';
    position: absolute;
    left: 80px;
    top: 0; bottom: 0;
    width: 2px;
    z-index: 3;
    pointer-events: none;
}
.cinema-tl-track[data-track-id^="v"]::before  { background: rgba(92,232,154,0.35); }
.cinema-tl-track[data-track-id^="a"]::before  { background: rgba(0,180,255,0.35);  }
.cinema-tl-track[data-track-id^="fx"]::before { background: rgba(184,248,71,0.35); }

.cinema-tl-track-header {
    width: 80px;
    min-width: 80px;
    padding: 4px 8px;
    background: rgba(10,12,16,0.92);
    border-right: 1px solid rgba(92,232,154,0.1);
    display: flex;
    align-items: center;
    gap: 4px;
    position: sticky;
    left: 0;
    z-index: 4;
}
/* Tint track headers by type so video/audio/effect are instantly distinguishable */
.cinema-tl-track[data-track-id^="v"]  .cinema-tl-track-header { box-shadow: inset 3px 0 0 rgba(92,232,154,0.25); }
.cinema-tl-track[data-track-id^="a"]  .cinema-tl-track-header { box-shadow: inset 3px 0 0 rgba(0,180,255,0.25);  }
.cinema-tl-track[data-track-id^="fx"] .cinema-tl-track-header { box-shadow: inset 3px 0 0 rgba(184,248,71,0.25); }

.cinema-tl-track-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: rgba(255,255,255,0.72);
    letter-spacing: 0.4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cinema-tl-track-body {
    flex: 1;
    position: relative;
    min-width: 0;
    /* Per-second gridlines so the eye can read distance even without clips */
    background-image:
        linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
    background-size: 90px 100%;   /* ~1 second at default zoom (fps 30 × 3px/frame) */
    background-position: 0 0;
}

/* Clips on timeline */
.cinema-tl-clip {
    position: absolute;
    top: 3px;
    height: calc(100% - 6px);
    border-radius: 4px;
    cursor: grab;
    display: flex;
    align-items: center;
    overflow: hidden;
    transition: box-shadow 0.15s;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: rgba(255,255,255,0.7);
    padding: 0 6px;
    white-space: nowrap;
}
.cinema-tl-clip.video { background: rgba(92,232,154,0.2); border: 1px solid rgba(92,232,154,0.3); }
.cinema-tl-clip.image { background: rgba(92,232,154,0.15); border: 1px solid rgba(92,232,154,0.25); }
.cinema-tl-clip.audio { background: rgba(0,180,255,0.15); border: 1px solid rgba(0,180,255,0.25); color: rgba(0,180,255,0.8); }
.cinema-tl-clip.effect { background: rgba(184,248,71,0.12); border: 1px solid rgba(184,248,71,0.2); color: rgba(184,248,71,0.8); }
.cinema-tl-clip.generating { opacity: 0.5; border-style: dashed; }
.cinema-tl-clip.selected { box-shadow: 0 0 0 2px #5ce89a, 0 0 12px rgba(92,232,154,0.2); z-index: 3; }
.cinema-tl-clip.dragging {
    z-index: 5;
    opacity: 0.92;
    box-shadow: 0 0 0 2px #5ce89a, 0 6px 24px rgba(92,232,154,0.35);
    will-change: transform;
    transition: none;
}
.cinema-tl-clip:active { cursor: grabbing; }

/* Clip resize handles */
.cinema-tl-clip-handle {
    position: absolute;
    top: 0; bottom: 0;
    width: 6px;
    cursor: ew-resize;
    z-index: 2;
}
.cinema-tl-clip-handle.left { left: 0; }
.cinema-tl-clip-handle.right { right: 0; }
.cinema-tl-clip-handle:hover { background: rgba(92,232,154,0.3); }

/* Playhead — spans full timeline height, always visible above clips */
.cinema-tl-playhead {
    position: absolute;
    top: 0;
    height: 100%;
    min-height: 300px;
    width: 3px;
    margin-left: -1px;
    background: linear-gradient(180deg, #a8ffcc, #5ce89a 15%, #5ce89a 85%, #a8ffcc);
    z-index: 999;
    pointer-events: auto;
    cursor: ew-resize;
    box-shadow: 0 0 10px rgba(92,232,154,0.7), 0 0 2px rgba(92,232,154,0.9), inset 0 0 1px rgba(255,255,255,0.6);
    border-radius: 1px;
}
/* Invisible wider hit-area for easier grabbing (12px wide around the 3px line) */
.cinema-tl-playhead::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    left: -6px; right: -6px;
    cursor: ew-resize;
}
.cinema-tl-playhead::before {
    content: '';
    position: absolute;
    top: 0; left: -7px;
    width: 16px; height: 16px;
    background: #5ce89a;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    filter: drop-shadow(0 0 5px rgba(92,232,154,0.7));
    cursor: grab;
    pointer-events: auto;
}
.cinema-tl-playhead.scrubbing,
.cinema-tl-playhead.scrubbing::before {
    cursor: grabbing !important;
}
.cinema-tl-playhead.scrubbing {
    box-shadow: 0 0 14px rgba(92,232,154,0.9), 0 0 4px rgba(92,232,154,1), inset 0 0 1px rgba(255,255,255,0.8);
}
/* Ruler becomes the scrub zone */
.cinema-tl-ruler { cursor: ew-resize; }

/* ==================== VERY BOTTOM: PROMPT BAR ==================== */
/* Prompt bar — snaps to very bottom of screen */
.cinema-prompt-bar {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 80px);
    max-width: 1000px;
    min-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px 14px 8px;
    background: rgba(14,14,20,0.95);
    backdrop-filter: blur(28px) saturate(1.3);
    border: 1px solid rgba(92,232,154,0.22);
    border-bottom: none;
    border-radius: 14px 14px 0 0;
    /* Mint edge glow — matches the loading video centerpiece at ~50% brightness */
    box-shadow:
        0 0 12px rgba(92,232,154,0.18),
        0 0 3px rgba(92,232,154,0.3),
        0 -4px 30px rgba(0,0,0,0.5);
    z-index: 1000;
    flex-shrink: 0;
}

.cinema-prompt-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cinema-prompt-input {
    /* No flex-grow: we now sit in a column-flex wrapper where flex:1 would
       collapse us to zero height. Width fills the wrapper instead. */
    flex: none;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    padding: 7px 12px;
    color: #e8e8ec;
    font-size: 15px;
    font-family: 'Outfit', sans-serif;
    outline: none;
    resize: none;
    min-height: 28px;
    /* Default starting height — JS resize handler overrides via inline style.height. */
    height: 36px;
    /* No max-height: drag handle controls expansion (up to viewport-40px). */
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* =====================================================================
   Cinema prompt-bar mode toggle
   Single compact pill. aria-pressed drives all visual state via CSS —
   setDirectorMode(active) only needs to flip the attribute.
   ===================================================================== */
.cin-mode-toggle {
    position: relative;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 11px 0 9px;
    height: 26px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.09);
    background: rgba(255,255,255,0.025);
    color: rgba(255,255,255,0.55);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.3px;
    text-transform: uppercase;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    transition: background 200ms ease, border-color 200ms ease, color 200ms ease, box-shadow 260ms ease;
}
.cin-mode-toggle:hover {
    border-color: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.78);
}
.cin-mode-toggle:focus-visible {
    box-shadow: 0 0 0 2px rgba(92,232,154,0.35);
}
.cin-mode-toggle .cin-mode-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: transparent;
    border: 1.25px solid currentColor;
    flex-shrink: 0;
    transition: background 220ms ease, border-color 220ms ease, box-shadow 260ms ease, transform 260ms ease;
}
.cin-mode-toggle .cin-mode-label {
    position: relative;
    display: inline-grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    min-width: 48px;
    height: 10px;
    overflow: hidden;
}
.cin-mode-toggle .cin-mode-label > span {
    grid-column: 1;
    grid-row: 1;
    display: block;
    transition: opacity 220ms ease, transform 260ms cubic-bezier(.4,0,.2,1);
}
.cin-mode-toggle .cin-mode-label-b {
    opacity: 0;
    transform: translateY(8px);
    color: #5ce89a;
}

/* ---- Director (active) state ---- */
.cin-mode-toggle[aria-pressed="true"] {
    border-color: rgba(92,232,154,0.42);
    background: rgba(92,232,154,0.09);
    color: #5ce89a;
    box-shadow:
        0 0 0 1px rgba(92,232,154,0.08),
        0 0 22px -4px rgba(92,232,154,0.5);
}
.cin-mode-toggle[aria-pressed="true"]:hover {
    border-color: rgba(92,232,154,0.6);
    color: #7ff0b6;
}
.cin-mode-toggle[aria-pressed="true"] .cin-mode-dot {
    background: #5ce89a;
    border-color: #5ce89a;
    box-shadow: 0 0 8px rgba(92,232,154,0.75);
    animation: cinModeDotPulse 1.8s ease-in-out infinite;
}
.cin-mode-toggle[aria-pressed="true"] .cin-mode-label-a {
    opacity: 0;
    transform: translateY(-8px);
}
.cin-mode-toggle[aria-pressed="true"] .cin-mode-label-b {
    opacity: 1;
    transform: translateY(0);
}
@keyframes cinModeDotPulse {
    0%, 100% { box-shadow: 0 0 6px rgba(92,232,154,0.6); }
    50%      { box-shadow: 0 0 13px rgba(92,232,154,1); }
}

/* ---- Suggest chip (Director mode only) ---- */
.cin-suggest-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    height: 26px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(92,232,154,0.28);
    background: rgba(92,232,154,0.07);
    color: #5ce89a;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1;
    transition: background 180ms ease, border-color 180ms ease, transform 180ms ease, box-shadow 220ms ease;
}
.cin-suggest-btn:hover {
    background: rgba(92,232,154,0.14);
    border-color: rgba(92,232,154,0.55);
    box-shadow: 0 0 18px -4px rgba(92,232,154,0.55);
}
.cin-suggest-btn:active { transform: translateY(1px); }
.cin-suggest-btn svg { flex-shrink: 0; }
.cinema-prompt-input:focus { border-color: rgba(92,232,154,0.2); box-shadow: 0 0 0 1px rgba(92,232,154,0.06); }
.cinema-prompt-input::placeholder { color: rgba(255,255,255,0.18); font-style: italic; }

.cinema-controls-row {
    display: flex;
    align-items: center;
    height: 26px;
    gap: 2px;
    flex-wrap: nowrap;
    min-width: 0;
    overflow: hidden;
}
.cinema-controls-row > * { flex-shrink: 0; }
.cinema-controls-row > .cinema-ctrl-divider:first-child,
.cinema-controls-row > .cinema-ctrl-divider + .cinema-ctrl-divider { display: none; }

.cinema-ctrl-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    padding: 2px 6px;
    white-space: nowrap;
    cursor: default;
}

.cinema-ctrl-select {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 4px;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}
.cinema-ctrl-select option { background: #0c0c10; color: #d0d0d8; }
.cinema-ctrl-select:hover { color: rgba(255,255,255,0.7); }

.cinema-ctrl-divider {
    width: 1px;
    height: 14px;
    background: rgba(255,255,255,0.06);
    margin: 0 3px;
    flex-shrink: 0;
}

.cinema-ctrl-btn {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 4px;
    background: none;
    color: rgba(255,255,255,0.6);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.cinema-ctrl-btn:hover { border-color: rgba(92,232,154,0.2); color: #5ce89a; }

/* Generate button — deep emerald gem, all greens, no whites */
.cinema-generate-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(180deg, #3fd47e 0%, #1f9a54 48%, #0a3e22 100%);
    border: 1px solid rgba(4,20,10,0.6);
    border-radius: 999px;
    color: #d8ffe9;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 800;
    padding: 5px 12px 5px 8px;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(.4,0,.2,1), box-shadow 0.2s ease, filter 0.2s ease;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 10px rgba(32,140,80,0.35), inset 0 1px 0 rgba(160,255,200,0.22);
    flex-shrink: 0;
    line-height: 1;
    text-shadow: 0 1px 0 rgba(4,20,10,0.35);
}
.cinema-generate-btn::before {
    /* Top facet — a cooler green highlight, not white */
    content: '';
    position: absolute;
    top: 1px; left: 6px; right: 6px;
    height: 38%;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(126,240,170,0.55), rgba(126,240,170,0));
    pointer-events: none;
}
.cinema-generate-btn::after {
    /* Shimmer sweep — lighter mint tint, no white */
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 40%, rgba(140,255,190,0.28) 50%, transparent 60%);
    background-size: 220% 100%;
    background-position: 180% 0;
    animation: cinGemShimmer 3.6s ease-in-out infinite;
    pointer-events: none;
}
@keyframes cinGemShimmer {
    0%   { background-position: 180% 0; }
    65%  { background-position: -80% 0; }
    100% { background-position: -80% 0; }
}
.cinema-generate-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 16px rgba(32,180,100,0.55), 0 0 22px rgba(32,180,100,0.3), inset 0 1px 0 rgba(160,255,200,0.28);
    filter: brightness(1.08);
}
.cinema-generate-btn:active { transform: translateY(0); filter: brightness(0.92); }
.cinema-generate-btn .cin-gen-gem {
    filter: drop-shadow(0 0 3px rgba(92,232,154,0.6));
    flex-shrink: 0;
    animation: cinGemSparkle 4.4s ease-in-out infinite;
}
@keyframes cinGemSparkle {
    0%, 100% { transform: rotate(0deg) scale(1); }
    45% { transform: rotate(-8deg) scale(1.06); }
    55% { transform: rotate(-8deg) scale(1.06); }
}
.cinema-generate-btn .cin-gen-label {
    position: relative;
    z-index: 1;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 900px) {
    .cinema-media-browser { width: 180px; min-width: 160px; }
    .cinema-properties { width: 200px; min-width: 180px; }
}
@media (max-width: 700px) {
    .cinema-top { flex-direction: column; }
    .cinema-media-browser, .cinema-properties { width: 100%; height: 150px; flex-direction: row; }
}
