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

        body,
        html {
            width: 100%;
            height: 100%;
            overflow: hidden;
            background-color: #02040a;
            font-family: 'Plus Jakarta Sans', sans-serif;
            color: #f1f5f9;
        }

        /* Shared screen geometry. The video track (bottom 26px, cards 94px + 14px) is unchanged; the live feed
           bar fits in the strip beneath it and the panels stop above both. */
        :root {
            --feed-bar-height: 24px;
            --ai-panel-top: 104px;
            --ai-panel-bottom: 144px;
            --right-panel-top: 20px;
            --right-panel-height: calc(100vh - 52px);
            --right-panel-height-dvh: calc(100dvh - 52px);
        }

        @media (max-width: 639px) {
            :root {
                --feed-bar-height: 20px;
                --ai-panel-top: 92px;
                --ai-panel-bottom: 116px;
                --right-panel-top: 12px;
                --right-panel-height: calc(100vh - 40px);
                --right-panel-height-dvh: calc(100dvh - 40px);
            }
        }

        #webgl-container {
            width: 100%;
            height: 100%;
            position: absolute;
            top: 0;
            left: 0;
            z-index: 1;
        }

        .glass-card {
            background: rgba(8, 16, 32, 0.35);
            backdrop-filter: blur(16px) saturate(180%);
            -webkit-backdrop-filter: blur(16px) saturate(180%);
            border: 1px solid rgba(0, 240, 255, 0.3);
            box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), inset 0 0 15px rgba(0, 240, 255, 0.1);
        }

        /* 3D Crystal Staked Layer Look for Modals */
        .crystal-3d-card {
            background: linear-gradient(135deg, rgba(8, 20, 42, 0.75), rgba(18, 9, 36, 0.85));
            backdrop-filter: blur(20px) saturate(200%);
            -webkit-backdrop-filter: blur(20px) saturate(200%);
            border: 1.5px solid rgba(0, 240, 255, 0.4);
            box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8), inset 0 0 25px rgba(0, 240, 255, 0.2), 0 0 15px rgba(176, 38, 255, 0.3);
            border-radius: 24px;
            position: relative;
        }

        .crystal-3d-card::before {
            content: '';
            position: absolute;
            inset: -2px;
            border-radius: 26px;
            padding: 2px;
            background: linear-gradient(135deg, rgba(0, 240, 255, 0.6), rgba(255, 0, 127, 0.6));
            -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
            -webkit-mask-composite: xor;
            mask-composite: exclude;
            pointer-events: none;
        }

        #settingsSidebar {
            position: fixed;
            top: 20px;
            right: 20px;
            height: var(--right-panel-height);
            height: var(--right-panel-height-dvh);
            width: 370px;
            transform: translateX(calc(100% + 40px));
            background: rgba(6, 12, 24, 0.18) !important;
            backdrop-filter: blur(8px) saturate(180%);
            -webkit-backdrop-filter: blur(8px) saturate(180%);
            border: 1.5px solid rgba(0, 240, 255, 0.35);
            border-radius: 20px;
            box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(0, 240, 255, 0.1);
            transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease;
            z-index: 40;
            overflow-y: auto;
        }

        #settingsSidebar .details-body > * + * {
            margin-top: 0.75rem;
        }

        #settingsSidebar #deleteConfirmContainer {
            overflow-wrap: anywhere;
        }

        #settingsSidebar::-webkit-scrollbar {
            width: 4px;
        }

        #settingsSidebar::-webkit-scrollbar-track {
            background: rgba(0, 0, 0, 0.1);
            border-radius: 4px;
        }

        #settingsSidebar::-webkit-scrollbar-thumb {
            background: rgba(0, 240, 255, 0.4);
            border-radius: 4px;
        }

        .sidebar-open {
            transform: translateX(0) !important;
        }

        .studio-header {
            align-items: flex-start;
            gap: 8px;
        }

        .studio-header-title {
            display: flex;
            gap: 5px;
            min-width: 0;
        }

        .studio-header-version {
            align-self: flex-start;
        }

        .studio-close-btn {
            width: 30px;
            height: 30px;
            flex-shrink: 0;
            border-radius: 10px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            color: #67e8f9;
            background: rgba(8, 16, 32, 0.55);
            border: 1px solid rgba(0, 240, 255, 0.45);
            box-shadow: 0 0 12px rgba(0, 240, 255, 0.3);
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .studio-close-btn:hover {
            color: #ffffff;
            border-color: #00f0ff;
            box-shadow: 0 0 16px rgba(0, 240, 255, 0.55);
            transform: scale(1.08);
        }

        /* ---------- 3D Crystal Video Track ---------- */
        /* z-index must stay below .ai-panel (30) and #settingsSidebar (40) so open panels cover the track. */
        .crystal-video-track {
            --cv-card-width: 168px;
            --cv-card-height: 94px;
            position: fixed;
            left: 0;
            right: 0;
            bottom: 26px;
            height: calc(var(--cv-card-height) + 14px);
            z-index: 20;
            overflow: hidden;
            pointer-events: none;
            -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 5%, #000 93%, transparent 100%);
            mask-image: linear-gradient(90deg, transparent 0, #000 5%, #000 93%, transparent 100%);
        }

        .crystal-video-card {
            --cv-accent: #00f0ff;
            position: absolute;
            top: 7px;
            left: 0;
            width: var(--cv-card-width);
            height: var(--cv-card-height);
            border-radius: 12px;
            overflow: hidden;
            background: #02040a;
            border: 1px solid color-mix(in srgb, var(--cv-accent) 65%, transparent);
            box-shadow: 0 0 16px color-mix(in srgb, var(--cv-accent) 35%, transparent), inset 0 0 14px rgba(176, 38, 255, 0.18);
            will-change: transform;
        }

        .crystal-video-card canvas {
            display: block;
            width: 100%;
            height: 100%;
        }

        .crystal-video-card::after {
            content: '';
            position: absolute;
            inset: 0;
            background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 38%, transparent 70%, rgba(0, 240, 255, 0.08));
            pointer-events: none;
        }

        .crystal-video-badge {
            position: absolute;
            top: 5px;
            left: 6px;
            display: inline-flex;
            align-items: center;
            gap: 4px;
            padding: 2px 6px;
            border-radius: 999px;
            font-size: 7px;
            font-weight: 800;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--cv-accent);
            background: rgba(2, 6, 16, 0.65);
            border: 1px solid color-mix(in srgb, var(--cv-accent) 70%, transparent);
            z-index: 1;
        }

        .crystal-video-meta {
            position: absolute;
            left: 6px;
            right: 6px;
            bottom: 5px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 6px;
            font-size: 8px;
            font-weight: 700;
            color: #e2e8f0;
            text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
            z-index: 1;
        }

        .crystal-video-title {
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }

        .crystal-video-time {
            flex-shrink: 0;
            font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
            color: #fcd34d;
        }

        @media (max-width: 639px) {
            .crystal-video-track {
                --cv-card-width: 128px;
                --cv-card-height: 72px;
                bottom: 22px;
            }
        }

        input[type=range] {
            -webkit-appearance: none;
            background: rgba(255, 255, 255, 0.15);
            height: 3px;
            border-radius: 3px;
            outline: none;
        }

        input[type=range]::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: #00f0ff;
            cursor: pointer;
            box-shadow: 0 0 10px #00f0ff;
            transition: all 0.2s ease;
        }

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

        input[type=text],
        input[type=password],
        input[type=email],
        input[type=tel],
        select,
        input[type="color"],
        input[type="number"] {
            width: 100%;
            background: rgba(10, 20, 40, 0.45) !important;
            color: #ffffff !important;
            border: 1px solid rgba(0, 240, 255, 0.3);
            padding: 8px 10px;
            border-radius: 8px;
            font-size: 11px;
            backdrop-filter: blur(6px);
            outline: none;
        }

        input[type=text]:focus,
        input[type=password]:focus,
        input[type=email]:focus,
        input[type=tel]:focus {
            border-color: #00f0ff;
            box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
        }

        select option {
            background-color: #0b132b !important;
            color: #ffffff !important;
        }

        input[type="color"] {
            height: 24px;
            cursor: pointer;
            padding: 1px;
            border-radius: 4px;
        }

        .cmyk-inputs {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 6px;
            text-align: center;
        }

        .cmyk-inputs input {
            padding: 4px 2px;
            text-align: center;
            font-size: 10px;
        }

        details {
            background: rgba(10, 20, 40, 0.2);
            border: 1px solid rgba(0, 240, 255, 0.2);
            border-radius: 12px;
            margin-bottom: 8px;
            overflow: hidden;
            backdrop-filter: blur(6px);
        }

        summary {
            background: rgba(15, 30, 55, 0.4);
            padding: 10px 12px;
            font-size: 11px;
            font-weight: 700;
            color: #00f0ff;
            cursor: pointer;
            display: flex;
            justify-content: space-between;
            align-items: center;
            list-style: none;
            letter-spacing: 0.5px;
        }

        summary::-webkit-details-marker {
            display: none;
        }

        summary {
            gap: 8px;
        }

        summary .fa-chevron-down {
            transition: transform 0.25s ease;
        }

        details[open] > summary .fa-chevron-down {
            transform: rotate(180deg);
        }

        details[open] > summary {
            border-bottom: 1px solid rgba(0, 240, 255, 0.15);
        }

        .palette-slot {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 3px;
            font-size: 8px;
            font-weight: 700;
            text-transform: uppercase;
            color: #94a3b8;
            cursor: pointer;
        }

        .palette-preset {
            display: flex;
            flex-direction: column;
            gap: 3px;
            padding: 4px;
            border-radius: 8px;
            background: rgba(15, 23, 42, 0.6);
            border: 1px solid rgba(148, 163, 184, 0.25);
            font-size: 8px;
            font-weight: 800;
            text-transform: uppercase;
            color: #e2e8f0;
            cursor: pointer;
            transition: border-color 0.2s ease, transform 0.2s ease;
        }

        .palette-preset:hover {
            border-color: rgba(0, 240, 255, 0.6);
            transform: translateY(-1px);
        }

        .palette-preset-swatch {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            height: 8px;
            border-radius: 4px;
            overflow: hidden;
        }

        summary:hover {
            background: rgba(25, 45, 80, 0.55);
        }

        .details-body {
            padding: 12px;
        }

        .special-builder-card {
            background: linear-gradient(135deg, rgba(255, 0, 127, 0.15), rgba(0, 240, 255, 0.15));
            border: 1.5px solid #ff007f;
            box-shadow: 0 0 20px rgba(255, 0, 127, 0.2), inset 0 0 15px rgba(0, 240, 255, 0.1);
            border-radius: 12px;
        }

        .special-builder-card > summary {
            background: rgba(255, 0, 127, 0.14);
        }

        .special-builder-card > summary:hover {
            background: rgba(255, 0, 127, 0.24);
        }

        .btn-cyber {
            background: linear-gradient(135deg, rgba(0, 240, 255, 0.25), rgba(176, 38, 255, 0.35));
            border: 1px solid rgba(0, 240, 255, 0.5);
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .btn-cyber:hover {
            background: linear-gradient(135deg, rgba(0, 240, 255, 0.45), rgba(176, 38, 255, 0.65));
            box-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
            transform: translateY(-1px);
        }

        .btn-special {
            background: linear-gradient(135deg, rgba(255, 0, 127, 0.5), rgba(255, 170, 0, 0.5));
            border: 1px solid #ff007f;
            transition: all 0.3s ease;
        }

        .btn-special:hover {
            background: linear-gradient(135deg, rgba(255, 0, 127, 0.8), rgba(255, 170, 0, 0.8));
            box-shadow: 0 0 15px rgba(255, 0, 127, 0.6);
        }

        .checkout-pkg-card {
            background: rgba(13, 19, 35, 0.85);
            border: 1px solid rgba(255, 255, 255, 0.12);
            transition: all 0.25s ease;
            cursor: pointer;
        }

        .checkout-pkg-card:hover,
        .checkout-pkg-card.active {
            border-color: #6366f1;
            box-shadow: 0 0 15px rgba(99, 102, 241, 0.35);
            background: rgba(22, 28, 52, 0.95);
        }

        @media (max-width: 639px) {
            #settingsSidebar {
                top: 12px;
                right: 12px;
                width: calc(100vw - 24px);
                height: var(--right-panel-height);
                height: var(--right-panel-height-dvh);
            }

            #settingsSidebar input[type=range]::-webkit-slider-thumb {
                width: 18px;
                height: 18px;
            }

            #settingsSidebar summary {
                min-height: 44px;
            }
        }

        /* ---------- AI Generation Studio ---------- */
        /* This file loads after the Tailwind build, so the display rules below would otherwise beat .hidden. */
        [class*="ai-"].hidden {
            display: none !important;
        }

        /* Left edge tab: only visible while the AI panel is closed, so it can be reopened. */
        .ai-edge-tab {
            position: fixed;
            top: var(--ai-panel-top);
            left: 0;
            z-index: 30;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 10px;
            width: 34px;
            padding: 14px 0;
            border-radius: 0 14px 14px 0;
            border: 1px solid rgba(255, 0, 127, 0.5);
            border-left: none;
            background: linear-gradient(180deg, rgba(76, 5, 45, 0.55), rgba(8, 16, 32, 0.6));
            backdrop-filter: blur(14px) saturate(180%);
            -webkit-backdrop-filter: blur(14px) saturate(180%);
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 0 16px rgba(255, 0, 127, 0.25);
            color: #f9a8d4;
            cursor: pointer;
            transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, visibility 0.25s, box-shadow 0.25s ease, width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .ai-edge-tab:hover,
        .ai-edge-tab:focus-visible {
            width: 42px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 0 24px rgba(255, 0, 127, 0.5);
            outline: none;
        }

        .ai-edge-tab[aria-expanded="true"] {
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
            transform: translateX(-100%);
        }

        .ai-edge-tab i {
            font-size: 13px;
        }

        .ai-edge-tab-label {
            writing-mode: vertical-rl;
            font-family: 'Space Grotesk', sans-serif;
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 0.24em;
            background: linear-gradient(180deg, #f9a8d4, #22d3ee);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }

        .ai-panel {
            position: fixed;
            top: var(--ai-panel-top);
            left: 20px;
            bottom: var(--ai-panel-bottom);
            width: 400px;
            z-index: 30;
            overflow-y: auto;
            padding: 18px;
            border-radius: 20px;
            background: rgba(6, 12, 24, 0.72);
            backdrop-filter: blur(14px) saturate(180%);
            -webkit-backdrop-filter: blur(14px) saturate(180%);
            border: 1.5px solid rgba(255, 0, 127, 0.35);
            box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55), inset 0 0 20px rgba(0, 240, 255, 0.08);
        }

        .ai-panel:not(.hidden) {
            display: flex;
            flex-direction: column;
            gap: 16px;
        }

        .ai-panel::-webkit-scrollbar {
            width: 4px;
        }

        .ai-panel::-webkit-scrollbar-thumb {
            background: rgba(255, 0, 127, 0.4);
            border-radius: 4px;
        }

        .ai-panel textarea,
        .ai-panel input {
            user-select: text;
        }

        .ai-panel textarea,
        .ai-panel input[type=url] {
            width: 100%;
            background: rgba(10, 20, 40, 0.45);
            color: #ffffff;
            border: 1px solid rgba(0, 240, 255, 0.3);
            padding: 10px 12px;
            border-radius: 10px;
            font-size: 12.5px;
            line-height: 1.5;
            font-family: inherit;
            outline: none;
            resize: vertical;
        }

        .ai-panel textarea:focus,
        .ai-panel input[type=url]:focus,
        .ai-panel input[type=number]:focus,
        .ai-panel select:focus {
            border-color: #00f0ff;
            box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
        }

        .ai-panel-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding-bottom: 12px;
            border-bottom: 1px solid rgba(255, 0, 127, 0.3);
        }

        .ai-panel-title {
            font-family: 'Space Grotesk', sans-serif;
            font-size: 13.5px;
            font-weight: 700;
            letter-spacing: 0.08em;
            background: linear-gradient(90deg, #f472b6, #22d3ee);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }

        .ai-panel-title i {
            -webkit-text-fill-color: #f472b6;
            margin-right: 4px;
        }

        .ai-icon-btn {
            width: 28px;
            height: 28px;
            border-radius: 8px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            color: #94a3b8;
            background: rgba(15, 23, 42, 0.6);
            border: 1px solid rgba(148, 163, 184, 0.25);
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .ai-icon-btn:hover {
            color: #22d3ee;
            border-color: rgba(34, 211, 238, 0.6);
        }

        .ai-icon-btn.spinning i {
            animation: ai-spin 0.8s linear infinite;
        }

        .ai-balance-card {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 14px;
            padding: 14px 16px;
            border-radius: 16px;
            background: linear-gradient(135deg, rgba(251, 191, 36, 0.14), rgba(255, 0, 127, 0.12));
            border: 1px solid rgba(251, 191, 36, 0.45);
        }

        .ai-balance-card.ai-balance-low {
            border-color: rgba(244, 63, 94, 0.7);
            box-shadow: 0 0 14px rgba(244, 63, 94, 0.25);
        }

        .ai-balance-label {
            display: block;
            font-size: 10.5px;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            color: #fde68a;
        }

        .ai-balance-value {
            display: flex;
            align-items: baseline;
            gap: 7px;
            margin-top: 5px;
        }

        #aiCreditBalance {
            font-family: 'Space Grotesk', sans-serif;
            font-size: 28px;
            font-weight: 800;
            line-height: 1;
            color: #ffffff;
            text-shadow: 0 0 14px rgba(251, 191, 36, 0.45);
        }

        .ai-balance-unit {
            font-size: 11.5px;
            font-weight: 700;
            text-transform: uppercase;
            color: #fcd34d;
        }

        .ai-balance-note {
            display: block;
            margin-top: 6px;
            font-size: 10.5px;
            line-height: 1.45;
            color: #cbd5e1;
        }

        .ai-balance-low .ai-balance-note {
            color: #fda4af;
        }

        .ai-balance-actions {
            display: flex;
            flex-direction: column;
            gap: 8px;
            flex-shrink: 0;
        }

        .ai-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            padding: 8px 13px;
            border-radius: 10px;
            font-size: 11px;
            font-weight: 800;
            text-transform: uppercase;
            cursor: pointer;
            transition: transform 0.2s ease, box-shadow 0.2s ease;
            white-space: nowrap;
        }

        .ai-btn:hover {
            transform: translateY(-1px);
        }

        .ai-btn-amber {
            background: linear-gradient(90deg, #fbbf24, #ec4899);
            color: #0f172a;
            box-shadow: 0 0 12px rgba(251, 191, 36, 0.35);
        }

        .ai-btn-cyan {
            background: linear-gradient(90deg, #22d3ee, #a855f7);
            color: #0f172a;
            box-shadow: 0 0 12px rgba(34, 211, 238, 0.35);
        }

        .ai-notice {
            padding: 11px 13px;
            border-radius: 12px;
            font-size: 11px;
            line-height: 1.55;
            color: #fde68a;
            background: rgba(120, 53, 15, 0.35);
            border: 1px solid rgba(251, 191, 36, 0.45);
        }

        .ai-notice i {
            margin-right: 4px;
        }

        .ai-notice code {
            font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
            color: #fcd34d;
        }

        .ai-mode-tabs {
            display: grid;
            grid-template-columns: repeat(4, minmax(0, 1fr));
            gap: 10px;
        }

        .ai-mode-tab {
            position: relative;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 6px;
            padding: 12px 5px 10px;
            border-radius: 14px;
            background: rgba(15, 23, 42, 0.65);
            border: 1px solid rgba(0, 240, 255, 0.25);
            color: #cbd5e1;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .ai-mode-tab i {
            font-size: 17px;
            color: #67e8f9;
        }

        .ai-mode-tab:hover {
            border-color: rgba(0, 240, 255, 0.6);
            transform: translateY(-1px);
        }

        .ai-mode-tab.active {
            background: linear-gradient(135deg, rgba(0, 240, 255, 0.22), rgba(255, 0, 127, 0.28));
            border-color: #f472b6;
            color: #ffffff;
            box-shadow: 0 0 14px rgba(255, 0, 127, 0.3);
        }

        .ai-mode-tab.active i {
            color: #ffffff;
        }

        .ai-mode-tab.ai-mode-unavailable {
            opacity: 0.55;
        }

        .ai-mode-tab.ai-mode-unavailable::after {
            content: 'OFF';
            position: absolute;
            top: -6px;
            right: -4px;
            padding: 1px 4px;
            border-radius: 4px;
            background: #475569;
            color: #e2e8f0;
            font-size: 7px;
            font-weight: 800;
        }

        .ai-mode-name {
            font-size: 10.5px;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 0.03em;
            line-height: 1.25;
            text-align: center;
        }

        .ai-cost-badge {
            padding: 2px 8px;
            border-radius: 999px;
            background: rgba(251, 191, 36, 0.15);
            border: 1px solid rgba(251, 191, 36, 0.5);
            color: #fcd34d;
            font-size: 9.5px;
            font-weight: 800;
            white-space: nowrap;
        }

        .ai-form {
            display: flex;
            flex-direction: column;
            gap: 14px;
        }

        .ai-fields:not(.hidden) {
            display: flex;
            flex-direction: column;
            gap: 13px;
        }

        .ai-label {
            display: block;
            font-size: 10.5px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            line-height: 1.4;
            color: #94a3b8;
        }

        .ai-label > input,
        .ai-label > textarea,
        .ai-label > select {
            display: block;
            margin-top: 7px;
            text-transform: none;
            letter-spacing: normal;
            font-weight: 400;
        }

        .ai-label em {
            color: #f472b6;
            font-style: normal;
        }

        .ai-optional {
            color: #64748b;
            font-weight: 600;
            text-transform: none;
            letter-spacing: 0;
        }

        .ai-grid-2 {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 12px;
        }

        .ai-hint {
            font-size: 10.5px;
            line-height: 1.5;
            color: #94a3b8;
        }

        .ai-preview:not(.hidden) {
            display: flex;
            justify-content: center;
            padding: 6px;
            border-radius: 10px;
            background: rgba(2, 6, 23, 0.6);
            border: 1px dashed rgba(0, 240, 255, 0.3);
        }

        .ai-preview img {
            max-height: 140px;
            max-width: 100%;
            border-radius: 8px;
            object-fit: contain;
        }

        .ai-preview audio {
            width: 100%;
        }

        .ai-preview .ai-preview-error {
            font-size: 9px;
            color: #fda4af;
        }

        .ai-attach {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-top: -4px;
            padding: 6px;
            border-radius: 10px;
            border: 1px dashed rgba(255, 0, 127, 0.35);
            background: rgba(2, 6, 23, 0.45);
            transition: border-color 0.2s ease, background 0.2s ease;
        }

        .ai-attach.dragging {
            border-color: #00f0ff;
            background: rgba(0, 240, 255, 0.08);
        }

        .ai-attach-btn {
            flex-shrink: 0;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            min-height: 32px;
            padding: 6px 10px;
            border-radius: 8px;
            background: rgba(255, 0, 127, 0.16);
            border: 1px solid rgba(255, 0, 127, 0.5);
            color: #fbcfe8;
            font-size: 9px;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            cursor: pointer;
        }

        .ai-attach-btn:hover,
        .ai-attach-btn:focus-within {
            background: rgba(255, 0, 127, 0.28);
            box-shadow: 0 0 10px rgba(255, 0, 127, 0.35);
        }

        .ai-attach.busy .ai-attach-btn {
            pointer-events: none;
            opacity: 0.6;
        }

        .ai-attach.busy .ai-attach-btn i::before {
            content: "\f110";
        }

        .ai-attach.busy .ai-attach-btn i {
            animation: ai-spin 1s linear infinite;
        }

        .ai-attach-name {
            flex: 1;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-size: 9px;
            color: #94a3b8;
        }

        .ai-attach-name.ai-attach-ready {
            color: #6ee7b7;
        }

        .ai-attach-name.ai-attach-error {
            white-space: normal;
            color: #fda4af;
        }

        .ai-attach-clear {
            flex-shrink: 0;
            width: 28px;
            height: 28px;
            border-radius: 8px;
            color: #fda4af;
            background: rgba(244, 63, 94, 0.12);
            border: 1px solid rgba(244, 63, 94, 0.4);
            cursor: pointer;
        }

        .ai-panel input[type=url]:read-only {
            opacity: 0.65;
            cursor: not-allowed;
        }

        .ai-segmented {
            display: grid;
            grid-template-columns: 1fr 1fr;
            padding: 3px;
            border-radius: 10px;
            background: rgba(2, 6, 23, 0.6);
            border: 1px solid rgba(0, 240, 255, 0.2);
        }

        .ai-segmented button {
            padding: 6px;
            border-radius: 8px;
            font-size: 9px;
            font-weight: 800;
            text-transform: uppercase;
            color: #94a3b8;
            cursor: pointer;
        }

        .ai-segmented button.active {
            background: rgba(0, 240, 255, 0.18);
            color: #ffffff;
            box-shadow: inset 0 0 0 1px rgba(0, 240, 255, 0.5);
        }

        .ai-form-error {
            padding: 8px 10px;
            border-radius: 10px;
            font-size: 10px;
            color: #fecdd3;
            background: rgba(136, 19, 55, 0.4);
            border: 1px solid rgba(244, 63, 94, 0.55);
            overflow-wrap: anywhere;
        }

        .ai-generate-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            width: 100%;
            padding: 11px;
            border-radius: 12px;
            background: linear-gradient(90deg, #ec4899, #a855f7 50%, #22d3ee);
            color: #ffffff;
            font-size: 11px;
            font-weight: 900;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            box-shadow: 0 0 18px rgba(236, 72, 153, 0.35);
            cursor: pointer;
            transition: transform 0.2s ease, filter 0.2s ease;
        }

        .ai-generate-btn:hover:not(:disabled) {
            transform: translateY(-1px);
            filter: brightness(1.1);
        }

        .ai-generate-btn:disabled {
            cursor: not-allowed;
            filter: grayscale(0.7) brightness(0.7);
        }

        .ai-cost-pill {
            padding: 3px 10px;
            border-radius: 999px;
            background: rgba(2, 6, 23, 0.45);
            font-size: 10.5px;
            color: #fde68a;
        }

        .ai-job {
            padding: 11px;
            border-radius: 14px;
            background: rgba(2, 6, 23, 0.55);
            border: 1px solid rgba(0, 240, 255, 0.3);
        }

        .ai-job-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
        }

        .ai-job-title {
            font-size: 11px;
            font-weight: 800;
            color: #e2e8f0;
        }

        .ai-job-title i {
            color: #67e8f9;
            margin-right: 4px;
        }

        .ai-status-chip {
            padding: 2px 8px;
            border-radius: 999px;
            font-size: 8px;
            font-weight: 800;
            text-transform: uppercase;
            white-space: nowrap;
            border: 1px solid currentColor;
        }

        .ai-status-submitting,
        .ai-status-pending,
        .ai-status-processing {
            color: #67e8f9;
            background: rgba(8, 145, 178, 0.15);
        }

        .ai-status-completed {
            color: #6ee7b7;
            background: rgba(5, 150, 105, 0.15);
        }

        .ai-status-failed,
        .ai-status-expired {
            color: #fda4af;
            background: rgba(225, 29, 72, 0.15);
        }

        .ai-progress {
            position: relative;
            height: 3px;
            margin-top: 9px;
            overflow: hidden;
            border-radius: 3px;
            background: rgba(148, 163, 184, 0.2);
        }

        .ai-progress span {
            position: absolute;
            inset: 0 auto 0 0;
            width: 40%;
            border-radius: 3px;
            background: linear-gradient(90deg, #22d3ee, #ec4899);
            animation: ai-progress 1.4s ease-in-out infinite;
        }

        .ai-job-message {
            margin-top: 7px;
            font-size: 10px;
            color: #cbd5e1;
            overflow-wrap: anywhere;
        }

        .ai-result:not(:empty) {
            display: flex;
            flex-direction: column;
            gap: 8px;
            margin-top: 9px;
        }

        .ai-result-item {
            display: flex;
            flex-direction: column;
            gap: 5px;
        }

        .ai-result img,
        .ai-result video {
            width: 100%;
            max-height: 320px;
            object-fit: contain;
            border-radius: 10px;
            background: #000;
            border: 1px solid rgba(0, 240, 255, 0.25);
        }

        .ai-result audio {
            width: 100%;
        }

        .ai-result-link {
            align-self: flex-end;
            font-size: 9px;
            font-weight: 800;
            text-transform: uppercase;
            color: #67e8f9;
        }

        .ai-result-link:hover {
            text-decoration: underline;
        }

        .ai-history {
            padding-top: 14px;
            border-top: 1px solid rgba(0, 240, 255, 0.2);
        }

        .ai-history-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 10px;
            font-size: 11.5px;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: #a5f3fc;
        }

        .ai-history-empty {
            font-size: 11.5px;
            line-height: 1.5;
            color: #64748b;
            text-align: center;
            padding: 12px 0;
        }

        /* Compact, self-scrolling list: about three entries tall so the panel stays clear of the video track. */
        .ai-history-list {
            display: flex;
            flex-direction: column;
            gap: 7px;
            list-style: none;
            max-height: 162px;
            overflow-y: auto;
            overscroll-behavior: contain;
            padding-right: 2px;
        }

        .ai-history-list::-webkit-scrollbar {
            width: 3px;
        }

        .ai-history-list::-webkit-scrollbar-thumb {
            background: rgba(0, 240, 255, 0.35);
            border-radius: 3px;
        }

        .ai-history-item {
            display: grid;
            grid-template-columns: 28px minmax(0, 1fr) auto;
            align-items: center;
            gap: 10px;
            padding: 7px 9px;
            border-radius: 10px;
            background: rgba(15, 23, 42, 0.55);
            border: 1px solid rgba(148, 163, 184, 0.15);
        }

        .ai-history-icon {
            width: 28px;
            height: 28px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(0, 240, 255, 0.12);
            color: #67e8f9;
            font-size: 13px;
        }

        .ai-history-main {
            min-width: 0;
        }

        .ai-history-title {
            display: flex;
            align-items: center;
            gap: 7px;
            font-size: 11.5px;
            font-weight: 800;
            line-height: 1.3;
            color: #e2e8f0;
        }

        .ai-history-meta {
            display: block;
            margin-top: 3px;
            font-size: 10.5px;
            color: #94a3b8;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .ai-history-view {
            padding: 5px 10px;
            border-radius: 8px;
            font-size: 10.5px;
            font-weight: 800;
            text-transform: uppercase;
            color: #67e8f9;
            border: 1px solid rgba(0, 240, 255, 0.4);
            cursor: pointer;
        }

        .ai-history-view:hover {
            background: rgba(0, 240, 255, 0.15);
        }

        .ai-modal-icon {
            width: 56px;
            height: 56px;
            margin: 0 auto;
            border-radius: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            color: #fcd34d;
            background: rgba(251, 191, 36, 0.15);
            border: 1px solid rgba(251, 191, 36, 0.5);
            box-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
        }

        .ai-credits-summary {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 6px;
            margin-top: 14px;
        }

        .ai-credits-summary div {
            padding: 8px 4px;
            border-radius: 10px;
            background: rgba(15, 23, 42, 0.75);
            border: 1px solid rgba(148, 163, 184, 0.2);
        }

        .ai-credits-summary span {
            display: block;
            font-size: 8px;
            font-weight: 700;
            text-transform: uppercase;
            color: #94a3b8;
        }

        .ai-credits-summary strong {
            display: block;
            margin-top: 2px;
            font-family: 'Space Grotesk', sans-serif;
            font-size: 18px;
            color: #ffffff;
        }

        .ai-toast {
            position: fixed;
            left: 50%;
            bottom: 24px;
            z-index: 60;
            max-width: min(420px, calc(100vw - 32px));
            transform: translateX(-50%);
            padding: 10px 14px;
            border-radius: 12px;
            font-size: 11px;
            font-weight: 700;
            color: #f8fafc;
            background: rgba(8, 16, 32, 0.92);
            border: 1px solid rgba(0, 240, 255, 0.45);
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
        }

        .ai-toast.ai-toast-error {
            border-color: rgba(244, 63, 94, 0.7);
        }

        .ai-toast.ai-toast-success {
            border-color: rgba(16, 185, 129, 0.7);
        }

        @keyframes ai-progress {
            0% { transform: translateX(-100%); }
            100% { transform: translateX(260%); }
        }

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

        .ai-unit-price {
            font-size: 9.5px;
            font-weight: 700;
            color: #94a3b8;
            white-space: nowrap;
        }

        .ai-mode-tab.active .ai-unit-price {
            color: #e2e8f0;
        }

        .ai-rate-note {
            font-size: 10.5px;
            line-height: 1.5;
            color: #94a3b8;
            text-align: center;
        }

        .ai-rate-note i {
            color: #fcd34d;
        }

        /* Credit rates: collapsed to one line; hover, keyboard focus or a click (pin) expands it smoothly. */
        .ai-pricing {
            border-radius: 14px;
            border: 1px solid rgba(251, 191, 36, 0.35);
            background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(168, 85, 247, 0.1));
            transition: border-color 0.25s ease, box-shadow 0.25s ease;
        }

        .ai-pricing-summary {
            width: 100%;
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 5px 9px;
            padding: 10px 14px;
            border-radius: 14px;
            background: none;
            text-align: left;
            cursor: pointer;
        }

        .ai-pricing-summary:focus-visible {
            outline: 1px solid rgba(251, 191, 36, 0.8);
            outline-offset: -1px;
        }

        .ai-pricing-icon {
            font-size: 11.5px;
            color: #fcd34d;
        }

        .ai-pricing-heading {
            flex: 1;
            font-size: 10.5px;
            font-weight: 800;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            color: #fde68a;
        }

        /* Second line under the heading, indented to the heading text (icon width + gap). */
        .ai-pricing-chips {
            order: 3;
            flex: 1 0 100%;
            min-width: 0;
            padding-left: 22px;
            text-align: left;
            font-size: 11px;
            letter-spacing: 0.02em;
            font-weight: 700;
            color: #cbd5e1;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .ai-pricing-chevron {
            font-size: 10.5px;
            color: #fcd34d;
            transition: transform 0.3s ease;
        }

        .ai-pricing-body {
            display: grid;
            grid-template-rows: 0fr;
            transition: grid-template-rows 0.35s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .ai-pricing-inner {
            min-height: 0;
            overflow: hidden;
        }

        /* The short open delay stops the section from flickering open when the pointer only passes over it. */
        .ai-pricing:not(.is-suppressed):hover .ai-pricing-body,
        .ai-pricing:has(:focus-visible) .ai-pricing-body,
        .ai-pricing.is-pinned .ai-pricing-body {
            grid-template-rows: 1fr;
            transition-delay: 0.12s;
        }

        .ai-pricing:not(.is-suppressed):hover,
        .ai-pricing:has(:focus-visible),
        .ai-pricing.is-pinned {
            border-color: rgba(251, 191, 36, 0.65);
            box-shadow: 0 0 16px rgba(251, 191, 36, 0.18);
        }

        .ai-pricing:not(.is-suppressed):hover .ai-pricing-chevron,
        .ai-pricing:has(:focus-visible) .ai-pricing-chevron,
        .ai-pricing.is-pinned .ai-pricing-chevron {
            transform: rotate(180deg);
        }

        .ai-pricing-list {
            list-style: none;
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 8px;
            padding: 4px 14px 12px;
        }

        .ai-pricing-list li {
            display: grid;
            grid-template-columns: 18px minmax(0, 1fr) auto;
            align-items: center;
            column-gap: 8px;
            row-gap: 3px;
            padding: 8px 10px;
            border-radius: 10px;
            background: rgba(15, 23, 42, 0.6);
            border: 1px solid rgba(148, 163, 184, 0.18);
            transition: border-color 0.2s ease, background 0.2s ease;
        }

        .ai-pricing-list li.is-active {
            background: linear-gradient(135deg, rgba(0, 240, 255, 0.14), rgba(255, 0, 127, 0.18));
            border-color: rgba(244, 114, 182, 0.7);
        }

        .ai-pricing-list i {
            grid-row: span 2;
            font-size: 12.5px;
            color: #67e8f9;
        }

        .ai-pricing-name {
            font-size: 10.5px;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: #e2e8f0;
        }

        .ai-pricing-list strong {
            font-size: 11.5px;
            font-weight: 800;
            color: #fcd34d;
            white-space: nowrap;
        }

        .ai-pricing-list em {
            grid-column: 2 / 4;
            font-size: 10px;
            font-style: normal;
            line-height: 1.35;
            color: #94a3b8;
        }

        .ai-pricing-extra {
            padding: 0 14px 8px;
            font-size: 10px;
            font-weight: 700;
            line-height: 1.45;
            text-align: center;
            color: #c4b5fd;
        }

        .ai-pricing .ai-rate-note {
            margin: 0;
            padding: 0 14px 12px;
        }

        /* Tablets: leave room for the 370px settings sidebar on the right. */
        @media (min-width: 640px) and (max-width: 1023px) {
            .ai-panel {
                width: max(300px, min(400px, calc(100vw - 430px)));
            }
        }

        @media (max-width: 360px) {
            .ai-mode-tabs {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }
        }

        @media (max-width: 639px) {
            /* Right inset keeps the panel clear of the 3D Studio / Video Editor tabs (8px + 44px + 6px lift + gap). */
            .ai-panel {
                left: 12px;
                right: 66px;
                width: auto;
            }
        }

        /* ---------- Workspace chrome: status ticker, headline, account bar, live feed ---------- */
        /* Same reason as the AI studio rule: these display rules would otherwise beat Tailwind's .hidden. */
        [class*="ve-"].hidden,
        [class*="guide"].hidden,
        [class*="account-"].hidden {
            display: none !important;
        }

        @keyframes crystal-marquee {
            from { transform: translateX(0); }
            to { transform: translateX(-50%); }
        }

        @keyframes crystal-pulse {
            0%, 100% { opacity: 1; transform: scale(1); }
            50% { opacity: 0.45; transform: scale(0.75); }
        }

        @keyframes synthesis-shimmer {
            from { background-position: 0% 50%; }
            to { background-position: 200% 50%; }
        }

        .live-feed-bar {
            position: fixed;
            left: 0;
            right: 0;
            bottom: 0;
            height: var(--feed-bar-height);
            z-index: 20;
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 0 14px;
            background: linear-gradient(90deg, rgba(20, 6, 32, 0.62), rgba(6, 12, 26, 0.55) 35%, rgba(6, 12, 26, 0.55) 65%, rgba(8, 18, 36, 0.62));
            backdrop-filter: blur(12px) saturate(170%);
            -webkit-backdrop-filter: blur(12px) saturate(170%);
            border-top: 1px solid rgba(0, 240, 255, 0.2);
            box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
        }

        .live-feed-label {
            flex-shrink: 0;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 3px 10px;
            border-radius: 999px;
            font-family: 'Space Grotesk', sans-serif;
            font-size: 10px;
            font-weight: 700;
            letter-spacing: 0.16em;
            line-height: 1.1;
            color: #f0abfc;
            background: rgba(192, 38, 211, 0.16);
            border: 1px solid rgba(217, 70, 239, 0.55);
            box-shadow: 0 0 12px rgba(217, 70, 239, 0.3);
        }

        .live-feed-pulse {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: #e879f9;
            box-shadow: 0 0 8px #e879f9;
            animation: crystal-pulse 1.6s ease-in-out infinite;
        }

        .live-feed-window {
            flex: 1;
            min-width: 0;
            overflow: hidden;
            -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 4%, #000 96%, transparent 100%);
            mask-image: linear-gradient(90deg, transparent 0, #000 4%, #000 96%, transparent 100%);
        }

        .live-feed-track,
        .status-ticker-track {
            display: inline-flex;
            align-items: center;
            white-space: nowrap;
            will-change: transform;
            animation: crystal-marquee var(--marquee-duration, 60s) linear infinite;
        }

        .live-feed-window:hover .live-feed-track {
            animation-play-state: paused;
        }

        .live-feed-item {
            display: inline-flex;
            align-items: center;
            gap: 7px;
            padding-right: 34px;
            font-size: 11.5px;
            font-weight: 600;
            color: #cbd5e1;
        }

        .live-feed-item::before {
            content: '';
            width: 5px;
            height: 5px;
            border-radius: 50%;
            background: var(--feed-dot, #22d3ee);
            box-shadow: 0 0 8px var(--feed-dot, #22d3ee);
        }

        .live-feed-item b {
            font-weight: 800;
            color: #f8fafc;
        }

        .live-feed-item time {
            font-size: 10.5px;
            color: #64748b;
        }

        .live-feed-brand {
            flex-shrink: 0;
            margin-left: auto;
            padding-left: 14px;
            border-left: 1px solid rgba(0, 240, 255, 0.2);
            font-family: 'Space Grotesk', sans-serif;
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 0.12em;
            color: rgba(165, 243, 252, 0.9);
            text-shadow: 0 0 10px rgba(0, 240, 255, 0.45);
            white-space: nowrap;
        }

        /* Top-centre column between the brand card (~367px incl. gap) and the account bar (~570px with the full
           guides label and a long name). Ticker width, headline width and headline type all derive from it. */
        :root {
            --center-w: min(580px, calc(100vw - 1180px));
        }

        @media (max-width: 1799px) {
            :root {
                --center-w: min(580px, calc(100vw - 860px));
            }
        }

        .status-ticker {
            position: fixed;
            top: 16px;
            left: 50%;
            z-index: 20;
            width: var(--center-w);
            height: 38px;
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 0 16px 0 6px;
            transform: translateX(-50%);
            border-radius: 999px;
            background: rgba(2, 6, 18, 0.45);
            backdrop-filter: blur(14px) saturate(180%);
            -webkit-backdrop-filter: blur(14px) saturate(180%);
            border: 1px solid rgba(0, 240, 255, 0.3);
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(0, 240, 255, 0.08);
        }

        .status-ticker-live {
            flex-shrink: 0;
            display: inline-flex;
            align-items: center;
            gap: 7px;
            padding: 5px 11px;
            border-radius: 999px;
            font-size: 10.5px;
            font-weight: 800;
            letter-spacing: 0.16em;
            line-height: 1;
            color: #6ee7b7;
            background: rgba(6, 78, 59, 0.45);
            border: 1px solid rgba(16, 185, 129, 0.5);
        }

        .status-ticker-dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: #34d399;
            box-shadow: 0 0 8px #34d399;
            animation: crystal-pulse 1.4s ease-in-out infinite;
        }

        .status-ticker-window {
            flex: 1;
            min-width: 0;
            overflow: hidden;
            -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 6%, #000 94%, transparent 100%);
            mask-image: linear-gradient(90deg, transparent 0, #000 6%, #000 94%, transparent 100%);
        }

        .status-ticker-item {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding-right: 42px;
            font-size: 13px;
            font-weight: 600;
            line-height: 1.4;
            color: #e2e8f0;
        }

        .status-ticker-item i {
            font-size: 12px;
            color: var(--ticker-accent, #22d3ee);
            filter: drop-shadow(0 0 4px var(--ticker-accent, #22d3ee));
        }

        .status-ticker-item b {
            font-weight: 800;
            color: var(--ticker-accent, #22d3ee);
        }

        .synthesis-headline {
            position: fixed;
            top: 68px;
            left: 50%;
            z-index: 20;
            max-width: var(--center-w);
            transform: translateX(-50%);
            text-align: center;
            pointer-events: none;
        }

        .synthesis-title {
            font-family: 'Space Grotesk', sans-serif;
            /* The line is ~15.7em wide; dividing by 17.5 keeps it on one line inside the column. */
            font-size: clamp(19px, calc(var(--center-w) / 17.5), 32px);
            font-weight: 700;
            line-height: 1.2;
            letter-spacing: 0.035em;
            white-space: nowrap;
            background: linear-gradient(100deg, #fde68a 0%, #fbbf24 16%, #f472b6 38%, #c084fc 58%, #22d3ee 80%, #fde68a 100%);
            background-size: 200% auto;
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            filter: drop-shadow(0 0 14px rgba(244, 114, 182, 0.28)) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
            animation: synthesis-shimmer 10s linear infinite;
        }

        .synthesis-sub {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            margin-top: 8px;
            font-size: clamp(9px, calc(var(--center-w) / 40), 13px);
            font-weight: 800;
            line-height: 1.4;
            letter-spacing: 0.22em;
            text-transform: uppercase;
            color: rgba(226, 232, 240, 0.82);
            text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
            white-space: nowrap;
        }

        .synthesis-sub::before,
        .synthesis-sub::after {
            content: '';
            width: 26px;
            height: 1px;
            background: linear-gradient(90deg, transparent, rgba(251, 191, 36, 0.8));
        }

        .synthesis-sub::after {
            transform: scaleX(-1);
        }

        .synthesis-sub i {
            font-style: normal;
            color: #fbbf24;
            letter-spacing: 0;
            text-shadow: 0 0 8px rgba(251, 191, 36, 0.8);
        }

        /* ALVIN AI brand mark and the external ALVIN AI Generator links (ai.alvinailab.com). */
        .alvin-ai-mark {
            font-weight: 900;
            letter-spacing: 0.14em;
            background: linear-gradient(90deg, #fde68a, #fbbf24 45%, #f472b6);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.45));
        }

        .synthesis-cta {
            pointer-events: auto;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            margin-top: 10px;
            padding: 4px 14px 4px 4px;
            border-radius: 999px;
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 0.16em;
            line-height: 1.4;
            text-transform: uppercase;
            text-decoration: none;
            color: #f8fafc;
            background: rgba(8, 8, 12, 0.62);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border: 1px solid rgba(251, 191, 36, 0.5);
            box-shadow: 0 0 18px rgba(251, 191, 36, 0.16), 0 6px 18px rgba(0, 0, 0, 0.45);
            transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
        }

        .synthesis-cta:hover,
        .synthesis-cta:focus-visible {
            border-color: #fbbf24;
            box-shadow: 0 0 26px rgba(251, 191, 36, 0.32), 0 6px 18px rgba(0, 0, 0, 0.45);
            transform: translateY(-1px);
        }

        .synthesis-cta:focus-visible,
        .brand-ai-link:focus-visible {
            outline: 2px solid #fbbf24;
            outline-offset: 2px;
        }

        .synthesis-cta-mark {
            padding: 3px 10px;
            border-radius: 999px;
            font-weight: 900;
            letter-spacing: 0.14em;
            color: #0b0b0f;
            background: linear-gradient(90deg, #fde68a, #fbbf24 45%, #f472b6);
        }

        .synthesis-cta i {
            font-size: 9px;
            color: #fbbf24;
        }

        /* The headline (and its CTA) is hidden below 1200px, so the brand card carries the link there. */
        .brand-ai-link {
            display: none;
            flex-shrink: 0;
            align-items: center;
            gap: 5px;
            margin-left: auto;
            padding: 6px 8px;
            border-radius: 10px;
            font-size: 11px;
            color: #fde68a;
            background: rgba(251, 191, 36, 0.12);
            border: 1px solid rgba(251, 191, 36, 0.45);
            transition: background 0.2s ease;
        }

        .brand-ai-link i + i {
            font-size: 8px;
        }

        .brand-ai-link:hover {
            background: rgba(251, 191, 36, 0.24);
        }

        @media (max-width: 1199px) {
            .brand-ai-link {
                display: inline-flex;
            }
        }

        .top-right-cluster {
            position: fixed;
            top: 16px;
            right: 20px;
            z-index: 30;
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            gap: 10px;
            transition: opacity 0.3s ease, visibility 0.3s;
        }

        .account-bar {
            display: flex;
            align-items: center;
            gap: 14px;
            padding: 7px 10px 7px 8px;
            border-radius: 18px;
        }

        .guides-menu {
            position: relative;
        }

        .guides-menu-btn {
            display: inline-flex;
            align-items: center;
            gap: 9px;
            height: 36px;
            padding: 0 14px;
            border-radius: 12px;
            font-size: 12.5px;
            font-weight: 700;
            color: #e0f2fe;
            background: rgba(2, 6, 23, 0.55);
            border: 1px solid rgba(0, 240, 255, 0.3);
            cursor: pointer;
            transition: border-color 0.2s ease, box-shadow 0.2s ease;
        }

        .guides-menu-btn > i:first-child {
            color: #fcd34d;
        }

        .guides-menu-btn:hover,
        .guides-menu-btn[aria-expanded="true"],
        .guides-menu-btn:focus-visible {
            border-color: rgba(0, 240, 255, 0.7);
            box-shadow: 0 0 14px rgba(0, 240, 255, 0.3);
            outline: none;
        }

        .guides-menu-chevron {
            font-size: 9.5px;
            color: #67e8f9;
            transition: transform 0.25s ease;
        }

        .guides-menu-btn[aria-expanded="true"] .guides-menu-chevron {
            transform: rotate(180deg);
        }

        .guides-menu-list {
            position: absolute;
            top: calc(100% + 8px);
            left: 0;
            min-width: 270px;
            display: flex;
            flex-direction: column;
            gap: 4px;
            padding: 8px;
            border-radius: 16px;
            background: rgba(6, 12, 26, 0.92);
            backdrop-filter: blur(16px) saturate(180%);
            -webkit-backdrop-filter: blur(16px) saturate(180%);
            border: 1px solid rgba(0, 240, 255, 0.35);
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 18px rgba(0, 240, 255, 0.15);
        }

        .guides-menu-list button {
            display: flex;
            align-items: center;
            gap: 11px;
            width: 100%;
            padding: 10px 12px;
            border-radius: 10px;
            font-size: 12.5px;
            font-weight: 600;
            line-height: 1.35;
            text-align: left;
            color: #e2e8f0;
            cursor: pointer;
            transition: background 0.15s ease, color 0.15s ease;
        }

        .guides-menu-list button i {
            width: 14px;
            text-align: center;
            color: #67e8f9;
        }

        .guides-menu-list button:hover,
        .guides-menu-list button:focus-visible {
            background: rgba(0, 240, 255, 0.12);
            color: #ffffff;
            outline: none;
        }

        .account-divider {
            width: 1px;
            height: 32px;
            background: linear-gradient(180deg, transparent, rgba(0, 240, 255, 0.45), transparent);
        }

        .account-identity {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 2px;
            max-width: 190px;
            padding: 4px 8px;
            border-radius: 10px;
            line-height: 1.3;
            text-align: left;
            cursor: pointer;
            transition: background 0.2s ease;
        }

        .account-identity:hover,
        .account-identity:focus-visible {
            background: rgba(0, 240, 255, 0.1);
            outline: none;
        }

        .account-role {
            font-size: 10px;
            font-weight: 800;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: #67e8f9;
        }

        .account-identity.is-admin .account-role {
            color: #fcd34d;
        }

        .account-name {
            max-width: 100%;
            font-size: 13.5px;
            font-weight: 700;
            color: #f8fafc;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .account-guest .account-name {
            background: linear-gradient(90deg, #22d3ee, #c084fc);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }

        .account-providers {
            display: flex;
            gap: 9px;
        }

        .account-provider {
            position: relative;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 15px;
            cursor: pointer;
            transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
        }

        .account-provider-google {
            color: #fca5a5;
            background: rgba(127, 29, 29, 0.5);
            border: 1px solid rgba(239, 68, 68, 0.6);
            box-shadow: 0 0 10px rgba(239, 68, 68, 0.25);
        }

        .account-provider-github {
            color: #e2e8f0;
            background: rgba(51, 65, 85, 0.6);
            border: 1px solid rgba(148, 163, 184, 0.55);
            box-shadow: 0 0 10px rgba(255, 255, 255, 0.12);
        }

        .account-provider[data-action]:hover,
        .account-provider[data-action]:focus-visible {
            transform: scale(1.1);
            box-shadow: 0 0 16px rgba(0, 240, 255, 0.45);
            outline: none;
        }

        /* Signed in: the provider used for this account is marked; the other one is dimmed. */
        .account-provider.is-linked::after {
            content: '';
            position: absolute;
            right: -1px;
            bottom: -1px;
            width: 9px;
            height: 9px;
            border-radius: 50%;
            background: #34d399;
            border: 2px solid #02040a;
            box-shadow: 0 0 6px #34d399;
        }

        .account-provider.is-unlinked {
            opacity: 0.4;
            cursor: default;
        }

        .account-provider.is-linked {
            cursor: default;
        }

        .dashboard-nav {
            display: flex;
            gap: 10px;
        }

        .dashboard-nav a {
            padding: 9px 16px;
            font-size: 12px;
            letter-spacing: 0.06em;
            line-height: 1.2;
        }

        body.right-panel-open .top-right-cluster {
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
        }

        .guide-modal {
            position: fixed;
            inset: 0;
            z-index: 55;
            align-items: center;
            justify-content: center;
            padding: 16px;
            background: rgba(0, 0, 0, 0.78);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
        }

        .guide-modal:not(.hidden) {
            display: flex;
        }

        .guide-modal-card {
            width: 100%;
            max-width: 520px;
            padding: 24px;
        }

        .guide-modal-close {
            position: absolute;
            top: 14px;
            right: 18px;
            font-size: 24px;
            font-weight: 700;
            color: #f43f5e;
            cursor: pointer;
            transition: transform 0.2s ease;
        }

        .guide-modal-close:hover {
            transform: scale(1.2);
        }

        .guide-modal-kicker {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 3px 10px;
            border-radius: 999px;
            font-size: 9px;
            font-weight: 800;
            letter-spacing: 0.14em;
            text-transform: uppercase;
            color: #67e8f9;
            background: rgba(8, 51, 68, 0.7);
            border: 1px solid rgba(0, 240, 255, 0.4);
        }

        .guide-modal-title {
            margin-top: 10px;
            padding-right: 24px;
            font-family: 'Space Grotesk', sans-serif;
            font-size: 20px;
            font-weight: 700;
            background: linear-gradient(90deg, #a5f3fc, #ffffff, #c084fc);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }

        .guide-modal-body {
            margin-top: 12px;
            max-height: min(60vh, 460px);
            overflow-y: auto;
            padding-right: 4px;
            font-size: 12px;
            line-height: 1.6;
            color: #cbd5e1;
            user-select: text;
        }

        .guide-modal-body h4 {
            margin: 12px 0 4px;
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: #fcd34d;
        }

        .guide-modal-body ol,
        .guide-modal-body ul {
            padding-left: 18px;
        }

        .guide-modal-body ol {
            list-style: decimal;
        }

        .guide-modal-body ul {
            list-style: disc;
        }

        .guide-modal-body li + li {
            margin-top: 4px;
        }

        .guide-modal-body strong {
            color: #f8fafc;
        }

        .guide-modal-body a {
            color: #67e8f9;
            text-decoration: underline;
        }

        /* ---------- Right edge tabs: 3D Studio + Video Editor ---------- */
        /* Starts below the account cluster, including the signed-in dashboard links. */
        .edge-tabs {
            position: fixed;
            top: 132px;
            right: 14px;
            z-index: 35;
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            gap: 12px;
            transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
        }

        body.right-panel-open .edge-tabs {
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
            transform: translateX(calc(100% + 14px));
        }

        /* Free-standing pills: fully visible at rest, they lift slightly toward the canvas when approached. */
        .edge-tab {
            --tab-accent: #00f0ff;
            --tab-accent-2: #b026ff;
            position: relative;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 12px;
            width: 54px;
            padding: 16px 0;
            border-radius: 18px;
            border: 1px solid color-mix(in srgb, var(--tab-accent) 55%, transparent);
            background:
                linear-gradient(180deg, color-mix(in srgb, var(--tab-accent) 18%, transparent), color-mix(in srgb, var(--tab-accent-2) 22%, transparent)),
                rgba(6, 12, 26, 0.55);
            backdrop-filter: blur(14px) saturate(180%);
            -webkit-backdrop-filter: blur(14px) saturate(180%);
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 0 14px color-mix(in srgb, var(--tab-accent) 25%, transparent),
                inset 0 1px 0 rgba(255, 255, 255, 0.08);
            cursor: pointer;
            transform: translateX(0);
            transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease, border-color 0.3s ease;
        }

        .edge-tab-video {
            --tab-accent: #ff2d7a;
            --tab-accent-2: #fbbf24;
        }

        /* A light streak sweeps across a tab while it is out. */
        .edge-tab::before {
            content: '';
            position: absolute;
            inset: 0;
            border-radius: inherit;
            background: linear-gradient(160deg, transparent 30%, rgba(255, 255, 255, 0.16) 48%, transparent 66%);
            background-size: 100% 300%;
            background-position: 0 100%;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease, background-position 0.9s ease;
        }

        .edge-tabs.is-near .edge-tab,
        .edge-tab:hover,
        .edge-tab:focus-visible {
            transform: translateX(-6px);
            box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5), 0 0 22px color-mix(in srgb, var(--tab-accent) 45%, transparent),
                inset 0 1px 0 rgba(255, 255, 255, 0.12);
            outline: none;
        }

        .edge-tabs.is-near .edge-tab::before,
        .edge-tab:hover::before {
            opacity: 1;
            background-position: 0 0;
        }

        .edge-tab:hover,
        .edge-tab:focus-visible {
            border-color: var(--tab-accent);
        }

        .edge-tab-glyph {
            width: 28px;
            height: 28px;
            border-radius: 9px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 12.5px;
            color: #ffffff;
            background: linear-gradient(135deg, var(--tab-accent), var(--tab-accent-2));
            box-shadow: 0 0 12px color-mix(in srgb, var(--tab-accent) 60%, transparent);
            opacity: 0.75;
            transition: opacity 0.3s ease, transform 0.3s ease;
        }

        .edge-tabs.is-near .edge-tab-glyph,
        .edge-tab:hover .edge-tab-glyph {
            opacity: 1;
            transform: scale(1.06);
        }

        .edge-tab-label {
            writing-mode: vertical-rl;
            font-family: 'Space Grotesk', sans-serif;
            font-size: 12px;
            font-weight: 700;
            letter-spacing: 0.22em;
            background: linear-gradient(180deg, #ffffff, color-mix(in srgb, var(--tab-accent) 75%, #ffffff));
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }

        .edge-tab-card {
            position: absolute;
            top: 50%;
            right: calc(100% + 14px);
            width: 236px;
            display: flex;
            flex-direction: column;
            gap: 7px;
            padding: 14px 16px;
            border-radius: 14px;
            text-align: left;
            background:
                linear-gradient(135deg, color-mix(in srgb, var(--tab-accent) 16%, transparent), color-mix(in srgb, var(--tab-accent-2) 14%, transparent)),
                rgba(6, 12, 26, 0.88);
            backdrop-filter: blur(16px) saturate(180%);
            -webkit-backdrop-filter: blur(16px) saturate(180%);
            border: 1px solid color-mix(in srgb, var(--tab-accent) 60%, transparent);
            box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55), 0 0 20px color-mix(in srgb, var(--tab-accent) 30%, transparent);
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
            transform: translate(10px, -50%);
            transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
        }

        .edge-tab:hover .edge-tab-card,
        .edge-tab:focus-visible .edge-tab-card {
            opacity: 1;
            visibility: visible;
            transform: translate(0, -50%);
        }

        .edge-tab-card-title {
            display: flex;
            align-items: center;
            gap: 7px;
            font-family: 'Space Grotesk', sans-serif;
            font-size: 14px;
            font-weight: 700;
            color: #ffffff;
        }

        .edge-tab-card-title i {
            color: var(--tab-accent);
            filter: drop-shadow(0 0 6px var(--tab-accent));
        }

        .edge-tab-card-text {
            font-size: 11.5px;
            line-height: 1.5;
            color: #cbd5e1;
        }

        .edge-tab-card-version {
            align-self: flex-start;
            padding: 2px 8px;
            border-radius: 999px;
            font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
            font-size: 10px;
            font-weight: 700;
            color: var(--tab-accent);
            border: 1px solid color-mix(in srgb, var(--tab-accent) 55%, transparent);
            background: rgba(2, 6, 16, 0.6);
        }

        /* Same breakpoint as the AI panel's 66px right inset. */
        @media (max-width: 639px) {
            .edge-tabs {
                right: 8px;
            }

            body.right-panel-open .edge-tabs {
                transform: translateX(calc(100% + 8px));
            }

            .edge-tab {
                width: 44px;
                padding: 12px 0;
                gap: 10px;
                border-radius: 15px;
            }

            .edge-tab-glyph {
                width: 24px;
                height: 24px;
                font-size: 11px;
            }

            .edge-tab-label {
                font-size: 10.5px;
            }
        }

        /* ---------- Video Editor panel ---------- */
        .video-editor-panel {
            position: fixed;
            top: var(--right-panel-top);
            right: 20px;
            z-index: 40;
            width: 380px;
            height: var(--right-panel-height);
            height: var(--right-panel-height-dvh);
            display: flex;
            flex-direction: column;
            gap: 10px;
            padding: 16px;
            overflow-y: auto;
            border-radius: 20px;
            background: rgba(6, 12, 24, 0.5);
            backdrop-filter: blur(12px) saturate(180%);
            -webkit-backdrop-filter: blur(12px) saturate(180%);
            border: 1.5px solid rgba(255, 45, 122, 0.4);
            box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(255, 45, 122, 0.08);
            transform: translateX(calc(100% + 40px));
            visibility: hidden;
            transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0.4s;
        }

        .video-editor-panel.ve-open {
            transform: translateX(0);
            visibility: visible;
            transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s;
        }

        .video-editor-panel::-webkit-scrollbar {
            width: 4px;
        }

        .video-editor-panel::-webkit-scrollbar-thumb {
            background: rgba(255, 45, 122, 0.45);
            border-radius: 4px;
        }

        .video-editor-panel input[type=text] {
            user-select: text;
        }

        .ve-head {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 8px;
            padding-bottom: 8px;
            border-bottom: 1px solid rgba(255, 45, 122, 0.3);
        }

        .ve-head-title {
            display: flex;
            flex-direction: column;
            gap: 5px;
        }

        .ve-title {
            display: flex;
            align-items: center;
            gap: 8px;
            font-family: 'Space Grotesk', sans-serif;
            font-size: 12px;
            font-weight: 700;
            letter-spacing: 0.08em;
            background: linear-gradient(90deg, #fb7185, #fbbf24);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }

        .ve-title i {
            -webkit-text-fill-color: #fb7185;
        }

        .ve-badges {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 6px;
        }

        .ve-free {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            padding: 2px 8px;
            border-radius: 999px;
            font-size: 9px;
            font-weight: 800;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: #6ee7b7;
            background: rgba(6, 78, 59, 0.45);
            border: 1px solid rgba(52, 211, 153, 0.45);
        }

        /* 4K studio export buttons while the payment gateway lock is on (exporter4k.js). */
        #export4KPngBtn.export-locked,
        #exportWebmBtn.export-locked {
            opacity: 0.55;
            filter: grayscale(0.6);
            cursor: not-allowed;
        }

        #export4KPngBtn.export-locked::after,
        #exportWebmBtn.export-locked::after {
            content: '\f023';
            font-family: 'Font Awesome 6 Free';
            font-weight: 900;
            font-size: 8px;
        }

        .ve-version {
            align-self: flex-start;
            padding: 2px 8px;
            border-radius: 999px;
            font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
            font-size: 9px;
            font-weight: 700;
            color: #fda4af;
            background: rgba(76, 5, 25, 0.7);
            border: 1px solid rgba(244, 63, 94, 0.45);
        }

        .ve-monitor {
            position: relative;
            flex-shrink: 0;
            aspect-ratio: 16 / 9;
            border-radius: 12px;
            overflow: hidden;
            background: #02040a;
            border: 1px solid rgba(0, 240, 255, 0.35);
            box-shadow: 0 0 18px rgba(0, 240, 255, 0.15), inset 0 0 18px rgba(176, 38, 255, 0.15);
        }

        .ve-monitor canvas {
            display: block;
            width: 100%;
            height: 100%;
        }

        .ve-monitor-empty {
            position: absolute;
            inset: 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 8px;
            padding: 16px;
            text-align: center;
            font-size: 10px;
            font-weight: 600;
            color: #94a3b8;
            background: radial-gradient(circle at 50% 45%, rgba(0, 240, 255, 0.1), transparent 65%);
        }

        .ve-monitor-empty i {
            font-size: 20px;
            color: #67e8f9;
            filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.6));
        }

        .ve-monitor-badge {
            position: absolute;
            top: 7px;
            right: 7px;
            padding: 2px 7px;
            border-radius: 999px;
            font-size: 7.5px;
            font-weight: 800;
            letter-spacing: 0.1em;
            color: #fcd34d;
            background: rgba(2, 6, 16, 0.7);
            border: 1px solid rgba(251, 191, 36, 0.5);
        }

        .ve-transport {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .ve-icon-btn {
            width: 30px;
            height: 30px;
            border-radius: 10px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 11px;
            color: #cbd5e1;
            background: rgba(15, 23, 42, 0.6);
            border: 1px solid rgba(148, 163, 184, 0.3);
            cursor: pointer;
            transition: color 0.2s ease, border-color 0.2s ease;
        }

        .ve-icon-btn:hover {
            color: #22d3ee;
            border-color: rgba(34, 211, 238, 0.6);
        }

        .ve-play-btn {
            width: 38px;
            height: 38px;
            border-radius: 50%;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 13px;
            color: #0f172a;
            background: linear-gradient(135deg, #fb7185, #fbbf24);
            box-shadow: 0 0 16px rgba(251, 113, 133, 0.45);
            cursor: pointer;
            transition: transform 0.2s ease, box-shadow 0.2s ease;
        }

        .ve-play-btn:hover {
            transform: scale(1.06);
            box-shadow: 0 0 22px rgba(251, 113, 133, 0.65);
        }

        .ve-play-btn:disabled,
        .ve-icon-btn:disabled {
            opacity: 0.45;
            cursor: not-allowed;
            transform: none;
        }

        .ve-timecode {
            margin-left: auto;
            font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
            font-size: 11px;
            font-weight: 700;
            color: #e2e8f0;
        }

        .ve-timecode em {
            margin: 0 4px;
            font-style: normal;
            color: #64748b;
        }

        .ve-section {
            display: flex;
            flex-direction: column;
            gap: 8px;
            padding: 10px;
            border-radius: 12px;
            background: rgba(10, 20, 40, 0.35);
            border: 1px solid rgba(0, 240, 255, 0.18);
        }

        .ve-section-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            font-size: 9.5px;
            font-weight: 800;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: #a5f3fc;
        }

        .ve-section-head i {
            margin-right: 3px;
            color: #f472b6;
        }

        .ve-section-meta {
            font-size: 8.5px;
            font-weight: 700;
            color: #64748b;
        }

        .ve-timeline {
            position: relative;
            height: 56px;
            border-radius: 10px;
            overflow: hidden;
            cursor: pointer;
            background:
                repeating-linear-gradient(90deg, rgba(148, 163, 184, 0.12) 0 1px, transparent 1px 10%),
                rgba(2, 6, 16, 0.65);
            border: 1px solid rgba(148, 163, 184, 0.2);
        }

        .ve-timeline-track {
            position: absolute;
            inset: 7px 0;
            display: flex;
        }

        .ve-timeline-track:empty::before {
            content: 'Your timeline is empty';
            margin: auto;
            font-size: 9px;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: #475569;
        }

        .ve-tl-clip {
            --clip-accent: #00f0ff;
            position: relative;
            min-width: 0;
            height: 100%;
            margin: 0 1px;
            padding: 4px 6px;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            border-radius: 7px;
            overflow: hidden;
            text-align: left;
            background: linear-gradient(135deg, color-mix(in srgb, var(--clip-accent) 45%, #02040a), color-mix(in srgb, var(--clip-accent) 15%, #02040a));
            border: 1px solid color-mix(in srgb, var(--clip-accent) 70%, transparent);
            cursor: pointer;
            transition: box-shadow 0.2s ease;
        }

        .ve-tl-clip[aria-selected="true"] {
            box-shadow: inset 0 0 0 2px #fde68a, 0 0 12px rgba(253, 230, 138, 0.45);
        }

        .ve-tl-name {
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            font-size: 8.5px;
            font-weight: 800;
            color: #ffffff;
            text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
        }

        .ve-tl-dur {
            font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
            font-size: 8px;
            color: #fde68a;
        }

        .ve-playhead {
            position: absolute;
            top: 0;
            bottom: 0;
            left: 0;
            width: 2px;
            margin-left: -1px;
            background: #fde68a;
            box-shadow: 0 0 8px rgba(253, 230, 138, 0.9);
            pointer-events: none;
            will-change: transform;
        }

        .ve-playhead::before {
            content: '';
            position: absolute;
            top: 0;
            left: -4px;
            border: 5px solid transparent;
            border-top-color: #fde68a;
        }

        .ve-field {
            display: flex;
            flex-direction: column;
            gap: 4px;
            font-size: 9px;
            font-weight: 700;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            color: #94a3b8;
        }

        .ve-field > span {
            display: flex;
            justify-content: space-between;
            gap: 6px;
        }

        .ve-field output {
            font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
            color: #fcd34d;
        }

        .ve-field-inline {
            flex-direction: row;
            align-items: center;
            justify-content: space-between;
        }

        .ve-field-inline input[type="color"] {
            width: 56px;
        }

        .ve-grid-2 {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 8px;
        }

        .ve-inspector-actions {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 6px;
        }

        .ve-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
            padding: 6px 6px;
            border-radius: 9px;
            font-size: 8.5px;
            font-weight: 800;
            text-transform: uppercase;
            color: #e2e8f0;
            background: rgba(15, 23, 42, 0.7);
            border: 1px solid rgba(148, 163, 184, 0.3);
            cursor: pointer;
            transition: border-color 0.2s ease, color 0.2s ease;
        }

        .ve-btn:hover:not(:disabled) {
            color: #67e8f9;
            border-color: rgba(34, 211, 238, 0.6);
        }

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

        .ve-btn-danger {
            color: #fda4af;
            border-color: rgba(244, 63, 94, 0.45);
        }

        .ve-btn-danger:hover:not(:disabled) {
            color: #ffffff;
            border-color: #f43f5e;
        }

        .ve-library {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 6px;
        }

        .ve-lib-item {
            --clip-accent: #00f0ff;
            position: relative;
            display: flex;
            flex-direction: column;
            border-radius: 10px;
            overflow: hidden;
            text-align: left;
            background: #02040a;
            border: 1px solid color-mix(in srgb, var(--clip-accent) 55%, transparent);
            cursor: pointer;
            transition: transform 0.2s ease, box-shadow 0.2s ease;
        }

        .ve-lib-item:hover,
        .ve-lib-item:focus-visible {
            transform: translateY(-1px);
            box-shadow: 0 0 14px color-mix(in srgb, var(--clip-accent) 45%, transparent);
            outline: none;
        }

        .ve-lib-item canvas {
            display: block;
            width: 100%;
            aspect-ratio: 16 / 9;
            background: radial-gradient(circle, color-mix(in srgb, var(--clip-accent) 25%, #02040a), #02040a 70%);
        }

        .ve-lib-item::after {
            content: '+';
            position: absolute;
            top: 4px;
            right: 4px;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            font-weight: 800;
            line-height: 1;
            color: #0f172a;
            background: var(--clip-accent);
            opacity: 0;
            transition: opacity 0.2s ease;
        }

        .ve-lib-item:hover::after,
        .ve-lib-item:focus-visible::after {
            opacity: 1;
        }

        .ve-lib-name {
            padding: 4px 5px;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            font-size: 8px;
            font-weight: 800;
            color: #e2e8f0;
        }

        .ve-import {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            padding: 8px;
            border-radius: 10px;
            border: 1px dashed rgba(0, 240, 255, 0.45);
            font-size: 9.5px;
            font-weight: 800;
            text-transform: uppercase;
            color: #67e8f9;
            cursor: pointer;
            transition: background 0.2s ease;
        }

        .ve-import:hover,
        .ve-import:focus-within {
            background: rgba(0, 240, 255, 0.08);
        }

        .ve-export {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .ve-export-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            width: 100%;
            padding: 10px;
            border-radius: 12px;
            font-size: 11px;
            font-weight: 800;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            color: #0f172a;
            background: linear-gradient(90deg, #fb7185, #fbbf24, #22d3ee);
            box-shadow: 0 0 18px rgba(251, 113, 133, 0.35);
            cursor: pointer;
            transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
        }

        .ve-export-btn:hover:not(:disabled) {
            transform: translateY(-1px);
            box-shadow: 0 0 24px rgba(251, 113, 133, 0.55);
        }

        .ve-export-btn:disabled {
            opacity: 0.45;
            cursor: not-allowed;
        }

        .ve-export-note {
            font-size: 8.5px;
            text-align: center;
            color: #94a3b8;
        }

        /* ---------- Workspace chrome: responsive ---------- */
        /* The full guides label needs ~160px more than the centre column can spare below 1800px. */
        @media (max-width: 1799px) {
            .guides-menu-label {
                display: none;
            }
        }

        @media (max-width: 1439px) {
            .account-identity {
                max-width: 160px;
            }
        }

        /* Below 1200px the centre column is too narrow beside the brand card and account bar. */
        @media (max-width: 1199px) {
            .status-ticker,
            .synthesis-headline {
                display: none;
            }

            .account-identity {
                max-width: 140px;
            }
        }

        /* Small tablets: the bar has ~275px beside the brand card, so it tightens before stacking on phones. */
        @media (max-width: 899px) {
            .top-right-cluster {
                right: 16px;
            }

            .account-bar {
                gap: 10px;
                padding: 6px 8px 6px 6px;
            }

            .guides-menu-btn {
                padding: 0 10px;
            }

            .guides-menu-chevron {
                display: none;
            }

            .account-divider {
                height: 28px;
            }

            .account-identity {
                max-width: 112px;
                padding: 3px 6px;
            }

            .account-name {
                font-size: 12px;
            }

            .account-providers {
                gap: 7px;
            }

            .account-provider {
                width: 32px;
                height: 32px;
                font-size: 14px;
            }

            /* Icon-only dashboard links keep clear of the AI panel and brand card. */
            .dashboard-nav a:not(.hidden) {
                width: 36px;
                height: 32px;
                padding: 0;
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 0;
            }

            .dashboard-nav a::before {
                font-family: 'Font Awesome 6 Free';
                font-weight: 900;
                font-size: 12px;
            }

            #userDashboardLink::before {
                content: '\f625';
            }

            #adminDashboardLink::before {
                content: '\f3ed';
            }
        }

        /* Phones: the brand card leaves ~76px on the right, so the account cluster stacks vertically. */
        @media (max-width: 639px) {
            .top-right-cluster {
                top: 12px;
                right: 8px;
                gap: 6px;
            }

            .account-bar,
            .account-providers,
            .dashboard-nav {
                flex-direction: column;
                gap: 6px;
            }

            .account-bar {
                padding: 4px;
                border-radius: 14px;
            }

            .account-divider,
            .account-identity {
                display: none !important;
            }

            .guides-menu-btn {
                width: 28px;
                height: 28px;
                padding: 0;
                justify-content: center;
            }

            .guides-menu-chevron {
                display: none;
            }

            .guides-menu-list {
                top: 0;
                left: auto;
                right: calc(100% + 10px);
            }

            .account-provider {
                width: 28px;
                height: 28px;
                font-size: 12px;
            }

            .edge-tabs {
                top: 200px;
            }

            .live-feed-bar {
                gap: 8px;
                padding: 0 8px;
            }

            .live-feed-label {
                padding: 1px 7px;
                font-size: 8.5px;
                letter-spacing: 0.12em;
            }

            .live-feed-item {
                font-size: 10px;
            }

            .live-feed-item time {
                font-size: 9px;
            }

            .live-feed-brand {
                padding-left: 8px;
                font-size: 9px;
                letter-spacing: 0.06em;
            }

            .video-editor-panel {
                right: 12px;
                width: calc(100vw - 24px);
            }
        }

        /* Short windows: icon-only tabs so the rail stays clear of the video track. */
        @media (max-height: 640px) {
            .edge-tabs {
                gap: 8px;
            }

            .edge-tab {
                padding: 10px 0;
            }

            .edge-tab-label {
                display: none;
            }
        }

        @media (max-width: 639px) and (max-height: 640px) {
            .edge-tabs {
                top: 132px;
            }
        }

        @media (prefers-reduced-motion: reduce) {
            .live-feed-track,
            .status-ticker-track,
            .synthesis-title,
            .live-feed-pulse,
            .status-ticker-dot {
                animation: none;
            }
        }

        /* ==========================================================================================
           Dark Glass Lucent theme
           Obsidian, low-saturation frosted glass for every UI surface so the 3D scene is the only
           saturated thing on screen. Accents stay on text, icons, active states and badges.
           Kept last so it overrides the surface colours above without touching layout rules.
           ========================================================================================== */
        :root {
            --dg-panel: rgba(6, 6, 8, 0.74);
            --dg-panel-strong: rgba(5, 5, 7, 0.93);
            --dg-chrome: rgba(6, 6, 8, 0.66);
            --dg-fill: rgba(255, 255, 255, 0.03);
            --dg-fill-hover: rgba(255, 255, 255, 0.06);
            --dg-well: rgba(0, 0, 0, 0.45);
            --dg-border: rgba(255, 255, 255, 0.075);
            --dg-border-strong: rgba(255, 255, 255, 0.13);
            --dg-focus: rgba(196, 181, 253, 0.55);
            --dg-blur: blur(22px) saturate(140%);
            --dg-shadow: 0 24px 60px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05);
            --dg-shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.045);
        }

        body,
        html {
            background-color: #000000;
        }

        /* ---- Floating surfaces ---- */
        .glass-card,
        .ai-panel,
        .video-editor-panel,
        .guides-menu-list,
        .edge-tab-card {
            background: var(--dg-panel);
            backdrop-filter: var(--dg-blur);
            -webkit-backdrop-filter: var(--dg-blur);
            border-color: var(--dg-border);
            box-shadow: var(--dg-shadow);
        }

        /* A hairline of each panel's accent along the top edge keeps the panels identifiable. */
        .ai-panel {
            box-shadow: var(--dg-shadow), inset 0 1px 0 rgba(216, 180, 254, 0.28);
        }

        .video-editor-panel {
            box-shadow: var(--dg-shadow), inset 0 1px 0 rgba(251, 113, 133, 0.28);
        }

        #settingsSidebar {
            background: var(--dg-panel) !important;
            backdrop-filter: var(--dg-blur);
            -webkit-backdrop-filter: var(--dg-blur);
            border-color: var(--dg-border);
            box-shadow: var(--dg-shadow), inset 0 1px 0 rgba(165, 243, 252, 0.22);
        }

        .guides-menu-list,
        .edge-tab-card,
        .ai-toast {
            background: var(--dg-panel-strong);
        }

        .ai-toast {
            border-color: var(--dg-border-strong);
            backdrop-filter: var(--dg-blur);
            -webkit-backdrop-filter: var(--dg-blur);
        }

        .crystal-3d-card {
            background: linear-gradient(160deg, rgba(14, 14, 18, 0.94), rgba(4, 4, 6, 0.96));
            backdrop-filter: var(--dg-blur);
            -webkit-backdrop-filter: var(--dg-blur);
            border-color: var(--dg-border);
            box-shadow: 0 30px 70px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.06);
        }

        .crystal-3d-card::before {
            background: linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.03) 45%, rgba(196, 181, 253, 0.22));
        }

        /* ---- Top chrome ---- */
        .status-ticker {
            background: var(--dg-chrome);
            backdrop-filter: var(--dg-blur);
            -webkit-backdrop-filter: var(--dg-blur);
            border-color: var(--dg-border);
            box-shadow: var(--dg-shadow-soft);
        }

        .status-ticker-live {
            background: rgba(16, 185, 129, 0.1);
            border-color: rgba(52, 211, 153, 0.35);
        }

        .synthesis-title {
            background: linear-gradient(100deg, #f8fafc 0%, #e9d5ff 28%, #ffffff 50%, #c7d2fe 72%, #f8fafc 100%);
            background-size: 200% auto;
            -webkit-background-clip: text;
            background-clip: text;
            filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.65));
        }

        .synthesis-sub {
            color: #a1a1aa;
        }

        .guides-menu-btn,
        .studio-close-btn,
        .ai-icon-btn,
        .ve-icon-btn {
            background: var(--dg-fill);
            border-color: var(--dg-border);
        }

        .guides-menu-btn:hover,
        .studio-close-btn:hover,
        .ai-icon-btn:hover,
        .ve-icon-btn:hover {
            background: var(--dg-fill-hover);
        }

        .account-divider {
            background: var(--dg-border-strong);
        }

        /* ---- Edge tabs ---- */
        .ai-edge-tab,
        .edge-tab {
            background: var(--dg-chrome);
            backdrop-filter: var(--dg-blur);
            -webkit-backdrop-filter: var(--dg-blur);
            border-color: var(--dg-border-strong);
            box-shadow: var(--dg-shadow-soft);
        }

        .ai-edge-tab {
            border-left: none;
        }

        .ai-edge-tab:hover,
        .ai-edge-tab:focus-visible {
            border-color: rgba(216, 180, 254, 0.45);
            box-shadow: var(--dg-shadow-soft), 0 0 18px rgba(192, 132, 252, 0.18);
        }

        .edge-tabs.is-near .edge-tab,
        .edge-tab:hover,
        .edge-tab:focus-visible {
            border-color: color-mix(in srgb, var(--tab-accent) 45%, transparent);
            box-shadow: var(--dg-shadow-soft), 0 0 18px color-mix(in srgb, var(--tab-accent) 18%, transparent);
        }

        .edge-tab-glyph {
            box-shadow: 0 0 10px color-mix(in srgb, var(--tab-accent) 30%, transparent);
        }

        .edge-tab-card {
            border-color: var(--dg-border-strong);
        }

        /* ---- Bottom: crystal track + live feed ---- */
        .crystal-video-card {
            background: #000000;
            border-color: color-mix(in srgb, var(--cv-accent) 38%, rgba(255, 255, 255, 0.08));
            box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55), 0 0 12px color-mix(in srgb, var(--cv-accent) 14%, transparent);
        }

        .crystal-video-card::after {
            background: linear-gradient(135deg, rgba(255, 255, 255, 0.09), transparent 38%, transparent 72%, rgba(255, 255, 255, 0.03));
        }

        .crystal-video-badge,
        .edge-tab-card-version,
        .ve-monitor-badge {
            background: rgba(0, 0, 0, 0.72);
        }

        .live-feed-bar {
            background: rgba(3, 3, 4, 0.84);
            backdrop-filter: var(--dg-blur);
            -webkit-backdrop-filter: var(--dg-blur);
            border-top: 1px solid var(--dg-border);
            box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.04);
        }

        .live-feed-label {
            background: rgba(192, 132, 252, 0.1);
            border-color: rgba(216, 180, 254, 0.35);
            box-shadow: none;
        }

        .live-feed-brand {
            border-left-color: var(--dg-border-strong);
        }

        /* ---- Inner tiles, wells and fields ---- */
        details,
        .palette-preset,
        .ai-mode-tab,
        .ai-history-item,
        .ai-pricing-list li,
        .ai-credits-summary div,
        .ve-section,
        .ve-btn,
        .checkout-pkg-card {
            background: var(--dg-fill);
            border-color: var(--dg-border);
        }

        .palette-preset:hover,
        .ve-btn:hover {
            background: var(--dg-fill-hover);
        }

        .ai-mode-tab:hover {
            border-color: var(--dg-border-strong);
            background: var(--dg-fill-hover);
        }

        .ai-mode-tab.active {
            background: linear-gradient(160deg, rgba(192, 132, 252, 0.16), rgba(244, 114, 182, 0.1));
            border-color: rgba(216, 180, 254, 0.55);
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 16px rgba(192, 132, 252, 0.14);
        }

        .ai-pricing-list li.is-active {
            background: linear-gradient(160deg, rgba(192, 132, 252, 0.14), rgba(244, 114, 182, 0.08));
            border-color: rgba(216, 180, 254, 0.45);
        }

        .ai-pricing {
            background: linear-gradient(160deg, rgba(251, 191, 36, 0.06), rgba(255, 255, 255, 0.02));
            border-color: rgba(251, 191, 36, 0.24);
        }

        .ai-balance-card {
            background: linear-gradient(160deg, rgba(251, 191, 36, 0.09), rgba(255, 255, 255, 0.025));
            border-color: rgba(251, 191, 36, 0.28);
        }

        .checkout-pkg-card:hover,
        .checkout-pkg-card.active {
            background: rgba(255, 255, 255, 0.06);
            border-color: rgba(165, 180, 252, 0.6);
            box-shadow: 0 0 16px rgba(129, 140, 248, 0.18);
        }

        .checkout-pkg-badge {
            position: absolute;
            top: -0.55rem;
            right: 0.5rem;
            padding: 0.1rem 0.4rem;
            border-radius: 0.3rem;
            border: 1px solid var(--dg-border-strong);
            background: rgba(10, 10, 14, 0.95);
            color: rgb(203 213 225);
            font-size: 8px;
            font-weight: 900;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            white-space: nowrap;
        }

        .checkout-pkg-badge.is-featured {
            border-color: transparent;
            background: linear-gradient(90deg, #818cf8, #c084fc);
            color: #fff;
        }

        .ai-preview:not(.hidden),
        .ai-attach,
        .ai-segmented,
        .ai-cost-pill,
        .ai-job {
            background: var(--dg-well);
            border-color: var(--dg-border);
        }

        .ai-panel-head,
        .ai-history {
            border-color: var(--dg-border);
        }

        input[type=text],
        input[type=password],
        input[type=email],
        input[type=tel],
        select,
        input[type="color"],
        input[type="number"],
        .ai-panel textarea,
        .ai-panel input[type=url] {
            background: rgba(255, 255, 255, 0.04) !important;
            border-color: var(--dg-border-strong);
        }

        input[type=text]:focus,
        input[type=password]:focus,
        input[type=email]:focus,
        input[type=tel]:focus,
        .ai-panel textarea:focus,
        .ai-panel input[type=url]:focus,
        .ai-panel input[type=number]:focus,
        .ai-panel select:focus {
            border-color: var(--dg-focus);
            box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.14);
        }

        select option {
            background-color: #0b0b0e !important;
        }

        #settingsSidebar::-webkit-scrollbar-thumb,
        .ai-panel::-webkit-scrollbar-thumb,
        .video-editor-panel::-webkit-scrollbar-thumb,
        .ai-history-list::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.16);
        }

        /* Tailwind slate utilities are blue-grey; map the ones used in the app to neutral obsidian. */
        .bg-slate-950\/90 { background-color: rgb(4 4 6 / 0.9); }
        .bg-slate-900 { background-color: rgb(14 14 17); }
        .bg-slate-900\/60 { background-color: rgb(14 14 17 / 0.6); }
        .bg-slate-900\/80 { background-color: rgb(14 14 17 / 0.8); }
        .bg-slate-900\/90 { background-color: rgb(14 14 17 / 0.9); }
        .bg-slate-800,
        .hover\:bg-slate-800:hover { background-color: rgb(32 32 37); }
        .bg-slate-700,
        .hover\:bg-slate-700:hover { background-color: rgb(46 46 52); }

        /* ---------- Crystal Guide assistant (assistantBot.js) ---------- */
        /* Sits in the bottom-right corner just above the crystal video track, clear of the right edge tabs. */
        .cg-root {
            --cg-right: 18px;
            --cg-bottom: calc(var(--ai-panel-bottom) + 4px);
            --cg-size: 52px;
            font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
        }

        body.right-panel-open .cg-root {
            --cg-right: 420px;
        }

        .cg-root .hidden,
        .cg-tour.hidden,
        .cg-tour .hidden {
            display: none !important;
        }

        .cg-toggle {
            position: fixed;
            right: var(--cg-right);
            bottom: var(--cg-bottom);
            z-index: 38;
            width: var(--cg-size);
            height: var(--cg-size);
            padding: 0;
            border: none;
            border-radius: 50%;
            background: none;
            cursor: pointer;
            transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s ease;
        }

        .cg-toggle:hover {
            transform: translateY(-2px) scale(1.04);
        }

        .cg-toggle:focus-visible {
            outline: 2px solid var(--dg-focus);
            outline-offset: 3px;
        }

        .cg-avatar {
            position: relative;
            display: grid;
            place-items: center;
            width: 100%;
            height: 100%;
            border-radius: 50%;
            color: #fff;
            font-size: 20px;
            background:
                radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.35), transparent 45%),
                conic-gradient(from 200deg, #7c3aed, #c084fc, #f472b6, #22d3ee, #7c3aed);
            box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.14), 0 0 22px rgba(192, 132, 252, 0.35);
        }

        .cg-avatar::after {
            content: '';
            position: absolute;
            inset: 3px;
            border-radius: 50%;
            background: rgba(6, 6, 10, 0.55);
            z-index: 0;
        }

        .cg-avatar > i {
            position: relative;
            z-index: 1;
            filter: drop-shadow(0 0 6px rgba(216, 180, 254, 0.8));
        }

        /* The breathing glow is a fixed shadow on its own layer with only its opacity animated, so it never repaints. */
        .cg-toggle .cg-avatar::before {
            content: '';
            position: absolute;
            inset: 0;
            border-radius: 50%;
            box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2), 0 0 30px rgba(192, 132, 252, 0.55);
            opacity: 0;
            pointer-events: none;
            will-change: opacity;
            animation: cg-breathe 3.6s ease-in-out infinite;
        }

        .cg-toggle.is-open .cg-avatar::before {
            animation: none;
        }

        .cg-avatar-sm {
            flex: none;
            width: 32px;
            height: 32px;
            font-size: 13px;
            box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 0 14px rgba(192, 132, 252, 0.3);
        }

        .cg-toggle-dot {
            position: absolute;
            right: 2px;
            bottom: 3px;
            width: 11px;
            height: 11px;
            border-radius: 50%;
            background: #34d399;
            border: 2px solid #050507;
            box-shadow: 0 0 8px rgba(52, 211, 153, 0.8);
        }

        @keyframes cg-breathe {
            0%, 100% { opacity: 0; }
            50% { opacity: 1; }
        }

        .cg-teaser {
            position: fixed;
            right: calc(var(--cg-right) + var(--cg-size) + 10px);
            bottom: calc(var(--cg-bottom) + 6px);
            z-index: 38;
            display: flex;
            align-items: flex-start;
            gap: 6px;
            max-width: 230px;
            padding: 9px 8px 9px 12px;
            border-radius: 14px 14px 4px 14px;
            background: var(--dg-panel-strong);
            border: 1px solid var(--dg-border-strong);
            box-shadow: var(--dg-shadow-soft);
            animation: cg-pop 0.35s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .cg-teaser-text {
            padding: 0;
            border: none;
            background: none;
            color: rgb(226 232 240);
            font: inherit;
            font-size: 11.5px;
            line-height: 1.45;
            text-align: left;
            cursor: pointer;
        }

        .cg-teaser-text strong {
            color: #fff;
        }

        .cg-teaser-close {
            flex: none;
            width: 20px;
            height: 20px;
            border: none;
            border-radius: 6px;
            background: none;
            color: rgb(148 163 184);
            font-size: 11px;
            cursor: pointer;
        }

        .cg-teaser-close:hover {
            color: #fff;
            background: var(--dg-fill-hover);
        }

        @keyframes cg-pop {
            from { opacity: 0; transform: translateY(8px) scale(0.97); }
            to { opacity: 1; transform: none; }
        }

        /* Docked beside the avatar (not above it) so the right edge tabs stay reachable while it is open. */
        .cg-panel {
            position: fixed;
            right: calc(var(--cg-right) + var(--cg-size) + 12px);
            bottom: var(--cg-bottom);
            z-index: 46;
            display: flex;
            flex-direction: column;
            width: min(360px, calc(100vw - 24px));
            /* Leaves room for the account bar in the top-right corner. */
            height: min(540px, calc(100vh - var(--cg-bottom) - 96px));
            height: min(540px, calc(100dvh - var(--cg-bottom) - 96px));
            min-height: 260px;
            overflow: hidden;
            border-radius: 20px;
            background: var(--dg-panel-strong);
            backdrop-filter: var(--dg-blur);
            -webkit-backdrop-filter: var(--dg-blur);
            border: 1px solid var(--dg-border-strong);
            box-shadow: var(--dg-shadow), inset 0 1px 0 rgba(216, 180, 254, 0.25);
            transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .cg-head {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 12px 12px 10px 14px;
            border-bottom: 1px solid var(--dg-border);
        }

        .cg-head-text {
            display: flex;
            flex: 1;
            min-width: 0;
            flex-direction: column;
        }

        .cg-head-title {
            display: flex;
            align-items: center;
            gap: 8px;
            color: #fff;
            font-family: 'Space Grotesk', sans-serif;
            font-size: 14px;
            font-weight: 800;
        }

        .cg-head-sub {
            overflow: hidden;
            color: rgb(148 163 184);
            font-size: 10px;
            white-space: nowrap;
            text-overflow: ellipsis;
        }

        .cg-head-btn {
            flex: none;
            width: 30px;
            height: 30px;
            border: 1px solid var(--dg-border);
            border-radius: 9px;
            background: var(--dg-fill);
            color: rgb(203 213 225);
            font-size: 12px;
            cursor: pointer;
            transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
        }

        .cg-head-btn:hover,
        .cg-head-btn:focus-visible {
            color: #fff;
            background: var(--dg-fill-hover);
            border-color: var(--dg-border-strong);
            outline: none;
        }

        .cg-wave {
            display: inline-flex;
            align-items: center;
            gap: 2px;
            height: 14px;
        }

        .cg-wave i {
            display: block;
            width: 3px;
            height: 4px;
            border-radius: 2px;
            background: linear-gradient(180deg, #e9d5ff, #a78bfa);
            opacity: 0.55;
        }

        .cg-panel.is-speaking .cg-head .cg-wave i,
        .cg-typing .cg-wave i,
        .cg-tour-head .cg-wave i {
            opacity: 1;
            animation: cg-wave 0.9s ease-in-out infinite;
        }

        .cg-wave i:nth-child(2) { animation-delay: -0.75s; }
        .cg-wave i:nth-child(3) { animation-delay: -0.6s; }
        .cg-wave i:nth-child(4) { animation-delay: -0.45s; }
        .cg-wave i:nth-child(5) { animation-delay: -0.3s; }

        @keyframes cg-wave {
            0%, 100% { height: 4px; }
            50% { height: 14px; }
        }

        .cg-log {
            display: flex;
            flex: 1;
            flex-direction: column;
            gap: 10px;
            min-height: 0;
            padding: 14px 12px 6px;
            overflow-y: auto;
            overscroll-behavior: contain;
            scrollbar-width: thin;
        }

        .cg-log::-webkit-scrollbar {
            width: 5px;
        }

        .cg-log::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.16);
            border-radius: 4px;
        }

        .cg-msg {
            display: flex;
        }

        .cg-msg-user {
            justify-content: flex-end;
        }

        .cg-bubble {
            max-width: 92%;
            padding: 9px 12px;
            border-radius: 14px;
            color: rgb(226 232 240);
            font-size: 12px;
            line-height: 1.55;
            overflow-wrap: anywhere;
        }

        .cg-msg-bot .cg-bubble {
            border-top-left-radius: 4px;
            background: var(--dg-fill);
            border: 1px solid var(--dg-border);
        }

        .cg-msg-user .cg-bubble {
            border-top-right-radius: 4px;
            color: #fff;
            background: linear-gradient(135deg, rgba(139, 92, 246, 0.55), rgba(236, 72, 153, 0.4));
            border: 1px solid rgba(216, 180, 254, 0.35);
        }

        .cg-bubble p {
            margin: 0;
        }

        .cg-bubble p + p,
        .cg-bubble p + ul,
        .cg-bubble p + ol,
        .cg-bubble ul + p,
        .cg-bubble ol + p {
            margin-top: 6px;
        }

        .cg-bubble ul,
        .cg-bubble ol {
            margin: 0;
            padding-left: 18px;
        }

        .cg-bubble ul {
            list-style: disc;
        }

        .cg-bubble ol {
            list-style: decimal;
        }

        .cg-bubble li + li {
            margin-top: 3px;
        }

        .cg-bubble li::marker {
            color: rgb(196 181 253);
        }

        .cg-bubble strong {
            color: #fff;
            font-weight: 700;
        }

        .cg-bubble a {
            color: rgb(196 181 253);
            text-decoration: underline;
            text-underline-offset: 2px;
        }

        .cg-typing .cg-bubble {
            padding: 10px 14px;
        }

        .cg-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            margin-top: 9px;
        }

        .cg-action {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            padding: 5px 10px;
            border-radius: 999px;
            border: 1px solid rgba(216, 180, 254, 0.45);
            background: rgba(192, 132, 252, 0.12);
            color: rgb(233 213 255);
            font: inherit;
            font-size: 11px;
            font-weight: 700;
            cursor: pointer;
            transition: background 0.2s ease, border-color 0.2s ease;
        }

        .cg-action:hover,
        .cg-action:focus-visible {
            background: rgba(192, 132, 252, 0.24);
            border-color: rgba(216, 180, 254, 0.7);
            outline: none;
        }

        .cg-chips {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            padding: 8px 12px;
            border-top: 1px solid var(--dg-border);
        }

        .cg-chips:empty {
            display: none;
        }

        .cg-chip {
            flex: none;
            padding: 6px 11px;
            border-radius: 999px;
            border: 1px solid var(--dg-border-strong);
            background: var(--dg-fill);
            color: rgb(226 232 240);
            font: inherit;
            font-size: 11px;
            font-weight: 600;
            white-space: nowrap;
            cursor: pointer;
            transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
        }

        .cg-chip:hover,
        .cg-chip:focus-visible {
            color: #fff;
            background: var(--dg-fill-hover);
            border-color: rgba(216, 180, 254, 0.5);
            outline: none;
        }

        .cg-form {
            display: flex;
            gap: 8px;
            padding: 8px 12px 12px;
        }

        .cg-input {
            flex: 1;
            min-width: 0;
            height: 38px;
            padding: 0 12px;
            border-radius: 12px;
            border: 1px solid var(--dg-border);
            background: var(--dg-well);
            color: #fff;
            font: inherit;
            font-size: 12px;
        }

        .cg-input::placeholder {
            color: rgb(100 116 139);
        }

        .cg-input:focus {
            outline: none;
            border-color: var(--dg-focus);
            box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.14);
        }

        .cg-send {
            flex: none;
            width: 38px;
            height: 38px;
            border: none;
            border-radius: 12px;
            color: #fff;
            background: linear-gradient(135deg, #8b5cf6, #ec4899);
            cursor: pointer;
            box-shadow: 0 6px 16px rgba(139, 92, 246, 0.3);
        }

        .cg-send:hover,
        .cg-send:focus-visible {
            filter: brightness(1.12);
            outline: none;
        }

        /* Guided tour */
        .cg-tour {
            position: fixed;
            inset: 0;
            z-index: 70;
            font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
        }

        .cg-tour-blocker {
            position: absolute;
            inset: 0;
        }

        .cg-tour.is-centered .cg-tour-blocker {
            background: rgba(0, 0, 0, 0.62);
        }

        .cg-tour-spot {
            position: absolute;
            top: 0;
            left: 0;
            border-radius: 14px;
            pointer-events: none;
            box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.62), 0 0 0 2px rgba(216, 180, 254, 0.85), 0 0 22px rgba(192, 132, 252, 0.45);
            transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), width 0.35s cubic-bezier(0.16, 1, 0.3, 1), height 0.35s cubic-bezier(0.16, 1, 0.3, 1);
        }

        /* Animating the 9999px dimming shadow would repaint the whole viewport every frame; only this ring pulses. */
        .cg-tour-spot::after {
            content: '';
            position: absolute;
            inset: 0;
            border-radius: inherit;
            box-shadow: 0 0 0 3px rgba(233, 213, 255, 1), 0 0 36px rgba(192, 132, 252, 0.7);
            opacity: 0;
            will-change: opacity;
            animation: cg-spot-pulse 2s ease-in-out infinite;
        }

        @keyframes cg-spot-pulse {
            0%, 100% { opacity: 0; }
            50% { opacity: 1; }
        }

        .cg-tour-card {
            position: absolute;
            top: 0;
            left: 0;
            width: min(320px, calc(100vw - 20px));
            padding: 14px 16px 14px;
            border-radius: 18px;
            background: rgba(7, 7, 10, 0.97);
            border: 1px solid var(--dg-border-strong);
            box-shadow: var(--dg-shadow), inset 0 1px 0 rgba(216, 180, 254, 0.25);
            transition: left 0.35s cubic-bezier(0.16, 1, 0.3, 1), top 0.35s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .cg-tour-head {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 10px;
        }

        .cg-tour-progress {
            flex: 1;
            color: rgb(196 181 253);
            font-size: 10px;
            font-weight: 800;
            letter-spacing: 0.08em;
            text-transform: uppercase;
        }

        .cg-tour-exit {
            width: 26px;
            height: 26px;
            border: none;
            border-radius: 8px;
            background: none;
            color: rgb(148 163 184);
            cursor: pointer;
        }

        .cg-tour-exit:hover,
        .cg-tour-exit:focus-visible {
            color: #fff;
            background: var(--dg-fill-hover);
            outline: none;
        }

        .cg-tour-title {
            margin: 0 0 4px;
            color: #fff;
            font-family: 'Space Grotesk', sans-serif;
            font-size: 16px;
            font-weight: 800;
        }

        .cg-tour-text {
            margin: 0;
            color: rgb(203 213 225);
            font-size: 12px;
            line-height: 1.55;
        }

        .cg-tour-action {
            margin-top: 10px;
        }

        .cg-tour-nav {
            display: flex;
            justify-content: space-between;
            gap: 8px;
            margin-top: 14px;
        }

        .cg-tour-btn {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 7px 14px;
            border-radius: 10px;
            border: 1px solid var(--dg-border-strong);
            background: var(--dg-fill);
            color: rgb(226 232 240);
            font: inherit;
            font-size: 12px;
            font-weight: 700;
            cursor: pointer;
        }

        .cg-tour-btn:hover:not(:disabled),
        .cg-tour-btn:focus-visible {
            background: var(--dg-fill-hover);
            outline: none;
        }

        .cg-tour-btn:disabled {
            opacity: 0.35;
            cursor: default;
        }

        .cg-tour-next {
            border-color: transparent;
            color: #fff;
            background: linear-gradient(135deg, #8b5cf6, #ec4899);
            box-shadow: 0 6px 16px rgba(139, 92, 246, 0.3);
        }

        .cg-tour-next:hover:not(:disabled),
        .cg-tour-next:focus-visible {
            background: linear-gradient(135deg, #8b5cf6, #ec4899);
            filter: brightness(1.12);
            box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.3);
        }

        @media (max-width: 639px) {
            .cg-root {
                --cg-right: 10px;
                --cg-size: 46px;
            }

            /* A right panel fills the screen width on phones, so the assistant steps aside. */
            body.right-panel-open .cg-root {
                display: none;
            }

            .cg-teaser {
                max-width: min(220px, calc(100vw - 90px));
            }

            /* Clears the AI Studio edge tab on the left and the stacked account cluster (~124px tall) above. */
            .cg-panel {
                right: var(--cg-right);
                bottom: calc(var(--cg-bottom) + var(--cg-size) + 10px);
                width: min(360px, calc(100vw - 54px));
                height: min(480px, calc(100vh - var(--cg-bottom) - var(--cg-size) - 146px));
                height: min(480px, calc(100dvh - var(--cg-bottom) - var(--cg-size) - 146px));
            }
        }

        @media (prefers-reduced-motion: reduce) {
            .cg-toggle .cg-avatar::before,
            .cg-teaser,
            .cg-tour-spot::after,
            .cg-wave i {
                animation: none !important;
            }

            .cg-tour-spot,
            .cg-tour-card {
                transition: none;
            }
        }

        /* ==========================================================================================
           Rendering budget and in-app navigation
           Every backdrop-filter re-samples the live WebGL canvas on each frame, so blur is kept to the
           outer panels on desktop and dropped on phones, tablets and weak devices (html.perf-lite, set by
           perf.js), where the panels turn near-opaque instead.
           ========================================================================================== */

        /* Fields and tiles sit inside panels that are already frosted; a second blur pass adds cost, not frost. */
        details,
        input[type=text],
        input[type=password],
        input[type=email],
        input[type=tel],
        select,
        input[type="color"],
        input[type="number"] {
            backdrop-filter: none;
            -webkit-backdrop-filter: none;
        }

        .payment-back-btn {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            min-height: 32px;
            margin-bottom: 10px;
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            color: #67e8f9;
            background: none;
            border: 0;
            cursor: pointer;
        }

        .payment-back-btn:hover,
        .payment-back-btn:focus-visible {
            color: #cffafe;
        }

        .payment-back-btn.hidden,
        .nav-bar {
            display: none;
        }

        @media (max-width: 1023px) {
            :root {
                --dg-blur: none;
                --dg-panel: rgba(6, 6, 8, 0.94);
                --dg-chrome: rgba(6, 6, 8, 0.88);
            }

            #authModal,
            #pricingModal,
            #paymentModal,
            #aiCreditsModal,
            .guide-modal,
            .live-feed-bar {
                backdrop-filter: none;
                -webkit-backdrop-filter: none;
            }

            /* Sticky inside each scrolling panel, so Back is reachable however far the user has scrolled. */
            .nav-bar {
                position: sticky;
                top: 0;
                z-index: 5;
                display: flex;
                align-items: center;
                gap: 10px;
                min-height: 52px;
                padding: 6px;
                border-radius: 12px;
                background: rgba(9, 9, 12, 0.97);
                border: 1px solid var(--dg-border-strong);
                box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
            }

            .nav-bar-back {
                flex: none;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                gap: 7px;
                min-width: 44px;
                min-height: 40px;
                padding: 0 14px;
                border-radius: 10px;
                font-size: 12.5px;
                font-weight: 700;
                color: #f8fafc;
                background: rgba(255, 255, 255, 0.07);
                border: 1px solid var(--dg-border-strong);
                cursor: pointer;
            }

            .nav-bar-back:active {
                background: rgba(255, 255, 255, 0.14);
            }

            .nav-bar-back:focus-visible,
            .nav-bar-trail button:focus-visible {
                outline: 2px solid var(--dg-focus);
                outline-offset: 2px;
            }

            .nav-bar-trail {
                display: flex;
                align-items: center;
                min-width: 0;
                overflow: hidden;
                list-style: none;
                font-size: 11.5px;
                white-space: nowrap;
                color: #a1a1aa;
            }

            .nav-bar-trail li {
                display: flex;
                align-items: center;
                min-width: 0;
                flex: none;
            }

            .nav-bar-trail li:last-child {
                flex: 1 1 auto;
            }

            .nav-bar-trail li + li::before {
                content: '\203A';
                padding: 0 6px;
                color: #52525b;
            }

            .nav-bar-trail button {
                min-height: 36px;
                padding: 0 2px;
                font: inherit;
                color: #c4b5fd;
                background: none;
                border: 0;
                cursor: pointer;
            }

            .nav-bar-trail [aria-current] {
                overflow: hidden;
                text-overflow: ellipsis;
                font-weight: 700;
                color: #f8fafc;
            }

            /* 44px touch targets for every way out of a panel or modal. */
            .studio-close-btn,
            .ai-icon-btn {
                width: 40px;
                height: 40px;
            }

            .modal-close-btn {
                top: 8px;
                right: 8px;
                width: 44px;
                height: 44px;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                z-index: 2;
            }
        }

        html.perf-lite {
            --dg-blur: none;
            --dg-panel: rgba(6, 6, 8, 0.94);
            --dg-chrome: rgba(6, 6, 8, 0.88);
        }

        html.perf-lite .glass-card,
        html.perf-lite .crystal-3d-card,
        html.perf-lite .ai-panel,
        html.perf-lite .video-editor-panel,
        html.perf-lite #settingsSidebar,
        html.perf-lite .live-feed-bar,
        html.perf-lite .guide-modal,
        html.perf-lite #authModal,
        html.perf-lite #pricingModal,
        html.perf-lite #paymentModal,
        html.perf-lite #aiCreditsModal {
            backdrop-filter: none;
            -webkit-backdrop-filter: none;
        }

        /* The title shimmer repaints a drop-shadowed gradient every frame. */
        html.perf-lite .synthesis-title {
            animation: none;
        }

        /* Closed side panels sit fully off-screen, so their contents skip style, layout and paint (most of the
           page's DOM). The delayed switch keeps the contents drawn while a panel slides out. The sidebar applies
           it to its content wrapper: on the fixed, transformed sidebar itself Chrome reports a large spurious
           layout shift whenever a late stylesheet or web font restyles the page. */
        #settingsSidebar:not(.sidebar-open) > div,
        .video-editor-panel:not(.ve-open) {
            content-visibility: hidden;
        }

        /* Until a panel is first opened there is no scroll position to keep, so its contents are not rendered
           at all: Chrome's autofill scan after DOMContentLoaded lays out every content-visibility: hidden subtree
           holding form fields (~150 ms on a mid-range phone). app.js adds the -visited classes. */
        #settingsSidebar:not(.sidebar-open):not(.sidebar-visited) > div,
        .video-editor-panel:not(.ve-open):not(.ve-visited) > * {
            display: none;
        }

        #settingsSidebar > div {
            /* Keeps the scroll height (and position) of a sidebar that has been opened before. */
            contain-intrinsic-size: auto none;
            transition: content-visibility 0s linear 0.4s allow-discrete;
        }

        #settingsSidebar.sidebar-open > div {
            transition: content-visibility 0s allow-discrete;
        }

        .video-editor-panel {
            transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0.4s,
                content-visibility 0s linear 0.4s allow-discrete;
        }

        .video-editor-panel.ve-open {
            transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s, content-visibility 0s allow-discrete;
        }
