/* ==========================================================================
   Video Editor (/video-editor)
   Mirrors the image editor's shell conventions (ie-* → ve-*).
   ========================================================================== */

.video-editor-page {
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
    display: flex;
    flex-direction: column;
    min-height: 420px;
}

/* ---------- launcher ---------- */

.ve-launcher {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.ve-launcher-inner {
    max-width: 640px;
    text-align: center;
}

.ve-launcher-icon {
    font-size: 44px;
    color: var(--accent-primary);
}

.ve-launcher-inner h1 {
    font-size: 26px;
    margin: 10px 0 8px;
}

.ve-launcher-inner > p {
    color: var(--text-secondary);
    margin: 0 auto 24px;
    max-width: 46ch;
}

.ve-draft-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    background: var(--accent-light, rgba(99,102,241,0.12));
    border: 1px solid var(--accent-primary);
    border-radius: 10px;
    padding: 10px 14px;
    margin: 0 auto 20px;
    font-size: 13.5px;
}

.ve-draft-banner .material-icons-outlined {
    color: var(--accent-primary);
}

.ve-launcher-actions {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

.ve-launcher-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 200px;
    padding: 22px 16px;
    background: var(--bg-secondary, rgba(255,255,255,0.04));
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    border-radius: 12px;
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
}

.ve-launcher-card .material-icons-outlined {
    font-size: 30px;
    color: var(--accent-primary);
}

.ve-launcher-card span:last-child {
    color: var(--text-secondary);
    font-size: 12.5px;
}

@media (hover: hover) {
    .ve-launcher-card:hover {
        border-color: var(--accent-primary);
    }
}

/* ---------- editor shell ---------- */

.ve-editor {
    flex: 1;
    display: grid;
    grid-template-rows: 46px 1fr 40px 236px;
    grid-template-areas: "top" "view" "transport" "timeline";
    min-height: 0;
    background: var(--bg-primary, #101014);
}

.ve-editor > * {
    min-width: 0;   /* grid children must not force horizontal page overflow */
}

.ve-topbar {
    grid-area: top;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 10px;
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.1));
    background: var(--bg-secondary, #16161c);
    min-width: 0;
}

.ve-menubar {
    display: flex;
    align-items: stretch;
    height: 100%;
}

.ve-menu {
    position: relative;
    display: flex;
}

.ve-menu > button {
    background: none;
    border: none;
    color: var(--text-primary);
    padding: 0 12px;
    font: inherit;
    font-size: 13.5px;
    cursor: pointer;
    border-radius: 6px;
}

.ve-menu.open > button,
.ve-menu > button:focus-visible {
    background: var(--bg-tertiary, rgba(255,255,255,0.08));
}

.ve-menu-drop {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 300;
    min-width: 235px;
    padding: 6px;
    background: var(--bg-secondary, #1b1b22);
    border: 1px solid var(--border-color, rgba(255,255,255,0.12));
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.45);
}

.ve-menu.open .ve-menu-drop {
    display: block;
}

.ve-menu-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    width: 100%;
    padding: 8px 10px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-primary);
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.ve-menu-item:hover {
    background: var(--bg-tertiary, rgba(255,255,255,0.08));
}

.ve-menu-sep {
    height: 1px;
    margin: 5px 8px;
    background: var(--border-color, rgba(255,255,255,0.1));
}

.ve-sc {
    color: var(--text-secondary);
    font-size: 11.5px;
}

.ve-tb-sep {
    width: 1px;
    height: 22px;
    background: var(--border-color, rgba(255,255,255,0.1));
    margin: 0 6px;
}

.ve-tb-spacer {
    flex: 1;
}

.ve-doc-name {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.ve-tb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    background: none;
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
}

.ve-tb-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.ve-tb-btn .material-icons-outlined {
    font-size: 20px;
}

@media (hover: hover) {
    .ve-tb-btn:not(:disabled):hover,
    .ve-btn-ghost:hover {
        background: var(--bg-tertiary, rgba(255,255,255,0.08));
    }
}

.ve-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    border: 1px solid transparent;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
}

.ve-btn .material-icons-outlined {
    font-size: 18px;
}

