            :root {
                --bg: #020204;
                --surface: rgba(20, 20, 24, 0.45);
                --card: rgba(25, 25, 30, 0.3);
                --border: rgba(255, 255, 255, 0.08);
                --border-hi: rgba(255, 255, 255, 0.2);
                --accent: #b721ff;
                --accent-glow: rgba(183, 33, 255, 0.4);
                --cyan: #21d4fd;
                --cyan-glow: rgba(33, 212, 253, 0.4);
                --pink: #ff2d78;
                --pink-glow: rgba(255, 45, 120, 0.4);
                --gold: #f5a623;
                --text: #f8f8ff;
                --muted: #888899;
                --success: #10b981;
            }
            * {
                box-sizing: border-box;
                margin: 0;
                padding: 0;
            }
            ::-webkit-scrollbar {
                width: 4px;
                height: 4px;
            }
            ::-webkit-scrollbar-track {
                background: var(--bg);
            }
            ::-webkit-scrollbar-thumb {
                background: rgba(99, 102, 241, 0.3);
                border-radius: 2px;
            }
            ::-webkit-scrollbar-thumb:hover {
                background: var(--accent);
            }

            body {
                background: var(--bg);
                color: var(--text);
                font-family: "Plus Jakarta Sans", sans-serif;
                height: 100vh;
                display: flex;
                flex-direction: column;
                overflow: hidden;
            }

            header {
                background: transparent;
                padding: 12px 24px;
                height: 60px;
                display: flex;
                align-items: center;
                justify-content: space-between;
                position: sticky;
                top: 0;
                z-index: 200;
                flex-shrink: 0;
            }

            .logo {
                font-family: "Syne", sans-serif;
                font-size: 18px;
                font-weight: 800;
                display: flex;
                align-items: center;
                gap: 10px;
                letter-spacing: -0.5px;
            }
            .logo-icon {
                width: 28px;
                height: 28px;
                background: linear-gradient(135deg, var(--accent), var(--cyan));
                border-radius: 8px;
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 14px;
                box-shadow: 0 0 20px var(--accent-glow);
            }
            .logo em {
                color: var(--cyan);
                font-style: normal;
            }

            .header-pills {
                display: flex;
                gap: 6px;
                align-items: center;
            }
            .hpill {
                background: rgba(99, 102, 241, 0.08);
                border: 1px solid rgba(99, 102, 241, 0.2);
                border-radius: 20px;
                padding: 4px 12px;
                font-size: 10px;
                font-weight: 700;
                color: var(--accent);
                font-family: "JetBrains Mono", monospace;
                letter-spacing: 0.5px;
            }
            .hpill.live {
                background: rgba(16, 185, 129, 0.1);
                border-color: rgba(16, 185, 129, 0.25);
                color: var(--success);
            }

            .app {
                display: flex;
                flex: 1;
                height: calc(100vh - 60px);
                overflow: hidden;
                position: relative;
            }
            .app::before {
                content: "";
                position: absolute;
                top: -200px;
                left: -200px;
                width: 800px;
                height: 800px;
                background: radial-gradient(
                    circle,
                    var(--accent-glow) 0%,
                    transparent 60%
                );
                filter: blur(100px);
                z-index: 0;
                pointer-events: none;
                opacity: 0.6;
            }
            .app::after {
                content: "";
                position: absolute;
                bottom: -200px;
                right: -200px;
                width: 800px;
                height: 800px;
                background: radial-gradient(
                    circle,
                    var(--cyan-glow) 0%,
                    transparent 60%
                );
                filter: blur(100px);
                z-index: 0;
                pointer-events: none;
                opacity: 0.6;
            }

            /* ── LEFT PANEL ─────────────────────────────────── */
            .panel-left {
                width: 320px;
                min-width: 320px;
                background: var(--surface);
                backdrop-filter: blur(30px);
                -webkit-backdrop-filter: blur(30px);
                border: 1px solid var(--border);
                border-radius: 24px;
                margin: 0 16px 16px 16px;
                display: flex;
                flex-direction: column;
                overflow: hidden;
                box-shadow:
                    0 20px 40px rgba(0, 0, 0, 0.4),
                    inset 0 1px 1px rgba(255, 255, 255, 0.1);
                position: relative;
                z-index: 10;
            }

            .panel-scroll {
                flex: 1;
                min-height: 0;
                overflow-y: auto;
                overflow-x: hidden;
            }

            .ps {
                padding: 14px;
                border-bottom: 1px solid var(--border);
            }
            .ps-title {
                font-family: "Space Grotesk", sans-serif;
                font-size: 10px;
                font-weight: 700;
                letter-spacing: 1.5px;
                text-transform: uppercase;
                color: var(--muted);
                margin-bottom: 10px;
                display: flex;
                align-items: center;
                gap: 6px;
            }
            .ps-title .dot {
                width: 6px;
                height: 6px;
                border-radius: 50%;
                background: var(--accent);
                box-shadow: 0 0 6px var(--accent-glow);
            }

            label {
                display: flex;
                justify-content: space-between;
                font-size: 10px;
                font-weight: 600;
                color: var(--muted);
                margin-bottom: 4px;
                margin-top: 10px;
                font-family: "JetBrains Mono", monospace;
                text-transform: uppercase;
                letter-spacing: 0.5px;
            }
            label:first-of-type {
                margin-top: 0;
            }

            input[type="text"],
            textarea,
            select {
                width: 100%;
                background: rgba(255, 255, 255, 0.03);
                border: 1px solid rgba(255, 255, 255, 0.08);
                border-radius: 12px;
                color: var(--text);
                font-family: "Plus Jakarta Sans", sans-serif;
                font-size: 12px;
                padding: 10px 14px;
                outline: none;
                transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
                box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
            }
            input[type="text"]:focus,
            textarea:focus,
            select:focus {
                border-color: var(--cyan);
                background: rgba(255, 255, 255, 0.06);
                box-shadow:
                    0 0 0 1px var(--cyan),
                    0 0 20px var(--cyan-glow),
                    inset 0 2px 4px rgba(0, 0, 0, 0.2);
            }
            select.font-source {
                display: none !important;
            }
            textarea {
                resize: vertical;
                min-height: 50px;
            }

            .scenes-list {
                display: flex;
                flex-direction: column;
                gap: 6px;
                max-height: 190px;
                overflow-y: auto;
                margin-bottom: 10px;
            }

            .scene-card {
                background: rgba(255, 255, 255, 0.02);
                border: 1px solid var(--border);
                border-radius: 10px;
                padding: 10px 11px;
                cursor: pointer;
                display: flex;
                align-items: center;
                gap: 10px;
                transition: all 0.2s;
                position: relative;
                overflow: hidden;
            }
            .scene-card::before {
                content: "";
                position: absolute;
                left: 0;
                top: 0;
                bottom: 0;
                width: 3px;
                background: var(--muted);
                border-radius: 3px;
                transition: all 0.2s;
            }
            .scene-card.active::before {
                background: #ffffff;
                box-shadow: 0 0 10px rgba(255, 255, 255, 0.9);
            }
            .scene-card:hover {
                background: rgba(255, 255, 255, 0.04);
                border-color: rgba(255, 255, 255, 0.15);
            }
            .scene-card.active {
                border-color: #ffffff;
                background: rgba(255, 255, 255, 0.12);
                box-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
            }
            .scene-card.active .scene-name {
                color: #ffffff;
            }
            .scene-card.active .scene-meta b {
                color: #ffffff;
            }

            .scene-thumb {
                width: 26px;
                height: 46px;
                border-radius: 5px;
                background: linear-gradient(135deg, #1a1a2e, #16213e);
                border: 1px solid var(--border);
                flex-shrink: 0;
                overflow: hidden;
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 10px;
                color: var(--muted);
            }

            .scene-info {
                flex: 1;
                overflow: hidden;
            }
            .scene-name {
                font-size: 11px;
                font-weight: 700;
                color: var(--text);
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }
            .scene-meta {
                font-family: "JetBrains Mono", monospace;
                font-size: 9px;
                color: var(--muted);
                margin-top: 2px;
                display: flex;
                gap: 6px;
            }
            .scene-meta b {
                color: var(--accent);
            }

            .scene-actions {
                display: flex;
                gap: 3px;
                flex-shrink: 0;
            }
            .sab {
                background: none;
                border: 1px solid var(--border);
                border-radius: 5px;
                width: 22px;
                height: 22px;
                color: var(--muted);
                cursor: pointer;
                font-size: 11px;
                display: flex;
                align-items: center;
                justify-content: center;
                transition: all 0.15s;
            }
            .sab:hover {
                background: rgba(255, 255, 255, 0.05);
                color: var(--text);
            }
            .sab.del:hover {
                background: rgba(255, 45, 120, 0.1);
                color: var(--pink);
                border-color: var(--pink);
            }

            .add-scene-btn {
                width: 100%;
                background: linear-gradient(
                    135deg,
                    rgba(33, 212, 253, 0.1),
                    rgba(183, 33, 255, 0.1)
                );
                border: 1px solid rgba(255, 255, 255, 0.15);
                color: var(--text);
                font-family: "Plus Jakarta Sans", sans-serif;
                font-size: 12px;
                font-weight: 700;
                padding: 12px;
                border-radius: 16px;
                cursor: pointer;
                display: flex;
                align-items: center;
                justify-content: center;
                gap: 8px;
                transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
                box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
            }
            .add-scene-btn:hover {
                background: linear-gradient(
                    135deg,
                    rgba(33, 212, 253, 0.2),
                    rgba(183, 33, 255, 0.2)
                );
                border-color: var(--cyan);
                box-shadow:
                    0 0 20px var(--cyan-glow),
                    0 0 40px var(--accent-glow);
                transform: translateY(-2px);
            }

            /* Templates grid */
            .tpl-grid {
                display: grid;
                grid-template-columns: 1fr 1fr;
                gap: 5px;
            }
            .tpl-btn {
                background: rgba(255, 255, 255, 0.02);
                border: 1px solid var(--border);
                border-radius: 10px;
                padding: 9px 8px;
                cursor: pointer;
                text-align: left;
                transition: all 0.2s;
                position: relative;
                overflow: hidden;
            }
            .tpl-btn::after {
                content: "";
                position: absolute;
                top: -30px;
                right: -30px;
                width: 70px;
                height: 70px;
                border-radius: 50%;
                transition: all 0.3s;
                opacity: 0;
            }
            .tpl-btn:hover::after {
                opacity: 1;
            }
            .tpl-btn.t1::after {
                background: radial-gradient(
                    circle,
                    rgba(99, 102, 241, 0.15),
                    transparent
                );
            }
            .tpl-btn.t2::after {
                background: radial-gradient(
                    circle,
                    rgba(0, 212, 255, 0.15),
                    transparent
                );
            }
            .tpl-btn.t3::after {
                background: radial-gradient(
                    circle,
                    rgba(255, 45, 120, 0.15),
                    transparent
                );
            }
            .tpl-btn.t4::after {
                background: radial-gradient(
                    circle,
                    rgba(245, 166, 35, 0.15),
                    transparent
                );
            }
            .tpl-btn.t5::after {
                background: radial-gradient(
                    circle,
                    rgba(220, 20, 60, 0.18),
                    transparent
                );
            }
            .tpl-btn:hover {
                border-color: rgba(99, 102, 241, 0.3);
                transform: translateY(-1px);
            }
            .tpl-name {
                font-size: 10px;
                font-weight: 800;
                color: var(--text);
                font-family: "Syne", sans-serif;
            }
            .tpl-desc {
                font-size: 8.5px;
                color: var(--muted);
                margin-top: 2px;
                font-family: "JetBrains Mono", monospace;
                line-height: 1.4;
            }

            /* Segmented alignment buttons */
            .align-btn-group {
                display: flex;
                background: #06060c;
                border: 1px solid var(--border);
                border-radius: 6px;
                padding: 2px;
                margin-top: 5px;
                margin-bottom: 8px;
                gap: 2px;
                width: 100%;
                box-sizing: border-box;
            }
            .align-btn {
                flex: 1;
                background: transparent;
                border: none;
                border-radius: 4px;
                padding: 4px 6px;
                color: var(--muted);
                font-size: 9px;
                font-weight: 700;
                cursor: pointer;
                font-family: "Space Grotesk", sans-serif;
                transition: all 0.2s;
                display: flex;
                align-items: center;
                justify-content: center;
                gap: 4px;
            }
            .align-btn:hover {
                color: var(--text);
                background: rgba(255, 255, 255, 0.03);
            }
            .align-btn.active {
                background: rgba(0, 212, 255, 0.08);
                color: var(--cyan);
                box-shadow: 0 0 8px rgba(0, 212, 255, 0.1);
            }

            /* Input header row with alignment buttons */
            .input-header-row {
                display: flex;
                justify-content: space-between;
                align-items: center;
                margin-bottom: 3px;
            }
            .input-header-row label {
                margin: 0 !important;
            }
            .txt-align-control {
                display: flex;
                background: #08080f;
                border: 1px solid var(--border);
                border-radius: 4px;
                padding: 1px;
                gap: 1px;
            }
            .align-icon-btn {
                background: transparent;
                border: none;
                border-radius: 3px;
                width: 18px;
                height: 16px;
                display: flex;
                align-items: center;
                justify-content: center;
                color: var(--muted);
                font-size: 10px;
                cursor: pointer;
                transition: all 0.2s;
                padding: 0;
            }
            .align-icon-btn:hover {
                color: var(--text);
                background: rgba(255, 255, 255, 0.04);
            }
            .align-icon-btn.active {
                background: rgba(0, 212, 255, 0.1);
                color: var(--cyan);
            }

            /* Style picker grid */
            .style-grid {
                display: grid;
                grid-template-columns: 1fr 1fr;
                gap: 4px;
            }
            .style-btn {
                background: #08080f;
                border: 1px solid var(--border);
                border-radius: 8px;
                padding: 7px 8px;
                cursor: pointer;
                font-family: "Plus Jakarta Sans", sans-serif;
                font-size: 9.5px;
                font-weight: 700;
                color: var(--muted);
                text-align: left;
                display: flex;
                align-items: center;
                gap: 5px;
                transition: all 0.2s;
                white-space: nowrap;
                overflow: hidden;
            }
            .txt-btn,
            .sub-btn {
                background: #08080f;
                border: 1px solid var(--border);
                border-radius: 8px;
                padding: 7px 8px;
                cursor: pointer;
                color: var(--muted);
                font-size: 9px;
                font-weight: 600;
                text-align: center;
                font-family: "Space Grotesk", sans-serif;
                transition: all 0.2s;
                white-space: nowrap;
                overflow: hidden;
            }
            .txt-btn:hover,
            .sub-btn:hover {
                color: var(--text);
                border-color: #303055;
            }
            .txt-btn.active {
                background: rgba(0, 212, 255, 0.07);
                border-color: var(--cyan);
                color: var(--cyan);
                box-shadow: 0 0 10px rgba(0, 212, 255, 0.1);
            }
            .sub-btn.active {
                background: rgba(165, 180, 252, 0.07);
                border-color: #a5b4fc;
                color: #a5b4fc;
                box-shadow: 0 0 10px rgba(165, 180, 252, 0.1);
            }
            .drag-toggle-btn {
                background: #0a0a14;
                border: 1px solid var(--border);
                border-radius: 6px;
                padding: 4px 9px;
                cursor: pointer;
                color: var(--muted);
                font-size: 9px;
                font-weight: 700;
                font-family: "Space Grotesk", sans-serif;
                transition: all 0.2s;
                white-space: nowrap;
            }
            .drag-toggle-btn:hover {
                color: var(--text);
                border-color: #303055;
            }
            .drag-toggle-btn.active {
                background: rgba(99, 102, 241, 0.1);
                border-color: var(--accent);
                color: var(--accent);
            }
            #txtDragOverlay {
                display: none;
                position: absolute;
                left: 0;
                top: 0;
                pointer-events: none;
                z-index: 30;
            }
            #txtDragOverlay.active {
                pointer-events: auto;
            }
            .drag-handle {
                position: absolute;
                transform: translate(-50%, -50%);
                width: 30px;
                height: 30px;
                border-radius: 50%;
                border: 2px solid;
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 11px;
                font-weight: 800;
                font-family: "JetBrains Mono", monospace;
                user-select: none;
                transition:
                    box-shadow 0.15s,
                    transform 0.1s;
                box-shadow: 0 0 8px currentColor;
            }
            .drag-handle:hover {
                transform: translate(-50%, -50%) scale(1.2);
                box-shadow: 0 0 16px currentColor;
            }
            .drag-handle-label {
                position: absolute;
                top: -18px;
                left: 50%;
                transform: translateX(-50%);
                font-size: 8px;
                white-space: nowrap;
                background: #000a;
                padding: 1px 5px;
                border-radius: 3px;
                pointer-events: none;
            }
            .cat-tabs {
                display: flex;
                gap: 5px;
                margin-bottom: 8px;
                overflow-x: auto;
                padding-bottom: 5px;
                scrollbar-width: none;
            }
            .cat-tabs::-webkit-scrollbar {
                display: none;
            }
            .cat-btn {
                background: #08080f;
                border: 1px solid var(--border);
                border-radius: 12px;
                padding: 4px 10px;
                cursor: pointer;
                color: var(--muted);
                font-size: 10px;
                font-weight: 600;
                white-space: nowrap;
                transition: all 0.2s;
            }
            .cat-btn:hover {
                color: var(--text);
                border-color: #303055;
            }
            .cat-btn.active {
                background: rgba(99, 102, 241, 0.1);
                border-color: var(--accent);
                color: var(--accent);
            }
            .el-card-btn {
                position: relative;
                border: 1px solid var(--border);
                border-radius: 8px;
                background: #08080f;
                cursor: pointer;
                padding: 0;
                overflow: hidden;
                display: flex;
                flex-direction: column;
                align-items: center;
                transition:
                    border-color 0.2s,
                    box-shadow 0.2s;
                user-select: none;
            }
            .el-card-btn:hover {
                border-color: #6366f1;
                box-shadow: 0 0 12px rgba(99, 102, 241, 0.25);
            }
            .el-card-btn.active {
                border-color: var(--accent);
                box-shadow: 0 0 14px rgba(99, 102, 241, 0.4);
                background: rgba(99, 102, 241, 0.07);
            }
            .el-card-btn canvas {
                display: block;
                border-radius: 7px 7px 0 0;
                width: 100%;
                height: 80px;
                object-fit: cover;
            }
            .el-card-btn .ec-label {
                font-family: "Space Grotesk", sans-serif;
                font-size: 8px;
                font-weight: 700;
                color: var(--muted);
                padding: 3px 4px;
                text-align: center;
                letter-spacing: 0.3px;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                width: 100%;
                box-sizing: border-box;
            }
            .el-card-btn.active .ec-label {
                color: var(--accent);
            }
            .el-card-none {
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 10px;
                color: var(--muted);
                font-family: "Space Grotesk", sans-serif;
                cursor: pointer;
                border: 1px dashed var(--border);
                border-radius: 8px;
                height: 100px;
                transition:
                    border-color 0.2s,
                    color 0.2s;
                grid-column: span 2;
            }
            .el-card-none:hover {
                border-color: #ff4466;
                color: #ff4466;
            }
            .el-card-none.active {
                border-color: #ff4466;
                color: #ff4466;
                background: rgba(255, 68, 102, 0.05);
            }
            .el-align-btn {
                background: #0a0a14;
                border: 1px solid var(--border);
                border-radius: 5px;
                color: var(--muted);
                font-size: 12px;
                padding: 4px;
                cursor: pointer;
                transition: all 0.15s;
                display: flex;
                align-items: center;
                justify-content: center;
            }
            .el-align-btn:hover {
                background: rgba(99, 102, 241, 0.1);
                border-color: var(--accent);
                color: var(--accent);
            }
            .el-btn {
                background: #08080f;
                border: 1px solid var(--border);
                border-radius: 8px;
                padding: 7px 8px;
                cursor: pointer;
                color: var(--muted);
                font-size: 9px;
                font-weight: 600;
                text-align: center;
                font-family: "Space Grotesk", sans-serif;
                transition: all 0.2s;
                white-space: nowrap;
                overflow: hidden;
            }
            .el-btn:hover {
                color: var(--text);
                border-color: #303055;
            }
            .el-btn.active {
                background: rgba(251, 191, 36, 0.08);
                border-color: #f59e0b;
                color: #f59e0b;
                box-shadow: 0 0 10px rgba(251, 191, 36, 0.1);
            }
            #elDataPanel {
                display: flex;
                flex-direction: column;
                gap: 6px;
                margin-top: 2px;
            }
            #elDataPanel .el-data-group {
                display: flex;
                flex-direction: column;
                gap: 3px;
            }
            #elDataPanel label.el-data-lbl {
                font-size: 9px;
                font-weight: 600;
                color: var(--muted);
                text-transform: uppercase;
                letter-spacing: 0.06em;
                margin: 0;
            }
            #elDataPanel input.el-data-inp {
                background: #08080f;
                border: 1px solid var(--border);
                border-radius: 6px;
                padding: 5px 8px;
                color: var(--text);
                font-size: 11px;
                font-family: "Space Grotesk", sans-serif;
                width: 100%;
                box-sizing: border-box;
                transition: border-color 0.2s;
            }
            #elDataPanel input.el-data-inp:focus {
                outline: none;
                border-color: #f59e0b;
            }
            #elDataPanel .el-data-title {
                font-size: 9px;
                font-weight: 700;
                color: #f59e0b;
                text-transform: uppercase;
                letter-spacing: 0.08em;
                padding: 4px 0 2px;
                border-bottom: 1px solid rgba(245, 158, 11, 0.18);
                margin-bottom: 2px;
            }
            .style-btn:hover {
                color: var(--text);
                border-color: #303055;
            }
            .style-btn.active {
                background: rgba(99, 102, 241, 0.08);
                border-color: var(--accent);
                color: var(--accent);
                box-shadow: 0 0 10px rgba(99, 102, 241, 0.12);
            }
            .style-icon {
                font-size: 12px;
                flex-shrink: 0;
            }

            /* Color pickers */
            .color-row {
                display: flex;
                gap: 5px;
                margin-top: 4px;
            }
            .color-chip {
                flex: 1;
                background: #08080f;
                border: 1px solid var(--border);
                border-radius: 8px;
                padding: 6px 8px;
                display: flex;
                align-items: center;
                gap: 6px;
                cursor: pointer;
                transition: all 0.15s;
            }
            .color-chip:hover {
                border-color: #303055;
            }
            input[type="color"] {
                -webkit-appearance: none;
                appearance: none;
                border: none;
                width: 18px;
                height: 18px;
                border-radius: 4px;
                cursor: pointer;
                background: none;
                flex-shrink: 0;
            }
            input[type="color"]::-webkit-color-swatch {
                border: 1px solid rgba(255, 255, 255, 0.15);
                border-radius: 3px;
            }
            .clabel {
                font-size: 9px;
                font-weight: 700;
                color: var(--muted);
                font-family: "JetBrains Mono", monospace;
            }

            /* Range inputs */
            .range-row {
                display: flex;
                align-items: center;
                gap: 8px;
            }
            input[type="range"] {
                -webkit-appearance: none;
                appearance: none;
                flex: 1;
                background: #0f0f1e;
                height: 3px;
                border-radius: 2px;
                outline: none;
                accent-color: var(--accent);
            }
            input[type="range"]::-webkit-slider-thumb {
                -webkit-appearance: none;
                width: 13px;
                height: 13px;
                border-radius: 50%;
                background: var(--accent);
                cursor: pointer;
                box-shadow: 0 0 8px var(--accent-glow);
                transition: transform 0.15s;
            }
            input[type="range"]::-webkit-slider-thumb:hover {
                transform: scale(1.3);
            }
            .rval {
                font-family: "JetBrains Mono", monospace;
                font-size: 10px;
                color: var(--cyan);
                min-width: 34px;
                text-align: right;
                font-weight: 700;
            }

            /* Aspect buttons */
            .asp-row {
                display: flex;
                gap: 5px;
            }
            .asp-btn {
                flex: 1;
                background: #08080f;
                border: 1px solid var(--border);
                border-radius: 9px;
                padding: 7px 5px;
                font-family: "JetBrains Mono", monospace;
                font-size: 9px;
                font-weight: 700;
                color: var(--muted);
                cursor: pointer;
                transition: all 0.2s;
                display: flex;
                flex-direction: column;
                align-items: center;
                gap: 3px;
            }
            .asp-btn.active {
                border-color: var(--accent);
                color: var(--accent);
                background: rgba(99, 102, 241, 0.06);
                box-shadow: 0 0 10px var(--accent-glow);
            }
            .asp-btn .asp-icon {
                font-size: 14px;
            }

            /* ── MAIN AREA ─────────────────────────────────── */
            .main {
                flex: 1;
                display: flex;
                flex-direction: column;
                min-height: 0;
                background: transparent;
                padding: 12px;
                overflow-y: auto;
                overflow-x: hidden;
                position: relative;
                z-index: 5;
            }

            /* Removed old floating grid for cleaner look */

            /* Orientation / mode bar */
            .top-controls {
                width: 100%;
                max-width: 680px;
                display: flex;
                align-items: center;
                justify-content: space-between;
                margin-bottom: 10px;
                position: relative;
                z-index: 1;
                gap: 10px;
                flex-wrap: wrap;
            }

            /* Preview canvas container */
            .canvas-wrap {
                position: relative;
                z-index: 1;
                flex-shrink: 0;
            }

            .phone-frame {
                border: 10px solid #0f0f1e;
                border-radius: 32px;
                box-shadow:
                    0 0 0 1px rgba(255, 255, 255, 0.06),
                    0 30px 80px -20px rgba(0, 0, 0, 0.9),
                    0 0 60px rgba(99, 102, 241, 0.08);
                background: #000;
                position: relative;
                overflow: hidden;
            }
            .phone-frame::before {
                content: "";
                position: absolute;
                top: 0;
                left: 50%;
                transform: translateX(-50%);
                width: 80px;
                height: 12px;
                background: #0f0f1e;
                border-bottom-left-radius: 8px;
                border-bottom-right-radius: 8px;
                z-index: 10;
            }

            .monitor-frame {
                border: 12px solid #0f0f1e;
                border-radius: 10px;
                border-bottom-width: 20px;
                box-shadow:
                    0 30px 80px -20px rgba(0, 0, 0, 0.9),
                    0 0 0 1px rgba(255, 255, 255, 0.04);
                background: #000;
            }

            .square-frame {
                border: 8px solid #0f0f1e;
                border-radius: 14px;
                box-shadow:
                    0 25px 70px -15px rgba(0, 0, 0, 0.9),
                    0 0 0 1px rgba(255, 255, 255, 0.04);
                background: #000;
            }

            canvas {
                display: block;
            }

            /* Mode pills */
            .mode-pills {
                display: flex;
                background: #06060c;
                border: 1px solid var(--border);
                border-radius: 22px;
                padding: 3px;
                box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
            }
            .mpill {
                background: none;
                border: none;
                font-family: "Space Grotesk", sans-serif;
                font-size: 10px;
                font-weight: 700;
                padding: 6px 14px;
                border-radius: 18px;
                cursor: pointer;
                transition: all 0.2s;
                display: flex;
                align-items: center;
                gap: 5px;
                color: var(--muted);
            }
            .mpill.active {
                background: var(--accent);
                color: #fff;
                box-shadow: 0 0 12px var(--accent-glow);
            }

            /* ── TIMELINE ─────────────────────────────────── */
            .timeline-bar {
                width: 100%;
                max-width: 680px;
                background: var(--surface);
                border: 1px solid var(--border);
                border-radius: 14px;
                padding: 10px 14px;
                margin-top: 10px;
                box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
                position: relative;
                z-index: 1;
            }

            .tl-header {
                display: flex;
                justify-content: space-between;
                align-items: center;
                margin-bottom: 8px;
            }
            .tl-time {
                font-family: "JetBrains Mono", monospace;
                font-size: 10px;
                color: var(--muted);
            }
            .tl-time b {
                color: var(--cyan);
            }

            .tl-tracks {
                position: relative;
                height: 40px;
                border: 1px solid var(--border);
                border-radius: 8px;
                background: #040408;
                overflow: hidden;
                display: flex;
                margin-bottom: 8px;
            }
            .tl-range {
                position: absolute;
                inset: 0;
                width: 100%;
                height: 100%;
                opacity: 0;
                z-index: 5;
                cursor: ew-resize;
                margin: 0;
            }
            .tl-playhead {
                position: absolute;
                top: 0;
                bottom: 0;
                width: 2px;
                background: var(--pink);
                box-shadow: 0 0 8px var(--pink-glow);
                left: 0%;
                z-index: 3;
                pointer-events: none;
                transition: none;
            }

            .tl-controls {
                display: flex;
                justify-content: center;
                gap: 8px;
            }
            .ctrl {
                background: rgba(255, 255, 255, 0.02);
                border: 1px solid var(--border);
                border-radius: 7px;
                padding: 5px 11px;
                color: var(--muted);
                font-family: "Plus Jakarta Sans", sans-serif;
                font-size: 10px;
                font-weight: 700;
                cursor: pointer;
                transition: all 0.2s;
                display: flex;
                align-items: center;
                gap: 5px;
            }
            .ctrl:hover {
                border-color: #303055;
                color: var(--text);
            }
            .ctrl.active {
                border-color: var(--accent);
                color: var(--accent);
                background: rgba(99, 102, 241, 0.06);
            }

            /* ── CAPCUT-STYLE MULTI-TRACK TIMELINE ───────── */
            .tl-grid {
                display: grid;
                grid-template-columns: 110px 1fr;
                border: 1px solid var(--border);
                border-radius: 10px;
                background: #040408;
                overflow: hidden;
                position: relative;
            }

            .tl-headers-col {
                border-right: 1px solid var(--border);
                display: flex;
                flex-direction: column;
                background: #06060c;
                z-index: 2;
            }

            .tl-track-header {
                height: 32px;
                display: flex;
                align-items: center;
                padding: 0 8px;
                font-family: "Space Grotesk", sans-serif;
                font-size: 9px;
                font-weight: 700;
                color: var(--muted);
                border-bottom: 1px solid rgba(255, 255, 255, 0.03);
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                box-sizing: border-box;
            }

            .tl-track-header.active {
                color: var(--accent);
                background: rgba(99, 102, 241, 0.04);
            }

            .tl-lanes-col {
                display: flex;
                flex-direction: column;
                position: relative;
                overflow-x: auto;
                overflow-y: hidden;
                background: #020205;
            }

            .tl-ruler {
                height: 20px;
                border-bottom: 1px solid rgba(255, 255, 255, 0.05);
                position: relative;
                background: #04040a;
                user-select: none;
                cursor: ew-resize;
                box-sizing: border-box;
            }

            .tl-tick {
                position: absolute;
                bottom: 0;
                font-family: "JetBrains Mono", monospace;
                font-size: 7px;
                color: rgba(255, 255, 255, 0.25);
                transform: translateX(-50%);
                display: flex;
                flex-direction: column;
                align-items: center;
                gap: 2px;
            }

            .tl-tick::after {
                content: "";
                width: 1px;
                height: 4px;
                background: rgba(255, 255, 255, 0.15);
            }

            .tl-lane {
                height: 32px;
                position: relative;
                border-bottom: 1px solid rgba(255, 255, 255, 0.03);
                box-sizing: border-box;
                display: flex;
                align-items: center;
            }

            .tl-clip {
                position: absolute;
                height: 22px;
                border-radius: 6px;
                display: flex;
                align-items: center;
                justify-content: space-between;
                padding: 0 4px;
                cursor: grab;
                font-family: "JetBrains Mono", monospace;
                font-size: 8px;
                font-weight: 700;
                color: #fff;
                box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
                border: 1px solid rgba(255, 255, 255, 0.1);
                user-select: none;
                transition:
                    border-color 0.2s,
                    box-shadow 0.2s;
                box-sizing: border-box;
            }

            .tl-clip:active {
                cursor: grabbing;
            }

            .tl-clip.selected {
                border-color: #fff;
                box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
            }

            .tl-clip-video {
                background: linear-gradient(90deg, #1e1b4b, #312e81);
                color: rgba(255, 255, 255, 0.85);
                border: 1px dashed rgba(255, 255, 255, 0.15);
            }

            .tl-clip-headline {
                background: linear-gradient(90deg, #4338ca, #4f46e5);
            }

            .tl-clip-subtext {
                background: linear-gradient(90deg, #0e7490, #0891b2);
            }

            .tl-clip-tag {
                background: linear-gradient(90deg, #047857, #059669);
            }

            .tl-clip-element {
                background: linear-gradient(90deg, #b45309, #d97706);
            }

            .tl-clip-body {
                flex: 1;
                height: 100%;
                display: flex;
                align-items: center;
                justify-content: center;
                gap: 3px;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                padding: 0 4px;
            }

            .tl-trim-handle {
                width: 6px;
                height: 14px;
                background: rgba(255, 255, 255, 0.25);
                border-radius: 1.5px;
                cursor: ew-resize;
                display: flex;
                align-items: center;
                justify-content: center;
                transition: background 0.2s;
                box-sizing: border-box;
            }

            .tl-trim-handle:hover {
                background: rgba(255, 255, 255, 0.8);
            }

            .tl-trim-handle::after {
                content: ":";
                font-size: 6px;
                color: rgba(0, 0, 0, 0.5);
                font-weight: bold;
            }

            .tl-playhead-line {
                position: absolute;
                top: 0;
                bottom: 0;
                width: 2px;
                background: var(--pink);
                box-shadow: 0 0 8px var(--pink-glow);
                pointer-events: none;
                z-index: 10;
                transform: translateX(-1px);
                transition: none;
            }

            .tl-playhead-cap {
                position: absolute;
                top: 0;
                width: 10px;
                height: 10px;
                background: var(--pink);
                border-radius: 50%;
                box-shadow: 0 0 6px var(--pink-glow);
                transform: translate(-50%, -50%);
            }

            /* ── EXPORT ─────────────────────────────────── */
            .export-panel {
                width: 100%;
                max-width: 680px;
                margin-top: 8px;
                background: rgba(9, 9, 15, 0.95);
                border: 1px solid var(--border);
                border-radius: 14px;
                padding: 12px 14px;
                position: relative;
                z-index: 1;
            }
            .exp-header {
                font-family: "Space Grotesk", sans-serif;
                font-size: 10px;
                font-weight: 700;
                letter-spacing: 1.5px;
                text-transform: uppercase;
                color: var(--muted);
                margin-bottom: 10px;
            }
            .exp-opts {
                display: flex;
                gap: 6px;
                margin-bottom: 10px;
                flex-wrap: wrap;
            }
            .exp-opt {
                flex: 1;
                min-width: 80px;
            }
            .exp-opt label {
                margin-top: 0;
            }

            .exp-btns {
                display: flex;
                gap: 6px;
                flex-wrap: wrap;
            }
            .ebtn {
                flex: 1;
                min-width: 100px;
                background: rgba(255, 255, 255, 0.02);
                border: 1px solid var(--border);
                border-radius: 10px;
                padding: 9px 12px;
                color: var(--text);
                font-family: "Plus Jakarta Sans", sans-serif;
                font-size: 10px;
                font-weight: 700;
                cursor: pointer;
                transition: all 0.2s;
                display: flex;
                align-items: center;
                justify-content: center;
                gap: 6px;
                white-space: nowrap;
            }
            .ebtn:hover {
                border-color: var(--muted);
                box-shadow: 0 0 10px rgba(255, 255, 255, 0.05);
            }
            .ebtn:disabled {
                opacity: 0.2;
                cursor: not-allowed;
            }
            .ebtn.green {
                background: rgba(16, 185, 129, 0.06);
                border-color: rgba(16, 185, 129, 0.3);
                color: var(--success);
            }
            .ebtn.green:hover {
                background: rgba(16, 185, 129, 0.12);
                box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
            }
            .ebtn.red {
                background: rgba(255, 45, 120, 0.06);
                border-color: rgba(255, 45, 120, 0.3);
                color: var(--pink);
            }
            .ebtn.red:hover {
                background: rgba(255, 45, 120, 0.12);
                box-shadow: 0 0 12px var(--pink-glow);
            }
            .ebtn.blue {
                background: rgba(99, 102, 241, 0.06);
                border-color: rgba(99, 102, 241, 0.3);
                color: var(--accent);
            }
            .ebtn.blue:hover {
                background: rgba(99, 102, 241, 0.12);
                box-shadow: 0 0 12px var(--accent-glow);
            }

            /* ── RIGHT PANEL ─────────────────────────────────── */
            .panel-right {
                width: 300px;
                min-width: 300px;
                background: var(--surface);
                backdrop-filter: blur(30px);
                -webkit-backdrop-filter: blur(30px);
                border: 1px solid var(--border);
                border-radius: 24px;
                margin: 0 16px 16px 16px;
                display: flex;
                flex-direction: column;
                overflow: hidden;
                box-shadow:
                    0 20px 40px rgba(0, 0, 0, 0.4),
                    inset 0 1px 1px rgba(255, 255, 255, 0.1);
                position: relative;
                z-index: 10;
            }

            /* ── PROGRESS OVERLAY ─────────────────────────────── */
            #progressOverlay {
                display: none;
                position: fixed;
                inset: 0;
                background: rgba(3, 3, 5, 0.95);
                backdrop-filter: blur(12px);
                z-index: 999;
                align-items: center;
                justify-content: center;
            }
            #progressOverlay.show {
                display: flex;
            }
            .prog-box {
                background: var(--surface);
                border: 1px solid rgba(99, 102, 241, 0.2);
                border-radius: 20px;
                padding: 28px;
                text-align: center;
                min-width: 340px;
                box-shadow: 0 0 60px rgba(99, 102, 241, 0.15);
            }
            .prog-title {
                font-family: "Syne", sans-serif;
                font-size: 16px;
                font-weight: 800;
                margin-bottom: 6px;
            }
            .prog-sub {
                font-family: "JetBrains Mono", monospace;
                font-size: 10px;
                color: var(--muted);
                margin-bottom: 20px;
                min-height: 16px;
            }
            .prog-bar-wrap {
                width: 100%;
                height: 4px;
                background: #07070b;
                border-radius: 2px;
                overflow: hidden;
            }
            .prog-bar {
                height: 100%;
                background: linear-gradient(90deg, var(--accent), var(--cyan));
                width: 0%;
                transition: width 0.08s linear;
                box-shadow: 0 0 8px var(--accent-glow);
            }
            .prog-pct {
                font-family: "JetBrains Mono", monospace;
                font-size: 14px;
                color: var(--accent);
                margin-top: 10px;
                font-weight: 700;
            }
            .prog-cancel {
                margin-top: 16px;
                background: none;
                border: 1px solid var(--border);
                border-radius: 8px;
                padding: 7px 18px;
                color: var(--muted);
                font-family: "Plus Jakarta Sans", sans-serif;
                font-size: 11px;
                cursor: pointer;
                transition: all 0.2s;
            }
            .prog-cancel:hover {
                color: #fff;
                border-color: #555;
            }

            /* ── TRANSITION GRID ─────────────────────────────── */
            .trans-grid {
                display: grid;
                grid-template-columns: repeat(3, 1fr);
                gap: 5px;
                margin-top: 4px;
                max-height: 360px;
                overflow-y: auto;
                overflow-x: hidden;
            }
            .trans-cat {
                grid-column: 1/-1;
                font-size: 8px;
                font-weight: 800;
                font-family: "Space Grotesk", sans-serif;
                color: #8b8bac;
                letter-spacing: 0.8px;
                text-transform: uppercase;
                padding: 7px 2px 1px;
            }
            .trans-card {
                background: #08080f;
                border: 1px solid var(--border);
                border-radius: 9px;
                padding: 0;
                cursor: pointer;
                transition: all 0.2s;
                overflow: hidden;
                position: relative;
                display: flex;
                flex-direction: column;
                align-items: center;
            }
            .trans-card:hover {
                border-color: #303055;
                transform: translateY(-1px);
            }
            .trans-card.active {
                border-color: var(--accent);
                box-shadow: 0 0 10px rgba(99, 102, 241, 0.25);
            }
            .trans-preview {
                width: 100%;
                height: 44px;
                position: relative;
                overflow: hidden;
                background: #04040a;
            }
            .trans-preview canvas {
                width: 100%;
                height: 100%;
                display: block;
            }
            .trans-name {
                font-size: 8px;
                font-weight: 700;
                font-family: "JetBrains Mono", monospace;
                color: var(--muted);
                padding: 4px 4px 5px;
                text-align: center;
                line-height: 1.2;
            }
            .trans-card.active .trans-name {
                color: var(--accent);
            }

            /* ── ANIMATION GRID & CARDS ─────────────────────────── */
            .anim-grid {
                display: grid;
                grid-template-columns: repeat(3, 1fr);
                gap: 4px;
                margin-top: 6px;
                max-height: 125px;
                overflow-y: auto;
                overflow-x: hidden;
                padding: 3px;
                background: #04040a;
                border: 1px solid var(--border);
                border-radius: 6px;
            }
            .anim-card {
                background: #08080f;
                border: 1px solid var(--border);
                border-radius: 6px;
                padding: 6px 3px;
                cursor: pointer;
                transition: all 0.2s;
                display: flex;
                flex-direction: column;
                align-items: center;
                justify-content: center;
                position: relative;
                user-select: none;
            }
            .anim-card:hover {
                border-color: #f59e0b66;
                background: #121224;
                transform: translateY(-1px);
            }
            .anim-card.active {
                border-color: var(--accent);
                background: rgba(99, 102, 241, 0.18);
                box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
            }
            .anim-icon {
                font-size: 13px;
                margin-bottom: 2px;
            }
            .anim-name {
                font-size: 7.5px;
                font-weight: 700;
                font-family: "Space Grotesk", sans-serif;
                color: var(--muted);
                text-align: center;
                line-height: 1.1;
                word-break: break-word;
            }
            .anim-card.active .anim-name {
                color: #fff;
            }

            /* ── TEXT STYLE OPTIONS ─────────────────────────────── */
            .text-opts {
                display: flex;
                flex-direction: column;
                gap: 5px;
                background: #08080f;
                border: 1px solid var(--border);
                border-radius: 8px;
                padding: 8px;
                margin-top: 4px;
                margin-bottom: 6px;
            }
            .text-opts-row {
                display: flex;
                align-items: center;
                gap: 6px;
                flex-wrap: wrap;
            }
            .text-opt-select {
                flex: 1;
                background: #04040a;
                border: 1px solid var(--border);
                border-radius: 6px;
                color: var(--text);
                font-family: "JetBrains Mono", monospace;
                font-size: 9px;
                font-weight: 700;
                padding: 4px 6px;
                outline: none;
                cursor: pointer;
            }
            .text-opt-select:focus {
                border-color: var(--accent);
            }
            .font-picker {
                position: relative;
                width: 100%;
            }
            .text-opts-row .font-picker {
                flex: 0 0 100%;
            }
            .font-picker-btn {
                width: 100%;
                height: 34px;
                background: #04040a;
                border: 1px solid var(--border);
                border-radius: 7px;
                color: var(--text);
                display: flex;
                align-items: center;
                justify-content: space-between;
                gap: 8px;
                padding: 0 9px;
                cursor: pointer;
                transition: all 0.2s;
                overflow: hidden;
            }
            .font-picker-btn:hover,
            .font-picker.open .font-picker-btn {
                border-color: var(--accent);
                box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
            }
            .font-picker-name {
                min-width: 0;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                font-size: 13px;
                line-height: 1;
                font-weight: 700;
            }
            .font-picker-meta {
                flex: 0 0 auto;
                font-family: "JetBrains Mono", monospace;
                font-size: 8px;
                color: var(--muted);
                text-transform: uppercase;
                letter-spacing: 0.5px;
            }
            .font-picker-panel {
                position: absolute;
                left: 0;
                right: auto;
                top: calc(100% + 5px);
                z-index: 60;
                width: 100%;
                min-width: 0;
                max-height: 255px;
                overflow-y: auto;
                background: #070711;
                border: 1px solid rgba(99, 102, 241, 0.24);
                border-radius: 9px;
                box-shadow:
                    0 18px 45px rgba(0, 0, 0, 0.55),
                    0 0 0 1px rgba(255, 255, 255, 0.03);
                padding: 5px;
                display: none;
            }
            .font-picker.open .font-picker-panel {
                display: block;
            }
            .font-picker-option {
                min-height: 54px;
                padding: 9px 10px;
                border-radius: 7px;
                cursor: pointer;
                display: flex;
                flex-direction: column;
                align-items: flex-start;
                justify-content: center;
                gap: 4px;
                color: var(--text);
                transition:
                    background 0.15s,
                    border-color 0.15s;
                border: 1px solid transparent;
            }
            .font-picker-option:hover {
                background: #101020;
                border-color: rgba(255, 255, 255, 0.06);
            }
            .font-picker-option.active {
                background: rgba(99, 102, 241, 0.15);
                border-color: rgba(99, 102, 241, 0.35);
            }
            .font-picker-sample {
                width: 100%;
                min-width: 0;
                font-size: 20px;
                line-height: 1.05;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }
            .font-picker-label {
                width: 100%;
                font-family: "JetBrains Mono", monospace;
                font-size: 8px;
                color: var(--muted);
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }
            .text-size-row {
                display: flex;
                align-items: center;
                gap: 5px;
            }
            .text-size-row span {
                font-size: 8px;
                color: var(--muted);
                white-space: nowrap;
            }
            .text-size-row input[type="range"] {
                flex: 1;
            }
            .clabel-sm {
                font-size: 8px;
                color: var(--muted);
                font-weight: 700;
                letter-spacing: 0.5px;
                font-family: "JetBrains Mono", monospace;
            }

            /* Sidebar Accordion Styles */
            .sidebar-accordion {
                border-bottom: 1px solid var(--border);
            }
            .accordion-header {
                display: flex;
                justify-content: space-between;
                align-items: center;
                padding: 12px 14px;
                background: rgba(255, 255, 255, 0.01);
                cursor: pointer;
                user-select: none;
                transition: background 0.2s;
            }
            .accordion-header:hover {
                background: rgba(255, 255, 255, 0.03);
            }
            .accordion-header h3 {
                font-family: "Space Grotesk", sans-serif;
                font-size: 11px;
                font-weight: 700;
                letter-spacing: 1px;
                text-transform: uppercase;
                color: var(--text);
                display: flex;
                align-items: center;
                gap: 8px;
                margin: 0;
            }
            .accordion-header .arrow {
                font-size: 10px;
                color: var(--muted);
                transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            }
            .accordion-body {
                max-height: 0;
                overflow: hidden;
                transition:
                    max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                    padding 0.3s ease;
                padding: 0 14px;
            }
            .sidebar-accordion.expanded .accordion-body {
                max-height: 80vh;
                padding: 12px 14px;
                overflow-y: auto;
            }
            .sidebar-accordion.expanded .accordion-header {
                background: rgba(255, 255, 255, 0.02);
                border-bottom: 1px solid rgba(255, 255, 255, 0.03);
            }
            .sidebar-accordion.expanded .accordion-header .arrow {
                transform: rotate(90deg);
                color: var(--accent);
            }

