/* CSS Design System for ANIAH Video Studio - Video Editor
   Design direction: professional dark NLE (Movavi/Premiere-adjacent).
   Two-accent system - violet for primary interactive state, cyan for
   focus/playhead/selection - with a single warm pink->orange gradient
   reserved for the one signature moment: Export Video. */

:root {
    --bg-app: #0a0a0d;
    --bg-panel: #131318;
    --bg-panel-header: #191921;
    --bg-input: #1d1d25;
    --bg-input-hover: #27272f;
    --border-color: #27272f;
    --border-light: #3c3c48;

    --text-main: #f5f5f8;
    --text-muted: #8f8fa3;
    --text-dark: #57576a;

    --accent: #7c5cff;
    --accent-hover: #9277ff;
    --accent-glow: rgba(124, 92, 255, 0.45);
    --accent-secondary: #00d2ff;
    --accent-secondary-glow: rgba(0, 210, 255, 0.35);

    --cta-gradient: linear-gradient(135deg, #ff3d77 0%, #ff8a3d 100%);
    --cta-gradient-hover: linear-gradient(135deg, #ff5288 0%, #ff9d57 100%);
    --cta-glow: rgba(255, 61, 119, 0.4);

    --success: #00e676;
    --danger: #ff3860;
    --warning: #ffb020;

    --track-height: 48px;
    --track-info-width: 140px;
    /* Timeline panel's total height. Must always be >= toolbar height (38px)
       + ruler height (28px) + 5 * --track-height, or the tracks area falls
       back to scrolling to show the lower tracks - kept in sync with
       --track-height at every breakpoint below so that never happens. */
    --timeline-height: 312px;

    /* Clip Colors */
    --clip-video: #2f6fed;
    --clip-video-border: #74acff;
    --clip-audio: #17a463;
    --clip-audio-border: #5fdb9d;
    --clip-image: #9b3fd6;
    --clip-image-border: #cd82f5;
    --clip-text: #e2650a;
    --clip-text-border: #ffb15c;
    --clip-highlight: #d6c60a;
    --clip-highlight-border: #ffee58;
    --clip-blur: #5b3fd6;
    --clip-blur-border: #a58cf5;
    --clip-zoompan: #0aa3a3;
    --clip-zoompan-border: #5fe8e8;

    --shadow-soft: 0 2px 10px rgba(0, 0, 0, 0.35);
    --shadow-elevated: 0 12px 32px rgba(0, 0, 0, 0.5);
    --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-app);
    background-image: radial-gradient(circle at 20% -10%, rgba(124, 92, 255, 0.08), transparent 40%),
                       radial-gradient(circle at 90% 0%, rgba(0, 210, 255, 0.06), transparent 35%);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
    font-family: inherit;
    color: inherit;
}

:focus-visible {
    outline: 2px solid var(--accent-secondary);
    outline-offset: 2px;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 6px;
    border: 2px solid var(--bg-app);
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
    background-clip: padding-box;
}

/* Timeline horizontal scrollbar - made larger and white so it's easy to
   see and grab, distinct from the app's other (smaller, dark) scrollbars. */
#timeline-scroll-container::-webkit-scrollbar {
    height: 20px; /* double the default 10px */
    width: 20px;
}
#timeline-scroll-container::-webkit-scrollbar-thumb {
    background: #ffffff;
    border-radius: 8px;
    border: 3px solid var(--bg-app);
    background-clip: padding-box;
}
#timeline-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #ffffff;
    background-clip: padding-box;
}
#timeline-scroll-container {
    scrollbar-color: #ffffff transparent; /* Firefox */
    scrollbar-width: auto;
}

/* App Container Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Top Navigation Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 52px;
    background-color: var(--bg-panel);
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 0 rgba(124, 92, 255, 0.15), 0 4px 16px rgba(0, 0, 0, 0.3);
    padding: 0 16px;
    z-index: 10;
    position: relative;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 9px;
}

.logo-icon {
    width: 22px;
    height: 22px;
    color: var(--accent-secondary);
    filter: drop-shadow(0 0 6px var(--accent-secondary-glow));
}

.app-title {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.3px;
    background: linear-gradient(135deg, #ffffff, var(--accent-secondary) 130%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.project-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

#project-name {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 5px;
    border: 1px solid transparent;
    cursor: text;
    transition: all 0.2s var(--ease);
}

#project-name:hover, #project-name:focus {
    border-color: var(--border-light);
    background-color: var(--bg-app);
    outline: none;
}

.project-status-badge {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    background: rgba(0, 230, 118, 0.1);
    color: var(--success);
    padding: 3px 9px;
    border-radius: 12px;
    border: 1px solid rgba(0, 230, 118, 0.25);
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* File Menu - top-left dropdown (Import Media / Import Project / Save
   Project / Exit), sits right in front of the app title. */
.file-menu {
    position: relative;
}

.file-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s var(--ease);
}

.file-menu-btn svg {
    transition: transform 0.2s var(--ease);
}

.file-menu-btn:hover {
    background-color: var(--bg-input-hover);
    border-color: var(--accent-secondary);
}

.file-menu.open .file-menu-btn {
    background-color: var(--bg-input-hover);
    border-color: var(--accent-secondary);
    box-shadow: 0 0 0 3px var(--accent-secondary-glow);
}

.file-menu.open .file-menu-btn svg {
    transform: rotate(180deg);
}

.file-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 190px;
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 9px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    padding: 6px;
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.15s var(--ease), transform 0.15s var(--ease), visibility 0.15s;
}

.file-menu.open .file-menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.file-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: none;
    border: none;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-size: 12.5px;
    font-weight: 500;
    text-align: left;
    padding: 9px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}

.file-menu-item svg {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: color 0.15s var(--ease);
}

.file-menu-item:hover {
    background-color: var(--bg-input-hover);
}