.ve-btn-primary {
    background: var(--accent-primary);
    color: #fff;
}

.ve-btn-ghost {
    background: none;
    border-color: var(--border-color, rgba(255,255,255,0.15));
    color: var(--text-primary);
}

.ve-tb-label {
    font-size: 13px;
}

/* ---------- preview stage ---------- */

.ve-viewport {
    grid-area: view;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    min-width: 0;
    padding: 14px;
    background: var(--bg-primary, #0c0c10);
    overflow: hidden;
}

.ve-stage {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    min-width: 0;
}

/* The inner box is driven by the viewport height; aspect-ratio derives the width,
   and max-width lets the ratio shrink the height on narrow screens. */
.ve-stage-inner {
    position: relative;
    background: #000;
    border: 1px solid var(--border-color, rgba(255,255,255,0.12));
    border-radius: 6px;
    overflow: hidden;
    height: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    margin: auto;
}

.ve-stage-inner video,
.ve-stage-inner img[data-ve="stageImg"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;   /* per-clip Fit (cover) overrides via inline style */
    background: #000;
}

.ve-stage-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 40px 60px;
}

.ve-stage-empty .material-icons-outlined {
    font-size: 36px;
}

.ve-stage-buffer {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ve-spin 0.8s linear infinite;
}

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

/* ---------- transport bar ---------- */

.ve-transport {
    grid-area: transport;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 10px;
    border-top: 1px solid var(--border-color, rgba(255,255,255,0.1));
    background: var(--bg-secondary, #16161c);
}

.ve-clock {
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    color: var(--text-secondary);
    margin-left: 6px;
}

/* ---------- timeline ---------- */

.ve-timeline {
    grid-area: timeline;
    min-height: 0;
    border-top: 1px solid var(--border-color, rgba(255,255,255,0.1));
    background: var(--bg-secondary, #131318);
}

.ve-tl-scroll {
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

.ve-tl-canvas {
    position: relative;
    height: 100%;
    min-width: 100%;
}

.ve-tl-ruler {
    position: relative;
    height: 26px;
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.08));
    cursor: pointer;
    touch-action: none;
    user-select: none;
}

.ve-tl-tick {
    position: absolute;
    top: 4px;
    font-size: 10.5px;
    color: var(--text-secondary);
    border-left: 1px solid var(--border-color, rgba(255,255,255,0.18));
    padding-left: 4px;
    pointer-events: none;
    white-space: nowrap;
}

.ve-tl-textlane {
    position: relative;
    height: 28px;
    margin-top: 8px;
    touch-action: none;
}

.ve-tl-lane {
    position: relative;
    height: 96px;
    margin-top: 6px;
    touch-action: none;
}

.ve-tl-audiolane {
    position: relative;
    height: 34px;
    margin-top: 6px;
    touch-action: none;
}

/* free-positioned clips (text + audio lanes) */
.ve-freeclip {
    position: absolute;
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color, rgba(255,255,255,0.2));
    font-size: 11.5px;
    color: #fff;
    overflow: hidden;
    cursor: grab;
    user-select: none;
    white-space: nowrap;
}

.ve-freeclip .material-icons-outlined {
    font-size: 14px;
    flex-shrink: 0;
    pointer-events: none;
}

.ve-freeclip-label {
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    position: relative;
    z-index: 1;
}

.ve-textclip {
    background: rgba(99, 102, 241, 0.35);
}

.ve-audioclip {
    background: rgba(34, 197, 94, 0.25);
}

.ve-audioclip .ve-clip-wave {
    inset: 0;
    bottom: 0;
    height: 100%;
    opacity: 0.7;
}

.ve-freeclip.selected {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 1px var(--accent-primary);
}

