
        /* ---- Local caption fonts (served from /fonts, same files libass uses) ---- */
        @font-face { font-family: 'Instrument Serif'; src: url('/fonts/InstrumentSerif-Italic.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772') format('truetype'); font-weight: 400; font-style: italic; font-display: swap; }
        @font-face { font-family: 'Akira Expanded'; src: url('/fonts/Akira-Super-Bold.otf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 700; }
        @font-face { font-family: 'Owners XNarrow Black'; src: url('/fonts/OwnersXNarrow-Black.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); }
        @font-face { font-family: 'Heebo ExtraBold'; src: url('/fonts/Heebo-ExtraBold.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 800; }
        @font-face { font-family: 'Heebo SemiBold'; src: url('/fonts/Heebo-SemiBold.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 600; }
        @font-face { font-family: 'Heebo'; src: url('/fonts/Heebo-Bold.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 700; }
        @font-face { font-family: 'Poppins'; src: url('/fonts/Poppins-Bold.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 700; }
        @font-face { font-family: 'Poppins Black'; src: url('/fonts/Poppins-BlackItalic.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 900; font-style: italic; }
        @font-face { font-family: 'Inter'; src: url('/fonts/Inter-Bold.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 700; }
        @font-face { font-family: 'Roboto Condensed Light'; src: url('/fonts/RobotoCondensed-Light.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 300; font-display: swap; }
        @font-face { font-family: 'Lobster'; src: url('/fonts/Lobster-Regular.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 400; font-display: swap; }
        @font-face { font-family: 'Arimo'; src: url('/fonts/Arimo-Regular.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 400; font-style: normal; font-display: swap; }
        @font-face { font-family: 'Coolvetica'; src: url('/fonts/Coolvetica-Regular.otf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 400; font-style: normal; font-display: swap; }
        @font-face { font-family: 'Arimo'; src: url('/fonts/Arimo-Bold.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 700; font-style: normal; font-display: swap; }
        @font-face { font-family: 'Montserrat Black'; src: url('/fonts/Montserrat-Black.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 900; }
        @font-face { font-family: 'Montserrat ExtraBold'; src: url('/fonts/Montserrat-ExtraBold.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 800; }
        @font-face { font-family: 'Raleway Black'; src: url('/fonts/Raleway-BlackItalic.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 900; font-style: italic; }
        @font-face { font-family: 'Permanent Marker'; src: url('/fonts/PermanentMarker-Regular.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
        @font-face { font-family: 'Komika Axis'; src: url('/fonts/Komika-Axis.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); }
        @font-face { font-family: 'Obviously Semibold'; src: url('/fonts/Obviously-Semibold.otf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 600; }
        @font-face { font-family: 'Owners Narrow'; src: url('/fonts/OwnersNarrow-BoldItalic.otf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 700; font-style: italic; }
        @font-face { font-family: 'Fort XCond Black'; src: url('/fonts/fort-xcond-black-italic.otf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 900; font-style: italic; }
        @font-face { font-family: 'Sofia Sans Extra Condensed Black'; src: url('/fonts/SofiaSansExtraCondensed-BlackItalic.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 900; font-style: italic; }
        /* Spinning targets Bebas Neue Pro Bold Italic. The bundled Regular
           asset is the safe local fallback; the preset's 900/italic metadata
           makes the browser synthesize the requested face until the licensed
           Pro font file is added. */
        @font-face { font-family: 'Bebas Neue'; src: url('/fonts/BebasNeue-Regular.otf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772') format('opentype'); font-weight: 400; font-style: normal; font-display: swap; }
        @font-face { font-family: 'Europa Grotesk SH'; src: url('/fonts/europa-grotesk-sh-bold.otf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 700; }
        @font-face { font-family: 'Arial Black'; src: url('/fonts/ArialBlack.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
        @font-face { font-family: 'Arial'; src: url('/fonts/Arial-Bold.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 700; }
        @font-face { font-family: 'Montserrat'; src: url('/fonts/Montserrat-Bold.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 700; }
        @font-face { font-family: 'Montserrat Medium'; src: url('/fonts/Montserrat-Medium.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); }
        @font-face { font-family: 'Fira Sans Condensed Black'; src: url('/fonts/FiraSansCondensed-Black.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); }
        @font-face { font-family: 'Fira Sans Condensed Medium'; src: url('/fonts/FiraSansCondensed-Medium.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); }
        @font-face { font-family: 'Gabarito Black'; src: url('/fonts/Gabarito-Black.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); }
        @font-face { font-family: 'Gabarito SemiBold'; src: url('/fonts/Gabarito-SemiBold.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); }
        @font-face { font-family: 'Anton'; src: url('/fonts/Anton-Regular.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
        @font-face { font-family: 'Rubik Black'; src: url('/fonts/Rubik-Black.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); }
        @font-face { font-family: 'DM Serif Display'; src: url('/fonts/DMSerifDisplay-Regular.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); }
        @font-face { font-family: 'IM FELL English'; src: url('/fonts/IMFellEnglish-Regular.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); }
        @font-face { font-family: 'Garamond'; src: url('/fonts/Garamond.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
        @font-face { font-family: 'Shantell Sans Medium'; src: url('/fonts/ShantellSans-Medium.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); }
        @font-face { font-family: 'Archivo SemiBold'; src: url('/fonts/Archivo-SemiBold.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); }
        @font-face { font-family: 'Roboto Black'; src: url('/fonts/Roboto-Black.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); }
        @font-face { font-family: 'Saira'; src: url('/fonts/Saira-Regular.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); }
        @font-face { font-family: 'Barlow Black'; src: url('/fonts/Barlow-Black.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); }
        @font-face { font-family: 'Alef'; src: url('/fonts/Alef-Bold.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 700; }
        @font-face { font-family: 'Balto'; src: url('/fonts/balto-bold.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 700; }
        @font-face { font-family: 'Rokiest Extrabold'; src: url('/fonts/Rokiest-Extrabold.otf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 800; font-style: normal; font-display: swap; }
        @font-face { font-family: 'TikTok Sans'; src: url('/fonts/TikTokSans-Bold.ttf?sp_release=22e2bfbccddefff762a46f4b3c38dac3de325772'); font-weight: 700; }

        :root {
            --bg-color: #0d0e12;
            --panel-bg: rgba(18, 20, 28, 0.7);
            --border-color: rgba(255, 255, 255, 0.08);
            --primary-gradient: #1014ef;
            --accent-gradient: #1014ef;
            --text-main: #f3f4f6;
            --text-muted: #9ca3af;
            --accent-cyan: #00f2fe;
            --accent-purple: #1014ef;
            --accent-green: #10b981;
        }

        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            font-family: 'Outfit', sans-serif;
            -webkit-font-smoothing: antialiased;
        }

        body {
            background-color: var(--bg-color);
            color: var(--text-main);
            min-height: 100vh;
            overflow-x: hidden;
            background-image:
                radial-gradient(circle at 10% 20%, rgba(0, 242, 254, 0.05) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(16, 20, 239, 0.05) 0%, transparent 40%);
        }

        header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 1.5rem 2rem;
            border-bottom: 1px solid var(--border-color);
            backdrop-filter: blur(12px);
            position: sticky;
            top: 0;
            z-index: 100;
            background: rgba(13, 14, 18, 0.8);
        }

        .logo-container { display: flex; align-items: center; gap: 0.75rem; }

        /* Top-level app tabs: Clipping (this dashboard), standalone Editor,
           Captions, Posting, and Content Calendar. */
        .app-tabs { display: flex; gap: 0.4rem; margin-left: 1.5rem; }
        .app-tab {
            padding: 0.6rem 1.4rem; border-radius: 24px; font-size: 1rem; font-weight: 700;
            color: var(--text-muted); border: 1px solid var(--border-color); text-decoration: none;
            background: rgba(255, 255, 255, 0.03); white-space: nowrap;
        }
        .app-tab:hover { color: var(--text-main); background: rgba(255, 255, 255, 0.06); }
        .app-tab.active { color: #0d0e12; background: var(--primary-gradient); border-color: transparent; }

        .standalone-editor-entry {
            max-width: 980px;
            margin: 3rem auto;
            padding: 0 1.5rem;
        }
        .standalone-editor-entry[hidden] { display: none !important; }
        .standalone-editor-card {
            background: var(--panel-bg);
            border: 1px solid var(--border-color);
            border-radius: 22px;
            padding: clamp(1.5rem, 4vw, 3rem);
            box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
        }
        .standalone-editor-eyebrow {
            color: var(--accent-cyan);
            font-size: 0.78rem;
            font-weight: 800;
            letter-spacing: 0.14em;
            text-transform: uppercase;
        }
        .standalone-editor-card h1 {
            margin: 0.5rem 0 0.65rem;
            font-size: clamp(1.8rem, 4vw, 3rem);
            line-height: 1.05;
        }
        .standalone-editor-copy {
            max-width: 650px;
            color: var(--text-muted);
            line-height: 1.6;
        }
        .standalone-editor-dropzone {
            display: grid;
            place-items: center;
            gap: 0.75rem;
            min-height: 260px;
            margin-top: 2rem;
            padding: 2rem;
            border: 1px dashed rgba(0, 242, 254, 0.55);
            border-radius: 18px;
            background: rgba(0, 242, 254, 0.045);
            text-align: center;
            cursor: pointer;
            transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
        }
        .standalone-editor-dropzone:hover,
        .standalone-editor-dropzone.dragover {
            border-color: var(--accent-cyan);
            background: rgba(0, 242, 254, 0.1);
            transform: translateY(-1px);
        }
        .standalone-editor-dropzone strong { font-size: 1.15rem; }
        .standalone-editor-dropzone span { color: var(--text-muted); font-size: 0.9rem; }
        .standalone-editor-status {
            min-height: 1.5rem;
            margin-top: 1rem;
            color: #bae6fd;
            line-height: 1.5;
        }
        .standalone-editor-status.error { color: #fca5a5; }
        .standalone-editor-status.ready { color: #86efac; }
        .standalone-editor-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 0.75rem;
            align-items: center;
            margin-top: 1rem;
        }
        .standalone-editor-history {
            display: grid;
            gap: 1rem;
            margin-top: 2.25rem;
        }
        .standalone-editor-history-header {
            display: flex;
            align-items: end;
            justify-content: space-between;
            gap: 1rem;
            flex-wrap: wrap;
        }
        .standalone-editor-history-header h2,
        .standalone-editor-rendered h2,
        .standalone-editor-new h2 {
            margin: 0.35rem 0 0;
            font-size: 1.15rem;
        }
        .standalone-editor-history-copy {
            margin: 0;
            color: var(--text-muted);
            font-size: 0.86rem;
            line-height: 1.45;
        }
        .standalone-editor-history-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 0.9rem;
        }
        .standalone-editor-session-card,
        .standalone-editor-rendered-card {
            min-width: 0;
            background: rgba(255, 255, 255, 0.025);
            border: 1px solid var(--border-color);
            border-radius: 14px;
            overflow: hidden;
        }
        .standalone-editor-session-card:hover,
        .standalone-editor-rendered-card:hover {
            border-color: rgba(0, 242, 254, 0.35);
        }
        .standalone-editor-session-thumb,
        .standalone-editor-rendered-video {
            display: block;
            width: 100%;
            aspect-ratio: 16 / 9;
            object-fit: cover;
            background: #050608;
        }
        .standalone-editor-rendered-video { aspect-ratio: 9 / 16; }
        .standalone-editor-session-body,
        .standalone-editor-rendered-body {
            display: grid;
            gap: 0.55rem;
            padding: 0.85rem;
        }
        .standalone-editor-session-title,
        .standalone-editor-rendered-title {
            font-size: 0.95rem;
            font-weight: 750;
            overflow-wrap: anywhere;
        }
        .standalone-editor-session-meta,
        .standalone-editor-rendered-meta {
            color: var(--text-muted);
            font-size: 0.76rem;
            line-height: 1.4;
            overflow-wrap: anywhere;
        }
        .standalone-editor-session-actions,
        .standalone-editor-rendered-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 0.45rem;
        }
        .standalone-editor-see-more {
            border: 1px solid var(--border-color);
            border-radius: 11px;
            background: rgba(255, 255, 255, 0.025);
            padding: 0.65rem 0.8rem;
        }
        .standalone-editor-see-more summary {
            color: var(--accent-cyan);
            cursor: pointer;
            font-size: 0.82rem;
            font-weight: 750;
        }
        .standalone-editor-see-more[hidden] { display: none !important; }
        .standalone-editor-rendered {
            display: grid;
            gap: 0.8rem;
            padding-top: 1rem;
        }
        .standalone-editor-rendered-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 0.9rem;
        }
        .standalone-editor-empty {
            padding: 1rem;
            border: 1px dashed rgba(255, 255, 255, 0.14);
            border-radius: 12px;
            color: var(--text-muted);
            font-size: 0.82rem;
            line-height: 1.45;
        }
        .standalone-editor-new {
            margin-top: 2.2rem;
            padding-top: 1.25rem;
            border-top: 1px solid rgba(255, 255, 255, 0.08);
        }
        .standalone-editor-new-copy {
            margin: 0.4rem 0 0;
            color: var(--text-muted);
            font-size: 0.84rem;
        }
        @media (max-width: 760px) {
            .app-tabs { gap: 0.25rem; margin-left: 0.6rem; overflow-x: auto; }
            .app-tab { padding: 0.5rem 0.75rem; font-size: 0.85rem; }
        }

        .logo-text {
            font-size: 1.8rem;
            font-weight: 800;
            background: var(--primary-gradient);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            letter-spacing: -0.5px;
        }

        .logo-badge {
            font-size: 0.75rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 1px;
            background: var(--accent-gradient);
            padding: 0.25rem 0.6rem;
            border-radius: 20px;
            color: white;
            box-shadow: 0 0 15px rgba(16, 20, 239, 0.3);
        }

        .status-indicator {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-size: 0.9rem;
            font-weight: 500;
            background: rgba(255, 255, 255, 0.03);
            padding: 0.5rem 1rem;
            border-radius: 30px;
            border: 1px solid var(--border-color);
        }

        .status-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background-color: var(--text-muted);
            box-shadow: 0 0 8px var(--text-muted);
        }

        .status-dot.active {
            background-color: var(--accent-green);
            box-shadow: 0 0 12px var(--accent-green);
            animation: pulse 1.5s infinite alternate;
        }

        /* SlicePost loading state: a tiny pixel grid, shimmer, and a truthful
           client-side elapsed timer shared by the header and job card. */
        .status-ready-state {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
        }

        .slice-loader {
            display: inline-flex;
            align-items: center;
            gap: 0.55rem;
            min-width: 0;
            color: var(--v2-muted, var(--text-muted));
            white-space: nowrap;
        }

        .slice-loader[hidden] { display: none !important; }

        .slice-loader-grid {
            display: grid;
            grid-template-columns: repeat(3, 4px);
            gap: 1.5px;
            width: 15px;
            height: 15px;
            flex: none;
        }

        .slice-loader-pixel {
            width: 4px;
            height: 4px;
            border-radius: 1px;
            background: var(--v2-white, var(--text-main));
            opacity: 0.15;
            animation: slice-post-pixel-on 650ms ease-in-out var(--pixel-delay, 0ms) infinite;
        }

        .slice-loader-pixel--round { border-radius: 50%; }
        .slice-loader-pixel--static { animation: none; opacity: 0.07; }

        .slice-loader-label {
            overflow: hidden;
            max-width: 28rem;
            text-overflow: ellipsis;
            font-size: 0.78rem;
            font-weight: 600;
            background-image: linear-gradient(
                90deg,
                var(--v2-dim, var(--text-muted)) 35%,
                var(--v2-white, var(--text-main)) 50%,
                var(--v2-dim, var(--text-muted)) 65%
            );
            background-size: 200% 100%;
            background-clip: text;
            -webkit-background-clip: text;
            color: transparent;
            -webkit-text-fill-color: transparent;
            animation: slice-post-shimmer 1.4s linear infinite;
        }

        .slice-loader-elapsed {
            flex: none;
            color: var(--v2-dim, var(--text-muted));
            font-family: 'JetBrains Mono', monospace;
            font-size: 0.72rem;
            font-variant-numeric: tabular-nums;
            letter-spacing: -0.02em;
        }

        .slice-loader--compact { gap: 0.45rem; }
        .slice-loader--compact .slice-loader-label { font-size: 0.74rem; }
        .slice-loader--panel { gap: 0.65rem; min-height: 1.25rem; }

        @keyframes slice-post-pixel-on {
            0%, 100% { opacity: 0.12; transform: scale(0.82); }
            50% { opacity: 0.95; transform: scale(1); }
        }

        @keyframes slice-post-shimmer {
            from { background-position: 100% 0; }
            to { background-position: -100% 0; }
        }

        .job-progress-status-group {
            display: flex;
            align-items: center;
            gap: 0.85rem;
            min-width: 0;
        }

        @media (max-width: 760px) {
            .status-indicator { padding: 0.45rem 0.65rem; }
            .slice-loader--compact .slice-loader-label { display: none; }
            .slice-loader--panel .slice-loader-label { max-width: 13rem; }
        }

        @media (prefers-reduced-motion: reduce) {
            .slice-loader-pixel { animation: none; opacity: 0.22; transform: none; }
            .slice-loader-label {
                animation: none;
                background-image: none;
                color: var(--v2-muted, var(--text-muted));
                -webkit-text-fill-color: currentColor;
            }
        }

        @keyframes pulse {
            0% { transform: scale(0.9); opacity: 0.6; }
            100% { transform: scale(1.1); opacity: 1; }
        }

        .main-container {
            max-width: 1440px;
            margin: 2rem auto;
            padding: 0 1.5rem;
            display: flex;
            flex-direction: column;
            gap: 1.5rem;
        }

        .panel {
            background: var(--panel-bg);
            border: 1px solid var(--border-color);
            border-radius: 20px;
            padding: 2rem;
            backdrop-filter: blur(20px);
            box-shadow: 0 10px 30px rgba(0,0,0,0.5);
            display: flex;
            flex-direction: column;
            gap: 1.5rem;
        }

        .panel-title {
            font-size: 1.25rem;
            font-weight: 600;
            color: var(--text-main);
            border-bottom: 1px solid rgba(255,255,255,0.05);
            padding-bottom: 0.75rem;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .input-group { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 0.5rem; }

        label {
            font-size: 0.9rem;
            font-weight: 600;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        input[type="text"], textarea, select {
            width: 100%;
            background: rgba(255,255,255,0.03);
            border: 1px solid var(--border-color);
            border-radius: 10px;
            padding: 1rem 1rem;
            color: var(--text-main);
            font-size: 1rem;
            transition: all 0.3s;
            outline: none;
        }

        input[type="text"]:focus, textarea:focus, select:focus {
            border-color: var(--accent-cyan);
            box-shadow: 0 0 10px rgba(0, 242, 254, 0.15);
            background: rgba(255,255,255,0.05);
        }

        .prompt-textarea {
            min-height: 94px;
            line-height: 1.5;
            resize: vertical;
        }

        .source-row { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem; }

        .btn-secondary {
            background: rgba(255,255,255,0.05);
            border: 1px solid var(--border-color);
            color: var(--text-main);
            padding: 0.85rem 1rem;
            border-radius: 10px;
            font-size: 0.9rem;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s;
            white-space: nowrap;
        }

        .btn-secondary:hover:not(:disabled) {
            border-color: var(--accent-cyan);
            color: var(--accent-cyan);
            background: rgba(0, 242, 254, 0.08);
        }

        .source-message {
            min-height: 1rem;
            color: var(--text-muted);
            font-size: 0.78rem;
            line-height: 1.3;
        }

        .source-message.error { color: #f87171; }
        .source-message.success { color: var(--accent-green); }

        .checkbox-row {
            display: flex;
            align-items: center;
            gap: 1rem;
            background: rgba(255,255,255,0.03);
            border: 1px solid var(--border-color);
            border-radius: 10px;
            padding: 1rem 1rem;
            color: var(--text-main);
            font-size: 1rem;
            cursor: pointer;
        }

        .checkbox-row input { width: 18px; height: 18px; accent-color: var(--accent-cyan); }

        .range-row { display: grid; gap: 0.6rem; }

        input[type="range"] { width: 100%; accent-color: var(--accent-cyan); }

        .range-control-panel {
            --range-progress: 50%;
            display: grid;
            gap: 0.65rem;
            padding: 0.85rem 0.9rem;
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 12px;
            background: rgba(255, 255, 255, 0.025);
        }
        .range-control-panel[hidden] { display: none; }
        .range-control-head,
        .range-scale {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.75rem;
        }
        .range-control-title {
            color: var(--text-main);
            font-size: 0.82rem;
            font-weight: 700;
            text-transform: none;
            letter-spacing: 0;
        }
        .range-value {
            min-width: 4.6rem;
            padding: 0.32rem 0.55rem;
            border: 1px solid rgba(34, 211, 238, 0.2);
            border-radius: 999px;
            background: rgba(34, 211, 238, 0.08);
            color: #c8f8ff;
            text-align: center;
            font-family: 'JetBrains Mono', monospace;
            font-size: 0.76rem;
            font-weight: 700;
            font-variant-numeric: tabular-nums;
        }
        .range-scale {
            color: #7f8998;
            font-size: 0.7rem;
            font-weight: 650;
        }
        .polished-range {
            width: 100%;
            height: 24px;
            margin: 0;
            appearance: none;
            -webkit-appearance: none;
            background: transparent;
            cursor: pointer;
        }
        .polished-range::-webkit-slider-runnable-track {
            height: 6px;
            border-radius: 999px;
            background: linear-gradient(
                to right,
                var(--accent-cyan) 0 var(--range-progress),
                var(--range-rest, rgba(255, 255, 255, 0.14)) var(--range-progress) 100%
            );
        }
        .polished-range::-webkit-slider-thumb {
            width: 20px;
            height: 20px;
            margin-top: -7px;
            border: 3px solid #0d1016;
            border-radius: 50%;
            appearance: none;
            -webkit-appearance: none;
            background: #eaffff;
            box-shadow: 0 0 0 2px var(--accent-cyan), 0 4px 12px rgba(0, 0, 0, 0.4);
        }
        .polished-range::-moz-range-track {
            height: 6px;
            border-radius: 999px;
            background: var(--range-rest, rgba(255, 255, 255, 0.14));
        }
        .polished-range::-moz-range-progress {
            height: 6px;
            border-radius: 999px;
            background: var(--accent-cyan);
        }
        .polished-range::-moz-range-thumb {
            width: 16px;
            height: 16px;
            border: 3px solid #0d1016;
            border-radius: 50%;
            background: #eaffff;
            box-shadow: 0 0 0 2px var(--accent-cyan), 0 4px 12px rgba(0, 0, 0, 0.4);
        }
        .polished-range:focus-visible { outline: none; }
        .polished-range:focus-visible::-webkit-slider-thumb {
            box-shadow: 0 0 0 3px #0d1016, 0 0 0 6px rgba(34, 211, 238, 0.45);
        }
        .polished-range:focus-visible::-moz-range-thumb {
            box-shadow: 0 0 0 3px #0d1016, 0 0 0 6px rgba(34, 211, 238, 0.45);
        }

        select option { background-color: var(--bg-color); color: var(--text-main); }

        /* Caption Preset Grid */
        .preset-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 10px;
            margin-top: 5px;
        }

        .preset-btn {
            background: rgba(255, 255, 255, 0.03);
            border: 2px solid var(--border-color);
            border-radius: 12px;
            padding: 12px 6px;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            min-height: 62px;
            user-select: none;
            overflow: hidden;
        }

        .preset-btn:hover { background: rgba(255, 255, 255, 0.08); transform: scale(1.02); }

        .preset-btn.active {
            border-color: var(--accent-cyan);
            background: rgba(0, 242, 254, 0.1);
            box-shadow: 0 0 15px rgba(0, 242, 254, 0.2);
        }

        .preset-btn .preset-face { font-size: 15px; line-height: 1.15; pointer-events: none; }

        /* Expanded display faces can be wider than their public preset name.
           Keep names such as Mountain intact inside every three-column tile. */
        .preset-btn .preset-face[data-long-preset-label="true"] {
            max-width: 100%;
            font-size: 12px;
            white-space: nowrap;
        }

        /* Live output preview. This is intentionally the same neutral monitor
           treatment used by Captions Only: before a source is chosen, show
           the renderer-backed sample caption over a calm placeholder instead
           of an unrelated stock/project thumbnail. */
        .preview-container { display: flex; justify-content: center; width: 100%; margin: 1rem 0; }

        .phone-mockup {
            --preview-aspect-number: 0.5625;
            width: min(100%, 720px);
            height: auto;
            aspect-ratio: 9 / 16;
            border-radius: 14px;
            border: 1px solid rgba(255,255,255,.13);
            background: #090b11;
            position: relative;
            overflow: hidden;
            box-shadow: 0 20px 50px rgba(0,0,0,.3);
        }

        .phone-screen {
            position: relative;
            width: 100%;
            height: 100%;
            overflow: hidden;
            background-size: cover;
            background-position: center;
            background: radial-gradient(circle at 50% 40%, rgba(16,20,239,.12), transparent 42%), #090b11;
        }

        .dashboard-framing-preview-canvas {
            position: absolute;
            inset: 0;
            z-index: 1;
            width: 100%;
            height: 100%;
            background: #000;
            pointer-events: none;
        }

        .dashboard-framing-preview-canvas[hidden],
        .dashboard-framing-preview-phase[hidden] { display: none !important; }

        .dashboard-framing-preview-phase {
            position: absolute;
            top: 10px;
            left: 10px;
            z-index: 5;
            max-width: calc(100% - 20px);
            padding: 5px 8px;
            border: 1px solid rgba(255, 255, 255, .18);
            border-radius: 999px;
            background: rgba(5, 7, 13, .78);
            color: rgba(255, 255, 255, .9);
            font-size: 10px;
            font-weight: 750;
            line-height: 1;
            letter-spacing: .02em;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            pointer-events: none;
            backdrop-filter: blur(8px);
        }

        /* The source monitor mirrors the selected preservation policy. Black
           Bars contains the complete clean source over literal black instead
           of leaving the generic full-bleed preview in place. */
        .phone-screen[data-framing-preview="black_bars"] { background: #000; }
        .phone-screen[data-framing-preview="black_bars"] #preview-video {
            object-fit: contain !important;
            background: #000;
        }

        .dashboard-preview-placeholder {
            position: absolute;
            inset: 0;
            z-index: 1;
            display: grid;
            place-content: center;
            justify-items: center;
            gap: 13px;
            color: #667184;
            background: radial-gradient(circle at 50% 40%, rgba(16,20,239,.12), transparent 42%);
            font-size: clamp(11px, 1.1vw, 14px);
            transform: translateY(3rem);
        }

        .dashboard-preview-placeholder[hidden] { display: none !important; }

        .dashboard-preview-placeholder img {
            width: 38px;
            height: 38px;
            opacity: .6;
        }

        /* The global `*` rule would force Outfit onto the spans the preview
           animator creates - make every descendant inherit the preset font. */
        .preview-caption-box *, .preset-face *,
        #editor-modal .editor-caption-preset-face *, #preview-hook-overlay * {
            font-family: inherit;
            font-weight: inherit;
            font-style: inherit;
        }

        .preview-caption-box {
            position: absolute;
            left: 50%;
            width: 100%;
            color: white;
            font-size: 14px;
            font-weight: bold;
            text-align: center;
            pointer-events: none;
            transition: top 0.15s ease;
            line-height: 1.25;
        }

        .phone-screen.renderer-preview-ready #preview-caption { display: none !important; }

        /* Keep the phone preview in view while the user works down either
           settings column. Sticky is bounded by .panel-columns, so it stops
           naturally before the processing summary below. */
        @media (min-width: 951px) {
            .panel-right.configuration-preview-panel {
                position: sticky;
                top: 108px;
                align-self: flex-start;
            }
            .configuration-preview-panel .phone-mockup {
                /* Use the available column width for landscape and square
                   outputs, while keeping portrait outputs within the visible
                   desktop viewport. The selected geometry supplies the
                   aspect-number variable through syncDashboardOutputPreview. */
                width: min(100%, 720px, max(220px, calc((100dvh - 300px) * var(--preview-aspect-number, .5625))));
                max-width: 720px !important;
            }
        }

        .btn-primary {
            background: var(--primary-gradient);
            color: #0d0e12;
            font-size: 1.05rem;
            font-weight: 700;
            padding: 1rem;
            border: none;
            border-radius: 12px;
            cursor: pointer;
            transition: all 0.3s;
            text-align: center;
            box-shadow: 0 4px 20px rgba(0, 242, 254, 0.25);
        }

        .btn-primary:hover:not(:disabled) {
            transform: translateY(-2px);
            box-shadow: 0 6px 25px rgba(0, 242, 254, 0.45);
        }

        .btn-primary:disabled {
            background: #1f2937;
            color: #4b5563;
            cursor: not-allowed;
            box-shadow: none;
        }

        .btn-danger {
            background: rgba(239, 68, 68, 0.15);
            border: 1px solid rgba(239, 68, 68, 0.3);
            color: #f87171;
            font-size: 1rem;
            font-weight: 600;
            padding: 0.85rem;
            border-radius: 12px;
            cursor: pointer;
            transition: all 0.3s;
        }

        .btn-danger:hover { background: rgba(239, 68, 68, 0.25); color: #ef4444; }

        @media (prefers-reduced-motion: reduce) {
            .pipeline-activity.is-entering { animation: none; }
        }

        .pipeline-activity {
            display: flex;
            flex-direction: column;
            gap: 1rem;
            margin-top: 1.5rem;
            padding-top: 1.25rem;
            border-top: 1px solid #2d313f;
        }

        .pipeline-activity[hidden] { display: none !important; }

        .pipeline-activity.is-entering {
            animation: pipeline-activity-enter 220ms ease-out both;
        }

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

        .job-progress {
            background: var(--panel-bg);
            border: 1px solid var(--border-color);
            border-radius: 12px;
            padding: 1.15rem 1.25rem;
            display: grid;
            gap: 0.65rem;
        }

        .job-progress-header {
            display: flex;
            justify-content: space-between;
            gap: 1rem;
            align-items: center;
            min-height: 1.5rem;
            font-size: 0.85rem;
            color: var(--text-muted);
        }

        .job-progress-header-right {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 0.75rem;
            flex-wrap: wrap;
        }

        .job-progress-elapsed {
            color: var(--text-main);
            font-family: 'JetBrains Mono', monospace;
            font-size: 0.76rem;
            font-variant-numeric: tabular-nums;
            white-space: nowrap;
        }

        .job-progress-elapsed[hidden],
        .job-savings[hidden] { display: none !important; }

        .job-savings {
            display: flex;
            align-items: baseline;
            flex-wrap: wrap;
            gap: 0.45rem;
            padding-top: 0.2rem;
            color: var(--text-main);
            font-size: 0.82rem;
        }

        .job-savings-label { color: var(--text-muted); }
        .job-savings-value {
            color: var(--accent-cyan);
            font-family: 'JetBrains Mono', monospace;
            font-variant-numeric: tabular-nums;
            font-weight: 800;
        }
        .job-savings-note { color: var(--text-muted); font-size: 0.74rem; }

        .btn-copy-logs {
            flex: none;
            padding: 0.36rem 0.7rem;
            border: 1px solid var(--border-color);
            border-radius: 7px;
            color: var(--text-main);
            background: rgba(255,255,255,0.06);
            font-size: 0.74rem;
            cursor: pointer;
            transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
        }
        .btn-copy-logs:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); background: rgba(255,255,255,0.1); }

        .job-status { color: var(--text-main); font-weight: 700; }
        .editor-render-progress .job-status { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .editor-render-progress .job-progress-elapsed { flex: none; }

        .progress-track {
            height: 10px;
            background: rgba(255,255,255,0.06);
            border-radius: 999px;
            overflow: hidden;
        }

        .progress-fill {
            width: 0%;
            height: 100%;
            background: var(--primary-gradient);
            border-radius: inherit;
            transition: width 0.3s ease;
        }

        .progress-track.is-indeterminate .progress-fill {
            width: 35%;
            animation: hosted-progress-indeterminate 1.6s ease-in-out infinite alternate;
        }

        @keyframes hosted-progress-indeterminate {
            from { transform: translateX(-100%); }
            to { transform: translateX(286%); }
        }

        @media (prefers-reduced-motion: reduce) {
            .progress-track.is-indeterminate .progress-fill { animation: none; }
        }

        .job-detail { min-height: 1.1rem; color: var(--text-muted); font-size: 0.82rem; }
        .clipping-pipeline-heading { margin: 0; font-size: 1.15rem; }
        .clipping-work-progress { margin: 0; color: var(--text-main); font-size: 0.85rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
        .sp-config-panel.is-processing-progress > :not(#pipeline-activity) { display: none !important; }
        .sp-config-panel.is-processing-progress { padding: 0; background: none; border: 0; }
        #pipeline-activity, #pipeline-activity .job-progress { min-width: 0; width: 100%; box-sizing: border-box; }
        #pipeline-activity .job-progress { grid-template-columns: minmax(0, 1fr); }
        #pipeline-activity .job-progress-header { flex-wrap: wrap; }
        #pipeline-activity .job-progress-status-group { min-width: 0; flex: 1 1 220px; }
        #pipeline-activity .job-progress-header-right { flex: 0 1 auto; }
        #pipeline-activity .job-detail { overflow-wrap: anywhere; }
        #btn-clipping-progress-cancel { min-height: 44px; padding: 8px 14px; }
        #pipeline-activity #job-progress-percent { color: var(--text-main); font-size: 1.05rem; font-weight: 800; font-variant-numeric: tabular-nums; }
        .clipping-pipeline-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; list-style: none; padding: 0; margin: 0 0 4px; }
        .clipping-pipeline-steps[hidden], .clipping-pipeline-heading[hidden] { display: none; }
        .clipping-pipeline-steps li { border-top: 3px solid var(--border-color); padding-top: 8px; color: var(--text-muted); font-size: 0.84rem; }
        .clipping-pipeline-steps li[data-state="current"] { border-color: var(--accent-cyan); color: var(--text-main); font-weight: 700; }
        .clipping-pipeline-steps li[data-state="done"] { border-color: var(--text-muted); }
        .clipping-pipeline-steps span { display: block; font-size: 0.75rem; font-weight: 400; margin-top: 4px; min-height: 1em; }
        @media (max-width: 600px) { .clipping-pipeline-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; } }
        .ai-early-clips {
            border-top: 1px solid var(--border-color);
            padding-top: 0.7rem;
            display: grid;
            gap: 0.55rem;
        }
        .ai-early-clips[hidden], .ai-early-preview[hidden], .ai-early-error[hidden],
        .ai-early-download[hidden] { display: none !important; }
        .ai-early-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
        .ai-early-actions button { font-size: 0.8rem; padding: 0.45rem 0.7rem; }
        .ai-early-preview { width: min(100%, 360px); max-height: 60vh; background: #000; border-radius: 8px; }
        .ai-early-error { margin: 0; color: var(--text-muted); font-size: 0.8rem; }
        .selection-failure {
            display: none;
            margin-top: 0.9rem;
            padding: 0.9rem 1rem;
            border: 1px solid rgba(248, 113, 113, 0.45);
            border-radius: 8px;
            background: rgba(127, 29, 29, 0.18);
            color: #fecaca;
        }
        .selection-failure-title {
            color: #fca5a5;
            font-size: 0.88rem;
            font-weight: 800;
            margin-bottom: 0.3rem;
        }
        .selection-failure-reason {
            font-size: 0.8rem;
            line-height: 1.45;
            overflow-wrap: anywhere;
        }
        .selection-failure-actions {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            margin-top: 0.75rem;
        }

        /* Clips Gallery */
        .gallery-title {
            font-size: 1.4rem;
            font-weight: 600;
            margin-bottom: 1rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .clips-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
            gap: 1.5rem;
        }

        .clip-card {
            background: rgba(255, 255, 255, 0.02);
            border: 1px solid var(--border-color);
            border-radius: 16px;
            overflow: hidden;
            transition: all 0.3s;
            display: flex;
            flex-direction: column;
        }

        /* The gallery filter owns card visibility. Keep this explicit because
           the card's normal display:flex rule must never make a filtered card
           visible again after the hidden attribute is applied. */
        .clip-card[hidden] {
            display: none !important;
        }

        .clip-card:hover {
            transform: translateY(-4px);
            border-color: rgba(0, 242, 254, 0.3);
            box-shadow: 0 12px 24px rgba(0,0,0,0.6);
        }

        .clip-video-container {
            position: relative;
            width: 100%;
            aspect-ratio: 9/16;
            background: #000;
        }

        .clip-video { width: 100%; height: 100%; object-fit: cover; }

        .project-thumb-container {
            position: relative;
            width: 100%;
            aspect-ratio: 16/9;
            background: #000;
        }

        .project-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
        .saved-source-thumb { display: grid; place-items: center; width: 100%; height: 100%;
            color: var(--text-muted); font-size: 0.9rem; }

        .project-render-placeholder {
            border-color: rgba(0, 242, 254, 0.24);
            background: linear-gradient(160deg, rgba(15, 23, 42, 0.9), rgba(8, 10, 16, 0.98));
            pointer-events: none;
        }
        .project-render-placeholder:hover {
            transform: none;
            border-color: rgba(0, 242, 254, 0.24);
            box-shadow: none;
        }
        .project-render-canvas {
            position: relative;
            width: 100%;
            aspect-ratio: 9 / 16;
            overflow: hidden;
            isolation: isolate;
            background:
                radial-gradient(circle at 50% 46%, rgba(16, 20, 239, 0.13), transparent 48%),
                #090b11;
        }
        .project-render-dots,
        .project-render-glow {
            position: absolute;
            inset: 8px;
            background-image: radial-gradient(circle, rgba(148, 163, 184, 0.72) 0 1px, transparent 1.45px);
            background-size: 13px 13px;
        }
        .project-render-dots { opacity: 0.16; }
        .project-render-glow {
            z-index: 1;
            background-image: radial-gradient(circle, rgba(0, 242, 254, 0.96) 0 1.15px, transparent 1.65px);
            opacity: 0.88;
            -webkit-mask-image:
                radial-gradient(ellipse at center, #000 0 34%, transparent 68%),
                radial-gradient(ellipse at center, #000 0 28%, transparent 66%);
            mask-image:
                radial-gradient(ellipse at center, #000 0 34%, transparent 68%),
                radial-gradient(ellipse at center, #000 0 28%, transparent 66%);
            -webkit-mask-repeat: no-repeat;
            mask-repeat: no-repeat;
            -webkit-mask-size: 74% 48%, 48% 34%;
            mask-size: 74% 48%, 48% 34%;
            -webkit-mask-position: 18% 22%, 72% 62%;
            mask-position: 18% 22%, 72% 62%;
            animation:
                project-render-morph 4.4s cubic-bezier(0.45, 0, 0.55, 1) infinite,
                project-render-breathe 1.9s ease-in-out infinite;
        }
        .project-render-sheen {
            position: absolute;
            inset: -35%;
            z-index: 2;
            background: linear-gradient(112deg, transparent 38%, rgba(255, 255, 255, 0.075) 49%, transparent 60%);
            transform: translateX(-42%) rotate(7deg);
            animation: project-render-sheen 2.8s ease-in-out infinite;
        }
        .project-render-label {
            width: fit-content;
            background: linear-gradient(90deg, #f8fafc 0 28%, #67e8f9 46%, #3b82f6 54%, #f8fafc 72% 100%);
            background-size: 280% 100%;
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            -webkit-text-fill-color: transparent;
            animation: slice-post-shimmer 2.4s ease-in-out infinite;
        }
        @keyframes project-render-morph {
            0%, 100% {
                -webkit-mask-size: 68% 44%, 42% 30%;
                mask-size: 68% 44%, 42% 30%;
                -webkit-mask-position: 16% 18%, 72% 66%;
                mask-position: 16% 18%, 72% 66%;
            }
            25% {
                -webkit-mask-size: 46% 58%, 48% 32%;
                mask-size: 46% 58%, 48% 32%;
                -webkit-mask-position: 82% 14%, 34% 34%;
                mask-position: 82% 14%, 34% 34%;
            }
            50% {
                -webkit-mask-size: 64% 40%, 38% 48%;
                mask-size: 64% 40%, 38% 48%;
                -webkit-mask-position: 78% 82%, 24% 66%;
                mask-position: 78% 82%, 24% 66%;
            }
            75% {
                -webkit-mask-size: 50% 54%, 46% 36%;
                mask-size: 50% 54%, 46% 36%;
                -webkit-mask-position: 12% 78%, 66% 32%;
                mask-position: 12% 78%, 66% 32%;
            }
        }
        @keyframes project-render-breathe {
            0%, 100% { opacity: 0.48; }
            50% { opacity: 1; }
        }
        @keyframes project-render-sheen {
            0%, 18% { transform: translateX(-42%) rotate(7deg); opacity: 0; }
            46% { opacity: 1; }
            82%, 100% { transform: translateX(42%) rotate(7deg); opacity: 0; }
        }
        @media (prefers-reduced-motion: reduce) {
            .project-render-glow,
            .project-render-sheen,
            .project-render-label { animation: none; }
            .project-render-glow { opacity: 0.72; }
            .project-render-sheen { display: none; }
            .project-render-label {
                color: var(--text-main);
                -webkit-text-fill-color: currentColor;
            }
        }

        .new-clips-badge {
            position: absolute;
            top: 0.7rem;
            right: 0.7rem;
            z-index: 2;
            padding: 0.38rem 0.62rem;
            border-radius: 999px;
            background: var(--accent-cyan);
            color: #071014;
            font-size: 0.72rem;
            font-weight: 800;
            letter-spacing: 0.02em;
            box-shadow: 0 5px 18px rgba(0, 242, 254, 0.28);
        }

        .project-select-box {
            position: absolute;
            top: 0.7rem;
            left: 0.7rem;
            z-index: 2;
            display: inline-flex;
            align-items: center;
            gap: 0.45rem;
            padding: 0.35rem 0.55rem;
            border-radius: 8px;
            background: rgba(5, 6, 8, 0.82);
            border: 1px solid rgba(255,255,255,0.18);
            color: var(--text-main);
            font-size: 0.78rem;
            cursor: pointer;
        }

        .project-select-box input { width: 16px; height: 16px; accent-color: var(--accent-cyan); }

        .gallery-actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

        .btn-danger-small {
            background: rgba(248, 113, 113, 0.12);
            border: 1px solid rgba(248, 113, 113, 0.35);
            color: #fecaca;
            padding: 0.42rem 0.75rem;
            border-radius: 6px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s;
        }

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

        .btn-danger-small:not(:disabled):hover {
            background: #f87171;
            color: #0d0e12;
            border-color: transparent;
        }

        .confirm-modal-backdrop {
            display: none;
            position: fixed;
            inset: 0;
            z-index: 1200;
            background: rgba(13, 14, 18, 0.78);
            backdrop-filter: blur(8px);
            align-items: center;
            justify-content: center;
            padding: 1rem;
        }

        .confirm-modal {
            width: min(460px, 100%);
            background: #1a1c23;
            border: 1px solid #3a4052;
            border-radius: 10px;
            padding: 1.25rem;
            box-shadow: 0 20px 40px rgba(0,0,0,0.55);
            display: grid;
            gap: 1rem;
        }

        .confirm-modal h3 { margin: 0; font-size: 1.15rem; color: #fff; }
        .confirm-modal p { color: var(--text-muted); line-height: 1.45; font-size: 0.92rem; }
        .confirm-modal-actions { display: flex; justify-content: flex-end; gap: 0.75rem; flex-wrap: wrap; }

        .clip-more-card {
            border: 1px dashed rgba(16, 20, 239, 0.72);
            background: linear-gradient(160deg, rgba(16, 20, 239, 0.12), rgba(13, 14, 18, 0.95));
            color: var(--text-main);
            cursor: pointer;
            font: inherit;
            padding: 0;
            text-align: left;
            min-height: 100%;
        }
        .clip-more-card:hover,
        .clip-more-card:focus-visible {
            border-color: var(--accent-cyan);
            box-shadow: 0 0 0 2px rgba(0, 242, 254, 0.16), 0 16px 36px rgba(0,0,0,0.35);
            outline: none;
            transform: translateY(-2px);
        }
        .clip-more-visual {
            aspect-ratio: 9 / 16;
            display: grid;
            place-items: center;
            background:
                radial-gradient(circle at 50% 42%, rgba(16, 20, 239, 0.28), transparent 42%),
                #090a0f;
        }
        .clip-more-plus {
            width: 72px;
            height: 72px;
            border-radius: 50%;
            display: grid;
            place-items: center;
            border: 1px solid rgba(255,255,255,0.2);
            color: #fff;
            font-size: 2.35rem;
            line-height: 1;
            background: rgba(16, 20, 239, 0.28);
        }
        .clip-more-modal { width: min(540px, 100%); }
        .clip-more-field { display: grid; gap: 0.45rem; }
        .clip-more-field label { color: var(--v2-white, #e2e8f0); font-size: 0.82rem; font-weight: 700; }
        .clip-more-field textarea {
            min-height: 96px;
            resize: vertical;
            background: #0d0e12;
            border: 1px solid #3a4052;
            border-radius: 8px;
            color: #fff;
            padding: 0.75rem;
            font: inherit;
        }
        .clip-more-cache {
            color: var(--v2-white, #b9f5dc);
            background: rgba(52, 211, 153, 0.08);
            border: 1px solid rgba(52, 211, 153, 0.22);
            border-radius: 8px;
            padding: 0.7rem 0.8rem;
            font-size: 0.84rem;
            line-height: 1.4;
        }
        .continuation-banner {
            display: none;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
            margin: 0 0 1rem;
            padding: 0.8rem 0.95rem;
            border: 1px solid rgba(16, 20, 239, 0.5);
            border-radius: 10px;
            background: rgba(16, 20, 239, 0.1);
        }
        .continuation-banner strong { display: block; color: #fff; }
        .continuation-banner span { color: var(--text-muted); font-size: 0.82rem; }
        .clip-card.new-continuation-clip {
            box-shadow: 0 0 0 2px var(--accent-cyan), 0 18px 40px rgba(0, 242, 254, 0.16);
        }
        @media (max-width: 620px) {
            .clip-more-modal {
                max-height: calc(100vh - 2rem);
                overflow-y: auto;
            }
            .clip-more-modal .confirm-modal-actions {
                display: grid;
                grid-template-columns: 1fr;
            }
            .continuation-banner {
                align-items: stretch;
                flex-direction: column;
            }
            .continuation-banner .btn-action {
                align-self: flex-end;
                flex-grow: 0;
                min-width: 96px;
            }
        }

        .clip-info {
            padding: 1.25rem;
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }

        .clip-name { font-weight: 600; font-size: 1.05rem; }
        .clip-version { background: var(--accent-cyan); color: #0d0e12; font-size: 0.7rem; padding: 0.1rem 0.4rem; border-radius: 4px; font-weight: bold; margin-left: 0.5rem; }

        .clip-sub { color: var(--text-muted); font-size: 0.82rem; }

        .clip-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

        .clip-status-controls {
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
            padding: 0.2rem;
            border: 1px solid var(--border-color);
            border-radius: 9px;
            background: rgba(255, 255, 255, 0.03);
        }

        .clip-status-filter {
            border: 0;
            border-radius: 7px;
            padding: 0.38rem 0.62rem;
            background: transparent;
            color: var(--text-muted);
            font: inherit;
            font-size: 0.78rem;
            font-weight: 700;
            cursor: pointer;
        }

        .clip-status-filter:hover,
        .clip-status-filter.active {
            background: rgba(0, 242, 254, 0.14);
            color: var(--accent-cyan);
        }

        .clip-post-badges {
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
            flex-wrap: wrap;
            margin-top: -0.2rem;
        }

        .clip-post-badges:empty { display: none; }

        .clip-post-badge {
            display: inline-flex;
            align-items: center;
            padding: 0.22rem 0.52rem;
            border: 1px solid transparent;
            border-radius: 999px;
            font-size: 0.68rem;
            font-weight: 800;
            letter-spacing: 0.02em;
            text-transform: uppercase;
        }

        .clip-edit-badge {
            display: inline-flex;
            align-items: center;
            padding: 0.22rem 0.52rem;
            border: 1px solid rgba(16, 20, 239, 0.35);
            border-radius: 999px;
            background: rgba(16, 20, 239, 0.14);
            color: #3b82f6;
            font-size: 0.68rem;
            font-weight: 800;
            letter-spacing: 0.02em;
            text-transform: uppercase;
        }

        .clip-post-badge.posted {
            border-color: rgba(74, 222, 128, 0.35);
            background: rgba(34, 197, 94, 0.14);
            color: #86efac;
        }

        .clip-post-badge.scheduled {
            border-color: rgba(251, 191, 36, 0.35);
            background: rgba(245, 158, 11, 0.14);
            color: #fcd34d;
        }

        .clip-post-badge.posting {
            border-color: rgba(34, 211, 238, 0.35);
            background: rgba(6, 182, 212, 0.14);
            color: #67e8f9;
        }

        .clip-post-badge.failed {
            border-color: rgba(248, 113, 113, 0.35);
            background: rgba(239, 68, 68, 0.14);
            color: #fca5a5;
        }

        .clip-delete-btn {
            flex: 0 0 auto;
            color: #fecaca;
            border-color: rgba(248, 113, 113, 0.35);
            background: rgba(248, 113, 113, 0.08);
        }

        .clip-delete-btn:hover:not(:disabled) {
            background: #f87171;
            color: #0d0e12;
            border-color: transparent;
        }

        .btn-action {
            flex-grow: 1;
            background: rgba(255,255,255,0.05);
            border: 1px solid var(--border-color);
            color: var(--text-main);
            padding: 0.6rem;
            border-radius: 8px;
            font-size: 0.85rem;
            font-weight: 600;
            cursor: pointer;
            text-decoration: none;
            text-align: center;
            transition: all 0.2s;
        }

        .btn-action:hover {
            background: var(--primary-gradient);
            color: #0d0e12;
            border-color: transparent;
        }

        /* --- Framing editor --- */
        .scene-item {
            background: #20232e;
            border: 1px solid #2d313f;
            border-radius: 8px;
            padding: 0.65rem 0.8rem;
            cursor: pointer;
            transition: all 0.15s;
            display: flex;
            flex-direction: column;
            gap: 0.15rem;
        }

        .scene-item:hover { border-color: #3f4459; }

        .scene-item.selected {
            border-color: var(--accent-cyan);
            background: rgba(0, 242, 254, 0.08);
        }

        .scene-item .scene-row1 {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 0.85rem;
            font-weight: 700;
        }

        .scene-item .scene-row2 { font-size: 0.75rem; color: #a0aec0; }

        .static-crop-row {
            margin-top: 0.4rem;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.65rem;
        }

        .static-crop-copy {
            display: flex;
            flex-direction: column;
            gap: 0.05rem;
            min-width: 0;
        }

        .static-crop-title {
            font-size: 0.68rem;
            font-weight: 800;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            color: #b5bed0;
            line-height: 1.1;
        }

        .static-crop-hint {
            font-size: 0.62rem;
            color: #737d93;
            line-height: 1.1;
        }

        .static-crop-toggle {
            position: relative;
            flex: 0 0 auto;
            width: 38px;
            height: 22px;
            border: 1px solid #3a4051;
            border-radius: 999px;
            background: #2b3040;
            padding: 0;
            cursor: pointer;
            transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
        }

        .static-crop-toggle::before {
            content: "";
            position: absolute;
            top: 3px;
            left: 3px;
            width: 14px;
            height: 14px;
            border-radius: 50%;
            background: #d9e1ef;
            transition: transform 0.15s ease, background 0.15s ease;
        }

        .static-crop-toggle.active {
            background: var(--accent-cyan);
            border-color: var(--accent-cyan);
        }

        .static-crop-toggle.active::before {
            transform: translateX(16px);
            background: #071014;
        }

        .static-crop-toggle:focus-visible {
            outline: 2px solid var(--accent-cyan);
            outline-offset: 2px;
        }

        .static-crop-toggle:disabled {
            opacity: 0.45;
            cursor: not-allowed;
        }

        .layout-badge {
            font-size: 0.65rem;
            font-weight: 700;
            padding: 0.1rem 0.45rem;
            border-radius: 999px;
            text-transform: uppercase;
            letter-spacing: 0.03em;
        }

        .layout-badge.single { background: rgba(0,242,254,0.15); color: var(--accent-cyan); }
        .layout-badge.split { background: rgba(16,20,239,0.15); color: #3b82f6; }
        .layout-badge.blur { background: rgba(255,255,255,0.12); color: #cbd5e1; }

        .editor-grid { display: grid; grid-template-columns: 300px 1fr; gap: 2rem; }
        @media (max-width: 950px) {
            .editor-grid { grid-template-columns: 1fr; }
            #editor-scenes-list { max-height: 220px !important; }
        }

        .crop-box {
            position: absolute;
            border: 2px solid var(--accent-cyan);
            background: rgba(0, 242, 254, 0.10);
            pointer-events: auto;
            cursor: grab;
            touch-action: none;
            user-select: none;
        }

        .crop-box.dragging { cursor: grabbing; }
        .crop-box.resizing { cursor: nwse-resize; }

        .crop-resize-handle {
            position: absolute;
            right: 2px;
            bottom: 2px;
            width: 20px;
            height: 20px;
            padding: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 0;
            border-radius: 4px;
            background: rgba(7, 16, 20, 0.55);
            color: var(--accent-cyan);
            cursor: nwse-resize;
            pointer-events: auto;
            touch-action: none;
        }

        .crop-resize-handle svg { display: block; }

        .crop-box.box-bottom .crop-resize-handle { color: #3b82f6; }

        .crop-box .crop-label {
            position: absolute;
            top: 4px;
            left: 4px;
            font-size: 0.65rem;
            font-weight: 800;
            letter-spacing: 0.05em;
            padding: 0.1rem 0.4rem;
            border-radius: 4px;
            background: rgba(0,0,0,0.65);
            color: var(--accent-cyan);
            pointer-events: none;
            white-space: nowrap;
        }

        .crop-box.box-bottom { border-color: #3b82f6; background: rgba(16, 20, 239, 0.10); }
        .crop-box.box-bottom .crop-label { color: #3b82f6; }
        .crop-box.box-blur { border-color: #cbd5e1; background: rgba(255,255,255,0.06); cursor: default; }
        .crop-box.box-blur .crop-label { color: #cbd5e1; }

        .crop-snap-guide {
            position: absolute;
            background: #ffdd55;
            box-shadow: 0 0 6px rgba(255, 221, 85, 0.85);
            pointer-events: none;
            z-index: 5;
        }
        .crop-snap-guide-v { top: 0; bottom: 0; width: 1px; }
        .crop-snap-guide-h { left: 0; right: 0; height: 1px; }

        /* Burned-text previews use renderer coordinates projected into the
           active source crop. Descendants inherit the selected caption/hook
           face instead of the page-wide Outfit fallback. */
        #editor-caption-preview,
        #editor-hook-preview {
            position: absolute;
            left: 50%;
            top: 50%;
            width: max-content;
            max-width: 96%;
            transform: translate(-50%, -50%);
            text-align: center;
            pointer-events: none;
            white-space: nowrap;
            z-index: 5;
        }
        #editor-caption-preview *,
        #editor-hook-preview * {
            font-family: inherit;
            font-weight: inherit;
            font-style: inherit;
        }
        #editor-hook-preview { z-index: 6; }
        
        /* Editor tool tabs: purely show/hide the sibling tool panels - every
           existing panel keeps its element IDs and handlers. */
        .editor-tabs {
            display: flex;
            gap: 0.25rem;
            border-bottom: 1px solid #2d313f;
        }
        .editor-tab {
            background: none;
            border: none;
            border-bottom: 2px solid transparent;
            color: #a0aec0;
            font-family: inherit;
            font-size: 0.85rem;
            font-weight: 600;
            padding: 0.5rem 1rem;
            cursor: pointer;
            transition: color 0.15s ease;
        }
        .editor-tab:hover { color: #e2e8f0; }
        .editor-tab.active {
            color: var(--accent-cyan);
            border-bottom-color: var(--accent-cyan);
        }

        /* Small helper text under controls (consumer microcopy). */
        .control-hint {
            font-size: 0.72rem;
            color: #64748b;
            margin-top: 0.35rem;
            line-height: 1.4;
        }

        .mode-guide-shell { position: relative; }
        .mode-guide-label {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        .mode-guide-button {
            width: 1.35rem;
            height: 1.35rem;
            border-radius: 999px;
            border: 1px solid rgba(34, 211, 238, 0.55);
            background: rgba(34, 211, 238, 0.08);
            color: #67e8f9;
            font-size: 0.78rem;
            font-weight: 800;
            line-height: 1;
            cursor: pointer;
            display: inline-grid;
            place-items: center;
            text-transform: none;
        }
        .mode-guide-button:hover,
        .mode-guide-button:focus-visible {
            border-color: var(--accent-cyan);
            background: rgba(34, 211, 238, 0.16);
            outline: none;
            box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
        }
        .mode-guide-popover {
            position: absolute;
            top: 1.8rem;
            right: 0;
            z-index: 300;
            width: min(430px, calc(100vw - 3rem));
            max-height: min(560px, 72vh);
            overflow-y: auto;
            padding: 1rem;
            border: 1px solid #3a4052;
            border-radius: 12px;
            background: #171920;
            box-shadow: 0 22px 55px rgba(0, 0, 0, 0.65);
            text-transform: none;
            letter-spacing: normal;
        }
        .mode-guide-popover[hidden] { display: none; }
        .mode-guide-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
            margin-bottom: 0.75rem;
        }
        .mode-guide-header h3 {
            margin: 0;
            color: #f8fafc;
            font-size: 1rem;
        }
        .mode-guide-close {
            border: 0;
            background: transparent;
            color: #94a3b8;
            font-size: 1.4rem;
            cursor: pointer;
            line-height: 1;
        }
        .mode-guide-item {
            padding: 0.72rem 0;
            border-top: 1px solid rgba(255, 255, 255, 0.07);
        }
        .mode-guide-item strong {
            display: block;
            color: #e2e8f0;
            font-size: 0.84rem;
            margin-bottom: 0.22rem;
        }
        .mode-guide-item p {
            margin: 0;
            color: #94a3b8;
            font-size: 0.77rem;
            line-height: 1.45;
        }

        /* Music track picker rows */
        .music-track {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 0.6rem;
            padding: 0.5rem 0.75rem;
            border: 1px solid #2d313f;
            border-radius: 6px;
            margin-bottom: 0.4rem;
            cursor: pointer;
            background: #1a1c23;
            transition: border-color 0.15s ease;
        }
        .music-track:hover,
        .music-track:focus-visible {
            border-color: #3f4459;
            outline: 2px solid rgba(103, 232, 249, 0.45);
            outline-offset: 1px;
        }
        .music-track.selected {
            border-color: var(--accent-cyan);
            background: rgba(0, 242, 254, 0.06);
        }
        .music-track.disabled {
            opacity: 0.4;
            cursor: not-allowed;
        }
        .music-track-name {
            font-size: 0.82rem;
            color: #e2e8f0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .music-duration-badge {
            font-size: 0.72rem;
            color: #a0aec0;
            font-variant-numeric: tabular-nums;
            flex-shrink: 0;
        }

        /* Non-blocking toast notifications (replaces alert()) */
        #toast-container {
            position: fixed;
            top: 1.5rem;
            right: 1.5rem;
            z-index: 3000;
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            max-width: 380px;
            pointer-events: none;
        }
        .toast {
            background: #1a1c23;
            border: 1px solid #2d313f;
            border-left: 3px solid var(--accent-cyan);
            border-radius: 8px;
            color: #e2e8f0;
            font-size: 0.85rem;
            line-height: 1.45;
            padding: 0.8rem 1rem;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
            animation: toast-in 0.25s ease;
            word-break: break-word;
        }
        #toast-container.editor-toast-mode {
            top: 0.75rem;
            right: auto;
            left: 50%;
            width: min(285px, calc(100vw - 2rem));
            max-width: 285px;
            align-items: center;
            transform: translateX(-50%);
        }
        #toast-container.editor-toast-mode .toast {
            animation: none;
            width: fit-content;
            max-width: 100%;
            padding: 0.55rem 0.72rem;
            border-radius: 6px;
            font-size: 0.72rem;
            line-height: 1.3;
            box-shadow: 0 5px 16px rgba(0, 0, 0, 0.4);
            text-align: center;
        }
        .toast.error { border-left-color: #f87171; }
        @keyframes toast-in {
            from { opacity: 0; transform: translateY(8px); }
            to   { opacity: 1; transform: translateY(0); }
        }

        /* Scene multi-select (shift/ctrl-click) - distinct from the primary
           .selected highlight so the paste-target set reads at a glance. */
        .scene-item.multi-selected {
            border-color: #3b82f6;
            box-shadow: 0 0 0 1px #3b82f6 inset;
        }
        .scene-delete-btn {
            width: 24px;
            height: 24px;
            flex: 0 0 24px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border: 1px solid transparent;
            border-radius: 5px;
            background: transparent;
            color: #64748b;
            font-family: inherit;
            font-size: 0.9rem;
            cursor: pointer;
        }
        .scene-delete-btn:hover:not(:disabled) {
            color: #fecaca;
            border-color: #7f1d1d;
            background: rgba(127, 29, 29, 0.25);
        }
        .scene-delete-btn:disabled { opacity: 0.35; cursor: not-allowed; }
        .context-menu-item.danger { color: #fca5a5; }
        .context-menu-item.danger:hover { background: rgba(127, 29, 29, 0.3); }

        .priority-control {
            padding: 1.15rem;
            border: 1px solid rgba(34, 211, 238, 0.2);
            border-radius: 15px;
            background:
                linear-gradient(145deg, rgba(34, 211, 238, 0.075), rgba(255, 255, 255, 0.018) 62%);
        }
        .priority-control > label,
        .smart-trim-toggle-copy strong {
            color: #f5fbff;
            font-size: 1.08rem;
        }
        #num-clips-hint { font-size: .9rem; color: #b8c3d6; }
        html[data-theme="light"] #num-clips-hint { color: var(--v2-muted); }
        .smart-trim-toggle-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
            cursor: pointer;
            text-transform: none;
            letter-spacing: 0;
        }
        .smart-trim-toggle-copy { min-width: 0; }
        .smart-trim-toggle-copy strong,
        .smart-trim-toggle-copy small { display: block; }
        .smart-trim-toggle-copy strong {
            font-size: 1.15rem;
            line-height: 1.2;
        }
        .smart-trim-toggle-copy small {
            margin-top: 0.35rem;
            color: #8e99a9;
            font-size: 0.78rem;
            font-weight: 550;
            line-height: 1.4;
        }
        .smart-trim-toggle-row .t-toggle {
            --toggle-travel: 20px;
            width: 48px;
            height: 28px;
        }
        .smart-trim-toggle-row .t-toggle-thumb {
            top: 4px;
            left: 4px;
            width: 18px;
            height: 18px;
        }
        .trim-strength-panel {
            display: grid;
            gap: 0.75rem;
            margin-top: 0.25rem;
            padding-top: 1rem;
            border-top: 1px solid rgba(255, 255, 255, 0.08);
        }
        .trim-strength-panel[hidden] { display: none; }
        .trim-strength-options {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 0.5rem;
        }
        .trim-strength-choice {
            position: relative;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.5rem;
            min-width: 0;
            min-height: 48px;
            padding: 0.68rem 0.72rem;
            border: 1px solid rgba(255, 255, 255, 0.08);
            border-radius: 9px;
            background: rgba(255, 255, 255, 0.025);
            color: #cbd5e1;
            font-family: inherit;
            font-size: 0.78rem;
            font-weight: 700;
            text-align: left;
            cursor: pointer;
            transition: border-color 150ms ease, background 150ms ease,
                        color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
        }
        .trim-strength-choice:hover {
            border-color: rgba(34, 211, 238, 0.42);
            background: rgba(34, 211, 238, 0.07);
            color: #f0fcff;
            transform: translateY(-1px);
        }
        .trim-strength-choice:focus-visible {
            outline: 2px solid var(--accent-cyan);
            outline-offset: 2px;
        }
        .trim-strength-choice[aria-pressed="true"] {
            border-color: rgba(34, 211, 238, 0.78);
            background: linear-gradient(145deg, rgba(34, 211, 238, 0.16), rgba(59, 130, 246, 0.09));
            color: #e8fcff;
            box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.12),
                        0 8px 24px rgba(8, 145, 178, 0.12);
        }
        .trim-strength-choice[aria-pressed="true"]::before {
            content: '';
            width: 7px;
            height: 7px;
            flex: 0 0 auto;
            border-radius: 50%;
            background: var(--accent-cyan);
            box-shadow: 0 0 10px rgba(34, 211, 238, 0.75);
        }
        .trim-strength-label {
            flex: 1 1 auto;
        }
        .info-tip {
            position: relative;
            flex: 0 0 auto;
            width: 20px;
            height: 20px;
            display: inline-grid;
            place-items: center;
            border: 1px solid rgba(34, 211, 238, 0.38);
            border-radius: 50%;
            color: #a8f4ff;
            font: 750 0.68rem/1 'JetBrains Mono', monospace;
            cursor: inherit;
        }
        .info-tooltip {
            position: absolute;
            left: 50%;
            bottom: calc(100% + 9px);
            z-index: 320;
            width: min(220px, 58vw);
            padding: 0.65rem 0.72rem;
            border: 1px solid rgba(34, 211, 238, 0.3);
            border-radius: 9px;
            background: #11151c;
            color: #d9e3ed;
            box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
            font: 500 0.72rem/1.4 Inter, sans-serif;
            opacity: 0;
            pointer-events: none;
            translate: -50% 4px;
            transition: opacity 140ms ease, translate 140ms ease;
        }
        .trim-strength-choice:hover .info-tooltip,
        .trim-strength-choice:focus-visible .info-tooltip {
            opacity: 1;
            translate: -50% 0;
        }
        @media (max-width: 620px) {
            .trim-strength-options { grid-template-columns: 1fr; }
            .info-tooltip { left: auto; right: 0; translate: 0 4px; }
            .trim-strength-choice:hover .info-tooltip,
            .trim-strength-choice:focus-visible .info-tooltip { translate: 0 0; }
        }

        /* Right-click context menu for scene blocks (Copy/Paste Effects) */
        #scene-context-menu,
        #media-segment-context-menu,
        #text-layer-context-menu,
        #transcript-context-menu {
            position: fixed;
            z-index: 2600;
            display: none;
            min-width: 180px;
            background: #1a1c23;
            border: 1px solid #3f4459;
            border-radius: 8px;
            padding: 0.3rem;
            box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
        }
        .context-menu-item {
            padding: 0.45rem 0.8rem;
            border-radius: 6px;
            font-size: 0.85rem;
            color: #e2e8f0;
            cursor: pointer;
            user-select: none;
        }
        .context-menu-item:hover { background: #2d313f; }
        .context-menu-item.disabled {
            color: #4b5563;
            cursor: not-allowed;
        }
        .context-menu-item.disabled:hover { background: none; }
        .context-menu-separator {
            height: 1px;
            margin: 0.3rem 0.2rem;
            background: #2d313f;
        }
        .context-menu-label {
            padding: 0.25rem 0.8rem 0.15rem;
            font-size: 0.65rem;
            font-weight: 700;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            color: #64748b;
            user-select: none;
        }

        /* Paste Effects checklist modal */
        #paste-effects-modal {
            position: fixed;
            inset: 0;
            z-index: 2500;
            display: none;
            background: rgba(0, 0, 0, 0.55);
        }
        .paste-effects-card {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 340px;
            background: #1a1c23;
            border: 1px solid #3f4459;
            border-radius: 10px;
            padding: 1.2rem;
            display: flex;
            flex-direction: column;
            gap: 0.8rem;
        }
        .paste-fx-row {
            display: flex;
            align-items: center;
            gap: 0.6rem;
            font-size: 0.88rem;
            color: #e2e8f0;
            cursor: pointer;
            user-select: none;
        }
        .paste-fx-row input { accent-color: var(--accent-cyan); width: 16px; height: 16px; }
        .fx-btn {
            background: #2d313f;
            border: 1px solid #3f4459;
            color: #fff;
            padding: 0.35rem 0.7rem;
            border-radius: 6px;
            font-size: 0.78rem;
            font-family: inherit;
            cursor: pointer;
        }
        .fx-btn:hover:not(:disabled) { border-color: var(--accent-cyan); }
        .fx-btn:disabled { opacity: 0.4; cursor: not-allowed; }
        .fx-btn.active { border-color: var(--accent-cyan); background: rgba(0,242,254,0.18); color: var(--accent-cyan); }
        .clip-scrubber-wrap {
            flex: 1; min-width: 120px; height: 26px; position: relative;
            display: flex; align-items: center;
        }
        #clip-cut-markers {
            position: absolute; inset: 0 7px; pointer-events: none; z-index: 2;
        }
        .timeline-cut-band {
            position: absolute; top: 8px; height: 10px; min-width: 2px;
            border-radius: 3px; background: rgba(248, 113, 113, 0.72);
            box-shadow: inset 0 0 0 1px rgba(254, 202, 202, 0.45);
        }
        #clip-scrubber {
            position: relative; z-index: 3; width: 100%; margin: 0;
            cursor: pointer; accent-color: var(--accent-cyan); background: transparent;
        }
        .dual-range-shell {
            position: relative; height: 34px; width: 100%; margin: 0.45rem 0 0.3rem;
        }
        .dual-range-rail, .dual-range-selection {
            position: absolute; left: 0; right: 0; top: 14px; height: 6px;
            border-radius: 999px;
        }
        .dual-range-rail { background: #353a49; }
        .dual-range-selection {
            right: auto; background: linear-gradient(90deg, #22d3ee, #60a5fa);
            box-shadow: 0 0 10px rgba(34, 211, 238, 0.28);
        }
        .dual-range-input {
            position: absolute; inset: 0; width: 100%; height: 34px; margin: 0;
            appearance: none; -webkit-appearance: none; background: transparent;
            pointer-events: none; outline: none;
        }
        .dual-range-input::-webkit-slider-runnable-track { height: 6px; background: transparent; }
        .dual-range-input::-moz-range-track { height: 6px; background: transparent; }
        .dual-range-input::-webkit-slider-thumb {
            appearance: none; -webkit-appearance: none; pointer-events: auto;
            width: 18px; height: 18px; margin-top: -6px; border-radius: 50%;
            border: 3px solid #0d0e12; background: #22d3ee; cursor: ew-resize;
            box-shadow: 0 0 0 2px rgba(34,211,238,.55), 0 2px 8px rgba(0,0,0,.5);
        }
        .dual-range-input.range-end::-webkit-slider-thumb { background: #fbbf24; box-shadow: 0 0 0 2px rgba(251,191,36,.55), 0 2px 8px rgba(0,0,0,.5); }
        .dual-range-input::-moz-range-thumb {
            pointer-events: auto; width: 14px; height: 14px; border-radius: 50%;
            border: 3px solid #0d0e12; background: #22d3ee; cursor: ew-resize;
        }
        .dual-range-input.range-end::-moz-range-thumb { background: #fbbf24; }
        .range-boundary-grid {
            display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem;
        }
        .range-boundary-card {
            border: 1px solid #343948; border-radius: 8px; padding: 0.6rem;
            background: rgba(255,255,255,0.025);
        }
        .range-boundary-title {
            display: flex; justify-content: space-between; gap: 0.5rem;
            font-size: 0.75rem; color: #a0aec0; margin-bottom: 0.45rem;
        }
        .range-time-value { color: #f8fafc; font-variant-numeric: tabular-nums; font-weight: 700; }
        .range-nudge-row { display: flex; flex-wrap: wrap; gap: 0.35rem; }
        .source-range-card {
            display: none; margin-top: 0.9rem; padding: 0.8rem;
            border: 1px solid rgba(34,211,238,.28); border-radius: 10px;
            background: rgba(8,15,24,.72);
        }
        #source-range-video {
            display: block; width: 100%; max-height: 250px; aspect-ratio: 16/9;
            object-fit: contain; background: #000; border-radius: 8px;
        }
        @media (max-width: 620px) {
            .range-boundary-grid { grid-template-columns: 1fr; }
        }

        /* Empty state for the projects gallery */
        .empty-state {
            grid-column: 1 / -1;
            text-align: center;
            color: #64748b;
            font-size: 0.9rem;
            line-height: 1.6;
            padding: 2.5rem 1rem;
            border: 1px dashed #2d313f;
            border-radius: 10px;
        }

        .recreate-controlled {
            transition: opacity 160ms ease, filter 160ms ease;
        }

        .recreate-controlled.recreate-disabled {
            opacity: 0.38;
            filter: grayscale(0.45);
        }

        .recreate-controlled.recreate-disabled label,
        .recreate-controlled.recreate-disabled .control-hint {
            cursor: not-allowed;
        }

        .output-aspect-control select { font-variant-numeric: tabular-nums; }
    