.file-menu-item:hover svg {
    color: var(--accent-secondary);
}

.file-menu-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 6px 4px;
}

.file-menu-item-danger:hover {
    background-color: rgba(255, 23, 68, 0.12);
    color: var(--danger);
}

.file-menu-item-danger:hover svg {
    color: var(--danger);
}

/* Exit Overlay - shown after the user confirms File > Exit, since a script
   can't reliably close a tab it didn't itself open. */
.exit-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-app);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.exit-overlay-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    color: var(--text-main);
}

.exit-overlay-card svg {
    color: var(--accent-secondary);
    filter: drop-shadow(0 0 10px var(--accent-secondary-glow));
    margin-bottom: 6px;
}

.exit-overlay-card h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 600;
}

.exit-overlay-card p {
    font-size: 13px;
    color: var(--text-muted);
}

/* Main Workspace */
.workspace {
    display: grid;
    grid-template-columns: 320px 1fr 340px;
    height: calc(100vh - 52px - var(--timeline-height));
    background-color: var(--bg-app);
    overflow: hidden;
}

.panel {
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-panel-header);
}

.panel-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Tab Header and Contents */
.tabs-header {
    display: flex;
    background-color: var(--bg-panel-header);
    border-bottom: 1px solid var(--border-color);
    padding: 0 8px;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 12px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s var(--ease);
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--accent-secondary);
    border-bottom-color: var(--accent-secondary);
    text-shadow: 0 0 12px var(--accent-secondary-glow);
}

.tab-content {
    display: none;
    flex-direction: column;
    height: calc(100% - 41px);
    overflow-y: auto;
    padding: 12px;
}

.tab-content.active {
    display: flex;
}

/* Left Panel: Media Bin */
.media-bin-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 10px;
}

.media-bin-title {
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.media-bin-count {
    font-size: 11px;
    color: var(--text-muted);
}

.media-bin-import-row {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.media-bin-import-row .media-bin-import-btn {
    width: auto;
    flex: 1;
    margin-bottom: 0;
    min-width: 0;
    font-size: 12px !important;
    padding: 9px 4px;
}

.media-bin-import-row .media-bin-import-btn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-bin-import-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    padding: 9px 6px;
    margin-bottom: 10px;
    font-size: 20px !important;
}

.media-bin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.media-bin-actions .btn {
    flex: 1 1 calc(50% - 3px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 4px;
    font-size: 13px !important;
    white-space: nowrap;
}

.media-bin-actions .btn svg {
    flex-shrink: 0;
}

.media-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}

.media-folders-list, .media-root-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Media Bin Folders */
.media-folder {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: rgba(124, 92, 255, 0.03);
    overflow: hidden;
}

.media-folder.drop-target {
    border-color: var(--accent-secondary);
    box-shadow: 0 0 0 1px var(--accent-secondary) inset, 0 0 16px rgba(0, 210, 255, 0.1);
}

.media-folder-header {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 12px 10px;
    cursor: pointer;
    user-select: none;
}

.media-folder-header:hover {
    background-color: var(--bg-input-hover);
}

.media-folder.selected .media-folder-header {
    background-color: rgba(0, 210, 255, 0.08);
    box-shadow: 0 0 0 1px var(--accent-secondary) inset;
}

.media-folder-chevron {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform 0.15s var(--ease);
}

.media-folder.collapsed .media-folder-chevron {
    transform: rotate(-90deg);
}

.media-folder-icon {
    flex-shrink: 0;
    color: var(--accent-secondary);
}

.media-folder-name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    outline: none;
    border-radius: 3px;
    padding: 1px 3px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-folder-name:focus {
    background-color: var(--bg-input);
    box-shadow: 0 0 0 1px var(--accent-secondary);
    white-space: normal;
}

.media-folder-count {
    font-size: 10.5px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.media-folder-delete-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: none;
    border: none;
    color: #ffb020;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s var(--ease);
}

.media-folder-delete-btn:hover {
    color: #ff1744;
    background-color: rgba(255, 176, 32, 0.12);
}

.media-folder-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 8px 8px 8px;
}

.media-folder.collapsed .media-folder-items {
    display: none;
}

.empty-media-msg {
    color: var(--text-dark);
    font-size: 12px;
    text-align: center;
    padding: 32px 16px;
    line-height: 1.5;
}

/* Media Item Card */
.media-item {
    display: flex;
    align-items: center;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px;
    gap: 10px;
    cursor: grab;
    user-select: none;
    transition: all 0.2s var(--ease);
}

.media-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    background-color: var(--bg-input-hover);
    box-shadow: var(--shadow-soft);
}

.media-item:active {
    cursor: grabbing;
}

.media-item.selected {
    border-color: var(--accent-secondary);
    background-color: rgba(0, 210, 255, 0.08);
    box-shadow: 0 0 0 1px var(--accent-secondary);
}

.media-marquee-box {
    position: fixed;
    border: 1px solid var(--accent-secondary);
    background-color: rgba(0, 210, 255, 0.12);
    z-index: 9999;
    pointer-events: none;
}

.media-thumbnail-wrapper {
    position: relative;
    width: 64px;
    height: 38px;
    background-color: #000;
    border-radius: 5px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-type-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.75);
    padding: 1px 3px;
    border-radius: 2px;
    font-size: 8px;
    font-weight: bold;
    text-transform: uppercase;
}

.media-info {
    flex: 1;
    min-width: 0;
}

.media-name {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.media-meta {
    font-size: 10px;
    color: var(--text-muted);
}

.media-actions {
    display: flex;
}

.media-delete-btn {
    background: none;
    border: none;
    color: #ffcc00;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s var(--ease);
}

.media-delete-btn:hover {
    color: var(--danger);
    background-color: rgba(255, 56, 96, 0.12);
}

/* Preset Cards (Texts and Transitions) */
.section-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 16px;
}