.ve-clip {
    position: absolute;
    top: 0;
    height: 96px;
    border-radius: 8px;
    border: 1px solid var(--border-color, rgba(255,255,255,0.2));
    background-color: var(--bg-tertiary, #232331);
    /* Tile the poster thumb at natural aspect (filmstrip look) instead of
       stretching one frame across the whole clip. Real per-interval
       filmstrips come with the probe endpoint in a later milestone. */
    background-size: auto 100%;
    background-position: left center;
    background-repeat: repeat-x;
    overflow: hidden;
    cursor: grab;
    user-select: none;
}

.ve-clip.selected {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 1px var(--accent-primary);
}

.ve-clip.dragging {
    opacity: 0.75;
    z-index: 5;
    cursor: grabbing;
}

/* head-trim in progress: edge follows the cursor over the temporary gap */
.ve-clip.trimhead {
    z-index: 6;
    box-shadow: 0 0 0 1px var(--accent-primary), 0 4px 16px rgba(0,0,0,0.4);
}

.ve-clip-label {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: space-between;
    gap: 6px;
    padding: 3px 8px;
    font-size: 11px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    pointer-events: none;
}

.ve-clip-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ve-clip-dur {
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.ve-clip-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 12px;
    cursor: ew-resize;
    touch-action: none;
}

.ve-clip-handle-l { left: 0; }
.ve-clip-handle-r { right: 0; }

.ve-clip-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 26px;
    border-radius: 2px;
    background: rgba(255,255,255,0.55);
}

.ve-clip-handle-l::after { left: 4px; }
.ve-clip-handle-r::after { right: 4px; }

.ve-clip.selected .ve-clip-handle::after {
    background: var(--accent-primary);
}

.ve-clip-film {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.ve-clip-wave {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 20px;      /* sits above the label bar */
    width: 100%;
    height: 18px;
    pointer-events: none;
    opacity: 0.9;
}

.ve-clip-wave.muted {
    opacity: 0.25;
}

.ve-tl-snapline {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 0;
    border-left: 1px dashed #fff;
    pointer-events: none;
    z-index: 5;
}

.ve-tl-caret {
    position: absolute;
    top: 26px;
    bottom: 0;
    width: 0;
    border-left: 3px solid var(--accent-primary);
    border-radius: 2px;
    pointer-events: none;
    z-index: 6;
}

.ve-trim-tip {
    position: fixed;
    z-index: 1200;
    padding: 4px 8px;
    background: rgba(10, 10, 14, 0.92);
    border: 1px solid var(--border-color, rgba(255,255,255,0.2));
    border-radius: 6px;
    color: #fff;
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
    white-space: nowrap;
}

/* transition button at video clip boundaries */
.ve-trans-btn {
    position: absolute;
    top: 4px;              /* sit high so the trim handles at mid-height stay grabbable */
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--border-color, rgba(255,255,255,0.35));
    background: var(--bg-secondary, #1b1b22);
    color: var(--text-secondary);
    cursor: pointer;
    z-index: 3;
}

.ve-trans-btn .material-icons-outlined {
    font-size: 14px;
}

.ve-trans-btn.has {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}

@media (hover: hover) {
    .ve-trans-btn:hover {
        border-color: var(--accent-primary);
        color: var(--text-primary);
    }
}

/* dead space before t=0 — grab room for the first clip's head trim */
.ve-tl-gutter {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 64px;
    background: repeating-linear-gradient(
        -45deg,
        transparent, transparent 6px,
        rgba(255,255,255,0.025) 6px, rgba(255,255,255,0.025) 12px
    );
    border-right: 1px solid var(--border-color, rgba(255,255,255,0.08));
    pointer-events: none;
}

.ve-tl-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 0;
    border-left: 2px solid var(--accent-primary);
    pointer-events: none;
    z-index: 4;
}

.ve-tl-playhead::before {
    content: '';
    position: absolute;
    top: 0;
    left: -6px;
    border: 5px solid transparent;
    border-top: 7px solid var(--accent-primary);
}

/* ---------- dialogs ---------- */

.ve-dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;   /* above the mobile bottom nav (z 1100) */
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.55);
    overscroll-behavior: contain;
}

.ve-dialog {
    width: min(440px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);   /* tall dialogs (video clip) must fit + scroll on phones */
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary, #1b1b22);
    border: 1px solid var(--border-color, rgba(255,255,255,0.12));
    border-radius: 14px;
    padding: 18px;
}

.ve-dialog h3 {
    margin: 0 0 12px;
    font-size: 17px;
    flex-shrink: 0;
}

.ve-dialog-body {
    font-size: 13.5px;
    overflow-y: auto;      /* scroll the fields; header + actions stay pinned */
    flex: 1;
    min-height: 0;
}

.ve-dialog-actions {
    flex-shrink: 0;
}

.ve-form-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;   /* multi-input rows must never overflow the dialog */
    gap: 10px;
    margin-bottom: 12px;
}

.ve-form-row label {
    width: 90px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.ve-form-row select,
.ve-form-row input {
    flex: 1;
    padding: 8px 10px;
    font-size: 16px; /* >=16px: avoid iOS zoom-on-focus */
    background: var(--bg-primary, #101014);
    color: var(--text-primary);
    border: 1px solid var(--border-color, rgba(255,255,255,0.15));
    border-radius: 8px;
}

/* Small numeric fields: fixed width so multi-input rows never overflow the dialog */
.ve-form-row input.ve-num {
    flex: 0 0 84px;
    width: 84px;
}

/* Color pickers must keep their native swatch size — the generic flex/padding
   rules above collapse them into a thin dash. */
.ve-form-row input[type="color"] {
    flex: 0 0 auto;
    width: 46px;
    height: 34px;
    padding: 2px;
    cursor: pointer;
}

.ve-form-row input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.ve-form-row input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 5px;
}

.ve-form-row input[type="checkbox"] {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    padding: 0;
}

/* text overlay preview */
.ve-stage-overlays {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 10;   /* videos carry z-index 1/2 for transition fades — text sits above */
}

.ve-text-overlay {
    position: absolute;
    transform: translate(-50%, -50%);
    text-align: center;
    /* Match the ASS render (WrapStyle 2): no auto-wrap, only explicit newlines.
       width: max-content also stops position-dependent shrink-to-fit wrapping —
       an abspos box otherwise narrows as `left` approaches the right edge. */
    white-space: pre;
    width: max-content;
    line-height: 1.15;
    pointer-events: auto;   /* container is pass-through; the text itself is draggable */
    cursor: move;
    touch-action: none;
}

/* text dialog bits */
.ve-form-row textarea {
    flex: 1;
    padding: 8px 10px;
    font-size: 16px;
    background: var(--bg-primary, #101014);
    color: var(--text-primary);
    border: 1px solid var(--border-color, rgba(255,255,255,0.15));
    border-radius: 8px;
    resize: vertical;
    font-family: inherit;
}

.ve-check {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--text-secondary);
}

.ve-pos-grid {
    display: grid;
    grid-template-columns: repeat(3, 30px);
    gap: 5px;
}

.ve-pos-cell input {
    display: none;
}

.ve-pos-cell span {
    display: block;
    width: 30px;
    height: 22px;
    border: 1px solid var(--border-color, rgba(255,255,255,0.2));
    border-radius: 5px;
    cursor: pointer;
}

.ve-pos-cell input:checked + span {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.ve-note {
    color: var(--text-secondary);
    font-size: 12.5px;
    margin: 10px 0 0;
}

.ve-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

.ve-dlg-reset {
    margin-right: auto;   /* park Reset on the left, away from Cancel/Apply */
}

.ve-progress {
    height: 10px;
    border-radius: 5px;
    background: var(--bg-primary, rgba(255,255,255,0.06));
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    overflow: hidden;
}

.ve-progress-fill {
    height: 100%;
    width: 0;
    background: var(--accent-primary);
    transition: width 0.4s ease;
}

.ve-progress-label {
    margin: 10px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
}

/* ---------- small screens ---------- */

@media (max-width: 760px) {
    /* Leave room for the fixed mobile bottom nav (50px) + safe area, like the image editor */
    .video-editor-page {
        height: calc(100vh - 50px - env(safe-area-inset-bottom, 0px));
        height: calc(100dvh - 50px - env(safe-area-inset-bottom, 0px));
    }
    .ve-editor {
        grid-template-rows: 46px 1fr 40px 150px;
    }
    .ve-tb-label,
    .ve-doc-name {
        display: none;
    }
    /* Transport bar is tight on phones: shrink the clock and let it never wrap */
    .ve-transport {
        gap: 2px;
        padding: 0 6px;
    }
    .ve-clock {
        font-size: 11px;
        margin-left: 2px;
        white-space: nowrap;
    }
    .ve-tb-btn {
        min-width: 28px;
        padding: 0 3px;
    }
    .ve-tl-lane {
        height: 78px;
    }
    .ve-clip {
        height: 78px;
    }
    .ve-stage-inner {
        max-height: calc(100dvh - 330px);
    }
    /* Keep dialogs clear of the fixed bottom nav: center them in the space above it */
    .ve-dialog-overlay {
        align-items: flex-start;
        padding: 12px 12px calc(50px + env(safe-area-inset-bottom, 0px) + 12px);
        overflow-y: auto;
    }
    .ve-dialog {
        margin: auto;
        max-height: calc(100dvh - 50px - env(safe-area-inset-bottom, 0px) - 24px);
    }
}

/* ---------- tutorial + shortcuts dialogs ---------- */

.ve-dialog:has(.ve-tut) { width: min(760px, 96vw); }
.ve-dialog:has(.ve-sc-grid) { width: min(560px, 96vw); }

.ve-tut {
    display: grid;
    grid-template-columns: 172px 1fr;
    gap: 16px;
    height: min(500px, 60vh);
    overflow: hidden;
}
.ve-tut-side,
.ve-tut-body { min-height: 0; }
.ve-tut-side {
    display: flex;
    flex-direction: column;
    gap: 3px;
    border-right: 1px solid var(--border-color, rgba(255,255,255,0.1));
    padding-right: 12px;
    overflow-y: auto;
}
.ve-tut-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: none;
    border: none;
    border-radius: 7px;
    color: var(--text-secondary);
    font-size: 12.5px;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}
.ve-tut-nav .material-icons-outlined { font-size: 17px; }
@media (hover: hover) {
    .ve-tut-nav:hover { background: var(--bg-tertiary, rgba(255,255,255,0.06)); color: var(--text-primary); }
}
.ve-tut-nav[aria-pressed="true"] {
    background: var(--accent-light, rgba(99,102,241,0.14));
    color: var(--accent-primary);
}
.ve-tut-body {
    overflow-y: auto;
    padding-right: 6px;
    padding-bottom: 8px;
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.55;
}
.ve-tut-body h3 { margin: 0 0 10px; font-size: 16px; color: var(--text-primary); }
.ve-tut-body p { margin: 0 0 10px; }
.ve-tut-body ul { margin: 0 0 10px; padding-left: 20px; }
.ve-tut-body li { margin-bottom: 6px; }
.ve-tut-body b, .ve-tut-body i { color: var(--text-primary); }
.ve-tut-body kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    background: var(--bg-tertiary, rgba(255,255,255,0.08));
    border: 1px solid var(--border-color, rgba(255,255,255,0.2));
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: 0 5px;
    color: var(--text-primary);
    white-space: nowrap;
}
.ve-tut-inline-icon {
    font-size: 15px;
    vertical-align: -2px;
    color: var(--accent-primary);
}
.ve-tut-tip {
    background: var(--accent-light, rgba(99,102,241,0.12));
    border-left: 3px solid var(--accent-primary);
    border-radius: 0 7px 7px 0;
    padding: 8px 12px;
    color: var(--text-primary);
}
.ve-tut-demo {
    display: block;
    width: 100%;
    max-width: 460px;
    margin: 6px 0 14px;
    background: #101014;
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    border-radius: 10px;
}
.ve-tut-try { margin-top: 2px; }
.ve-tut-try .material-icons-outlined { font-size: 16px; color: var(--accent-primary); }