.preset-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.preset-card {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s var(--ease);
}

.preset-card:hover {
    border-color: var(--accent-secondary);
    background-color: var(--bg-input-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.preset-preview {
    height: 48px;
    background-color: #000;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 20px;
    margin-bottom: 6px;
    overflow: hidden;
    user-select: none;
}

.preset-title {
    font-size: 11px;
    font-weight: 500;
}

/* Text Presets Styling */
.text-preview {
    color: #fff;
    background: linear-gradient(135deg, #333, #111);
}
.text-glow {
    text-shadow: 0 0 8px var(--accent-secondary);
    color: var(--accent-secondary);
}

/* Annotate Presets Styling (Highlight Box / Zoom & Pan) */
.annotate-preview {
    background: linear-gradient(135deg, #222, #111);
    color: var(--clip-zoompan-border);
}
.highlight-preview-swatch {
    padding: 3px 10px;
    border-radius: 5px;
    background: rgba(214, 198, 10, 0.35);
    border: 2px solid var(--clip-highlight-border);
    color: #fff;
    font-size: 15px;
}
.blur-preview-swatch {
    width: 34px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid var(--clip-blur-border);
    background: rgba(91, 63, 214, 0.35);
    backdrop-filter: blur(3px);
}
.zoompan-preview {
    color: var(--clip-zoompan-border);
}

/* Transition Presets Preview Styling */
.t-none { background: #2a2a2e; color: #888; font-size: 13px; }
.t-fade { background: linear-gradient(90deg, #111 0%, var(--accent-secondary) 100%); color: #fff; font-size: 14px; }
.t-blur-fade { background: linear-gradient(90deg, #111 0%, var(--accent-secondary) 100%); color: #fff; font-size: 14px; filter: blur(1.5px); }
.t-slide-left { background: linear-gradient(90deg, var(--accent-secondary), #111); color: #fff; font-size: 22px; }
.t-slide-right { background: linear-gradient(270deg, var(--accent-secondary), #111); color: #fff; font-size: 22px; }
.t-slide-up { background: linear-gradient(0deg, var(--accent-secondary), #111); color: #fff; font-size: 22px; }
.t-slide-down { background: linear-gradient(180deg, var(--accent-secondary), #111); color: #fff; font-size: 22px; }
.t-wipe-left { background: linear-gradient(90deg, #111 0%, #111 45%, var(--accent-secondary) 45%, var(--accent-secondary) 100%); }
.t-wipe-right { background: linear-gradient(90deg, var(--accent-secondary) 0%, var(--accent-secondary) 55%, #111 55%, #111 100%); }
.t-wipe-up { background: linear-gradient(0deg, #111 0%, #111 45%, var(--accent-secondary) 45%, var(--accent-secondary) 100%); }
.t-wipe-down { background: linear-gradient(180deg, #111 0%, #111 45%, var(--accent-secondary) 45%, var(--accent-secondary) 100%); }
.t-iris-circle { background: radial-gradient(circle, var(--accent-secondary) 0 45%, #111 46% 100%); }
.t-iris-diamond { background: #111; background-image: linear-gradient(45deg, transparent 47%, var(--accent-secondary) 47% 53%, transparent 53%), linear-gradient(135deg, transparent 47%, var(--accent-secondary) 47% 53%, transparent 53%); background-size: 60% 60%; background-position: center; background-repeat: no-repeat; }
.t-star-wipe { background: #111; color: var(--accent-secondary); font-size: 22px; }
.t-clock-wipe { background: conic-gradient(var(--accent-secondary) 0deg 120deg, #111 120deg 360deg); font-size: 18px; }
.t-venetian { background: repeating-linear-gradient(0deg, var(--accent-secondary) 0 4px, #111 4px 12px); }
.t-blinds { background: repeating-linear-gradient(90deg, var(--accent-secondary) 0 6px, #111 6px 14px); }
.t-blinds-2 { background: repeating-linear-gradient(90deg, var(--accent-secondary) 0 16px, #111 16px 34px); }
.t-random { background: linear-gradient(135deg, #111, var(--accent-secondary)); color: #fff; font-size: 22px; }
.t-checkerboard { background: repeating-conic-gradient(var(--accent-secondary) 0% 25%, #111 0% 50%); background-size: 16px 16px; }
.t-mosaic { background: radial-gradient(circle, var(--accent-secondary) 0 20%, #111 21% 40%, var(--accent-secondary) 41% 60%, #111 61% 100%); }
.t-doors { background: linear-gradient(90deg, #111 0%, #111 46%, var(--accent-secondary) 46%, var(--accent-secondary) 54%, #111 54%, #111 100%); }
.t-curtains { background: linear-gradient(180deg, #111 0%, #111 46%, var(--accent-secondary) 46%, var(--accent-secondary) 54%, #111 54%, #111 100%); }
.t-flip { background: linear-gradient(90deg, #111, var(--accent-secondary), #111); color: #fff; font-size: 22px; }
.t-flip-vertical { background: linear-gradient(0deg, #111, var(--accent-secondary), #111); color: #fff; font-size: 22px; }
.t-spin { background: conic-gradient(var(--accent-secondary), #111, var(--accent-secondary)); color: #fff; font-size: 20px; }
.t-roll { background: radial-gradient(circle, var(--accent-secondary), #111); color: #fff; font-size: 20px; }
.t-cube { background: linear-gradient(135deg, #111, var(--accent-secondary)); color: #fff; font-size: 20px; }
.t-zoom-in { background: radial-gradient(circle, #111 0 30%, var(--accent-secondary) 100%); color: #fff; font-size: 22px; font-weight: 800; }
.t-zoom-out { background: radial-gradient(circle, var(--accent-secondary) 0 30%, #111 100%); color: #fff; font-size: 22px; font-weight: 800; }
.t-cross-zoom { background: radial-gradient(circle, var(--accent-secondary), #111); color: #fff; font-size: 20px; filter: blur(0.5px); }
.t-peel { background: linear-gradient(45deg, #111 58%, var(--accent-secondary) 58%); }

/* Center Panel: Preview Player */
.center-panel {
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 16px;
    background-color: var(--bg-app);
    min-height: 0;
    overflow: hidden;
}

.player-container {
    width: 100%;
    max-width: 960px;
    height: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 0;
}

/* Fullscreen Preview - the browser's Fullscreen API is applied to
   .player-container (canvas + HUD together) so playback controls stay
   usable. The 960px cap and panel padding no longer apply once it's
   filling the whole screen. */
.player-container:fullscreen,
.player-container:-webkit-full-screen {
    max-width: none;
    width: 100vw;
    height: 100vh;
    padding: 32px;
    background-color: #000;
}

.canvas-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background-color: #000;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-elevated), 0 0 0 1px var(--border-color);
    flex-shrink: 0; /* sized precisely in JS (layoutPreviewCanvas) - flex shouldn't second-guess it */
}

#preview-canvas {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.draw-box-hint {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 15, 20, 0.85);
    border: 1px solid var(--clip-blur-border);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    padding: 7px 14px;
    border-radius: 20px;
    z-index: 6;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: var(--shadow-soft);
}

.canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 5;
    backdrop-filter: blur(4px);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-secondary);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.player-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 16px;
    box-shadow: var(--shadow-soft);
}

.player-time-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
    width: 150px;
}

.time-separator {
    color: var(--text-dark);
}

#total-time {
    color: var(--text-muted);
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.player-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease);
}

.player-btn:hover {
    color: var(--text-main);
    background-color: var(--bg-input);
}

.player-btn.active {
    color: var(--danger);
    background-color: rgba(255, 56, 96, 0.12);
}

.player-btn-main {
    background: linear-gradient(135deg, var(--accent), #5a8bff);
    color: #fff;
    width: 44px;
    height: 44px;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.player-btn-main:hover {
    filter: brightness(1.12);
    color: #fff;
    transform: scale(1.06);
}

.player-btn-sm {
    width: 24px;
    height: 24px;
}

.player-audio-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 150px;
    justify-content: flex-end;
}

#volume-slider {
    width: 70px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-color);
    border-radius: 2px;
    outline: none;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-main);
    cursor: pointer;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.3);
    transition: background 0.2s var(--ease);
}

#volume-slider::-webkit-slider-thumb:hover {
    background: var(--accent-secondary);
}

/* Right Panel: Properties Panel */
.empty-properties-msg {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-dark);
    text-align: center;
    gap: 12px;
}

.empty-properties-msg p {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.empty-properties-msg span {
    font-size: 11px;
    padding: 0 16px;
    line-height: 1.4;
}

.prop-section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--accent-secondary);
    margin-top: 18px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}

.prop-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.prop-group label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
}

.prop-row-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.control-input {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 6px 10px;
    font-size: 12px;
    outline: none;
    transition: all 0.2s var(--ease);
    width: 100%;
}

.control-input:hover {
    border-color: var(--border-light);
}

.control-input:focus {
    border-color: var(--accent-secondary);
    box-shadow: 0 0 0 3px var(--accent-secondary-glow);
}

input[type="range"] {
    width: 100%;
    margin-top: 4px;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--accent-secondary);
    cursor: pointer;
    box-shadow: 0 0 8px var(--accent-secondary-glow), 0 0 0 3px var(--bg-panel);
    transition: transform 0.15s var(--ease);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.slider-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--text-muted);
    text-align: right;
    margin-top: 2px;
}

.color-picker-input {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    cursor: pointer;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    cursor: pointer;
}

.align-btn-group, .valign-btn-group {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    overflow: hidden;
}

.align-btn-group .btn, .valign-btn-group .btn {
    flex: 1;
    border: none;
    border-radius: 0;
    font-size: 11px;
    padding: 6px;
}

.align-btn-group .btn.active, .valign-btn-group .btn.active {
    background: linear-gradient(135deg, var(--accent), #5a8bff);
    color: #fff;
}

.text-area {
    resize: none;
}

/* Button UI */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 7px;
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 500;
    padding: 8px 14px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s var(--ease);
    user-select: none;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 11px;
    border-radius: 5px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #5a8bff);
    color: #fff;
    box-shadow: 0 3px 10px var(--accent-glow);
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 5px 16px var(--accent-glow);
}

.btn-secondary {
    background-color: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--bg-input-hover);
    border-color: var(--accent-secondary);
    transform: translateY(-1px);
}

.btn-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-danger {
    background-color: var(--danger);
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    filter: brightness(1.1);
}

.btn-danger:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.w-full {
    width: 100%;
}

/* Signature CTA: Export Video - the one bold gradient moment in the UI */
#btn-export {
    background: var(--cta-gradient);
    color: #fff;
    border: none;
    box-shadow: 0 4px 16px var(--cta-glow);
    font-weight: 600;
}

#btn-export:hover {
    background: var(--cta-gradient-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 22px var(--cta-glow);
}

#btn-export:active {
    transform: translateY(0);
}

/* Bottom Timeline Container */
.timeline-container {
    height: var(--timeline-height);
    background-color: var(--bg-panel);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    z-index: 10;
    user-select: none; /* dragging to select/move clips must never trigger the browser's text-selection popup */
}

.timeline-toolbar {
    height: 38px;
    background-color: var(--bg-panel-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    flex-shrink: 0; /* never let the tracks area below squeeze this - its height must stay fixed and predictable so the track budget math holds */
    overflow-x: auto; /* if it ever runs out of horizontal room, scroll sideways rather than wrapping to a second row and eating into the tracks area's height */
    overflow-y: hidden;
    scrollbar-width: thin;
}

.toolbar-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-divider {
    width: 1px;
    height: 16px;
    background-color: var(--border-color);
    margin: 0 4px;
}

.active-tool-indicator {
    font-size: 11px;
    color: var(--text-dark);
}

.timeline-zoom-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.zoom-label {
    font-size: 11px;
    color: var(--text-muted);
}

.project-length-indicator {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.2px;
}

#timeline-zoom-slider {
    width: 100px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-color);
    border-radius: 2px;
}

/* Tracks Workspace */
.timeline-scroll-container {
    flex: 1;
    overflow: auto;
    position: relative;
}

.timeline-tracks-wrapper {
    position: relative;
    min-width: 100%;
    /* Width will be set dynamically via js based on zoom and total duration */
    display: flex;
    flex-direction: column;
}

.timeline-ruler {
    height: 28px;
    background-color: #101014;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 12;
    display: flex;
}

.ruler-spacer {
    width: var(--track-info-width);
    min-width: var(--track-info-width);
    background-color: var(--bg-panel-header);
    border-right: 1px solid var(--border-color);
    position: sticky;
    left: 0;
    z-index: 13;
}

#ruler-canvas {
    display: block;
    flex: 1;
    height: 100%;
}

.timeline-tracks-area {
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Playhead Scrubber */
.timeline-playhead {
    position: absolute;
    top: -28px; /* overlapping ruler */
    left: 0;
    height: calc(100% + 28px);
    width: 1px;
    z-index: 14; /* above .timeline-ruler (12) and .ruler-spacer (13), or the handle gets hidden behind them */
    pointer-events: none; /* Mouse moves scrubber by clicking ruler or handle */
}

.playhead-handle {
    position: absolute;
    top: 0;
    left: -6px;
    width: 13px;
    height: 16px;
    background-color: var(--accent-secondary);
    box-shadow: 0 0 8px var(--accent-secondary-glow);
    clip-path: polygon(0% 0%, 100% 0%, 100% 60%, 50% 100%, 0% 60%);
    cursor: ew-resize;
    pointer-events: auto;
    animation: playhead-pulse 2.2s ease-in-out infinite;
}

@keyframes playhead-pulse {
    0%, 100% { box-shadow: 0 0 6px var(--accent-secondary-glow); }
    50% { box-shadow: 0 0 12px var(--accent-secondary-glow); }
}

.playhead-line {
    width: 1px;
    height: 100%;
    background-color: var(--accent-secondary);
    box-shadow: 0 0 5px var(--accent-secondary);
}

/* Track Rows */
.track-row {
    display: flex;
    height: var(--track-height);
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.track-row:last-child {
    border-bottom: none;
}

.track-info {
    width: var(--track-info-width);
    min-width: var(--track-info-width);
    background-color: var(--bg-panel-header);
    border-right: 1px solid var(--border-color);
    padding: 6px 12px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 9px;
    position: sticky;
    left: 0;
    z-index: 10;
}

.track-label-group {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.track-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.track-icon-text { background: var(--clip-text); color: #1a1206; }
.track-icon-overlay { background: var(--clip-image); color: #1e0a2e; }
.track-icon-video { background: var(--clip-video); color: #06152e; }
.track-icon-audio { background: var(--clip-audio); color: #04150c; }
.track-icon-annotation { background: linear-gradient(135deg, var(--clip-highlight), var(--clip-zoompan)); color: #0a1210; }

.track-label {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-meta {
    font-size: 9px;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-content {
    flex: 1;
    position: relative;
    background-color: rgba(20, 20, 25, 0.2);
    min-height: 100%;
    /* Add time grids via background pattern in JS or CSS */
    background-size: 100px 100%;
    background-image: linear-gradient(to right, var(--border-color) 1px, transparent 1px);
    transition: background-color 0.2s var(--ease);
}

.track-content.dragover {
    background-color: rgba(0, 210, 255, 0.07);
    box-shadow: inset 0 0 0 1px var(--accent-secondary);
}

.track-content.dragover-blocked {
    background-color: rgba(255, 64, 64, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 64, 64, 0.5);
    cursor: not-allowed;
}

.track-row[data-track-id="text"] .track-content { background-color: rgba(226, 101, 10, 0.035); }
.track-row[data-track-id="overlay"] .track-content { background-color: rgba(155, 63, 214, 0.035); }
.track-row[data-track-id="video"] .track-content { background-color: rgba(47, 111, 237, 0.035); }
.track-row[data-track-id="audio"] .track-content { background-color: rgba(23, 164, 99, 0.035); }
/* Extra tracks added via "+ Video Track" / "+ Audio Track" (data-track-id
   like "video-2", "audio-3") get the same tint as their built-in track. */
.track-row[data-track-id^="video-"] .track-content { background-color: rgba(47, 111, 237, 0.035); }
.track-row[data-track-id^="audio-"] .track-content { background-color: rgba(23, 164, 99, 0.035); }

/* --- Track Lock --- */
.track-lock-btn {
    flex-shrink: 0;
    margin-left: auto;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-dark);
    cursor: pointer;
    transition: background-color 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.track-lock-btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text-light);
}

.track-lock-btn .icon-locked {
    display: none;
}

.track-lock-btn.active {
    background-color: rgba(255, 176, 32, 0.16);
    border-color: rgba(255, 176, 32, 0.4);
    color: #ffb020;
}

.track-lock-btn.active .icon-locked {
    display: block;
}

.track-lock-btn.active .icon-unlocked {
    display: none;
}

/* A locked track's clips are visibly "off limits": diagonal hatching on the
   row, dimmed/desaturated clips, and a not-allowed cursor - clicking,
   dragging, dropping, or double-clicking any of them is a no-op in JS. */
.track-row.track-locked .track-content {
    background-image:
        repeating-linear-gradient(135deg, rgba(255, 176, 32, 0.05) 0px, rgba(255, 176, 32, 0.05) 6px, transparent 6px, transparent 14px),
        linear-gradient(to right, var(--border-color) 1px, transparent 1px);
}

.track-row.track-locked .track-info {
    background-color: rgba(255, 176, 32, 0.05);
}

.track-row.track-locked .timeline-clip {
    opacity: 0.55;
    filter: saturate(0.5);
    cursor: not-allowed;
}

/* --- Track Mute --- */
.track-mute-btn {
    flex-shrink: 0;
    margin-left: auto;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-dark);
    cursor: pointer;
    transition: background-color 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease);
}

/* Lock button follows mute, so it no longer needs its own auto margin to
   hug the right edge of the track header. */
.track-mute-btn + .track-lock-btn {
    margin-left: 0;
}

.track-mute-btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text-light);
}

.track-mute-btn .icon-muted {
    display: none;
}

.track-mute-btn.active {
    background-color: rgba(255, 64, 96, 0.16);
    border-color: rgba(255, 64, 96, 0.4);
    color: #ff4060;
}

.track-mute-btn.active .icon-muted {
    display: block;
}

.track-mute-btn.active .icon-unmuted {
    display: none;
}

/* A muted track's clips still look and behave normally (only playback
   audio is affected) - just a subtle red tint on the header so the muted
   state is easy to spot at a glance. */
.track-row.track-muted .track-info {
    background-color: rgba(255, 64, 96, 0.05);
}

/* Floating Timeline Clips */
.timeline-clip {
    position: absolute;
    top: 3px;
    height: calc(var(--track-height) - 7px);
    border-radius: 5px;
    background-color: var(--clip-video);
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 40%);
    border: 1px solid var(--clip-video-border);
    display: flex;
    align-items: center;
    padding: 0 8px;
    overflow: hidden;
    font-size: 10px;
    color: #fff;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
    transition: box-shadow 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.15s var(--ease);
    z-index: 4; /* below .track-info (10) so clips scroll behind the sticky track sidebar instead of over it */
}

.timeline-clip:hover {
    filter: brightness(1.12);
    transform: translateY(-1px);
}

.timeline-clip.selected {
    outline: 2px solid #fff;
    outline-offset: -1px;
    box-shadow: 0 0 0 3px var(--accent-glow), 0 4px 14px rgba(0, 0, 0, 0.45);
    z-index: 5;
}

/* Live preview highlight while a clip is inside the marquee box-select
   rectangle, before the drag is released and the selection is committed. */
.timeline-clip.marquee-hover {
    outline: 2px dashed #fff;
    outline-offset: -1px;
    filter: brightness(1.15);
}

/* Rubber-band box-select rectangle, drawn in fixed/viewport coordinates so
   it tracks the mouse correctly regardless of timeline scroll position. */
.timeline-marquee-select {
    position: fixed;
    border: 1px solid var(--accent-secondary, #00d2ff);
    background-color: rgba(0, 210, 255, 0.12);
    pointer-events: none;
    z-index: 9998;
    border-radius: 2px;
}

/* Effect Marker - the "X" badge that appears automatically wherever two
   clips on the same track are touching. Gray until a transition has been
   applied to the incoming clip; its width tracks the transition's duration
   in timeline pixels. Draggable left/right to shrink/grow that duration. */
.effect-marker {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 20px;
    min-width: 14px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: ew-resize;
    z-index: 6; /* above clips (4) and selected clips (5) so it's always reachable at the seam */
    user-select: none;
    background-color: rgba(140, 140, 155, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.15s var(--ease);
}

.effect-marker:hover {
    background-color: rgba(170, 170, 185, 0.75);
    transform: translateY(-50%) scale(1.08);
}

.effect-marker.has-effect {
    background-color: var(--accent-secondary);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 6px var(--accent-secondary-glow), 0 1px 4px rgba(0, 0, 0, 0.4);
}

.effect-marker.has-effect:hover {
    box-shadow: 0 0 10px var(--accent-secondary-glow), 0 1px 4px rgba(0, 0, 0, 0.4);
}

.effect-marker-x {
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    color: rgba(255, 255, 255, 0.85);
    pointer-events: none;
}

.effect-marker.has-effect .effect-marker-x {
    color: #05141c;
}

/* Clip Trim Handles */
.clip-handle {
    position: absolute;
    top: 0;
    width: 6px;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.2);
    cursor: ew-resize;
    display: none;
}

.timeline-clip.selected .clip-handle {
    display: block;
}

.clip-handle:hover {
    background-color: rgba(255, 255, 255, 0.55);
}

.clip-handle-left {
    left: 0;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}

.clip-handle-right {
    right: 0;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

.clip-text-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    font-weight: 500;
}

/* Clip Thumbnails - a solid file-name bar on top, with a tiled filmstrip
   preview (pulled from the media bin) filling the rest of the clip below
   it, matching how most video editors, e.g. Movavi, lay out their
   timeline clips. */
.timeline-clip {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
}

.clip-label-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 5px;
    height: 15px;
    padding: 0 6px;
    pointer-events: none;
    background: linear-gradient(135deg, var(--accent), #5a8bff);
    border-bottom: 1px solid rgba(0, 0, 0, 0.25);
}

.clip-thumb-area {
    flex: 1 1 auto;
    min-height: 0;
    background-repeat: repeat-x;
    background-position: left center;
    background-size: auto 100%;
    pointer-events: none;
}

.timeline-clip.has-thumbnail .clip-thumb-area {
    background-color: #14151b;
}

/* Specific clip color variations - each type gets its own textured fill so
   the timeline reads as real editable media, not flat color chips. */
.clip-type-video {
    background-color: var(--clip-video);
    border-color: var(--clip-video-border);
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 40%),
        repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.22) 0 2px, transparent 2px 11px);
}
.clip-type-audio {
    background-color: var(--clip-audio);
    border-color: var(--clip-audio-border);
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 40%),
        repeating-linear-gradient(90deg,
            rgba(255, 255, 255, 0.4) 0 2px, transparent 2px 4px,
            rgba(255, 255, 255, 0.18) 4px 5px, transparent 5px 8px);
}
.clip-type-image {
    background-color: var(--clip-image);
    border-color: var(--clip-image-border);
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 40%),
        radial-gradient(circle, rgba(255, 255, 255, 0.16) 1px, transparent 1.4px);
    background-size: auto, 7px 7px;
}
.clip-type-text {
    background-color: var(--clip-text);
    border-color: var(--clip-text-border);
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 40%),
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.08) 0 6px, transparent 6px 12px);
}
.clip-type-highlight {
    background-color: var(--clip-highlight);
    border-color: var(--clip-highlight-border);
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 40%),
        repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.12) 0 6px, transparent 6px 12px);
}
.clip-type-blur {
    background-color: var(--clip-blur);
    border-color: var(--clip-blur-border);
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 40%),
        radial-gradient(circle, rgba(255, 255, 255, 0.14) 2px, transparent 3px);
    background-size: auto, 10px 10px;
}
.clip-type-zoompan {
    background-color: var(--clip-zoompan);
    border-color: var(--clip-zoompan-border);
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 40%),
        radial-gradient(circle, rgba(255, 255, 255, 0.22) 1.5px, transparent 2px);
    background-size: auto, 9px 9px;
}

.clip-type-icon {
    display: flex;
    align-items: center;
    margin-right: 5px;
    opacity: 0.85;
    flex-shrink: 0;
}
.clip-type-icon svg {
    display: block;
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(6px);
}

/* Light overlay variant - used for small popup-style modals (e.g. New
   Folder) so the editor stays visible in the background instead of being
   darkened/blurred out like the full export modal. Still catches outside
   clicks to dismiss. */
.modal-overlay-light {
    background-color: rgba(0, 0, 0, 0.25);
    backdrop-filter: none;
}

.modal-card {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    width: 450px;
    box-shadow: var(--shadow-elevated), 0 0 0 1px rgba(124, 92, 255, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    background-color: var(--bg-panel-header);
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 600;
}

.modal-body {
    padding: 24px 20px;
}

.export-status-message {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.export-tab-notice {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 10px;
    opacity: 0.8;
}

.progress-bar-container {
    height: 8px;
    background-color: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar-fill {
    height: 100%;
    background: var(--cta-gradient);
    width: 0%;
    transition: width 0.1s linear;
}

.export-stats {
    display: flex;
    justify-content: space-between;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-muted);
}

.modal-footer {
    padding: 16px 20px;
    background-color: var(--bg-panel-header);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Small modal variant (e.g. New Folder prompt) */
.modal-card-sm {
    width: 340px;
}

.modal-text-input {
    width: 100%;
    padding: 9px 11px;
    border-radius: 7px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-input);
    color: var(--text-main);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: all 0.15s var(--ease);
}

.modal-text-input:focus {
    border-color: var(--accent-secondary);
    box-shadow: 0 0 0 1px var(--accent-secondary);
}

/* Right-click Context Menu (media bin folders) */
.context-menu {
    position: fixed;
    z-index: 10000;
    min-width: 170px;
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 9px;
    padding: 5px;
    box-shadow: var(--shadow-elevated), 0 0 0 1px rgba(124, 92, 255, 0.15);
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 12.5px;
    font-family: inherit;
    padding: 8px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.1s var(--ease);
}

.context-menu-item:hover:not(:disabled) {
    background-color: var(--bg-input-hover);
}

.context-menu-item:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.context-menu-item-danger:hover:not(:disabled) {
    color: var(--danger);
    background-color: rgba(255, 56, 96, 0.12);
}

.context-menu-separator {
    height: 1px;
    background-color: var(--border-color);
    margin: 4px 3px;
}

/* Folder cut/drag visual states */
.media-folder.cut-pending {
    opacity: 0.45;
}

.media-folder.dragging {
    opacity: 0.4;
}

/* ==========================================================================
   Touch Support - the corresponding JS drag interactions (clip move/trim,
   effect-marker resize, playhead scrub, timeline marquee-select, and
   dragging a selected element directly on the preview canvas) were ported
   from mouse events to Pointer Events so they work with touch as well as
   mouse/pen. touch-action:none on the elements that start those drags stops
   the browser's own scroll/zoom gestures from fighting with them; the
   track/timeline scroll area is left at pan-x so horizontal scrubbing
   through the timeline via touch still works everywhere else.
   ========================================================================== */
.timeline-clip,
.clip-handle,
.effect-marker,
.playhead-handle,
#ruler-canvas,
#preview-canvas {
    touch-action: none;
}

.timeline-tracks-area,
.track-content {
    touch-action: pan-x;
}

/* Mobile panel-switcher tab bar - only relevant/shown below the 900px
   breakpoint; markup is present at all sizes but hidden by default here. */
.mobile-panel-tabs {
    display: none;
}

/* ==========================================================================
   Mobile / Small-Screen Layout
   Desktop keeps its fixed-viewport, 3-column NLE layout untouched. Below
   900px there isn't room for media bin + preview + properties side by side,
   so the workspace becomes a single scrollable column instead: preview at
   the top (most important), then Media/Properties as a tab-switched panel,
   then the timeline - kept reachable via position:sticky so it's always
   one scroll away instead of being pushed far down the page.
   ========================================================================== */
@media (max-width: 900px) {
    html, body {
        height: auto;
        min-height: 100vh;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .app-container {
        height: auto;
        min-height: 100vh;
        width: 100%;
    }

    /* --- Header --- */
    .top-bar {
        height: auto;
        flex-wrap: wrap;
        row-gap: 8px;
        padding: 8px 10px;
    }

    .logo-section {
        gap: 6px;
    }

    .app-title {
        font-size: 13px;
    }

    /* The file-menu dropdown, project name/status/aspect-ratio row, and the
       action buttons each get their own full-width row so nothing clips or
       overlaps on a narrow screen. */
    .project-info {
        order: 3;
        width: 100%;
        flex-wrap: wrap;
        row-gap: 6px;
    }

    .project-info #project-aspect-ratio {
        margin-left: auto !important;
    }

    .top-actions {
        order: 2;
        flex-wrap: wrap;
        row-gap: 6px;
        width: 100%;
        justify-content: flex-end;
    }

    /* Icon-only action buttons on mobile - the label text is still read by
       screen readers via the title attribute, it just doesn't take up
       precious header width. Export stays labeled since it's the one
       action worth the extra tap-target width. */
    .top-actions .btn-icon-text span {
        display: none;
    }
    .top-actions #btn-export span {
        display: inline;
    }
    .top-actions .btn-icon-text {
        padding: 8px;
    }
    .top-actions #btn-export {
        padding: 8px 14px;
    }

    /* --- Mobile Panel Switcher ---
       Media Bin / Properties can't sit side-by-side with the preview
       anymore, so a small tab bar (inserted by JS) lets the user flip
       between them; both panels stack full-width below the preview. */
    .mobile-panel-tabs {
        display: flex;
        order: 2;
        width: 100%;
        background-color: var(--bg-panel-header);
        border-bottom: 1px solid var(--border-color);
        border-top: 1px solid var(--border-color);
    }

    .mobile-panel-tab {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 11px 6px;
        background: none;
        border: none;
        color: var(--text-muted);
        font-family: 'Outfit', sans-serif;
        font-size: 12px;
        font-weight: 600;
        letter-spacing: 0.2px;
        cursor: pointer;
    }

    .mobile-panel-tab.active {
        color: var(--accent-secondary);
        background-color: var(--bg-app);
        box-shadow: inset 0 -2px 0 var(--accent-secondary);
    }

    /* --- Workspace: single scrollable column --- */
    .workspace {
        display: flex;
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    .center-panel {
        order: 1;
        width: 100%;
        height: 50vh;
        min-height: 220px;
        max-height: 420px;
        padding: 10px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        flex-shrink: 0;
    }

    .left-panel, .right-panel {
        order: 3;
        width: 100%;
        max-height: 340px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    /* Only the panel matching the active mobile tab is shown; JS toggles
       this class on .left-panel / .right-panel to match. Off-screen on
       desktop this never applies since the media query gates it. */
    .left-panel.mobile-panel-hidden,
    .right-panel.mobile-panel-hidden {
        display: none;
    }

    .panel-body {
        padding: 12px;
    }

    /* --- Timeline: shorter, and always in reach via sticky positioning --- */
    .timeline-container {
        position: sticky;
        bottom: 0;
        order: 3;
        flex-shrink: 0;
    }

    /* Single fixed-height row that scrolls sideways instead of wrapping -
       a wrapping toolbar grows taller unpredictably and eats into the
       vertical space the tracks area needs, which is what was forcing the
       track list (and its left-side labels) to need scrolling to see them
       all. Button labels are hidden too so the common tools fit without
       any scrolling at all; only reaching the tail end of the row needs a
       swipe. */
    .timeline-toolbar {
        height: 34px;
        padding: 0 8px;
        gap: 6px;
    }

    .toolbar-tools {
        gap: 4px;
    }

    .toolbar-tools .btn-icon-text span {
        display: none;
    }

    .toolbar-tools .btn-icon-text {
        padding: 5px 7px;
    }

    .toolbar-tools span.active-tool-indicator {
        display: none;
    }

    #timeline-zoom-slider {
        width: 60px;
    }

    :root {
        --track-height: 40px;
        --track-info-width: 84px;
        /* toolbar (34px, fixed above) + ruler (28px) + 5 * --track-height (40px) = 262px */
        --timeline-height: 266px;
    }

    .track-meta {
        display: none;
    }

    .track-label {
        font-size: 10.5px;
    }

    .track-info {
        padding: 6px 6px;
        gap: 6px;
    }

    .track-icon {
        width: 18px;
        height: 18px;
    }

    .track-lock-btn,
    .track-mute-btn {
        width: 16px;
        height: 16px;
    }

    .track-lock-btn svg,
    .track-mute-btn svg {
        width: 9px;
        height: 9px;
    }

    /* --- Bigger touch targets throughout --- */
    .player-btn {
        min-width: 34px;
        min-height: 34px;
    }

    .player-btn-main {
        min-width: 44px;
        min-height: 44px;
    }

    .clip-handle {
        width: 14px;
    }

    input[type="range"] {
        min-height: 24px;
    }

    /* --- Modals: fit small viewports instead of a fixed 450px/340px --- */
    .modal-card {
        width: 92vw;
        max-width: 450px;
        max-height: 88vh;
        overflow-y: auto;
    }

    .modal-card-sm {
        width: 88vw;
        max-width: 340px;
    }
}

@media (max-width: 480px) {
    .center-panel {
        height: 42vh;
        min-height: 180px;
    }

    :root {
        --track-height: 36px;
        --track-info-width: 68px;
        /* toolbar (34px, from the 900px breakpoint above) + ruler (28px) + 5 * --track-height (36px) = 242px */
        --timeline-height: 246px;
    }

    .app-title {
        display: none; /* logo icon alone is enough at this width */
    }

    .track-icon {
        display: none; /* too tight at this width to keep both the icon and the lock button legible */
    }

    .track-info {
        padding: 4px 5px;
        gap: 4px;
    }

    .track-lock-btn,
    .track-mute-btn {
        width: 15px;
        height: 15px;
    }

    .project-status-badge {
        display: none;
    }
}