.ve-tut-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
    border-top: 1px solid var(--border-color, rgba(255,255,255,0.1));
    padding-top: 10px;
}
.ve-tut-count {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11.5px;
    color: var(--text-secondary);
}
.ve-tut-footer .ve-btn:disabled { opacity: 0.4; cursor: default; }

.ve-panel-link {
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
    color: var(--text-secondary);
}
.ve-launcher-tour {
    margin-top: 18px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}
@media (hover: hover) {
    .ve-launcher-tour:hover { color: var(--accent-primary); }
}
.ve-launcher-tour .material-icons-outlined { font-size: 17px; }

.ve-sc-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 14px;
    align-items: center;
    font-size: 13px;
}
.ve-sc-grid kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    background: var(--bg-tertiary, rgba(255,255,255,0.08));
    border: 1px solid var(--border-color, rgba(255,255,255,0.2));
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: 2px 7px;
    color: var(--text-primary);
    justify-self: start;
    white-space: nowrap;
}
.ve-sc-grid span { color: var(--text-secondary); }

@media (max-width: 640px) {
    .ve-tut { grid-template-columns: 1fr; height: min(64vh, 560px); }
    .ve-tut-side {
        flex-direction: row;
        flex-wrap: wrap;
        border-right: none;
        border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.1));
        padding: 0 0 8px;
    }
    .ve-sc-grid { grid-template-columns: 1fr; gap: 2px 0; }
    .ve-sc-grid span { margin-bottom: 8px; }
}

/* ==================== AI generation (Animate with AI) ==================== */

.ve-form-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.ve-form-col label {
    color: var(--text-secondary);
}

.ve-gen-prompt {
    width: 100%;
    padding: 8px 10px;
    font-size: 16px; /* >=16px: avoid iOS zoom-on-focus */
    font-family: inherit;
    background: var(--bg-primary, #101014);
    color: var(--text-primary);
    border: 1px solid var(--border-color, rgba(255,255,255,0.15));
    border-radius: 8px;
    resize: vertical;
}

.ve-btn-gen {
    background: rgba(139, 92, 246, 0.12);
    color: #c4b5fd;
    border-color: rgba(139, 92, 246, 0.45);
}

@media (hover: hover) {
    .ve-btn-gen:hover {
        background: rgba(139, 92, 246, 0.25);
    }
}

.ve-gen-note span {
    color: var(--text-secondary);
    font-size: 12px;
}

/* Timeline clip while its video is generating */
.ve-clip.generating {
    outline: 1px dashed rgba(139, 92, 246, 0.8);
}

.ve-clip-genbadge {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(12, 12, 20, 0.55);
    color: #c4b5fd;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    pointer-events: none;
    animation: ve-gen-pulse 1.6s ease-in-out infinite;
}

@keyframes ve-gen-pulse {
    0%, 100% { opacity: 0.9; }
    50% { opacity: 0.55; }
}

/* ---- AI-first timeline affordances ---- */

/* ✨ on image clips (top-right corner, above the filmstrip) */
.ve-clip-ai {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 4;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 12px;
    border-radius: 50%;
    border: 1px solid rgba(139, 92, 246, 0.5);
    background: rgba(12, 12, 20, 0.75);
    cursor: pointer;
}

@media (hover: hover) {
    .ve-clip-ai:hover {
        background: rgba(139, 92, 246, 0.35);
    }
}

/* "+5s ✨" ghost chip after the last clip */
.ve-extend-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    color: #c4b5fd;
    background: rgba(139, 92, 246, 0.08);
    border: 1px dashed rgba(139, 92, 246, 0.55);
    border-radius: 8px;
    cursor: pointer;
}

@media (hover: hover) {
    .ve-extend-btn:hover {
        background: rgba(139, 92, 246, 0.22);
    }
}

/* Transport ✨ button */
.ve-tb-sparkle {
    font-size: 15px;
    line-height: 1;
}

.ve-tb-btn.ve-tb-ai:not(:disabled) {
    border: 1px solid rgba(139, 92, 246, 0.45);
    border-radius: 8px;
}

.ve-tb-btn.ve-tb-ai:disabled .ve-tb-sparkle {
    filter: grayscale(1);
    opacity: 0.4;
}

/* Launcher "Animate an image" card */
.ve-launcher-card-ai {
    border-color: rgba(139, 92, 246, 0.5);
    background: rgba(139, 92, 246, 0.08);
}

@media (hover: hover) {
    .ve-launcher-card-ai:hover {
        background: rgba(139, 92, 246, 0.18);
    }
}

.ve-launcher-sparkle {
    font-size: 26px;
    line-height: 1;
}
