        :root {
            --bg-dark: #090d16;
            --panel-bg: #0f172a;
            --card-bg: #1e293b;
            --card-bg-light: #334155;
            --accent: #6366f1;
            --accent-hover: #4f46e5;
            --text-main: #f8fafc;
            --text-muted: #94a3b8;
            --border-color: #1e293b;
            --border-light: #334155;
        }

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

        html, body {
            width: 100%;
            height: 100%;
            overflow: hidden;
            font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            background-color: var(--bg-dark);
            color: var(--text-main);
            user-select: none;
        }

        body {
            display: flex;
            flex-direction: column;
        }

        /* HEADER */
        header {
            background-color: var(--panel-bg);
            border-bottom: 1px solid var(--border-color);
            padding: 8px 16px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            z-index: 20;
            flex-shrink: 0;
        }

        .header-brand {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .brand-icon {
            width: 32px;
            height: 32px;
            border-radius: 8px;
            background: var(--accent);
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
        }

        .brand-title h1 {
            font-size: 15px;
            font-weight: 700;
            background: linear-gradient(135deg, #818cf8, #f472b6);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            line-height: 1.2;
        }

        .brand-title p {
            font-size: 10px;
            color: var(--text-muted);
        }

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

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

        /* BUTTONS & INPUTS */
        button, select {
            font-family: inherit;
            font-size: 12px;
            color: var(--text-main);
            background-color: var(--card-bg);
            border: 1px solid var(--border-light);
            border-radius: 6px;
            padding: 6px 12px;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            transition: all 0.15s ease;
        }

        button:hover, select:hover {
            background-color: var(--card-bg-light);
        }

        button.btn-accent {
            background-color: var(--accent);
            border-color: var(--accent);
            font-weight: 500;
        }

        button.btn-accent:hover {
            background-color: var(--accent-hover);
        }

        button.btn-success {
            background-color: #059669;
            border-color: #059669;
            font-weight: 500;
        }

        button.btn-success:hover {
            background-color: #10b981;
        }

        button.btn-icon {
            padding: 6px;
            width: 28px;
            height: 28px;
            justify-content: center;
        }

        select {
            outline: none;
            cursor: pointer;
        }

        input[type="number"] {
            background-color: var(--panel-bg);
            border: 1px solid var(--border-light);
            color: #818cf8;
            border-radius: 4px;
            padding: 2px 6px;
            font-family: monospace;
            font-size: 12px;
            width: 50px;
            text-align: right;
        }

        input[type="range"] {
            accent-color: var(--accent);
            height: 4px;
            background: var(--card-bg-light);
            border-radius: 4px;
            cursor: pointer;
        }

        input[type="color"] {
            border: none;
            width: 28px;
            height: 28px;
            border-radius: 4px;
            background: transparent;
            cursor: pointer;
        }



        .project-nav, .morph-library-nav { position: relative; display:inline-flex; }
        .project-menu {
            position:fixed; top:52px; right:12px; min-width:245px; max-width:calc(100vw - 24px); max-height:calc(100vh - 64px); overflow-y:auto; padding:6px;
            background:rgba(15,23,42,.98); border:1px solid var(--border-light); border-radius:9px;
            box-shadow:0 16px 35px rgba(0,0,0,.5); z-index:100; display:flex; flex-direction:column; gap:3px;
        }
        .project-menu.hidden { display:none !important; }
        .project-menu button { width:100%; justify-content:flex-start; border:0; background:transparent; padding:8px 9px; }
        .project-menu button:hover { background:var(--card-bg-light); }
        .menu-separator { height:1px; background:var(--border-light); margin:4px 2px; }
        .project-menu .menu-section-separator { height:0; background:none; border:0; border-top:1px solid rgba(148,163,184,.52); margin:8px 4px; pointer-events:none; }
        .library-modal {
            position:fixed; inset:0; background:rgba(0,0,0,.55); display:flex; align-items:center; justify-content:center;
            z-index:200; padding:18px;
        }
        .library-modal.hidden { display:none !important; }
        .library-card {
            width:min(720px, calc(100vw - 30px)); max-height:min(620px, calc(100vh - 36px));
            background:var(--panel-bg); border:1px solid var(--border-light); border-radius:12px;
            box-shadow:0 24px 60px rgba(0,0,0,.55); display:flex; flex-direction:column; overflow:hidden;
        }
        .library-head { padding:10px 12px; display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid var(--border-color); }
        .library-tabs { display:flex; gap:4px; padding:7px; border-bottom:1px solid var(--border-color); }
        .library-tab { flex:1; justify-content:center; }
        .library-tab.active { background:var(--accent); color:white; border-color:var(--accent); }
        .library-list { overflow:auto; padding:9px; display:flex; flex-direction:column; gap:5px; }
        .library-item { display:flex; align-items:center; gap:8px; padding:8px; background:rgba(30,41,59,.55); border:1px solid var(--border-light); border-radius:7px; }
        .library-item .library-name { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
        .library-item small { color:var(--text-muted); }

        .header-actions { flex-wrap: wrap; justify-content: flex-end; }
        .random-settings-panel { overflow-y: auto; }
        .morph-setting-row label { min-width: 0; }
        .morph-setting-row select { min-width: 0 !important; max-width: 240px; }
        @media (max-width: 1050px) {
            .brand-title p { display:none; }
            .preset-nav select { min-width:145px; }
            aside { width:330px; }
        }
        @media (max-height: 620px) {
            .morph-settings-panel, .random-settings-panel { top: 48px; max-height: calc(100vh - 56px); padding: 7px; }
            .morph-setting-row { min-height: 24px; padding: 3px 6px; }
            .morph-settings-grid { gap: 3px; }
        }
        @media (max-width: 820px) {
            aside { width:300px; }
            .header-actions { gap:4px; }
            .preset-nav select { min-width:120px; max-width:150px; }
            .project-menu, .morph-library-nav .project-menu { right:12px; max-width:calc(100vw - 24px); }
        }

        /* MAIN LAYOUT */
        .app-container {
            flex: 1;
            display: flex;
            overflow: hidden;
            position: relative;
        }

        aside {
            width: 360px;
            background-color: rgba(15, 23, 42, 0.95);
            border-right: 1px solid var(--border-color);
            display: flex;
            flex-direction: column;
            z-index: 10;
            flex-shrink: 0;
            box-shadow: 10px 0 25px rgba(0, 0, 0, 0.5);
        }

        .section-header {
            padding: 10px 12px;
            border-bottom: 1px solid var(--border-color);
            display: flex;
            align-items: center;
            justify-content: space-between;
            background-color: var(--panel-bg);
            font-size: 11px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            color: var(--text-muted);
        }

        .badge {
            background-color: var(--card-bg);
            color: #818cf8;
            font-size: 10px;
            padding: 2px 6px;
            border-radius: 10px;
            font-family: monospace;
        }

        #layerList {
            max-height: 140px;
            overflow-y: auto;
            padding: 8px;
            display: flex;
            flex-direction: column;
            gap: 4px;
            background-color: rgba(9, 13, 22, 0.4);
            border-bottom: 1px solid var(--border-color);
        }

        .layer-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 6px 10px;
            border-radius: 4px;
            font-size: 12px;
            cursor: pointer;
            border: 1px solid var(--border-color);
            background-color: rgba(15, 23, 42, 0.6);
            color: var(--text-muted);
            transition: all 0.15s ease;
        }

        .layer-item.active {
            background-color: rgba(99, 102, 241, 0.15);
            border-color: rgba(99, 102, 241, 0.6);
            color: var(--text-main);
        }

        /* v300 — Shift/Ctrl multi-selection. Active is the editing anchor; the other
           selected layers receive the same edited properties. */
        .layer-item.selected {
            background-color: rgba(14, 165, 233, 0.10);
            border-color: rgba(56, 189, 248, 0.48);
            color: var(--text-main);
        }
        .layer-item.selected.active {
            background-color: rgba(99, 102, 241, 0.22);
            border-color: rgba(129, 140, 248, 0.82);
            box-shadow: inset 3px 0 0 rgba(56, 189, 248, 0.8);
        }

        .sidebar-content {
            flex: 1;
            overflow-y: auto;
            padding: 12px;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .control-group {
            background-color: rgba(30, 41, 59, 0.4);
            border: 1px solid rgba(51, 65, 85, 0.5);
            border-radius: 8px;
            padding: 12px;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .control-group-title {
            font-size: 12px;
            font-weight: 600;
            color: var(--text-main);
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .control-row {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .row-label {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 11px;
            color: var(--text-muted);
        }

        .row-inputs {
            display: flex;
            align-items: center;
            gap: 6px;
            min-width: 0;
            width: 100%;
        }

        .row-inputs input[type="range"] {
            flex: 1 1 auto;
            min-width: 0;
            width: 0;
        }

        .control-row > input[type="range"] {
            width: 100%;
            min-width: 0;
            display: block;
        }

        .chaos-star-toggle-row, .geometry-circles-row {
            border: 1px solid rgba(99,102,241,.26);
            background: rgba(15,23,42,.42);
            border-radius: 7px;
            padding: 8px;
        }
        .chaos-star-head, .geometry-circles-head {
            display:flex; align-items:center; justify-content:space-between; gap:8px;
        }
        .chaos-star-head > label, .geometry-circles-head > label {
            display:flex; align-items:center; gap:7px; cursor:pointer; font-size:11px; color:var(--text-main);
        }
        .chaos-star-head input[type="checkbox"], .geometry-circles-head input[type="checkbox"],
        .geometry-circle-modes input[type="checkbox"] { accent-color: var(--accent); }
        .chaos-star-settings {
            display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; margin-top:8px;
        }
        .chaos-star-settings.hidden, .geometry-circle-modes.hidden { display:none !important; }
        .chaos-star-field {
            display:flex; flex-direction:column; gap:3px; min-width:0; font-size:9px; color:var(--text-muted);
        }
        .chaos-star-field input[type="number"] { width:100% !important; text-align:center; }
        .chaos-regenerate-btn { min-width:30px; width:30px; height:26px; padding:0; justify-content:center; font-size:16px; }
        .geometry-circle-modes {
            margin-top:8px; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:5px;
        }
        .geometry-circle-modes label {
            display:flex; align-items:center; gap:6px; min-width:0; padding:5px 6px; border-radius:5px;
            border:1px solid rgba(51,65,85,.62); background:rgba(30,41,59,.36); font-size:9px; color:var(--text-muted); cursor:pointer;
        }

        .grid-2 {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
        }

        .btn-group-toggle {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            background-color: var(--panel-bg);
            padding: 2px;
            border-radius: 6px;
            border: 1px solid var(--border-light);
        }

        .btn-group-toggle button {
            background: transparent;
            border: none;
            padding: 4px 0;
            font-size: 10px;
            text-align: center;
            border-radius: 4px;
            color: var(--text-muted);
        }

        .btn-group-toggle button.active {
            background-color: var(--accent);
            color: white;
        }

        .profile-canvas-container {
            position: relative;
            background-color: var(--bg-dark);
            border: 1px solid var(--border-light);
            border-radius: 6px;
            overflow: hidden;
        }

        #profileCanvas {
            width: 100%;
            height: 160px;
            display: block;
            cursor: crosshair;
        }

        .profile-overlay-controls {
            position: absolute;
            top: 6px;
            right: 6px;
            display: flex;
            gap: 2px;
            background-color: rgba(15, 23, 42, 0.8);
            padding: 2px;
            border-radius: 4px;
            border: 1px solid var(--border-color);
        }

        .profile-overlay-controls button {
            padding: 2px 6px;
            height: 22px;
            font-size: 10px;
            background: transparent;
            border: none;
        }

        .color-presets {
            display: flex;
            gap: 6px;
            flex-wrap: wrap;
        }

        .color-swatch {
            width: 22px;
            height: 22px;
            border-radius: 50%;
            border: 1px solid var(--border-light);
            cursor: pointer;
            transition: transform 0.1s ease;
        }

        .color-swatch:hover {
            transform: scale(1.15);
        }



        /* PROFILE LIBRARY v94 */
        .profile-library-tabs {
            display:grid;
            grid-template-columns:repeat(4,minmax(0,1fr));
            gap:3px;
            width:100%;
            min-width:0;
            margin-bottom:5px;
        }
        .profile-library-tab {
            min-width:0;
            min-height:30px;
            padding:3px 2px;
            justify-content:center;
            text-align:center;
            white-space:normal;
            line-height:1.05;
            font-size:8.5px;
            color:var(--text-muted);
            background:rgba(15,23,42,.68);
            border-color:var(--border-light);
        }
        .profile-library-tab.active {
            color:#e0f2fe;
            background:rgba(99,102,241,.20);
            border-color:rgba(129,140,248,.62);
            box-shadow:inset 0 0 0 1px rgba(129,140,248,.12);
        }
        #profilePresetSelect {
            transition:background-color .12s ease, border-color .12s ease;
        }

        .profile-spline-render-row {
            margin-top:2px;
            padding:7px 8px;
            border:1px solid rgba(51,65,85,.55);
            border-radius:7px;
            background:rgba(15,23,42,.42);
            display:flex;
            align-items:center;
            gap:7px;
            min-width:0;
        }
        .profile-spline-render-row > span:first-child {
            font-size:10px;
            color:var(--text-muted);
            white-space:nowrap;
        }

        #wholeCurveSplineRow {
            cursor:pointer;
            margin-top:6px;
            gap:9px;
            font-size:12px;
            color:var(--text-main, #cbd5e1);
        }
        #wholeCurveSplineRow input[type="checkbox"] {
            flex:0 0 auto;
            width:16px;
            height:16px;
            accent-color:#ed4899;
        }
        #wholeCurveSplineRow:has(input:disabled) { opacity:.65; }
        .profile-mode-transition-row {
            margin-top:6px;
        }
        .profile-mode-transition-row .profile-spline-render-switch {
            max-width:none;
        }
        .profile-spline-render-switch {
            display:grid;
            grid-template-columns:1fr 1fr;
            gap:2px;
            flex:1 1 auto;
            min-width:0;
            padding:2px;
            border:1px solid var(--border-light);
            border-radius:6px;
            background:rgba(15,23,42,.58);
        }
        .profile-spline-render-switch button {
            min-width:0;
            padding:4px 5px;
            justify-content:center;
            border:0;
            border-radius:4px;
            background:transparent;
            color:var(--text-muted);
            font-size:10px;
        }
        .profile-spline-render-switch button.active {
            color:#fff;
            background:var(--accent);
        }
        .profile-spline-point-editor {
            flex:0 0 auto; display:inline-flex; align-items:center; gap:4px;
            font-size:9px; color:var(--text-muted); white-space:nowrap;
        }
        .profile-spline-point-editor input[type="number"] {
            width:50px !important; height:24px; padding:2px 4px !important; text-align:center !important;
            color:#a5b4fc !important;
        }
        .profile-spline-point-count {
            flex:0 0 auto; min-width:20px; text-align:left;
            font:9px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color:#a5b4fc;
        }
        #profilePresetSelect.family-triangle { background:#5a4a14; border-color:#a88519; color:#fff4b0; }
        #profilePresetSelect.family-square   { background:#55262b; border-color:#9f3b45; color:#ffe0e3; }
        #profilePresetSelect.family-sine     { background:#173b61; border-color:#2d6fa8; color:#d9efff; }
        #profilePresetSelect option.profile-family-triangle { background:#5a4a14; color:#fff4b0; }
        #profilePresetSelect option.profile-family-square   { background:#55262b; color:#ffe0e3; }
        #profilePresetSelect option.profile-family-sine     { background:#173b61; color:#d9efff; }
        #profilePresetSelect option.profile-library-placeholder { background:#111827; color:#94a3b8; }
        .profile-family-legend {
            display:flex;
            gap:8px;
            flex-wrap:wrap;
            margin-top:4px;
            font-size:8px;
            color:var(--text-muted);
        }
        .profile-family-legend span { display:inline-flex; align-items:center; gap:4px; }
        .profile-family-legend i { width:8px; height:8px; border-radius:2px; display:inline-block; }
        .profile-family-legend .tri i { background:#d9ad26; }
        .profile-family-legend .sq i  { background:#cf4b58; }
        .profile-family-legend .sin i { background:#3f8fd0; }

        /* MAIN CANVAS WORKSPACE */
        main {
            flex: 1;
            position: relative;
            background-color: var(--bg-dark);
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }

        .grid-pattern {
            position: absolute;
            inset: 0;
            background-image: radial-gradient(#1e293b 1px, transparent 1px);
            background-size: 24px 24px;
            opacity: 0.4;
            pointer-events: none;
        }

        #mainCanvas,
        #lampGlCanvas,
        #geometryGlCanvas,
        #sweepGlCanvas {
            width: 100%;
            height: 100%;
            display: block;
        }
        #lampGlCanvas,
        #geometryGlCanvas,
        #sweepGlCanvas {
            /* v263/v279: internal WebGL surfaces. The finished light buffer is copied once
               into mainCanvas, so CSS blend/compositor quirks cannot hide the lamps. */
            position:absolute;
            left:-100000px;
            top:-100000px;
            width:1px;
            height:1px;
            opacity:0;
            pointer-events:none;
        }

        #viewportBackgroundImage {
            position: absolute;
            inset: 0;
            z-index: 0;
            pointer-events: none;
            background-position: center center;
            background-repeat: no-repeat;
            background-size: cover;
            opacity: 1;
            display: none;
        }
        #viewportBackgroundImage.active { display: block; }
        .project-morph-background-layer {
            position:absolute; inset:0; z-index:0; pointer-events:none; display:none;
            background-position:center center; background-repeat:no-repeat; background-size:cover;
            opacity:1; transform:translate3d(0,0,0); will-change:opacity,transform,mask-image,-webkit-mask-image;
        }
        .project-morph-background-layer.active { display:block; }
        #mainContainer.project-morph-background-active #viewportBackgroundImage { display:none !important; }
        #mainCanvas { position: relative; z-index: 1; }
        .background-image-btn.active {
            color:#e0f2fe;
            border-color:rgba(56,189,248,.7);
            background:rgba(14,165,233,.18);
        }
        .background-image-clear {
            width:22px !important; min-width:22px !important; padding:0 !important;
            color:#fecaca; border-color:rgba(248,113,113,.4);
        }


        /* v303 — whole-scene Photoshop-style blend compositor.  A duplicate of the
           finished transparent scene is blended against the viewport background, while
           the normal scene above it provides a continuous Effect Strength crossfade. */
        #sceneBlendCanvas {
            position:absolute;
            inset:0;
            width:100%;
            height:100%;
            display:none;
            z-index:1;
            pointer-events:none;
            opacity:0;
            mix-blend-mode:normal;
            transform:translateZ(0);
            backface-visibility:hidden;
        }
        /* v321 — optional final WebGPU presentation surface. It is enabled only for
           full-frame post effects (vignette / scene blend / scene opacity), while the
           proven Canvas2D composition remains the source scene and fallback. */
        #finalGpuCanvas {
            position:absolute; inset:0; width:100%; height:100%; display:none; z-index:3;
            pointer-events:none; opacity:1; mix-blend-mode:normal; transform:translateZ(0);
            backface-visibility:hidden;
        }
        /* v433: GPU-only Graffiti fallback overlay. Normal Graffiti stays in the deferred
           Layer Scene; this surface is used only when another legacy pass blocks FrameGraph. */
        #graffitiGpuOverlayCanvas {
            position:absolute; inset:0; width:100%; height:100%; display:none; z-index:4;
            pointer-events:none; opacity:1; mix-blend-mode:normal; transform:translateZ(0);
            backface-visibility:hidden;
        }
        /* v429: GPU-only overlay for Sprite/Moving Line. It stays independent from
           deferred Layer Scene so Canvas/Legacy effects in another pass cannot suppress it. */
        #pathFxOverlayCanvas {
            position:absolute; inset:0; width:100%; height:100%; display:none; z-index:5;
            pointer-events:none; opacity:1; mix-blend-mode:normal; transform:translateZ(0);
            backface-visibility:hidden;
        }
        #mainCanvas { z-index:2; }
        .scene-blend-menu {
            position:fixed;
            z-index:240;
            width:min(304px, calc(100vw - 16px));
            max-height:calc(100dvh - 16px);
            overflow:auto;
            padding:10px;
            border:1px solid var(--border-light);
            border-radius:10px;
            background:rgba(15,23,42,.985);
            box-shadow:0 18px 48px rgba(0,0,0,.58);
            backdrop-filter:blur(10px);
            overscroll-behavior:contain;
        }
        .scene-blend-menu.hidden { display:none !important; }
        .scene-blend-head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:8px; }
        .scene-blend-head strong { font-size:11px; color:var(--text-main); }
        .scene-blend-head small { font-size:8px; color:var(--text-muted); }
        .scene-blend-field {
            display:grid;
            grid-template-columns:minmax(104px,auto) minmax(0,1fr) 42px;
            align-items:center;
            gap:7px;
            padding:6px 0;
            font-size:10px;
            color:var(--text-muted);
        }
        .scene-blend-field.mode { grid-template-columns:minmax(82px,auto) minmax(0,1fr); }
        .scene-blend-mode-stepper { display:grid; grid-template-columns:26px minmax(0,1fr) 26px; gap:4px; align-items:center; min-width:0; }
        .scene-blend-mode-stepper button { width:26px; min-width:26px; height:26px; padding:0; justify-content:center; font-size:16px; line-height:1; }
        .scene-blend-mode-stepper select { width:100%; min-width:0; max-width:152px; height:26px; padding-left:5px; padding-right:4px; font-size:9px; }
        .scene-blend-field select { width:100%; min-width:0; }
        .scene-blend-field input[type="range"] { width:100%; min-width:0; }
        .scene-blend-value { text-align:right; color:#a5b4fc; font:10px/1 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; }
        .scene-background-actions { display:grid; grid-template-columns:1fr 1fr; gap:6px; margin-top:7px; }
        .scene-background-actions button { min-width:0; min-height:28px; padding:4px 7px; justify-content:center; font-size:9px; }
        #btnClearBackgroundImageMenu:disabled { opacity:.42; cursor:default; }
        .scene-desktop-transparent-toggle { display:flex; align-items:center; gap:7px; margin-top:8px; padding:7px 8px; border:1px solid rgba(56,189,248,.28); border-radius:7px; background:rgba(14,165,233,.07); color:#cbd5e1; font-size:9.5px; cursor:pointer; }
        .scene-desktop-transparent-toggle input { accent-color:#38bdf8; }
        .scene-desktop-transparent-toggle:has(input:checked) { border-color:rgba(56,189,248,.72); background:rgba(14,165,233,.16); color:#e0f2fe; }
        .scene-desktop-transparent-hint { margin-top:5px; font-size:8px; line-height:1.35; color:#64748b; }
        body.desktop-transparent main#mainContainer { background-color:transparent !important; }
        body.desktop-transparent #viewportBackgroundImage,
        body.desktop-transparent #projectMorphBackgroundSource,
        body.desktop-transparent #projectMorphBackgroundTarget,
        body.desktop-transparent #gridPattern { display:none !important; }
        body.desktop-transparent #mainCanvas,
        body.desktop-transparent #sceneBlendCanvas,
        body.desktop-transparent #finalGpuCanvas,
        body.desktop-transparent #graffitiGpuOverlayCanvas,
        body.desktop-transparent #pathFxOverlayCanvas,
        body.desktop-transparent #particleGpuOverlayCanvas { background:transparent !important; }
        .scene-blend-note { margin-top:6px; font-size:8.5px; line-height:1.35; color:var(--text-muted); }
        .scene-blend-reset { width:100%; margin-top:8px; justify-content:center; color:#cbd5e1; }
        .background-image-btn.blend-active { color:#f0abfc; border-color:rgba(232,121,249,.62); background:rgba(192,38,211,.16); }

        .floating-controls {
            position: absolute;
            bottom: 16px;
            right: 16px;
            background-color: rgba(15, 23, 42, 0.92);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            padding: 5px;
            display: flex;
            align-items: center;
            gap: 5px;
            box-shadow: 0 10px 25px rgba(0,0,0,0.5);
            z-index: 12;
            backdrop-filter: blur(8px);
        }

        .floating-display-controls {
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .floating-display-controls .display-control {
            width: 28px;
            height: 28px;
            padding: 0;
            justify-content: center;
            border-radius: 6px;
            border: 1px solid transparent;
            background: transparent;
            color: var(--text-muted);
        }

        .floating-display-controls .display-control:hover {
            background: var(--card-bg-light);
            color: var(--text-main);
            border-color: var(--border-light);
        }

        .floating-display-controls input[type="color"] {
            width: 18px;
            height: 18px;
            padding: 0;
            border-radius: 50%;
        }

        .floating-display-controls .display-color-control {
            position: relative;
            width: 28px;
            height: 28px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 6px;
            cursor: pointer;
        }

        .floating-display-controls .display-color-control:hover {
            background: var(--card-bg-light);
        }

        .floating-display-controls .display-color-control input {
            position: absolute;
            inset: 0;
            opacity: 0;
            cursor: pointer;
        }

        .floating-display-controls .display-color-dot {
            width: 14px;
            height: 14px;
            border-radius: 50%;
            border: 1px solid rgba(255,255,255,0.25);
            pointer-events: none;
        }

        .floating-display-controls .display-check {
            width: 28px;
            height: 28px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 6px;
            cursor: pointer;
            color: var(--text-muted);
        }

        .floating-display-controls .display-check:has(input:checked) {
            background: rgba(99,102,241,0.18);
            color: #c7d2fe;
        }

        .floating-display-controls .display-check input {
            position: absolute;
            opacity: 0;
            pointer-events: none;
        }

        .preset-nav {
            display: flex;
            align-items: center;
            gap: 3px;
        }

        .preset-nav select {
            min-width: 190px;
        }

        .random-preset-btn {
            width: 32px;
            height: 28px;
            padding: 5px;
            color: #fbbf24;
            border-color: rgba(251, 191, 36, 0.35);
            background: rgba(251, 191, 36, 0.08);
        }

        .random-preset-btn:hover {
            background: rgba(251, 191, 36, 0.16);
            border-color: rgba(251, 191, 36, 0.6);
            transform: translateY(-1px);
        }

        .random-preset-btn .dice-icon {
            width: 17px;
            height: 17px;
            fill: none;
        }

        .morph-nav {
            position: relative;
            display: inline-flex;
            align-items: center;
            gap: 2px;
            padding-left: 2px;
        }

        .morph-settings-btn {
            width: 28px;
            height: 28px;
            padding: 5px;
            color: #cbd5e1;
            background: rgba(148, 163, 184, 0.06);
            border-color: rgba(148, 163, 184, 0.24);
        }

        .morph-settings-btn:hover {
            background: rgba(148, 163, 184, 0.14);
            border-color: rgba(148, 163, 184, 0.45);
        }

        .morph-settings-panel {
            position: fixed;
            top: 52px;
            right: 12px;
            width: 560px;
            max-width: calc(100vw - 24px);
            max-height: calc(100dvh - 64px);
            overflow-y: auto;
            overflow-x: hidden;
            overscroll-behavior: contain;
            -webkit-overflow-scrolling: touch;
            scrollbar-gutter: stable;
            padding: 7px;
            background: rgba(15, 23, 42, 0.98);
            border: 1px solid var(--border-light);
            border-radius: 10px;
            box-shadow: 0 16px 35px rgba(0,0,0,0.45);
            z-index: 60;
        }

        .morph-settings-panel.hidden {
            display: none !important;
        }

        .morph-settings-panel select {
            max-width: 240px;
            height: 23px;
            padding-top: 2px;
            padding-bottom: 2px;
            font-size: 9px;
        }

        .morph-settings-title {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            margin-bottom: 5px;
            font-size: 10px;
            font-weight: 700;
            color: var(--text-main);
        }

        .mobile-panel-close {
            display: none;
            margin-left: auto;
            width: 28px;
            height: 28px;
            min-height: 28px;
            padding: 0;
            align-items: center;
            justify-content: center;
            font-size: 18px;
            line-height: 1;
        }

        .morph-settings-subtitle {
            font-size: 9px;
            font-weight: 400;
            color: var(--text-muted);
        }

        .morph-settings-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 3px;
        }

        .morph-setting-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 5px;
            min-height: 23px;
            padding: 3px 5px;
            border: 1px solid rgba(51,65,85,0.55);
            border-radius: 5px;
            background: rgba(30,41,59,0.45);
            font-size: 9px;
            color: var(--text-muted);
        }

        .morph-setting-row label {
            display: flex;
            align-items: center;
            gap: 4px;
            cursor: pointer;
            width: 100%;
        }

        .morph-setting-row input[type="checkbox"] {
            accent-color: #67e8f9;
        }

        .morph-setting-row.interval-row {
            grid-column: 1 / -1;
        }

        .morph-settings-note {
            margin-top: 5px;
            font-size: 9px;
            line-height: 1.35;
            color: var(--text-muted);
        }

        .morph-btn {
            width: 30px;
            height: 28px;
            color: #67e8f9;
            border-color: rgba(103, 232, 249, 0.28);
            background: rgba(103, 232, 249, 0.06);
            font-size: 16px;
            line-height: 1;
        }

        .morph-btn:hover {
            background: rgba(103, 232, 249, 0.14);
            border-color: rgba(103, 232, 249, 0.5);
        }

        .morph-btn.active {
            color: #0b1220;
            background: #67e8f9;
            border-color: #67e8f9;
            box-shadow: 0 0 0 1px rgba(103,232,249,0.18), 0 0 14px rgba(103,232,249,0.28);
        }

        .morph-interval {
            width: 42px !important;
            height: 23px;
            padding: 1px 4px !important;
            font-size: 10px !important;
            color: #67e8f9 !important;
            text-align: right;
        }

        .morph-range-controls {
            display: inline-flex;
            align-items: center;
            gap: 3px;
            margin-left: auto;
        }

        .morph-range-controls .morph-interval {
            width: 48px !important;
        }


        .morph-fade-controls {
            display: grid;
            grid-template-columns: minmax(150px, 1fr) 54px auto;
            align-items: center;
            gap: 6px;
            width: min(330px, 100%);
            margin-left: auto;
            min-width: 0;
        }
        .morph-fade-controls input[type="range"] {
            width: 100%;
            min-width: 0;
        }
        .morph-fade-controls input[type="number"] {
            width: 54px !important;
            text-align: right !important;
        }

        .morph-setting-row.compact-morph-row label { width:auto; flex:1; }
        .morph-setting-row.compact-morph-row .morph-range-controls { flex-shrink:0; }
        .morph-setting-row.compact-morph-row .morph-row-check {
            display:inline-flex; align-items:center; gap:5px; white-space:nowrap; margin-left:auto;
        }
        .morph-setting-row.mono-orbit-row .morph-range-controls { transition: opacity .15s ease; }
        .morph-setting-row.mono-orbit-row.mono-orbit-disabled .morph-range-controls { opacity:.42; }
        .morph-setting-row.mono-orbit-row .morph-row-check { min-width:0; }

        .morph-setting-row.morph-shape-row {
            grid-column: 1 / -1;
            display: block;
            padding: 4px 5px;
        }

        .morph-fill-color-row {
            grid-column: 1 / -1;
            display:flex;
            align-items:center;
            gap:7px;
            flex-wrap:wrap;
            min-width:0;
        }
        .morph-fill-color-row > label { width:auto; flex:0 0 auto; white-space:nowrap; }
        .morph-fill-counts { display:inline-flex; align-items:center; gap:4px; flex:0 0 auto; }
        .morph-fill-counts input { width:44px !important; }
        .morph-fill-hue-wrap { position:relative; flex:1 1 180px; min-width:120px; height:28px; }
        .morph-fill-hue-track { position:absolute; left:0; right:0; top:12px; height:4px; border-radius:4px;
            background:linear-gradient(90deg,#ef4444,#f59e0b,#84cc16,#06b6d4,#6366f1,#d946ef,#ef4444); opacity:.62; }
        .morph-fill-hue-wrap input[type="range"] { position:absolute; inset:0; width:100%; margin:0; background:transparent; pointer-events:none; accent-color:#f8fafc; }
        .morph-fill-hue-wrap input[type="range"]::-webkit-slider-thumb { pointer-events:auto; }
        .morph-fill-hue-wrap input[type="range"]::-moz-range-thumb { pointer-events:auto; }
        .morph-fill-hue-text { flex:0 0 auto; min-width:78px; text-align:center; font:10px monospace; color:#cbd5e1; }
        .morph-fill-color-row.fill-disabled .morph-fill-counts,
        .morph-fill-color-row.fill-disabled .morph-fill-hue-wrap,
        .morph-fill-color-row.fill-disabled .morph-fill-hue-text,
        .morph-fill-color-row.fill-disabled .morph-fill-reset { opacity:.42; }
        .morph-fill-color-row.hue-reset .morph-fill-hue-wrap { opacity:.35; }
        @media (max-width:760px) {
            .morph-fill-color-row { flex-wrap:wrap; }
            .morph-fill-hue-wrap { flex-basis:180px; }
        }
        .morph-shape-head {
            display: flex;
            align-items: center;
            gap: 5px;
        }
        .morph-shape-head > label {
            width: auto;
            flex: 1;
        }
        .morph-shape-head select {
            min-width: 118px;
            max-width: 172px;
        }
        .morph-shape-options {
            display: block;
            margin-top: 4px;
            min-width: 0;
        }
        .morph-profile-group-switch {
            display:grid;
            grid-template-columns:repeat(5, minmax(0, 1fr));
            gap:2px;
            padding:2px;
            border:1px solid var(--border-light);
            border-radius:6px;
            background:rgba(15,23,42,.58);
            min-width:0;
            width:100%;
        }
        .morph-profile-group-switch button {
            min-width:0;
            padding:3px 3px;
            justify-content:center;
            border:0;
            border-radius:4px;
            background:transparent;
            color:var(--text-muted);
            font-size:9px;
            line-height:1.15;
            text-align:center;
            white-space:normal;
        }
        .morph-profile-group-switch button.active {
            color:white;
            background:var(--accent);
        }
        .spiral-settings-block { margin-top:7px; padding:7px; border:1px solid rgba(34,211,238,.28); border-radius:7px; background:rgba(8,47,73,.20); display:flex; flex-direction:column; gap:7px; }
        .spiral-settings-block.hidden { display:none !important; }
        .spiral-settings-row { display:grid; grid-template-columns:minmax(0,1fr) 82px; gap:8px; align-items:center; min-width:0; }
        .spiral-settings-row > span { font-size:10px; color:var(--text-muted); min-width:0; }
        .spiral-settings-row input[type="number"] { width:82px !important; min-width:0; text-align:right; }
        /* Morph-capable geometry control: the same cyan framed vocabulary as routed parameters. */
        #spiralOrderControl.spiral-order-morphable { border:1px solid rgba(34,211,238,.65); border-radius:6px; padding:5px 7px; background:rgba(8,145,178,.09); box-shadow:inset 2px 0 0 rgba(34,211,238,.72); }
        #spiralOrderControl.spiral-order-morphable:focus-within { border-color:#22d3ee; box-shadow:0 0 0 2px rgba(34,211,238,.2),inset 2px 0 0 #67e8f9; }
        #spiralOrderControl.spiral-order-morphable input { border:1px solid rgba(34,211,238,.48)!important; background:rgba(15,23,42,.8); }
        .spiral-fill-type-row { grid-template-columns:minmax(0,1fr) 118px; }
        .spiral-fill-type-row select { width:118px; max-width:118px; min-width:0; font-size:10px; }
        .spiral-fill-type-row.hidden { display:none !important; }
        .spiral-step-link, .spiral-tangent-toggle, .spiral-seam-round-toggle, .spiral-fill-toggle { display:flex; align-items:center; gap:6px; cursor:pointer; font-size:10px; color:var(--text-muted); min-width:0; }
        .spiral-step-link input, .spiral-tangent-toggle input, .spiral-seam-round-toggle input, .spiral-fill-toggle input { accent-color:#22d3ee; }
        .spiral-step-link span, .spiral-tangent-toggle span, .spiral-seam-round-toggle span, .spiral-fill-toggle span { min-width:0; }
        .spiral-closure-row { display:flex; align-items:center; gap:7px; min-width:0; }
        .spiral-closure-row > span { flex:0 0 auto; font-size:10px; color:var(--text-muted); }
        .spiral-closure-toggle { display:grid; grid-template-columns:1fr 1fr; gap:2px; flex:1 1 auto; padding:2px; border:1px solid var(--border-light); border-radius:6px; background:rgba(15,23,42,.58); }
        .spiral-closure-toggle button { min-width:0; padding:4px 5px; justify-content:center; border:0; border-radius:4px; background:transparent; color:var(--text-muted); font-size:10px; }
        .spiral-closure-toggle button.active { color:#ecfeff; background:#0e7490; box-shadow:inset 0 0 0 1px rgba(34,211,238,.42); }
        .spiral-step-manual-disabled { opacity:.48; }
        .contour-mode-toggle { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:3px; width:100%; }
        .contour-mode-toggle button {
            justify-content:center;
            min-width:0;
            min-height:34px;
            padding:4px 3px;
            font-size:9px;
            line-height:1.08;
            white-space:normal;
            text-align:center;
        }
        .contour-mode-toggle button.active { background:var(--accent); border-color:var(--accent); color:#fff; }
        .contour-mode-toggle button[data-contour-mode^="spiral-"].active { background:#0e7490; border-color:#22d3ee; color:#ecfeff; }
        .contour-status-badges { display:flex; align-items:center; justify-content:flex-end; gap:4px; flex-wrap:wrap; }
        #spiralTopologyBadge.hidden { display:none !important; }
        .spiral-setting-disabled { opacity:.45; }
        .morph-spiral-row { grid-column:1 / -1; }
        .morph-spiral-continuity-row { grid-column:1 / -1; }
        .morph-lamp-morph-row { grid-column:1 / -1; display:block; }
        .morph-lamp-morph-inner { display:flex; align-items:center; gap:8px; flex-wrap:wrap; width:100%; }
        .morph-lamp-morph-inner > label { width:auto; flex:0 0 auto; }
        .morph-lamp-morph-inner .lamp-morph-settings { margin:0; flex:1 1 300px; min-width:220px; }
        .morph-lamp-morph-inner .lamp-morph-settings.hidden { display:none !important; }
        .morph-chaos-morph-row { grid-column:1 / -1; display:block; }
        .morph-chaos-morph-inner { display:flex; align-items:center; gap:8px; flex-wrap:wrap; width:100%; }
        .morph-chaos-morph-inner > label { width:auto; flex:0 0 auto; }
        .chaos-morph-settings { display:inline-flex; align-items:center; gap:5px; margin-left:auto; min-width:0; }
        .chaos-morph-settings.hidden { display:none !important; }
        .chaos-morph-settings .chaos-morph-number { display:inline-flex; align-items:center; gap:3px; white-space:nowrap; font-size:9px; color:var(--text-muted); }
        .chaos-morph-settings input[type="number"] { width:42px !important; height:23px; text-align:center !important; color:#fbbf24; }
        .random-spiral-range { display:inline-flex; align-items:center; gap:3px; margin-left:auto; }
        .random-spiral-range input { width:48px !important; }
        .morph-profile-group-switch button:last-of-type.active {
            box-shadow:none;
        }
        .morph-spline-points-row {
            display:flex;
            align-items:center;
            justify-content:flex-end;
            gap:5px;
            margin-top:3px;
            min-width:0;
            font-size:9px;
            color:var(--text-muted);
        }
        .morph-spline-points-row > span { white-space:nowrap; }
        .morph-spline-point-input {
            width:58px !important;
            height:24px;
            padding:2px 5px !important;
            text-align:center !important;
            color:#a5b4fc !important;
            flex:0 0 58px;
        }
        .morph-spline-points-switch {
            display:grid;
            grid-template-columns:repeat(3, minmax(34px, 1fr));
            gap:2px;
            padding:2px;
            border:1px solid var(--border-light);
            border-radius:6px;
            background:rgba(15,23,42,.58);
            width:min(150px, 48%);
        }
        .morph-spline-points-switch button {
            min-width:0;
            padding:3px 5px;
            justify-content:center;
            border:0;
            border-radius:4px;
            background:transparent;
            color:var(--text-muted);
            font-size:9px;
        }
        .morph-spline-points-switch button.active {
            color:white;
            background:var(--accent);
        }
        .morph-segmented-switch {
            display:grid;
            grid-template-columns:1fr 1fr;
            padding:2px;
            border:1px solid var(--border-light);
            border-radius:6px;
            background:rgba(15,23,42,.58);
            min-width:0;
        }
        .morph-segmented-switch button {
            min-width:0;
            padding:3px 5px;
            justify-content:center;
            border:0;
            border-radius:4px;
            background:transparent;
            color:var(--text-muted);
            font-size:10px;
            white-space:nowrap;
        }
        .morph-segmented-switch button.active {
            background:rgba(103,232,249,.18);
            color:#a5f3fc;
            box-shadow:inset 0 0 0 1px rgba(103,232,249,.42);
        }
        .morph-dual-setting-row {
            grid-column: 1 / -1;
            display: grid;
            grid-template-columns: minmax(0,1fr) minmax(0,1fr);
            gap: 3px;
            min-width: 0;
        }
        .morph-dual-setting-row .morph-setting-row {
            min-width: 0;
        }
        .morph-standard-only-btn {
            min-width: 112px;
            padding: 3px 7px;
            justify-content: center;
            border-radius: 5px;
            font-size: 9px;
            white-space: nowrap;
            color: var(--text-muted);
            background: rgba(15,23,42,.58);
            border: 1px solid var(--border-light);
        }
        .morph-standard-only-btn.active {
            color: #a5f3fc;
            background: rgba(103,232,249,.18);
            border-color: rgba(103,232,249,.42);
            box-shadow: inset 0 0 0 1px rgba(103,232,249,.12);
        }
        .morph-shape-row.shape-disabled .morph-shape-options,
        .morph-shape-row.shape-disabled select {
            opacity: .42;
            pointer-events: none;
        }
        .morph-inline-options {
            grid-column:1 / -1;
            display:grid;
            grid-template-columns:repeat(2,minmax(0,1fr));
            gap:6px;
        }
        .morph-inline-options label {
            width:auto;
            justify-content:center;
            white-space:nowrap;
        }
        .morph-inline-options .morph-size-option {
            grid-column:1 / -1;
            justify-content:flex-start;
            gap:7px;
            min-width:0;
        }
        .morph-size-variation-controls {
            display:grid;
            grid-template-columns:auto minmax(90px,1fr) 50px auto;
            align-items:center;
            gap:5px;
            flex:1 1 auto;
            min-width:0;
        }
        .morph-size-variation-controls input[type="range"] { width:100%; min-width:0; }
        .morph-size-variation-controls input[type="number"] { width:50px !important; }
        .rounding-reset-btn { margin-left:4px; color:#fecaca; border-color:rgba(248,113,113,.38); background:rgba(127,29,29,.14); }
        .rounding-reset-btn:hover { color:#fff; background:rgba(185,28,28,.35); border-color:rgba(248,113,113,.68); }
        .morph-harmony-palette {
            display:flex;
            align-items:center;
            justify-content:flex-end;
            gap:4px;
            flex:1 1 330px;
            min-width:220px;
            flex-wrap:wrap;
        }
        .morph-harmony-btn {
            min-height:24px;
            height:24px;
            padding:2px 6px;
            font-size:9px;
            white-space:nowrap;
            border-color:rgba(148,163,184,.28);
            background:rgba(15,23,42,.55);
        }
        .morph-harmony-btn.active {
            color:#0b1220;
            background:#67e8f9;
            border-color:#a5f3fc;
        }
        .morph-fill-color-row.fill-disabled .morph-harmony-palette { opacity:.42; }
        .morph-fill-block {
            grid-column:1 / -1;
            border:1px solid rgba(51,65,85,.65);
            border-radius:7px;
            background:rgba(30,41,59,.38);
            overflow:hidden;
        }
        .morph-fill-block .morph-setting-row {
            border:0;
            border-radius:0;
            background:transparent;
            margin:0;
        }
        .morph-fill-block .morph-fill-opacity-row {
            border-top:1px solid rgba(51,65,85,.52);
        }
        .fill-reset-btn {
            flex:0 0 auto;
            min-height:24px;
            height:24px;
            padding:2px 7px;
            font-size:9px;
            white-space:nowrap;
        }
        .editable-number-value {
            cursor:text;
            border-bottom:1px dashed rgba(129,140,248,.6);
            outline:none;
            min-width:34px;
            text-align:right;
            border-radius:3px;
            padding:1px 2px;
        }
        .editable-number-value:focus {
            background:rgba(99,102,241,.14);
            box-shadow:0 0 0 1px rgba(129,140,248,.38);
            border-bottom-color:transparent;
        }
        @media (max-width: 650px) {
            .morph-shape-options { grid-template-columns: 1fr; }
            .morph-inline-options { grid-template-columns:repeat(2,minmax(0,1fr)); }
            .morph-harmony-palette { justify-content:flex-start; min-width:0; }
        }
        .freehand-interpolation-panel {
            display:none; grid-template-columns:repeat(3,1fr); gap:5px; margin-top:6px;
            padding:6px; border:1px solid var(--border-light); border-radius:6px; background:rgba(15,23,42,.65);
        }
        .freehand-interpolation-panel.visible { display:grid; }
        .freehand-interpolation-panel button { padding:5px 4px; font-size:10px; justify-content:center; }

        .morph-sec {
            font-size: 10px;
            color: var(--text-muted);
            margin-right: 1px;
        }

        #morphInterval {
            width: 72px !important;
            text-align: left !important;
            padding: 2px 22px 2px 7px !important;
        }

        .morph-cycle-controls {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            margin-left: auto;
            white-space: nowrap;
        }

        .morph-quick-btn {
            min-width: 32px;
            height: 24px;
            padding: 2px 6px;
            justify-content: center;
            font-size: 10px;
        }

        .morph-quick-btn.active {
            background: rgba(103,232,249,.16);
            border-color: rgba(103,232,249,.55);
            color: #67e8f9;
        }

        .tap-auto-badge {
            color:#ef4444;
            font:800 9px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
            letter-spacing:.55px;
            margin-right:2px;
            flex:0 0 auto;
        }

        .morph-fill-opacity-row.fill-disabled { opacity:.42; }
        .fill-settings-block {
            margin-top:8px;
            padding:9px;
            border:1px solid rgba(103,232,249,.18);
            border-radius:9px;
            background:rgba(15,23,42,.32);
            display:flex;
            flex-direction:column;
            gap:7px;
        }
        .fill-settings-title {
            display:flex;
            align-items:center;
            justify-content:space-between;
            gap:8px;
            font-size:11px;
            font-weight:700;
            color:#e2e8f0;
        }
        .fill-settings-body {
            display:flex;
            flex-direction:column;
            gap:6px;
        }
        .fill-settings-body.fill-disabled {
            opacity:.42;
        }
        .fill-opacity-control.hidden,
        .fill-match-stroke-control.hidden,
        .fill-mode-control.hidden,
        .fill-special-control.hidden { display:none !important; }
        .fill-match-stroke-control {
            padding-top:2px;
            padding-bottom:2px;
        }
        .fill-match-stroke-control label {
            display:flex;
            align-items:center;
            gap:6px;
            font-size:11px;
            color:#cbd5e1;
            cursor:pointer;
        }
        .fill-mode-control .row-label {
            margin-bottom:4px;
        }
        .fill-mode-select,
        #paramFillFadeDirection {
            width:100%;
            min-width:0;
            height:28px;
            border-radius:6px;
            border:1px solid #334155;
            background:#172033;
            color:#e2e8f0;
            font-size:10px;
            padding:0 8px;
        }
        .fill-timer-inputs {
            justify-content:flex-start;
            gap:6px;
        }
        #paramFillAccumulationSeconds {
            width:78px;
        }
        .fill-special-control {
            padding-top:2px;
        }
        .fill-mode-buttons {
            display:grid;
            grid-template-columns:1fr 1fr;
            gap:5px;
            width:100%;
        }
        .fill-mode-btn {
            min-width:0;
            height:28px;
            padding:0 8px;
            border-radius:6px;
            border:1px solid #334155;
            background:#172033;
            color:#cbd5e1;
            font-size:10px;
            cursor:pointer;
        }
        .fill-mode-btn.active {
            border-color:#22d3ee;
            background:rgba(8,145,178,.30);
            color:#e6fdff;
            box-shadow:inset 0 0 0 1px rgba(34,211,238,.14);
        }
        .fill-mode-hint {
            margin-top:3px;
            min-height:20px;
            color:#64748b;
            font-size:9px;
            line-height:1.25;
        }
        #paramFillColor:disabled {
            opacity:.48;
            cursor:not-allowed;
        }
        .graffiti-playlist-palette-row select {
            width:100%;
            min-width:0;
            height:26px;
            font-size:10px;
        }
        #graffitiBrightPaletteSwatches:empty::after {
            content:'Нет цветов';
            color:var(--text-muted);
            font-size:9px;
        }

        .random-nav {
            position: relative;
            display: inline-flex;
            align-items: center;
            gap: 2px;
        }

        .random-settings-btn {
            width: 28px;
            height: 28px;
            padding: 5px;
            color: #fbbf24;
            background: rgba(251, 191, 36, 0.06);
            border-color: rgba(251, 191, 36, 0.24);
        }

        .random-settings-btn:hover {
            background: rgba(251, 191, 36, 0.14);
            border-color: rgba(251, 191, 36, 0.45);
        }

        .random-settings-panel {
            position: fixed;
            top: 52px;
            right: 12px;
            width: min(360px, calc(100vw - 24px));
            max-height: calc(100vh - 64px);
            overflow-y: auto;
            padding: 10px;
            background: rgba(15, 23, 42, 0.98);
            border: 1px solid var(--border-light);
            border-radius: 10px;
            box-shadow: 0 16px 35px rgba(0,0,0,0.45);
            z-index: 100;
        }

        .random-settings-panel.hidden {
            display: none !important;
        }

        .random-layer-count {
            display: inline-flex;
            align-items: center;
            gap: 3px;
            padding: 0 2px 0 4px;
            height: 28px;
            border: 1px solid var(--border-light);
            border-radius: 6px;
            background: rgba(15, 23, 42, 0.6);
        }

        .random-layer-count label {
            font-size: 10px;
            color: var(--text-muted);
        }

        .random-layer-count input {
            width: 32px !important;
            height: 22px;
            padding: 2px 4px !important;
            border: none !important;
            background: transparent !important;
            color: #fbbf24 !important;
            font-family: monospace;
            font-size: 11px !important;
            text-align: center;
        }

        .fps-counter {
            position: absolute;
            left: 16px;
            bottom: 16px;
            z-index: 14;
            min-width: 52px;
            padding: 4px 7px;
            border: 1px solid rgba(51,65,85,.7);
            border-radius: 6px;
            background: rgba(15,23,42,.78);
            color: #cbd5e1;
            font: 10px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
            text-align: center;
            pointer-events: none;
            backdrop-filter: blur(6px);
        }

        .info-pill {
            position: absolute;
            top: 16px;
            left: 16px;
            background-color: rgba(15, 23, 42, 0.85);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            padding: 6px 12px;
            font-size: 11px;
            color: var(--text-muted);
            display: flex;
            align-items: center;
            gap: 8px;
            pointer-events: none;
        }

        .status-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background-color: #10b981;
        }

        .hidden { display: none !important; }
        .text-mono { font-family: monospace; color: #818cf8; }

        /* v426 — render-backend performance warnings. Orange means this control/effect
           used a Canvas2D/legacy path in the latest rendered frame. White means the
           corresponding active path stayed GPU-resident. Forced Canvas toggles remain
           orange even while disabled so their performance cost is visible before use. */
        .perf-backend-canvas, .perf-backend-canvas * { color:#f59e0b !important; }
        .perf-backend-gpu, .perf-backend-gpu * { color:#f8fafc !important; }
        .perf-backend-mixed, .perf-backend-mixed * { color:#fb923c !important; }
        .perf-backend-canvas input[type="color"], .perf-backend-gpu input[type="color"], .perf-backend-mixed input[type="color"] { color:initial !important; }
        .perf-forced-canvas, .perf-forced-canvas * { color:#f59e0b !important; }
        .hint-text { font-size: 10px; color: var(--text-muted); line-height: 1.3; }

        /* SVG ICONS */
        .icon {
            width: 14px;
            height: 14px;
            fill: currentColor;
            display: inline-block;
            vertical-align: middle;
        }


        /* TUNNEL / CORRIDOR MODE */
        .tunnel-btn {
            color:#c4b5fd;
            border-color:rgba(167,139,250,.36);
            background:rgba(124,58,237,.08);
            white-space:nowrap;
        }
        .tunnel-btn:hover {
            color:#ede9fe;
            border-color:rgba(167,139,250,.62);
            background:rgba(124,58,237,.18);
        }
        .tunnel-btn.active {
            color:white;
            background:#7c3aed;
            border-color:#8b5cf6;
            box-shadow:0 0 0 1px rgba(167,139,250,.16), 0 0 16px rgba(124,58,237,.32);
        }
        /* TAP TEMPO */
        .tap-nav { position:relative; display:inline-flex; align-items:center; gap:2px; }
        .tap-btn {
            min-width:72px; height:28px; justify-content:center; font-weight:800; color:#111827;
            background:#ffffff; border-color:rgba(239,68,68,.75); font-variant-numeric:tabular-nums;
        }
        .tap-btn.tempo-active {
            animation:tapBeatPulse var(--tap-beat-ms, 500ms) steps(1,end) infinite;
            color:#111827; border-color:#ef4444;
        }
        @keyframes tapBeatPulse { 0%,22% { background:#ef4444; } 23%,100% { background:#ffffff; } }
        .tap-settings-btn { color:#fca5a5; border-color:rgba(239,68,68,.32); background:rgba(239,68,68,.07); }
        .tap-settings-btn:hover { color:#fee2e2; background:rgba(239,68,68,.16); border-color:rgba(239,68,68,.55); }
        .tap-reset-btn { color:#fecaca; border-color:rgba(239,68,68,.30); background:rgba(127,29,29,.10); white-space:nowrap; }
        .auto-tap-listen-btn {
            width:30px; height:28px; min-height:28px; padding:4px; justify-content:center;
            color:#fff; background:#b91c1c; border-color:#ef4444; font-size:16px; line-height:1;
            box-shadow:0 0 0 1px rgba(239,68,68,.12);
        }
        .auto-tap-listen-btn:hover { background:#dc2626; border-color:#f87171; }
        .auto-tap-listen-btn.active {
            background:#ef4444; border-color:#fecaca; color:#fff;
            box-shadow:0 0 0 1px rgba(254,202,202,.22), 0 0 14px rgba(239,68,68,.38);
        }
        .tap-settings-panel {
            position:fixed; top:52px; left:12px; width:min(340px, calc(100vw - 24px)); padding:10px;
            background:rgba(15,23,42,.98); border:1px solid var(--border-light); border-radius:10px;
            box-shadow:0 16px 35px rgba(0,0,0,.48); z-index:106; backdrop-filter:blur(10px);
        }
        .tap-settings-panel.hidden { display:none !important; }
        .tap-setting-row { display:flex; align-items:center; justify-content:space-between; gap:10px; margin:7px 0; padding:7px; border:1px solid rgba(51,65,85,.55); border-radius:7px; background:rgba(30,41,59,.36); font-size:10px; color:var(--text-muted); }
        .tap-setting-row label { display:flex; align-items:center; gap:6px; cursor:pointer; color:var(--text-main); }
        .tap-setting-row input[type="number"] { width:68px; }
        .tap-setting-row select { min-width:132px; max-width:170px; }
        .tap-setting-row input[type="checkbox"] { accent-color:#ef4444; }
        .tap-status { margin-top:7px; font-size:9px; line-height:1.4; color:var(--text-muted); }
        .mobile-only-action { display:none !important; }

        .mobile-number-stepper {
            display: inline-flex;
            align-items: center;
            gap: 3px;
            max-width: 100%;
            vertical-align: middle;
        }
        .mobile-step-btn {
            display: none;
            align-items: center;
            justify-content: center;
            width: 36px;
            height: 36px;
            flex: 0 0 36px;
            border: 1px solid var(--border-light);
            border-radius: 8px;
            background: rgba(30,41,59,.9);
            color: var(--text-main);
            font: 700 22px/1 system-ui, sans-serif;
            cursor: pointer;
            touch-action: manipulation;
            -webkit-tap-highlight-color: transparent;
        }
        .mobile-step-btn:active {
            transform: scale(.94);
            background: var(--card-bg-light);
        }

        .tunnel-nav { position:relative; display:inline-flex; align-items:center; gap:2px; }
        .tunnel-settings-btn {
            width:28px; height:28px; padding:5px;
            color:#c4b5fd; background:rgba(124,58,237,.06); border-color:rgba(167,139,250,.24);
        }
        .tunnel-settings-btn:hover { color:#ede9fe; background:rgba(124,58,237,.16); border-color:rgba(167,139,250,.5); }
        .tunnel-settings-panel {
            position:fixed; top:52px; left:12px; width:min(360px, calc(100vw - 24px));
            padding:10px; background:rgba(15,23,42,.98); border:1px solid var(--border-light); border-radius:10px;
            box-shadow:0 16px 35px rgba(0,0,0,.48); z-index:105; backdrop-filter:blur(10px);
        }
        .tunnel-settings-panel.hidden { display:none !important; }
        .tunnel-settings-head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:9px; }
        .tunnel-settings-head strong { font-size:12px; }
        .tunnel-setting { margin:7px 0; padding:7px; border:1px solid rgba(51,65,85,.55); border-radius:7px; background:rgba(30,41,59,.36); }
        .tunnel-setting-head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:6px; font-size:10px; color:var(--text-muted); }
        .tunnel-effect-control { display:grid; grid-template-columns:minmax(0,1fr) 54px; gap:7px; align-items:center; }
        .tunnel-effect-control input[type="range"] { width:100%; min-width:0; }
        .tunnel-effect-control input[type="number"] { width:54px; min-width:0; }
        .tunnel-direction-toggle { display:grid; grid-template-columns:1fr 1fr; gap:4px; }
        .tunnel-direction-toggle button { justify-content:center; padding:5px 8px; min-height:28px; font-size:10px; }
        .tunnel-direction-toggle button.active { background:#7c3aed; border-color:#8b5cf6; color:white; }
        .tunnel-settings-note { margin-top:7px; font-size:9px; line-height:1.35; color:var(--text-muted); }
        .tunnel-fade-toggle { display:flex; align-items:center; gap:6px; cursor:pointer; color:var(--text-main); }
        .tunnel-default-active-row .tunnel-fade-toggle { font-weight:400 !important; font-size:10px; line-height:1.25; }
        .tunnel-fade-toggle input[type="checkbox"] { accent-color:#8b5cf6; }
        .tunnel-vignette-toggle { font-size:12px; line-height:1.25; }
        .tunnel-fade-control { display:grid; gap:6px; }
        .tunnel-fade-numeric-row { display:grid; grid-template-columns:minmax(0,1fr) 82px auto; gap:7px; align-items:center; font-size:10px; color:var(--text-muted); }
        .tunnel-fade-numeric-row input[type="number"] { width:82px; text-align:right; }
        .tunnel-fade-unit { min-width:34px; color:var(--text-muted); }
        .tunnel-color-shift-controls { display:grid; gap:7px; margin-top:8px; padding-top:7px; border-top:1px solid rgba(51,65,85,.48); }
        .tunnel-color-shift-controls.hidden { display:none !important; }
        .tunnel-color-shift-controls .tunnel-setting-head { margin-bottom:0; }
        .tunnel-color-degree-control input[type="number"] { width:54px; }
        .tunnel-palette-lag-toggle { font-size:10px; color:var(--text-muted); }

        .minimal-morph-btn {
            width:32px; height:28px; padding:5px; color:#fb923c;
            border-color:rgba(251,146,60,.38); background:rgba(249,115,22,.08);
            font-size:15px; line-height:1; justify-content:center;
        }
        .minimal-morph-btn:hover {
            color:#fed7aa; background:rgba(249,115,22,.18); border-color:rgba(251,146,60,.65);
            transform:translateY(-1px);
        }
        .minimal-morph-btn.active {
            color:white; background:#f97316; border-color:#fb923c;
            box-shadow:0 0 0 1px rgba(251,146,60,.18), 0 0 14px rgba(249,115,22,.32);
        }

        .minimal-morph-btn.paused,
        .morph-btn.paused {
            opacity:.62;
            outline:1px dashed currentColor;
            outline-offset:2px;
        }

        #mainCanvas {
            transform:translateZ(0);
            backface-visibility:hidden;
            will-change:contents;
        }



        /* v147 — explicit Chromium/Opera range rendering. Opera can ignore accent-color
           on stacked transparent sliders, so draw a real thumb instead. */
        input[type="range"] { -webkit-appearance:none; appearance:none; }
        input[type="range"]::-webkit-slider-runnable-track { height:4px; border-radius:4px; background:rgba(71,85,105,.72); }
        input[type="range"]::-webkit-slider-thumb { -webkit-appearance:none; appearance:none; width:14px; height:14px; margin-top:-5px; border-radius:50%; border:2px solid #0f172a; background:#e2e8f0; box-shadow:0 0 0 1px rgba(255,255,255,.34),0 1px 5px rgba(0,0,0,.55); pointer-events:auto; }
        input[type="range"]::-moz-range-track { height:4px; border-radius:4px; background:rgba(71,85,105,.72); }
        input[type="range"]::-moz-range-thumb { width:14px; height:14px; border-radius:50%; border:2px solid #0f172a; background:#e2e8f0; box-shadow:0 0 0 1px rgba(255,255,255,.34),0 1px 5px rgba(0,0,0,.55); pointer-events:auto; }
        .dual-range-wrap input[type="range"]::-webkit-slider-runnable-track { background:transparent; }
        .dual-range-wrap input[type="range"]::-moz-range-track { background:transparent; }
        .audio-band-count-row,.audio-custom-bands-toggle { display:flex; align-items:center; justify-content:space-between; gap:8px; margin:6px 0; font-size:9px; color:var(--text-muted); }
        .audio-band-count-row select { min-width:74px; }
        .audio-custom-bands-toggle label { display:flex; align-items:center; gap:6px; cursor:pointer; }
        .audio-custom-band-rows { display:grid; gap:5px; margin:5px 0 9px; }
        .audio-custom-band-rows.hidden { display:none!important; }
        .audio-custom-band-row { display:grid; grid-template-columns:92px minmax(380px,1fr) 170px; gap:9px; align-items:center; min-height:32px; font-size:9px; color:var(--text-muted); }
        .audio-custom-band-name { display:flex; align-items:center; gap:6px; white-space:nowrap; }
        .audio-custom-band-dot { width:9px; height:9px; border-radius:50%; flex:none; background:var(--band-color); box-shadow:0 0 7px var(--band-color); }
        .audio-custom-dual { position:relative; height:28px; min-width:380px; }
        .audio-custom-dual input[type="range"] { position:absolute; inset:0; width:100%; margin:0; background:transparent; pointer-events:none; }
        .audio-custom-dual input[type="range"]::-webkit-slider-runnable-track { background:color-mix(in srgb,var(--band-color) 48%,#334155); }
        .audio-custom-dual input[type="range"]::-moz-range-track { background:color-mix(in srgb,var(--band-color) 48%,#334155); }
        .audio-custom-band-values { display:grid; grid-template-columns:76px 12px 76px; gap:3px; align-items:center; justify-content:end; font-family:monospace; white-space:nowrap; }
        .audio-custom-band-values input[type="number"] { width:76px !important; min-width:0; padding:3px 4px; text-align:right !important; color:#e2e8f0; }
        .audio-band-gain-wrap{display:grid;grid-template-columns:10px 1fr;gap:2px;align-items:center;color:var(--text-muted);}.audio-band-gain { width:54px !important; min-width:0; padding:3px 4px !important; text-align:right !important; color:#e2e8f0 !important; }
        .audio-cutoff-row-label #audioCutoffText { display:inline-flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:0; }
        .audio-cutoff-boundary { cursor:text; border-bottom:1px dashed rgba(129,140,248,.58); border-radius:3px; padding:0 1px; min-width:22px; text-align:center; }
        .audio-cutoff-boundary:hover { color:#e0e7ff; background:rgba(99,102,241,.12); }
        .audio-cutoff-boundary.editing { color:#fff; background:rgba(99,102,241,.22); box-shadow:0 0 0 1px rgba(129,140,248,.52); border-bottom-color:transparent; outline:none; }
        .audio-routing-tools { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:4px; align-items:center; margin:0 0 4px; padding:5px; border:1px solid rgba(71,85,105,.45); border-radius:7px; background:rgba(30,41,59,.28); }
        .audio-route-group { position:relative; min-width:0; }
        .audio-route-group-btn { width:100%; min-width:0; min-height:25px; padding:3px 4px; font-size:8px; justify-content:center; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
        .audio-route-group-btn.group-enabled { border-color:#f472b6; color:#fbcfe8; background:rgba(190,24,93,.24); }
        .audio-route-group-menu { position:absolute; z-index:125; top:29px; left:0; width:210px; max-height:300px; overflow:auto; padding:5px; background:#0b1220; border:1px solid rgba(244,114,182,.46); border-radius:7px; box-shadow:0 14px 34px rgba(0,0,0,.55); }
        .audio-route-group-menu.hidden { display:none!important; }
        .audio-route-group-menu button { width:100%; justify-content:flex-start; min-height:25px; margin:1px 0; padding:3px 6px; font-size:9px; border:0; background:transparent; }
        .audio-route-group-menu button:hover { background:rgba(236,72,153,.24); }
        .audio-routing-tools-meta { display:flex; align-items:center; justify-content:space-between; gap:10px; margin:0 0 7px; padding:0 2px; min-height:20px; }
        .audio-routing-tools-hint { color:#94a3b8; font-size:8px; line-height:1.25; }
        .audio-routing-defaults { margin-left:auto; display:inline-flex; align-items:center; gap:5px; font-size:8px; color:#cbd5e1; cursor:pointer; white-space:nowrap; }
        .audio-routing-preset-bar { display:flex; align-items:center; gap:5px; flex-wrap:wrap; margin:0 0 7px; padding:5px 6px; border:1px solid rgba(71,85,105,.45); border-radius:7px; background:rgba(2,6,23,.28); }
        .audio-routing-preset-bar > span { font-size:8px; color:#94a3b8; }
        .audio-routing-preset-bar select { min-width:150px; height:25px; padding:2px 6px; font-size:9px; }
        .audio-clear-all-btn { min-height:25px; padding:3px 7px; font-size:9px; color:#fecaca; border-color:rgba(248,113,113,.45); background:rgba(127,29,29,.16); }
        .audio-clear-all-btn:hover { color:white; border-color:#f87171; background:rgba(185,28,28,.34); }
        .lamp-adaptive-strength-row { margin-top:2px; }

        .editable-mult-summary { cursor:text; border-bottom:1px dashed rgba(244,114,182,.55); outline:none; }
        .editable-mult-summary:focus { background:rgba(190,24,93,.16); box-shadow:0 0 0 1px rgba(244,114,182,.35); border-radius:3px; }

        /* AUDIO REACTIVE / COLOR MUSIC */
        .audio-reactive-btn { color:#fce7f3; border-color:rgba(236,72,153,.58); background:rgba(190,24,93,.30); }
        .audio-reactive-btn:hover { color:#fff; border-color:#f472b6; background:rgba(219,39,119,.48); }
        .audio-reactive-btn.active { background:#ec4899; border-color:#f9a8d4; color:white; box-shadow:0 0 14px rgba(236,72,153,.36); }
        .audio-routing-btn { color:#fce7f3; border-color:rgba(236,72,153,.58); background:rgba(190,24,93,.30); font-size:15px; }
        .audio-routing-btn:hover,.audio-routing-btn.active { color:#fff; border-color:#f9a8d4; background:#db2777; box-shadow:0 0 14px rgba(236,72,153,.32); }
        .header-audio-entry { display:inline-flex; align-items:center; gap:3px; }
        .audio-routing-panel {
            position:fixed; top:48px; bottom:8px; left:8px; z-index:85;
            width:50vw; min-width:640px; max-width:calc(100vw - 16px); max-height:none;
            background:rgba(15,23,42,.985); border:1px solid rgba(244,114,182,.42); border-radius:10px;
            box-shadow:0 20px 60px rgba(0,0,0,.62); backdrop-filter:blur(12px); overflow:hidden;
            display:flex; flex-direction:column;
        }
        .audio-routing-panel.hidden { display:none!important; }
        .audio-routing-head { height:38px; padding:6px 8px 6px 10px; display:flex; align-items:center; justify-content:space-between; gap:8px; border-bottom:1px solid rgba(71,85,105,.58); background:rgba(131,24,67,.13); }
        .audio-routing-head strong { color:#fbcfe8; font-size:12px; }
        .audio-routing-layout { display:grid; grid-template-columns:118px minmax(0,1fr); min-height:0; max-height:none; flex:1 1 auto; overflow:hidden; }
        .audio-routing-layers { padding:7px; overflow:auto; border-right:1px solid rgba(71,85,105,.58); background:rgba(2,6,23,.40); }
        .audio-routing-layer { width:100%; min-height:28px; margin:0 0 4px; padding:4px 7px; display:flex; align-items:center; gap:6px; justify-content:flex-start; color:#cbd5e1; font-size:10px; border:1px solid rgba(71,85,105,.55); background:rgba(30,41,59,.45); border-radius:6px; overflow:hidden; }
        .audio-routing-layer.active { color:#fff; border-color:#f472b6; background:rgba(190,24,93,.42); }
        .audio-routing-layer-dot { width:8px; height:8px; border-radius:50%; flex:none; box-shadow:0 0 7px currentColor; }
        .audio-routing-layer.signal-disabled { color:#94a3b8; border-color:rgba(100,116,139,.58); background:rgba(51,65,85,.32); }
        .audio-routing-layer.signal-disabled.active { color:#e2e8f0; border-color:#94a3b8; background:rgba(71,85,105,.52); }
        .audio-routing-layer.signal-disabled .audio-routing-layer-dot { color:#64748b!important; background:#64748b!important; box-shadow:none!important; opacity:.92; }
        .audio-routing-main { min-width:0; overflow:auto; padding:8px; }
        .audio-routing-target-title { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:7px; color:#f8fafc; font-size:11px; }
        .audio-routing-note { color:#94a3b8; font-size:9px; line-height:1.35; margin-bottom:8px; }
        .audio-master-amplitude { margin:0 0 8px; padding:7px; border:1px solid rgba(244,114,182,.38); border-radius:7px; background:rgba(131,24,67,.12); }
        .audio-master-amplitude.hidden { display:none!important; }
        .audio-master-amplitude-head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:5px; color:#fbcfe8; font-size:10px; font-weight:700; }
        .audio-master-amplitude-value { color:#f9a8d4; font:9px/1 ui-monospace,SFMono-Regular,Menlo,monospace; white-space:nowrap; }
        .audio-master-amplitude-control { display:grid; grid-template-columns:minmax(120px,1fr) auto 68px; gap:6px; align-items:center; }
        .audio-master-amplitude-control input[type=range] { width:100%; min-width:0; accent-color:#ec4899; }
        .audio-master-amplitude-control input[type=number] { width:68px; min-width:0; }
        .audio-master-amplitude-mult { color:#f9a8d4; font-weight:700; }
        .audio-master-global-routes { margin-top:7px; padding-top:7px; border-top:1px solid rgba(244,114,182,.28); }
        .audio-master-global-routes-head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:5px; color:#f9a8d4; font-size:9px; }
        .audio-master-global-routes-note { color:#94a3b8; font-size:8px; font-weight:400; }
        .audio-master-global-routes .audio-routing-rows { margin-bottom:5px; }
        .audio-master-global-routes .audio-routing-add { border-color:rgba(244,114,182,.42); background:rgba(190,24,93,.14); color:#fbcfe8; }
        .audio-master-global-routes .audio-route-row { border-color:rgba(244,114,182,.28); background:rgba(131,24,67,.08); }

        .audio-master-route-controls { margin:0 0 8px; padding:7px; border:1px solid rgba(56,189,248,.42); border-radius:7px; background:rgba(3,105,161,.10); }
        .audio-master-route-controls.hidden { display:none!important; }
        .audio-master-route-controls-head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:6px; color:#bae6fd; font-size:10px; font-weight:700; }
        .audio-master-route-controls-note { color:#7dd3fc; opacity:.8; font-size:8px; font-weight:400; }
        .audio-master-route-control-rows { display:grid; gap:5px; }
        .audio-master-route-row { display:grid; grid-template-columns:minmax(145px,1fr) minmax(130px,1.4fr) 68px 62px 28px; gap:6px; align-items:center; min-height:31px; padding:4px 5px; border:1px solid rgba(56,189,248,.24); border-radius:6px; background:rgba(2,132,199,.07); }
        .audio-master-polarity-btn { width:28px; min-width:28px; height:25px; padding:0; justify-content:center; font-size:15px; font-weight:800; border-color:rgba(56,189,248,.42); background:rgba(14,165,233,.10); }
        .audio-master-polarity-btn.polarity-plus { color:#86efac; }
        .audio-master-polarity-btn.polarity-minus { color:#fca5a5; background:rgba(127,29,29,.14); border-color:rgba(248,113,113,.42); }
        .audio-master-route-label { min-width:0; color:#e0f2fe; font-size:9px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
        .audio-master-route-row input[type=range] { width:100%; min-width:0; accent-color:#38bdf8; }
        .audio-master-route-row input[type=number] { width:62px; min-width:0; color:#7dd3fc; }
        .audio-master-route-value { color:#7dd3fc; font:8px/1 ui-monospace,SFMono-Regular,Menlo,monospace; text-align:right; white-space:nowrap; }
        .audio-routing-rows { display:grid; gap:6px; }
        .audio-route-row { position:relative; display:grid; grid-template-columns:20px 14px 64px minmax(120px,1fr) 78px minmax(78px,118px) 54px 22px; gap:4px; align-items:center; min-width:600px; padding:5px; border:1px solid rgba(71,85,105,.50); border-radius:7px; background:rgba(30,41,59,.34); }
        .audio-route-row.disabled { opacity:.48; }
        .audio-route-row input[type=checkbox] { accent-color:#ec4899; }
        .audio-route-band-dot { width:10px; height:10px; border-radius:50%; background:var(--band-color,#fff); opacity:calc(.22 + var(--audio-level,0) * .78); box-shadow:0 0 calc(3px + var(--audio-level,0) * 12px) var(--band-color,#fff); transition:opacity .07s linear,box-shadow .07s linear; }
        .audio-route-row select,.audio-route-row input[type=number],.audio-param-picker-button { min-height:25px; height:25px; padding:2px 5px; font-size:9px; min-width:0; }
        .audio-route-gain { display:grid; grid-template-columns:minmax(0,1fr); gap:2px; min-width:0; }
        .audio-route-gain input[type=range] { width:100%; min-width:0; accent-color:#ec4899; }
        .audio-route-gain-value { color:#f9a8d4; font:8px/1 ui-monospace,SFMono-Regular,Menlo,monospace; text-align:center; white-space:nowrap; }
        .audio-route-mode-wrap { display:flex; align-items:center; justify-content:center; gap:3px; min-width:0; }
        .audio-route-derivative { display:flex; align-items:center; justify-content:center; gap:3px; min-width:0; color:#cbd5e1; font-size:8.5px; white-space:nowrap; cursor:pointer; user-select:none; }
        .audio-route-derivative input { margin:0; flex:none; }
        .audio-route-signal-mode { width:24px; min-width:24px; height:24px; padding:0; justify-content:center; border-radius:5px; font-size:14px; font-weight:900; line-height:1; }
        .audio-route-signal-mode.mode-add { color:#86efac; border-color:rgba(74,222,128,.46); background:rgba(22,101,52,.16); }
        .audio-route-signal-mode.mode-median { color:#fde047; border-color:rgba(250,204,21,.48); background:rgba(113,63,18,.16); }
        .audio-route-signal-mode.mode-subtract { color:#fca5a5; border-color:rgba(248,113,113,.48); background:rgba(127,29,29,.16); }
        .audio-param-picker { position:relative; min-width:0; }
        .audio-param-picker-button { width:100%; text-align:left; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#e2e8f0; }
        .audio-param-menu { position:absolute; z-index:120; top:29px; left:0; width:min(330px,70vw); max-height:320px; overflow:auto; padding:6px; background:#0b1220; border:1px solid rgba(244,114,182,.46); border-radius:7px; box-shadow:0 16px 38px rgba(0,0,0,.55); }
        .audio-param-menu.hidden { display:none!important; }
        .audio-param-search { width:100%; height:27px; margin-bottom:5px; font-size:10px; }
        .audio-param-group-title { padding:5px 4px 3px; color:#f9a8d4; font-size:9px; font-weight:700; border-top:1px solid rgba(71,85,105,.32); }
        .audio-param-group-title:first-of-type { border-top:0; }
        .audio-param-option { width:100%; min-height:25px; padding:3px 6px; margin:1px 0; text-align:left; border:0; background:transparent; color:#cbd5e1; font-size:9px; border-radius:4px; }
        .audio-param-option:hover,.audio-param-option.active { color:white; background:rgba(236,72,153,.25); }
        .audio-route-remove { width:24px; height:24px; min-height:24px; padding:0!important; color:#fca5a5; }
        .audio-routing-add { margin-top:8px; min-height:29px; color:#fff; border-color:#ec4899; background:rgba(190,24,93,.42); }
        .audio-routing-add:hover { background:#db2777; }
        :fullscreen .audio-routing-panel, :-webkit-full-screen .audio-routing-panel { display:none!important; }
        @media(max-width:1300px) and (min-width:761px){ .audio-routing-panel{width:calc(100vw - 16px);min-width:0;} }
        @media(max-width:760px){
            .audio-routing-panel{top:6px;bottom:6px;left:6px;width:calc(100vw - 12px);max-height:none}
            .audio-routing-layout{grid-template-columns:104px minmax(0,1fr);max-height:none;min-height:0}
            .audio-route-row{grid-template-columns:22px 18px 72px minmax(135px,1fr) 82px 100px 52px 24px}
            .audio-custom-band-row{grid-template-columns:68px minmax(150px,1fr) 132px;gap:5px}
            .audio-custom-dual{min-width:150px}
            .audio-custom-band-values{grid-template-columns:58px 10px 58px}
            .audio-custom-band-values input[type="number"]{width:58px !important}
            .header-audio-entry{display:none!important}
        }
        .audio-panel {
            position:fixed; left:8px; top:48px; right:auto; bottom:auto; width:min(520px, calc(100vw - 16px));
            background:rgba(15,23,42,.97); border:1px solid var(--border-light); border-radius:10px;
            box-shadow:0 18px 45px rgba(0,0,0,.55); z-index:40; padding:12px; backdrop-filter:blur(10px);
        }
        .audio-panel.hidden { display:none !important; }
        .audio-panel-head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:10px; }
        .audio-panel-head strong { font-size:12px; }
        .audio-source-row { display:grid; grid-template-columns:1fr auto; gap:8px; align-items:center; margin-bottom:10px; }
        .audio-source-row select { width:100%; }
        .audio-status { font-size:10px; color:var(--text-muted); margin-bottom:10px; line-height:1.35; }
        .audio-diagnostics { margin:0 0 10px; border:1px solid rgba(51,65,85,.65); border-radius:7px; background:rgba(15,23,42,.48); overflow:hidden; }
        .audio-diagnostics summary { cursor:pointer; padding:7px 9px; font-size:10px; color:#cbd5e1; user-select:none; list-style:none; display:flex; align-items:center; justify-content:space-between; gap:8px; }
        .audio-diagnostics summary::-webkit-details-marker { display:none; }
        .audio-diagnostics summary::after { content:'▾'; color:var(--text-muted); }
        .audio-diagnostics[open] summary::after { content:'▴'; }
        .audio-diagnostics-body { border-top:1px solid rgba(51,65,85,.55); padding:8px; }
        .audio-diagnostics-actions { display:flex; gap:6px; align-items:center; flex-wrap:wrap; margin-bottom:7px; }
        .audio-diagnostics-actions button { min-height:28px; padding:4px 8px; font-size:10px; }
        .audio-diagnostics-text { margin:0; padding:7px; border-radius:6px; background:#080d17; color:#a5b4fc; font:9px/1.45 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; white-space:pre-wrap; overflow-wrap:anywhere; word-break:break-word; user-select:text; }
        .dual-range-wrap { position:relative; height:30px; margin:2px 0 4px; }
        .dual-range-track { position:absolute; left:0; right:0; top:13px; height:4px; border-radius:4px; background:linear-gradient(90deg,#fb7185 0 33%,#fbbf24 33% 66%,#67e8f9 66% 100%); opacity:.55; }
        .dual-range-wrap input[type="range"] { position:absolute; inset:0; width:100%; margin:0; background:transparent; pointer-events:none; accent-color:#e2e8f0; }
        .dual-range-wrap input[type="range"]::-webkit-slider-thumb { pointer-events:auto; }
        .dual-range-wrap input[type="range"]::-moz-range-thumb { pointer-events:auto; }
        .dual-range-wrap .audio-gate-range { accent-color:#e2e8f0; }
        .audio-four-handle-labels { display:grid; grid-template-columns:1fr 1fr; margin-top:-1px; margin-bottom:4px; font-size:8px; color:#94a3b8; }
        .audio-four-handle-labels span:last-child { text-align:right; }
        .audio-band-labels { display:grid; grid-template-columns:1fr 1fr 1fr; gap:6px; font-size:9px; color:var(--text-muted); margin-bottom:8px; }
        .audio-band-labels span:nth-child(2) { text-align:center; }
        .audio-band-labels span:nth-child(3) { text-align:right; }
        .audio-meters { display:grid; gap:6px; }
        .audio-meter-row { display:grid; grid-template-columns:64px minmax(0,1fr) 38px 66px; gap:7px; align-items:center; font-size:10px; }
        .audio-meter { height:7px; border-radius:8px; overflow:hidden; background:#0b1220; border:1px solid rgba(51,65,85,.7); }
        .audio-meter > i { display:block; height:100%; width:0%; background:currentColor; transition:width .045s linear; }
        .audio-meter-row.bass { color:#fb7185; }
        .audio-meter-row.mid { color:#fbbf24; }
        .audio-meter-row.high { color:#67e8f9; }
        .audio-hotkey-note { margin-top:9px; font-size:9px; color:var(--text-muted); line-height:1.4; }
        .audio-effect-row { margin:3px 0 9px; }
        .audio-effect-head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:3px; font-size:10px; color:var(--text-muted); }
        .audio-effect-title { display:flex; align-items:center; gap:6px; min-width:0; }
        .audio-effect-title input[type="checkbox"] { accent-color:#67e8f9; }
        .audio-effect-control { display:grid; grid-template-columns:minmax(0,1fr) 52px; gap:7px; align-items:center; }
        .audio-effect-control input[type="range"] { width:100%; min-width:0; }
        .audio-effect-control input[type="number"] { width:52px; min-width:0; }
        .audio-effect-row.disabled .audio-effect-control { opacity:.42; }
        .audio-cutoff-grid { display:grid; gap:5px; margin:3px 0 2px; }
        .audio-cutoff-row { display:grid; grid-template-columns:62px minmax(0,1fr) 72px; gap:7px; align-items:center; font-size:10px; color:var(--text-muted); }
        .audio-cutoff-row input[type="range"] { width:100%; min-width:0; }
        .audio-cutoff-row .text-mono { text-align:right; white-space:nowrap; }
        .audio-frequency-scale { display:flex; justify-content:space-between; margin:0 79px 7px 69px; font-size:8px; color:#64748b; }
        .audio-normalization-row { display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap; margin:2px 0 9px; padding:6px 7px; border:1px solid rgba(51,65,85,.55); border-radius:6px; background:rgba(30,41,59,.35); font-size:9px; color:var(--text-muted); }
        .audio-reaction-row { display:flex; align-items:center; justify-content:space-between; gap:8px; margin:9px 0 5px; padding:7px; border:1px solid rgba(103,232,249,.30); border-radius:6px; background:rgba(8,47,73,.20); font-size:9px; color:var(--text-muted); }
        .audio-reaction-row > span { color:#cbd5e1; }
        .audio-reaction-row select { min-width:132px; height:27px; color:#a5f3fc; border-color:rgba(103,232,249,.38); }
        .audio-normalization-row label { display:inline-flex; align-items:center; gap:5px; cursor:pointer; }
        .audio-normalization-row input[type="checkbox"] { accent-color:#67e8f9; }
        .audio-noise-gate-panel { margin:5px 0 9px; padding:7px; border:1px solid rgba(51,65,85,.55); border-radius:6px; background:rgba(30,41,59,.35); }
        .audio-noise-gate-row { display:flex; align-items:center; gap:7px; margin-bottom:6px; font-size:9px; color:var(--text-muted); }
        .audio-noise-gate-row > label { display:inline-flex; align-items:center; gap:6px; cursor:pointer; margin-right:auto; }
        .audio-noise-gate-row input[type="checkbox"] { accent-color:#67e8f9; }
        .audio-noise-gate-value { display:inline-flex; align-items:center; gap:4px; white-space:nowrap; }
        .audio-noise-gate-value input[type="number"] { width:58px; }
        .audio-noise-gate-listen { min-height:24px; height:24px; padding:2px 7px; font-size:9px; color:#fecaca; border-color:rgba(248,113,113,.42); background:rgba(127,29,29,.18); }
        .audio-noise-gate-listen.listening { color:#0f172a; background:#fca5a5; border-color:#fecaca; }
        .audio-gate-threshold-wrap { position:relative; height:22px; margin:0 1px 2px; }
        .audio-gate-threshold-wrap input[type="range"] { position:absolute; inset:0; width:100%; margin:0; accent-color:#fb7185; }
        .audio-noise-gate-soft-row { display:grid; grid-template-columns:auto minmax(0,1fr) 54px; gap:7px; align-items:center; margin:6px 0 2px; font-size:9px; color:var(--text-muted); }
        .audio-noise-gate-soft-row > label { display:inline-flex; align-items:center; gap:5px; cursor:pointer; white-space:nowrap; }
        .audio-noise-gate-soft-row input[type="checkbox"] { accent-color:#67e8f9; }
        .audio-noise-gate-soft-row input[type="range"] { width:100%; min-width:0; accent-color:#f59e0b; }
        .audio-noise-gate-soft-row input[type="number"] { width:54px; }
        .audio-noise-gate-soft-row.soft-disabled .audio-noise-gate-soft-control,
        .audio-noise-gate-soft-row.soft-disabled input[type="number"] { opacity:.42; }
        .audio-noise-gate-soft-control { display:flex; align-items:center; gap:5px; min-width:0; }
        .audio-level-meter { position:relative; height:9px; overflow:hidden; border-radius:999px; background:#070b13; border:1px solid rgba(51,65,85,.75); }
        .audio-level-meter > i { display:block; height:100%; width:0%; background:linear-gradient(90deg,#22c55e 0%,#facc15 72%,#ef4444 100%); transition:width .045s linear; }
        .audio-level-meter.gated > i { opacity:.35; }
        .audio-level-meter-head { display:flex; justify-content:space-between; align-items:center; gap:8px; margin-top:4px; font-size:9px; color:var(--text-muted); }
        .shortcut-toast { position:absolute; left:50%; bottom:18px; transform:translateX(-50%); z-index:50; padding:6px 10px; border-radius:7px; background:rgba(15,23,42,.92); border:1px solid var(--border-light); font:11px monospace; color:#cbd5e1; pointer-events:none; opacity:0; transition:opacity .16s ease; }
        .shortcut-toast.show { opacity:1; }



        /* DESKTOP COLLAPSIBLE SETTINGS SIDEBAR */
        #settingsSidebar {
            position: relative;
            transition: width .2s ease, min-width .2s ease;
        }
        .sidebar-collapse-btn {
            width: 26px;
            height: 26px;
            min-height: 26px;
            padding: 0;
            flex: 0 0 26px;
            align-items: center;
            justify-content: center;
            font-size: 18px;
            line-height: 1;
        }
        #settingsSidebar.desktop-collapsed {
            width: 42px !important;
            min-width: 42px !important;
            flex-basis: 42px !important;
        }
        #settingsSidebar.desktop-collapsed > #layerList,
        #settingsSidebar.desktop-collapsed > .sidebar-content,
        #settingsSidebar.desktop-collapsed .sidebar-section-title,
        #settingsSidebar.desktop-collapsed .sidebar-layer-actions,
        #settingsSidebar.desktop-collapsed .master-layer-btn {
            display: none !important;
        }
        #settingsSidebar.desktop-collapsed > .section-header {
            min-height: 42px;
            padding: 7px !important;
            justify-content: center;
            border-bottom: 0;
        }

        /* v45 — compact sidebar headers and layer actions */
        #settingsSidebar > .section-header { position: relative; }
        .sidebar-tool-rail .sidebar-collapse-btn {
            position: static;
            width: 34px;
            height: 34px;
            min-height: 34px;
            flex: 0 0 34px;
            margin: 0 0 3px;
            padding: 0;
            justify-content: center;
            font-size: 17px;
            line-height: 1;
            letter-spacing: -1px;
            color: #cbd5e1;
            background: rgba(15,23,42,.82);
            border-color: rgba(51,65,85,.76);
        }
        .sidebar-tool-rail .sidebar-collapse-btn:hover {
            color: #fff;
            background: var(--card-bg-light);
        }
        .sidebar-section-title {
            flex: 0 0 auto;
        }
        .sidebar-layer-actions {
            width: auto !important;
            flex: 0 0 auto !important;
            margin-left: auto;
            justify-content: flex-end;
        }
        .group-title-toggle {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            min-width: 0;
            cursor: pointer;
            font: inherit;
            color: inherit;
        }
        .group-title-toggle input[type="checkbox"] {
            margin: 0;
            width: 13px;
            height: 13px;
            flex: 0 0 13px;
            accent-color: #818cf8;
        }
        .lamp-settings-group .group-title-toggle input[type="checkbox"] { accent-color:#facc15; }
        .lamp-raster-toggle { display:inline-flex; align-items:center; gap:4px; margin-left:auto; margin-right:6px; font-size:9px; font-weight:500; color:var(--text-muted); cursor:pointer; white-space:nowrap; }
        .lamp-raster-toggle input { width:12px; height:12px; margin:0; accent-color:#facc15; }
        .lamp-raster-toggle:has(input:checked) { color:#fde68a; }
        .lamp-quality-toggles { display:inline-flex; align-items:center; gap:8px; margin-left:auto; margin-right:6px; }
        .lamp-quality-toggles .lamp-raster-toggle { margin:0; }
        .lamp-hd-toggle:has(input:checked) { color:#a5f3fc; }
        .lamp-hd-toggle input { accent-color:#22d3ee; }
        #settingsSidebar.desktop-collapsed > .section-header {
            position: relative;
            padding: 7px !important;
        }

        /* MOBILE / TOUCH LAYOUT */
        html, body {
            min-height: 100%;
            min-height: 100dvh;
            overscroll-behavior: none;
        }

        button, select {
            touch-action: manipulation;
            -webkit-tap-highlight-color: transparent;
        }

        #mainContainer,
        #mainCanvas,
        #profileCanvas {
            touch-action: none;
        }

        .mobile-controls-toggle,
        .mobile-sidebar-close,
        .mobile-sidebar-backdrop {
            display: none;
        }

        @media (max-width: 760px), (max-height: 480px) and (hover: none) and (pointer: coarse) {
            html, body {
                width: 100%;
                height: 100%;
                height: 100dvh;
                overflow: hidden;
            }

            body {
                padding-top: env(safe-area-inset-top);
                padding-left: env(safe-area-inset-left);
                padding-right: env(safe-area-inset-right);
                padding-bottom: env(safe-area-inset-bottom);
            }

            header {
                padding: 6px 8px;
                gap: 5px;
                align-items: stretch;
                flex-direction: column;
                min-width: 0;
                overflow: visible;
            }

            .header-brand {
                min-height: 30px;
                gap: 8px;
                width: 100%;
                min-width: 0;
                flex: 0 0 auto;
            }

            .brand-icon {
                width: 28px;
                height: 28px;
                border-radius: 7px;
            }

            .brand-title h1 {
                font-size: 14px;
            }

            .brand-title p {
                display: none;
            }

            .header-actions {
                width: 100%;
                max-width: 100%;
                min-width: 0;
                flex-wrap: wrap;
                justify-content: flex-start;
                align-items: center;
                gap: 5px;
                overflow-x: hidden;
                overflow-y: visible;
                padding: 1px 1px 4px;
            }

            .header-actions::-webkit-scrollbar {
                display: none;
            }

            .header-actions > * {
                flex: 0 1 auto;
                min-width: 0;
                max-width: 100%;
            }

            .tap-nav,
            .tunnel-nav,
            .preset-nav,
            .random-nav,
            .morph-nav,
            .project-nav,
            .morph-library-nav {
                flex: 0 1 auto;
                min-width: 0;
                max-width: 100%;
            }

            .header-actions .divider {
                margin: 0 1px;
            }

            button,
            select {
                min-height: 38px;
                font-size: 13px;
                padding: 7px 10px;
            }

            button.btn-icon,
            .random-preset-btn,
            .minimal-morph-btn,
            .morph-settings-btn,
            .morph-btn,
            .project-morph-btn,
            .project-morph-settings-btn,
            .random-settings-btn {
                width: 38px;
                height: 38px;
                min-height: 38px;
                padding: 7px;
            }

            input[type="number"],
            select {
                font-size: 16px !important;
            }

            input[type="number"] {
                width: 62px;
                min-height: 36px;
            }

            .mobile-number-stepper {
                gap: 4px;
                flex: 0 0 auto;
                max-width: 100%;
            }

            .mobile-number-stepper input[type="number"] {
                width: 64px !important;
                min-width: 54px;
                min-height: 38px;
                padding-left: 5px !important;
                padding-right: 5px !important;
                text-align: center !important;
            }

            .mobile-step-btn {
                display: inline-flex;
                width: 38px;
                height: 38px;
                flex-basis: 38px;
            }

            .morph-range-controls .mobile-number-stepper,
            .morph-fill-counts .mobile-number-stepper {
                flex: 0 0 auto;
            }

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

            .preset-nav select {
                min-width: 158px;
                max-width: 178px;
            }

            .app-container {
                position: relative;
                display: block;
                min-width: 0;
                min-height: 0;
            }

            main#mainContainer {
                position: absolute;
                inset: 0;
                width: 100%;
                height: 100%;
                min-width: 0;
                min-height: 0;
            }

            aside#settingsSidebar {
                position: fixed;
                top: 0;
                bottom: 0;
                left: 0;
                width: min(92vw, 380px);
                max-width: 380px;
                height: 100dvh;
                padding-top: env(safe-area-inset-top);
                padding-bottom: env(safe-area-inset-bottom);
                z-index: 160;
                transform: translate3d(-105%, 0, 0);
                transition: transform .22s ease;
                box-shadow: 16px 0 42px rgba(0,0,0,.62);
                visibility: hidden;
            }

            aside#settingsSidebar.mobile-open {
                transform: translate3d(0, 0, 0);
                visibility: visible;
            }

            .sidebar-tool-rail {
                position:fixed; top:0; bottom:0; left:0; width:44px; z-index:161;
                padding-top:calc(8px + env(safe-area-inset-top));
                transform:translate3d(-105%,0,0); visibility:hidden; transition:transform .22s ease;
            }
            .sidebar-tool-rail.mobile-open { transform:translate3d(0,0,0); visibility:visible; }
            aside#settingsSidebar { left:44px; width:min(calc(92vw - 44px), 336px); max-width:336px; }

            aside#settingsSidebar .section-header {
                padding-left: 12px;
                padding-right: 52px;
            }

            .sidebar-collapse-btn {
                display: none !important;
            }

            .mobile-sidebar-close {
                position: absolute;
                top: calc(7px + env(safe-area-inset-top));
                right: 8px;
                z-index: 5;
                display: inline-flex;
                width: 44px;
                height: 44px;
                min-width: 44px;
                padding: 0;
                align-items: center;
                justify-content: center;
                border-radius: 8px;
                font-size: 24px;
                line-height: 1;
                background: rgba(30,41,59,.96);
            }

            .mobile-sidebar-backdrop {
                position: fixed;
                inset: 0;
                z-index: 150;
                display: block;
                background: rgba(2,6,23,.58);
                backdrop-filter: blur(2px);
                opacity: 0;
                visibility: hidden;
                pointer-events: none;
                transition: opacity .2s ease, visibility .2s ease;
            }

            .mobile-sidebar-backdrop.visible {
                opacity: 1;
                visibility: visible;
                pointer-events: auto;
            }

            .mobile-controls-toggle {
                position: fixed;
                left: max(10px, env(safe-area-inset-left));
                bottom: max(10px, env(safe-area-inset-bottom));
                z-index: 45;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                min-height: 42px;
                padding: 8px 12px;
                background: rgba(15,23,42,.94);
                border-color: rgba(99,102,241,.55);
                box-shadow: 0 10px 26px rgba(0,0,0,.42);
                backdrop-filter: blur(9px);
                font-weight: 600;
            }

            .sidebar-content {
                padding: 10px 10px calc(80px + env(safe-area-inset-bottom));
                -webkit-overflow-scrolling: touch;
                overscroll-behavior: contain;
            }

            #layerList {
                max-height: 126px;
                -webkit-overflow-scrolling: touch;
            }

            .control-group {
                padding: 10px;
            }

            .grid-2 {
                gap: 7px;
            }

            #profileCanvas {
                height: 190px;
            }

            .floating-controls {
                left: auto;
                right: max(10px, env(safe-area-inset-right));
                bottom: max(10px, env(safe-area-inset-bottom));
                max-width: calc(100vw - 128px - env(safe-area-inset-left) - env(safe-area-inset-right));
                overflow-x: hidden;
                overflow-y: visible;
                flex-wrap: wrap;
                justify-content: flex-end;
                align-content: flex-end;
                padding: 4px;
                gap: 4px;
                border-radius: 11px;
            }

            .floating-controls::-webkit-scrollbar {
                display: none;
            }

            .floating-controls > * {
                flex: 0 0 auto;
            }

            .mobile-only-action { display:inline-flex !important; }

            /* Keep the controls people use while drawing at the beginning of the mobile dock. */
            #btnZoomOut { order:-40; }
            #btnZoomIn { order:-39; }
            #btnResetView { order:-38; }
            #btnMobileMic { order:-37; }
            #btnAudioReactive { order:-36; }
            #btnMobileFullscreen { order:-35; }
            .floating-display-controls { order:0; }
            #btnBackgroundImage, #btnClearBackgroundImage { flex:0 0 auto; }
            #zoomDisplay { order:2; }

            #btnZoomIn,
            #btnZoomOut {
                width: 44px !important;
                height: 44px !important;
                min-height: 44px !important;
                padding: 0 !important;
                border-color: rgba(129,140,248,.52);
                background: rgba(99,102,241,.14);
                color: #e0e7ff;
                font-size: 25px;
                font-weight: 700;
                line-height: 1;
            }

            #btnMobileMic {
                border-color: rgba(236,72,153,.55);
                background: rgba(236,72,153,.12);
            }

            /* One microphone/audio entry point on mobile. */
            #btnAudioReactive {
                display: none !important;
            }

            .floating-controls > .divider {
                display: none;
            }

            .floating-controls .btn-icon,
            .floating-display-controls .display-control,
            .floating-display-controls .display-check,
            .floating-display-controls .display-color-control {
                width: 38px;
                height: 38px;
                min-height: 38px;
            }

            .floating-controls .divider {
                height: 22px;
            }

            .fps-counter {
                left: max(10px, env(safe-area-inset-left));
                bottom: calc(60px + env(safe-area-inset-bottom));
            }

            .info-pill {
                top: 8px;
                left: 8px;
                max-width: calc(100% - 16px);
                padding: 5px 8px;
                font-size: 10px;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            .mobile-panel-close {
                display: inline-flex !important;
                position: fixed;
                top: calc(90px + env(safe-area-inset-top));
                right: max(14px, calc(env(safe-area-inset-right) + 14px));
                z-index: 280;
                flex: 0 0 38px;
                width: 38px;
                height: 38px;
                min-height: 38px;
                padding: 0;
                margin: 0;
                border-radius: 9px;
                background: rgba(15,23,42,.97);
                border: 1px solid rgba(148,163,184,.5);
                box-shadow: 0 5px 18px rgba(0,0,0,.45);
                backdrop-filter: blur(8px);
            }

            .morph-fade-controls {
                grid-template-columns: minmax(0, 1fr) 58px auto;
                width: 100%;
            }

            .project-menu,
            .morph-library-nav .project-menu,
            .random-settings-panel,
            .morph-settings-panel,
            .tunnel-settings-panel,
            .tap-settings-panel {
                position: fixed;
                top: calc(84px + env(safe-area-inset-top));
                left: max(8px, env(safe-area-inset-left));
                right: max(8px, env(safe-area-inset-right));
                width: auto;
                min-width: 0;
                max-width: none;
                max-height: calc(100dvh - 96px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
                overflow-y: auto;
                overflow-x: hidden;
                overscroll-behavior-x: none;
                -webkit-overflow-scrolling: touch;
                z-index: 220;
            }

            .project-menu,
            .morph-library-nav .project-menu,
            .random-settings-panel,
            .morph-settings-panel,
            .tunnel-settings-panel,
            .tap-settings-panel,
            .audio-panel,
            aside#settingsSidebar,
            .sidebar-content,
            .control-group,
            .control-row,
            .row-label,
            .row-inputs,
            .profile-canvas-container {
                min-width: 0;
                max-width: 100%;
                overflow-x: hidden;
            }

            .profile-preset-row {
                display: grid !important;
                grid-template-columns: 38px minmax(0, 1fr) 38px;
                width: 100%;
                min-width: 0;
                gap: 5px !important;
            }
            .profile-preset-row select {
                width: 100% !important;
                min-width: 0 !important;
                max-width: 100% !important;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            .morph-settings-grid {
                grid-template-columns: 1fr;
                min-width: 0;
                max-width: 100%;
            }

            .morph-setting-row,
            .morph-setting-row.interval-row,
            .morph-setting-row.morph-shape-row {
                grid-column: 1;
            }

            .morph-setting-row {
                min-height: 30px;
                min-width: 0;
                max-width: 100%;
                flex-wrap: wrap;
            }
            .morph-setting-row > label,
            .morph-setting-row label {
                min-width: 0;
                max-width: 100%;
                flex-wrap: wrap;
            }
            .morph-setting-row select,
            .morph-shape-head select {
                width: 100% !important;
                min-width: 0 !important;
                max-width: 100% !important;
                margin-left: 0 !important;
            }
            .morph-shape-head {
                flex-wrap: wrap;
                min-width: 0;
            }
            .morph-dual-setting-row { grid-template-columns: 1fr; }
            .morph-shape-options { grid-template-columns: 1fr !important; }
            .morph-standard-only-btn { width: 100%; }
            .morph-range-controls {
                width: 100%;
                min-width: 0;
                margin-left: 0;
                justify-content: flex-start;
            }

            .morph-cycle-controls,
            .morph-range-controls {
                flex-wrap: wrap;
                justify-content: flex-end;
            }

            .library-modal {
                padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
            }

            .library-card {
                width: 100%;
                max-height: 92dvh;
            }

            .audio-panel {
                position: fixed;
                left: max(8px, env(safe-area-inset-left));
                right: max(8px, env(safe-area-inset-right));
                bottom: calc(66px + env(safe-area-inset-bottom));
                width: auto;
                max-height: calc(100dvh - 150px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
                overflow-y: auto;
                overflow-x: hidden;
                overscroll-behavior-x: none;
                -webkit-overflow-scrolling: touch;
                z-index: 230;
            }

            .audio-source-row {
                grid-template-columns: minmax(0, 1fr) auto;
                gap: 7px;
            }

            .audio-source-row select,
            .audio-source-row button {
                min-height: 44px;
            }
        }

        @media (max-width: 430px) {
            .brand-icon {
                display: none;
            }

            .header-brand {
                min-height: 24px;
            }

            .brand-title h1 {
                font-size: 13px;
            }

            .preset-nav select {
                min-width: 145px;
                max-width: 154px;
            }

            .grid-2 {
                grid-template-columns: 1fr;
            }

            .floating-controls {
                max-width: calc(100vw - 118px - env(safe-area-inset-left) - env(safe-area-inset-right));
            }

            .mobile-controls-toggle {
                padding-left: 10px;
                padding-right: 10px;
                font-size: 12px;
            }

            #zoomDisplay {
                display: none;
            }
        }

        @media (max-height: 520px) and (orientation: landscape) {
            .header-brand {
                display: none;
            }

            header {
                padding-top: 4px;
                padding-bottom: 4px;
            }

            .project-menu,
            .morph-library-nav .project-menu,
            .random-settings-panel,
            .morph-settings-panel,
            .tunnel-settings-panel,
            .tap-settings-panel {
                top: calc(52px + env(safe-area-inset-top));
                max-height: calc(100dvh - 60px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
            }


            .mobile-panel-close {
                top: calc(58px + env(safe-area-inset-top));
            }

            aside#settingsSidebar {
                width: min(76vw, 360px);
            }
        }

        @media (prefers-reduced-motion: reduce) {
            aside#settingsSidebar,
            .mobile-sidebar-backdrop {
                transition: none;
            }
        }

        /* TRUE FULLSCREEN PRESENTATION MODE */
        :fullscreen body {
            width: 100vw;
            height: 100vh;
        }

        :fullscreen header,
        :fullscreen aside,
        :fullscreen .sidebar-tool-rail,
        :fullscreen .floating-controls,
        :fullscreen .info-pill,
        :fullscreen .audio-panel,
        :fullscreen .tunnel-settings-panel,
        :fullscreen .tap-settings-panel,
        :fullscreen .library-modal,
        :fullscreen .shortcut-toast,
        :fullscreen .mobile-controls-toggle,
        :fullscreen .mobile-sidebar-close,
        :fullscreen .mobile-sidebar-backdrop {
            display: none !important;
        }

        :-webkit-full-screen header,
        :-webkit-full-screen aside,
        :-webkit-full-screen .sidebar-tool-rail,
        :-webkit-full-screen .floating-controls,
        :-webkit-full-screen .info-pill,
        :-webkit-full-screen .audio-panel,
        :-webkit-full-screen .tunnel-settings-panel,
        :-webkit-full-screen .tap-settings-panel,
        :-webkit-full-screen .library-modal,
        :-webkit-full-screen .shortcut-toast,
        :-webkit-full-screen .mobile-controls-toggle,
        :-webkit-full-screen .mobile-sidebar-close,
        :-webkit-full-screen .mobile-sidebar-backdrop {
            display: none !important;
        }

        :fullscreen .fps-counter {
            left: 12px;
            bottom: 12px;
        }

        :fullscreen .app-container {
            width: 100vw;
            height: 100vh;
            flex: none;
        }

        :fullscreen main#mainContainer {
            position: fixed;
            inset: 0;
            width: 100vw;
            height: 100vh;
            margin: 0;
        }

        :fullscreen #mainCanvas {
            width: 100vw;
            height: 100vh;
        }


        /* =========================================================
           MOBILE REPAIR V4 — stable one-row header / full settings
           ========================================================= */
        /* Grid is retired in both desktop and mobile UI. The hidden
           checkbox remains only so old project/state code stays safe. */
        #gridPattern { display: none !important; }
        #paramShowGrid { display: none !important; }

        /* Brand block was removed from markup. Header now contains controls only. */
        header {
            justify-content: flex-start;
        }
        .header-actions {
            width: 100%;
        }

        @media (max-width: 760px) {
            html, body {
                width: 100%;
                max-width: 100%;
                overflow: hidden;
            }

            /* One single, finger-scrollable top toolbar. */
            header {
                display: block !important;
                width: 100%;
                max-width: 100%;
                padding: 6px 8px !important;
                overflow: hidden !important;
                min-height: 50px;
            }
            .header-actions {
                display: flex !important;
                flex-flow: row nowrap !important;
                align-items: center !important;
                justify-content: flex-start !important;
                width: 100% !important;
                max-width: 100% !important;
                min-width: 0 !important;
                gap: 5px !important;
                overflow-x: auto !important;
                overflow-y: hidden !important;
                padding: 0 0 3px !important;
                scrollbar-width: none;
                -webkit-overflow-scrolling: touch;
                touch-action: pan-x;
            }
            .header-actions::-webkit-scrollbar { display: none; }
            .header-actions > * {
                flex: 0 0 auto !important;
                min-width: auto !important;
                max-width: none !important;
            }
            .tap-nav,
            .tunnel-nav,
            .preset-nav,
            .random-nav,
            .morph-nav,
            .project-nav,
            .morph-library-nav {
                flex: 0 0 auto !important;
                min-width: auto !important;
                max-width: none !important;
            }
            .preset-nav select {
                width: 170px !important;
                min-width: 170px !important;
                max-width: 170px !important;
            }

            /* Popups start immediately below the now single-row toolbar. */
            .project-menu,
            .morph-library-nav .project-menu,
            .random-settings-panel,
            .morph-settings-panel,
            .tunnel-settings-panel,
            .tap-settings-panel {
                top: calc(56px + env(safe-area-inset-top)) !important;
                left: max(8px, env(safe-area-inset-left)) !important;
                right: max(8px, env(safe-area-inset-right)) !important;
                width: auto !important;
                max-width: calc(100vw - 16px - env(safe-area-inset-left) - env(safe-area-inset-right)) !important;
                max-height: calc(100dvh - 64px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
                overflow-x: hidden !important;
                overflow-y: auto !important;
                box-sizing: border-box !important;
            }

            /* Full-width settings drawer. Keep desktop structure, only constrain width. */
            aside#settingsSidebar {
                width: min(100vw, 420px) !important;
                max-width: 100vw !important;
                min-width: 0 !important;
                height: 100dvh !important;
                box-sizing: border-box !important;
                overflow: hidden !important;
            }
            aside#settingsSidebar .section-header {
                flex: 0 0 auto;
                min-width: 0;
                width: 100%;
                box-sizing: border-box;
            }
            #layerList {
                flex: 0 0 auto;
                width: 100%;
                max-width: 100%;
                box-sizing: border-box;
                overflow-x: hidden !important;
            }
            .sidebar-content {
                flex: 1 1 auto !important;
                min-height: 0 !important;
                width: 100% !important;
                max-width: 100% !important;
                padding: 10px 10px calc(74px + env(safe-area-inset-bottom)) !important;
                overflow-x: hidden !important;
                overflow-y: auto !important;
                box-sizing: border-box !important;
                -webkit-overflow-scrolling: touch;
                overscroll-behavior: contain;
            }
            .control-group {
                width: 100% !important;
                max-width: 100% !important;
                min-width: 0 !important;
                height: auto !important;
                min-height: 0 !important;
                max-height: none !important;
                overflow: visible !important;
                box-sizing: border-box !important;
                flex: 0 0 auto !important;
            }
            .control-group-title,
            .control-row,
            .row-label,
            .row-inputs,
            .profile-canvas-container,
            .color-presets,
            .btn-group-toggle {
                min-width: 0 !important;
                max-width: 100% !important;
                box-sizing: border-box !important;
            }
            .control-row {
                width: 100% !important;
                height: auto !important;
                max-height: none !important;
                overflow: visible !important;
            }
            .row-label {
                width: 100%;
                gap: 6px;
            }
            .row-label > span:first-child,
            .row-label > label:first-child {
                min-width: 0;
            }
            .row-inputs {
                width: 100% !important;
                overflow: visible !important;
            }
            .row-inputs input[type="range"],
            .control-row > input[type="range"] {
                min-width: 0 !important;
                max-width: 100% !important;
            }
            .profile-preset-row {
                display: grid !important;
                grid-template-columns: 38px minmax(0, 1fr) 38px !important;
                gap: 5px !important;
                width: 100% !important;
                min-width: 0 !important;
                max-width: 100% !important;
                overflow: visible !important;
            }
            .profile-preset-row select {
                width: 100% !important;
                min-width: 0 !important;
                max-width: 100% !important;
            }
            #profileCanvas {
                width: 100% !important;
                height: 160px !important;
                max-width: 100% !important;
            }
            .grid-2 {
                grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
                gap: 8px !important;
            }
            .color-presets { flex-wrap: wrap !important; }

            /* Morph/Random remain narrow-safe without turning every row into a malformed block. */
            .morph-settings-grid {
                grid-template-columns: 1fr !important;
                width: 100%;
                min-width: 0;
            }
            .morph-setting-row {
                width: 100% !important;
                min-width: 0 !important;
                max-width: 100% !important;
                box-sizing: border-box !important;
            }
            .morph-setting-row > label,
            .morph-setting-row label {
                min-width: 0 !important;
            }
            .morph-setting-row select,
            .morph-shape-head select {
                min-width: 0 !important;
                max-width: 100% !important;
            }
            .morph-range-controls {
                min-width: 0 !important;
                max-width: 100% !important;
            }

            /* Audio is a proper viewport modal on phones, so all controls remain reachable. */
            .audio-panel {
                position: fixed !important;
                top: calc(56px + env(safe-area-inset-top)) !important;
                left: max(8px, env(safe-area-inset-left)) !important;
                right: max(8px, env(safe-area-inset-right)) !important;
                bottom: max(8px, env(safe-area-inset-bottom)) !important;
                width: auto !important;
                max-width: calc(100vw - 16px - env(safe-area-inset-left) - env(safe-area-inset-right)) !important;
                max-height: none !important;
                overflow-x: hidden !important;
                overflow-y: auto !important;
                box-sizing: border-box !important;
                z-index: 230 !important;
                -webkit-overflow-scrolling: touch;
            }
            .audio-source-row {
                grid-template-columns: minmax(0, 1fr) auto !important;
                width: 100%;
                min-width: 0;
            }
            .audio-source-row select { min-width: 0 !important; width: 100% !important; }
            .audio-cutoff-row,
            .audio-effect-control,
            .audio-noise-gate-soft-row,
            .tunnel-effect-control,
            .tunnel-fade-numeric-row {
                min-width: 0 !important;
                max-width: 100% !important;
            }

            /* Main-screen dock: no zoom +/-; no grid; one compact row. */
            #btnZoomIn,
            #btnZoomOut,
            #zoomDisplay {
                display: none !important;
            }
            #btnAudioReactive { display: none !important; }
            .floating-controls {
                left: auto !important;
                right: max(8px, env(safe-area-inset-right)) !important;
                bottom: max(8px, env(safe-area-inset-bottom)) !important;
                display: flex !important;
                flex-flow: row nowrap !important;
                align-items: center !important;
                justify-content: flex-end !important;
                width: auto !important;
                max-width: calc(100vw - 124px - env(safe-area-inset-left) - env(safe-area-inset-right)) !important;
                overflow: hidden !important;
                padding: 4px !important;
                gap: 3px !important;
                border-radius: 10px;
            }
            .floating-display-controls {
                display: flex !important;
                flex-flow: row nowrap !important;
                gap: 3px !important;
            }
            .floating-controls > .divider { display: none !important; }
            .floating-controls .btn-icon,
            .floating-display-controls .display-control,
            .floating-display-controls .display-check,
            .floating-display-controls .display-color-control {
                width: 34px !important;
                height: 34px !important;
                min-width: 34px !important;
                min-height: 34px !important;
                flex: 0 0 34px !important;
                padding: 4px !important;
            }
            #btnResetView { order: -20; }
            #btnMobileMic { order: -19; }
            #btnMobileFullscreen { order: -18; }
            .floating-display-controls { order: 0; }
            .mobile-controls-toggle {
                left: max(8px, env(safe-area-inset-left)) !important;
                bottom: max(8px, env(safe-area-inset-bottom)) !important;
                min-height: 42px !important;
                padding: 8px 10px !important;
                font-size: 12px !important;
                white-space: nowrap;
            }
            .fps-counter {
                bottom: calc(58px + env(safe-area-inset-bottom)) !important;
            }
        }

        @media (max-width: 430px) {
            .grid-2 {
                grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
            }
            .preset-nav select {
                width: 154px !important;
                min-width: 154px !important;
                max-width: 154px !important;
            }
            .floating-controls {
                max-width: calc(100vw - 118px - env(safe-area-inset-left) - env(safe-area-inset-right)) !important;
            }
        }



        /* v37 — morph hierarchy + Lines/Lamps workspace */
        .morph-mode-card {
            grid-column: 1 / -1;
            display:flex; flex-direction:column; gap:5px;
            padding:6px; border:1px solid rgba(103,232,249,.28); border-radius:8px;
            background:rgba(15,23,42,.72); overflow:hidden;
        }
        .morph-mode-card > .morph-setting-row { border:0; background:transparent; padding:3px 2px; min-height:30px; }
        .morph-mode-card select { min-width:190px !important; }
        .morph-dependent-row {
            overflow:hidden; max-height:0; opacity:0; transform:translateY(-5px);
            margin-top:-5px; padding-top:0 !important; padding-bottom:0 !important;
            border-width:0 !important; min-height:0 !important;
            transition:max-height .22s ease, opacity .18s ease, transform .22s ease, margin .22s ease, padding .22s ease, border-width .22s ease;
        }
        .morph-dependent-row.is-visible {
            max-height:180px; opacity:1; transform:translateY(0); margin-top:0;
            padding-top:5px !important; padding-bottom:5px !important; border-width:1px !important;
        }
        .morph-top-row { grid-column:1/-1; }
        .morph-lightning-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:5px; width:100%; }
        .morph-lightning-grid label { justify-content:center; width:auto; white-space:nowrap; }
        .morph-lightning-grid .lightning-color-wrap { display:flex; align-items:center; justify-content:center; gap:6px; }
        .morph-lightning-grid input[type="color"] { width:30px; height:24px; }
        .lightning-effect-control { grid-column:1 / -1; display:grid; grid-template-columns:auto minmax(90px,1fr) 54px auto; gap:6px; align-items:center; width:100%; font-size:10px; color:var(--text-muted); }
        .lightning-effect-control input[type="range"] { width:100%; min-width:0; }
        .lightning-effect-control input[type="number"] { width:54px !important; text-align:right; }
        .lightning-effect-control .unit { min-width:18px; color:var(--text-muted); }
        #morphLightningSettingsRow.is-visible { max-height:320px; }
        @media (max-width:650px) { #morphLightningSettingsRow.is-visible { max-height:460px; } }

        /* v39 — compact Photoshop-like tool rail. The rail chooses which settings
           are visible; it no longer decides whether lines/lamps are rendered. */
        .sidebar-tool-rail {
            width:44px; flex:0 0 44px; display:flex; flex-direction:column; align-items:center; gap:7px;
            padding:8px 5px; background:#0b1220; border-right:1px solid var(--border-color); z-index:12;
            box-shadow:4px 0 14px rgba(0,0,0,.28);
        }
        .sidebar-tool-btn {
            width:34px; height:34px; min-height:34px; padding:0; justify-content:center;
            border-radius:7px; border:1px solid rgba(51,65,85,.72); background:rgba(15,23,42,.78);
            color:var(--text-muted); font-size:20px; line-height:1;
        }
        .sidebar-tool-btn.active { background:rgba(99,102,241,.19); border-color:rgba(129,140,248,.7); color:#e0e7ff; }
        .sidebar-tool-btn[data-sidebar-mode="lamps"].active { background:rgba(250,204,21,.16); border-color:rgba(250,204,21,.68); color:#fff59d; }
        .sidebar-tool-btn[data-sidebar-mode="web"].active { background:rgba(226,232,240,.14); border-color:rgba(226,232,240,.62); color:#f8fafc; }
        .sidebar-tool-btn[data-sidebar-mode="sweep"].active { background:rgba(125,211,252,.14); border-color:rgba(186,230,253,.72); color:#f0f9ff; }
        .sidebar-tool-btn .lamp-dot-icon { width:13px; height:13px; border-radius:50%; background:currentColor; box-shadow:0 0 9px currentColor; }
        .sidebar-tool-btn .sweep-icon { position:relative; width:13px; height:22px; border:1px solid currentColor; border-radius:2px; overflow:hidden; display:block; }
        .sidebar-tool-btn .sweep-icon::after { content:''; position:absolute; width:22px; height:4px; left:-5px; top:8px; transform:rotate(-35deg); background:currentColor; box-shadow:0 0 7px currentColor,0 0 12px currentColor; }
        .sidebar-tool-btn .web-icon { width:20px; height:20px; display:block; fill:none; stroke:currentColor; stroke-width:1.25; }
        #settingsSidebar.sidebar-mode-lines .lamp-settings-group,
        #settingsSidebar.sidebar-mode-lines .web-settings-group,
        #settingsSidebar.sidebar-mode-lines .sweep-settings-group { display:none; }
        #settingsSidebar.sidebar-mode-lamps .sidebar-content > .control-group:not(.lamp-settings-group) { display:none; }
        #settingsSidebar.sidebar-mode-web .sidebar-content > .control-group:not(.web-settings-group) { display:none; }
        #settingsSidebar.sidebar-mode-sweep .sidebar-content > .control-group:not(.sweep-settings-group) { display:none; }
        .lamp-settings-group { border-color:rgba(250,204,21,.32); }
        .web-settings-group { border-color:rgba(226,232,240,.34); }
        .sweep-settings-group { border-color:rgba(125,211,252,.38); }
        .sweep-settings-group .group-title-toggle input { accent-color:#7dd3fc; }
        .lamp-compact-toggle { font-size:10px !important; font-weight:400 !important; line-height:1.2; gap:5px !important; }
        .lamp-compact-toggle span { font-size:10px !important; font-weight:400 !important; }
        .line-profile-mode { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px; }
        .line-profile-mode button { justify-content:center; padding:5px 4px; font-size:10px; min-width:0; }
        .line-profile-mode button.active { background:rgba(129,140,248,.18); border-color:rgba(129,140,248,.62); color:#e0e7ff; }
        .line-profile-mode button:disabled { opacity:.34; cursor:not-allowed; filter:saturate(.45); }
        .line-profile-application-mode { grid-template-columns:repeat(2,minmax(0,1fr)); }
        .graffiti-gpu-heading { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:7px; font-size:10px; font-weight:700; color:var(--text-main); }
        .graffiti-gpu-heading .text-mono { color:#86efac; }
        .line-main-mode { grid-template-columns:repeat(4,minmax(0,1fr)); }
        .line-main-mode button { min-width:0; padding:5px 3px; font-size:9px; justify-content:center; }
        .line-marker-type-grid, .graffiti-nib-stamp-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:5px; }
        .line-marker-type-grid button, .graffiti-nib-stamp-grid button {
            min-width:0; min-height:42px; padding:4px 2px; justify-content:center; flex-direction:column; gap:3px;
            border:1px solid var(--border-light); background:rgba(15,23,42,.56); color:var(--text-muted);
        }
        .line-marker-type-grid button.active, .graffiti-nib-stamp-grid button.active {
            color:#fff; border-color:rgba(129,140,248,.72); background:rgba(99,102,241,.22);
        }
        .profile-stamp-icon { width:23px; height:23px; display:block; position:relative; }
        .profile-stamp-icon.circle::before { content:''; position:absolute; inset:4px; border-radius:50%; background:currentColor; }
        .profile-stamp-icon.square::before { content:''; position:absolute; inset:4px; background:currentColor; transform:rotate(45deg); }
        .profile-stamp-icon.slash::before { content:''; position:absolute; left:2px; right:2px; top:10px; height:4px; border-radius:3px; background:currentColor; transform:rotate(-35deg); }
        .profile-stamp-icon.cross::before,.profile-stamp-icon.cross::after { content:''; position:absolute; left:2px; right:2px; top:10px; height:3px; border-radius:2px; background:currentColor; }
        .profile-stamp-icon.cross::before { transform:rotate(45deg); }.profile-stamp-icon.cross::after { transform:rotate(-45deg); }
        .graffiti-stamp { width:28px; height:28px; display:block; position:relative; overflow:hidden; border-radius:4px; background:rgba(2,6,23,.45); }
        .graffiti-stamp::before { content:''; position:absolute; left:3px; right:3px; top:12px; height:5px; background:currentColor; transform:rotate(-28deg); transform-origin:center; }
        .graffiti-stamp.pointed::before { clip-path:polygon(0 50%,12% 12%,88% 12%,100% 50%,88% 88%,12% 88%); }
        .graffiti-stamp.blunt::before { border-radius:1px; }
        .graffiti-stamp.pinched::before { clip-path:polygon(0 12%,42% 38%,50% 50%,58% 38%,100% 12%,100% 88%,58% 62%,50% 50%,42% 62%,0 88%); }
        .graffiti-stamp.round::before { border-radius:999px; height:8px; top:10px; }
        #lineSpriteBlock.line-mode-hidden, #lineMarkerTypeRow.line-mode-hidden, #graffitiProfileRow.line-mode-hidden, #graffitiNibRow.line-mode-hidden, #graffitiAngleRow.line-mode-hidden { display:none !important; }

        .line-profile-sprite-lock { margin-top:5px; color:#94a3b8; }
        .sweep-control-grid { display:grid; gap:8px; }
        .sweep-control-grid .row-inputs input[type="range"] { flex:1 1 auto; }
        .sweep-glint-settings { display:grid; gap:7px; padding:8px; border:1px solid rgba(125,211,252,.24); border-radius:8px; background:rgba(14,116,144,.045); }
        .sweep-glint-settings.hidden { display:none !important; }
        .sweep-lightning-settings { display:grid; gap:7px; padding:8px; border:1px solid rgba(125,211,252,.32); border-radius:8px; background:rgba(14,116,144,.08); }
        .sweep-lightning-settings.hidden { display:none !important; }
        .sweep-lightning-settings .control-row { margin:0; }
        .lightning-type-precision-row { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; align-items:end; }
        .lightning-type-precision-field { display:flex; flex-direction:column; gap:4px; min-width:0; }
        .lightning-type-precision-field select { width:100%; min-width:0; }
        .lightning-glow-box {
            display:grid; gap:7px; padding:8px; margin-top:1px;
            border:1px solid rgba(125,211,252,.28); border-radius:7px;
            background:rgba(14,116,144,.055);
        }
        .lightning-glow-box-title { font-size:9px; font-weight:700; color:#bae6fd; letter-spacing:.02em; }
        .sweep-subsection { display:grid; gap:7px; padding:8px; border:1px solid rgba(125,211,252,.22); border-radius:7px; background:rgba(14,116,144,.045); }
        .sweep-subsection-title { font-size:9px; font-weight:700; color:#bae6fd; letter-spacing:.02em; }
        .sweep-check-row { justify-content:flex-start !important; gap:7px; }
        .sweep-inline-meta { display:flex; align-items:center; gap:8px; }
        .sweep-mini-check { display:inline-flex; align-items:center; gap:4px; font-size:9px; white-space:nowrap; }
        .lightning-color-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:5px 7px; align-items:center; padding:7px; border:1px solid rgba(125,211,252,.2); border-radius:7px; background:rgba(2,6,23,.16); }
        .lightning-color-grid > span { min-width:0; text-align:center; font-size:9px; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
        .lightning-color-grid > input[type="color"] { width:100%; min-width:0; height:28px; padding:2px; }
        @media (max-width:520px) { .lightning-type-precision-row { grid-template-columns:1fr 1fr; gap:5px; } }
        .web-settings-group .group-title-toggle input { accent-color:#f8fafc; }
        .web-settings-note { font-size:9px; line-height:1.35; color:var(--text-muted); }
        .line-outline-row { margin-top:2px; padding-top:8px; border-top:1px solid rgba(51,65,85,.52); }
        .line-outline-head { display:flex; align-items:center; justify-content:space-between; gap:8px; }
        .line-outline-head label { display:inline-flex; align-items:center; gap:6px; cursor:pointer; font-size:11px; color:var(--text-main); font-weight:600; }
        .line-outline-head input[type="checkbox"] { accent-color:#818cf8; }
        .line-outline-head input[type="color"] { width:30px; height:24px; }
        .line-outline-control { display:grid; grid-template-columns:minmax(0,1fr) 56px; gap:6px; align-items:center; }
        .line-outline-control input[type="range"] { width:100%; min-width:0; }
        .line-outline-control input[type="number"] { width:56px !important; }
        .line-slider-mult { flex:1 1 auto; min-width:0; display:grid; grid-template-columns:minmax(0,1fr) auto 58px; gap:5px; align-items:center; }
        .line-slider-mult input[type="range"] { width:100%; min-width:0; }
        .line-slider-mult input[type="number"] { width:58px !important; min-width:0; }
        /* v303: the base line thickness sits immediately before × multiplier.
           Keep both number boxes compact so the slider remains the primary control. */
        .line-slider-mult.line-slider-with-base { grid-template-columns:minmax(0,1fr) 46px auto 46px; gap:5px; }
        .line-slider-mult.line-slider-with-base input[type="number"] { width:46px !important; min-width:0; padding-left:4px; padding-right:4px; }
        .line-outline-modes { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:5px; margin-top:3px; }
        .line-outline-mode { min-width:0; display:flex; align-items:center; justify-content:center; gap:5px; padding:5px 4px; border:1px solid rgba(51,65,85,.62); border-radius:5px; background:rgba(15,23,42,.48); color:var(--text-muted); font-size:9px; cursor:pointer; text-align:center; }
        .line-outline-mode:has(input:checked) { color:#e0e7ff; border-color:rgba(129,140,248,.68); background:rgba(99,102,241,.18); }
        .line-outline-mode input { accent-color:#818cf8; }
        .display-enable-toggle { display:flex; align-items:center; gap:7px; cursor:pointer; color:var(--text-main); font-weight:600; }
        .display-enable-toggle input { accent-color:#818cf8; }
        .lamp-settings-group .display-enable-toggle input { accent-color:#facc15; }
        .master-layer-btn { width:auto !important; min-width:78px; padding:4px 8px !important; font-size:10px; font-weight:700; color:#cbd5e1; border-color:rgba(148,163,184,.35); }
        .master-layer-btn.active { color:#fff7ed; background:rgba(249,115,22,.18); border-color:rgba(251,146,60,.75); box-shadow:0 0 12px rgba(249,115,22,.18); }
        .lamp-bokeh-grid { display:grid; grid-template-columns:1fr; gap:7px; margin-top:5px; }
        .lamp-morph-settings { margin-top:5px; padding-top:6px; border-top:1px solid rgba(250,204,21,.16); }
        .lamp-color-mode { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px; }
        .lamp-color-mode button { min-width:0; padding:5px 4px; justify-content:center; font-size:9px; }
        .lamp-color-mode button.active { background:rgba(250,204,21,.16); border-color:rgba(250,204,21,.62); color:#fef08a; }
        .lamp-color-row { display:grid; grid-template-columns:1fr auto; gap:8px; align-items:center; }
        .lamp-color-row input[type="color"] { width:40px; height:28px; }
        .lamp-selected-palette { margin-top:2px; }
        .lamp-selected-palette .color-swatch { width:21px; height:21px; }
        .lamp-control-grid { display:grid; grid-template-columns:1fr; gap:8px; }
        .lamp-control-grid .control-row { min-width:0; }
        .lamp-slider-mult { display:grid; grid-template-columns:minmax(0,1fr) auto 56px; gap:5px; align-items:center; }
        .lamp-slider-mult input[type="range"] { width:100%; min-width:0; }
        .lamp-slider-mult input[type="number"] { width:56px !important; }
        .lamp-mult-label { color:var(--text-muted); font-size:9px; }
        .lamp-type-preview { font-size:9px; color:var(--text-muted); line-height:1.35; margin-top:2px; }
        @media (max-width:650px) {
            .morph-mode-card select { min-width:0 !important; max-width:180px; }
            .morph-lightning-grid { grid-template-columns:1fr; }
            .lamp-control-grid { grid-template-columns:1fr; }
        }

        /* v38 — anchored menus, file settings, size/rotation morph ranges */
        .file-settings-block { margin:3px 0; padding:4px; border:1px solid rgba(51,65,85,.55); border-radius:6px; background:rgba(9,13,22,.34); }
        .file-settings-block.hidden { display:none !important; }
        .file-settings-block button { min-height:30px; }
        .morph-size-row, .morph-rotation-row { grid-column:1 / -1; }
        .morph-size-row > label, .morph-rotation-row > label { width:100%; }
        /* Morph controls with multipliers now mirror Corridor: one slider + one multiplier field. */
        .morph-effect-control { display:grid; grid-template-columns:minmax(0,1fr) 54px; gap:7px; align-items:center; flex:1 1 220px; min-width:150px; margin-left:auto; }
        .morph-effect-control input[type="range"] { width:100%; min-width:0; }
        .morph-effect-control input[type="number"] { width:54px !important; min-width:0; }
        .morph-multiplier-label { color:var(--text-muted); font-size:9px; white-space:nowrap; }
        .morph-inline-summary { margin-left:6px; white-space:nowrap; }
        .morph-rotation-number-controls { display:grid; grid-template-columns:50px auto 50px auto auto 56px; gap:4px; align-items:center; margin-left:auto; min-width:0; }
        .morph-rotation-number-controls input[type="number"] { width:50px !important; text-align:right !important; }
        .morph-rotation-number-controls .rotation-multiplier { width:56px !important; }
        .morph-rotation-direction { display:inline-flex; align-items:center; gap:5px; white-space:nowrap; margin-left:8px; }
        .morph-opacity-row { grid-column:1 / -1; }
        .morph-opacity-reset-btn { margin-left:4px; color:#dbeafe; border-color:rgba(96,165,250,.38); background:rgba(30,64,175,.12); }
        .morph-opacity-reset-btn:hover { color:#fff; background:rgba(37,99,235,.3); border-color:rgba(96,165,250,.68); }
        .morph-line-color-row { border-bottom:1px solid rgba(51,65,85,.52) !important; }
        .morph-global-hue-row{grid-column:1 / -1;display:flex!important;align-items:center!important;justify-content:space-between!important;gap:8px!important;padding-top:4px!important;}
        .morph-global-hue-row>label{display:inline-flex!important;align-items:center;gap:5px;min-width:0;font-size:10px;}
        .morph-global-hue-controls{display:inline-flex;align-items:center;gap:3px;white-space:nowrap;color:var(--text-muted);font-size:9px;}
        .morph-global-hue-controls input[type=number]{width:58px!important;text-align:right!important;}
        .morph-global-hue-row.color-disabled .morph-global-hue-controls{opacity:.45;}
        .morph-line-palette { display:flex; align-items:center; gap:4px; flex-wrap:wrap; margin-left:auto; }
        .morph-line-palette-btn { min-height:23px; height:23px; padding:2px 6px; font-size:9px; white-space:nowrap; }
        .morph-line-palette-btn.active { color:#0b1220; background:#67e8f9; border-color:#a5f3fc; }
        .morph-line-palette-btn[data-line-morph-palette="fire"] { border-color:rgba(249,115,22,.55); }
        .morph-line-palette-btn[data-line-morph-palette="ice"] { border-color:rgba(56,189,248,.55); }
        .morph-line-palette-btn[data-line-morph-palette="sex"] { border-color:rgba(244,63,94,.55); }
        .morph-line-palette-btn[data-line-morph-palette="holy"] { border-color:rgba(250,204,21,.72); box-shadow:inset 0 0 0 1px rgba(255,255,255,.08); }
        .morph-line-color-row.color-disabled .morph-line-palette { opacity:.58; pointer-events:auto; }
        .morph-spiral-order-controls { display:inline-flex; align-items:center; gap:3px; margin-left:8px; flex-wrap:wrap; }
        .morph-spiral-order-controls .morph-interval { width:44px !important; }
        .morph-spiral-link-check { display:inline-flex !important; width:auto !important; flex:0 0 auto !important; align-items:center; gap:4px; white-space:nowrap; margin-left:5px; }
        .morph-spiral-order-controls.linked input[type=number] { opacity:.45; }
        @media(max-width:650px){ .morph-line-palette { width:100%; margin-left:0; } .morph-spiral-order-controls { margin-left:0; width:100%; } }
        @media (max-width:760px) {
            .morph-effect-control { grid-template-columns:minmax(90px,1fr) 52px; min-width:130px; }
            .morph-rotation-number-controls { grid-template-columns:46px auto 46px auto auto 52px; }
            .morph-rotation-number-controls input[type="number"] { width:46px !important; }
            .morph-rotation-number-controls .rotation-multiplier { width:52px !important; }
            .morph-rotation-direction { margin-left:0; }
        }

    
        /* v40 — header choosers, File→Morphing and lamp position mode */
        .preset-chooser-panel,.morph-type-nav{display:inline-flex;align-items:center;gap:3px;}
        .morph-type-nav select{min-width:190px;}
        .header-choice-hidden{display:none!important;}
        .file-settings-block,.file-morphing-block,.file-defaults-block{display:flex;flex-direction:column;gap:4px;padding:5px;border:1px solid rgba(51,65,85,.55);border-radius:7px;background:rgba(15,23,42,.55);}
        .file-settings-block.hidden,.file-morphing-block.hidden,.file-defaults-block.hidden{display:none!important;}
        .file-setting-toggle{display:flex;align-items:center;gap:7px;padding:6px 7px;font-size:10px;color:var(--text-main);cursor:pointer;}
        .file-setting-toggle input{accent-color:#818cf8;}
        .file-morphing-actions{display:flex;flex-direction:column;gap:3px;margin-bottom:4px;}
        .file-morphing-actions button{justify-content:flex-start;min-height:27px;padding:4px 7px;font-size:10px;border:1px solid var(--border-light);background:rgba(30,41,59,.55);}
        .file-morphing-reset{margin-top:3px;min-height:27px!important;padding:4px 7px!important;font-size:10px!important;color:#fecaca!important;border-color:rgba(248,113,113,.42)!important;background:rgba(127,29,29,.18)!important;}
        .file-morphing-block .morph-settings-panel{position:static!important;top:auto!important;left:auto!important;right:auto!important;width:100%!important;max-width:none!important;max-height:none!important;overflow:visible!important;box-shadow:none!important;padding:7px!important;background:rgba(15,23,42,.35)!important;}
        .file-morphing-block .mobile-panel-close{display:none!important;}
        .lamp-position-mode{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;}
        .lamp-position-mode button{justify-content:center;padding:5px 5px;font-size:9px;min-width:0;white-space:normal;line-height:1.15;}
        .lamp-position-mode button.active{background:rgba(250,204,21,.16);border-color:rgba(250,204,21,.62);color:#fef08a;}
        .lamp-morph-motion-mode{grid-template-columns:repeat(4,minmax(0,1fr));}
        .lamp-morph-motion-mode button{font-size:10px;}
        .lamp-morph-motion-mode button.active{background:rgba(103,232,249,.16);border-color:rgba(103,232,249,.58);color:#a5f3fc;}
        .lamp-morph-motion-note{font-size:9px;line-height:1.3;color:var(--text-muted);}
        @media(max-width:820px){.morph-type-nav select{min-width:125px;max-width:155px}.file-morphing-actions{grid-template-columns:1fr}}


        /* v41 — File→Shapes submenu + viewport-safe floating panels */
        .file-shapes-block {
            display:flex;
            flex-direction:column;
            gap:4px;
            padding:5px;
            margin:3px 0;
            border:1px solid rgba(51,65,85,.55);
            border-radius:7px;
            background:rgba(15,23,42,.55);
            min-width:0;
            max-width:100%;
        }
        .file-shapes-block.hidden { display:none!important; }
        .file-shapes-block button {
            min-height:30px;
            border:1px solid var(--border-light)!important;
            background:rgba(30,41,59,.42)!important;
        }
        #projectMenu {
            max-width:calc(100vw - 16px)!important;
            max-height:calc(100dvh - 16px);
            overflow-y:auto;
            overflow-x:hidden;
            overscroll-behavior:contain;
            scrollbar-gutter:stable;
        }
        #projectMenu > *,
        #projectMenu .file-settings-block,
        #projectMenu .file-shapes-block,
        #projectMenu .file-morphing-block,
        #projectMenu .morph-settings-panel,
        #projectMenu .morph-settings-grid,
        #projectMenu .morph-mode-card,
        #projectMenu .morph-setting-row {
            min-width:0;
            max-width:100%;
        }
        #projectMenu select { max-width:100%; }
        .random-settings-panel,
        .tunnel-settings-panel,
        .tap-settings-panel,
        .audio-panel {
            max-height:calc(100dvh - 16px)!important;
            overflow-y:auto;
            overscroll-behavior:contain;
        }
        @media (max-width:820px) {
            #projectMenu {
                max-width:calc(100vw - 12px)!important;
                max-height:calc(100dvh - 12px)!important;
            }
        }


        /* v164 — every scrollable popup stays inside the viewport. */
        .project-menu,
        .morph-settings-panel,
        .random-settings-panel,
        .tunnel-settings-panel,
        .tap-settings-panel,
        .audio-panel,
        .project-morph-settings-panel,
        .audio-param-menu,
        .audio-route-group-menu {
            max-height:calc(100dvh - 16px);
            overflow-y:auto;
            overscroll-behavior:contain;
            scrollbar-gutter:stable;
            -webkit-overflow-scrolling:touch;
        }
        .audio-param-menu, .audio-route-group-menu {
            max-width:calc(100vw - 16px);
            overflow-x:hidden;
        }

        /* v42 — restored top Morphing settings + checkbox bulk actions */
        .morph-checkbox-tools {
            display:inline-flex;
            align-items:center;
            gap:3px;
            margin-left:auto;
            flex:0 0 auto;
        }
        .morph-checkbox-tools button {
            width:26px;
            min-width:26px;
            height:26px;
            min-height:26px;
            padding:0!important;
            justify-content:center;
            border-radius:6px;
        }
        .morph-clear-checks {
            color:#cbd5e1;
            border-color:rgba(148,163,184,.35);
            background:rgba(148,163,184,.07);
            font-size:14px!important;
        }
        .morph-clear-checks:hover { background:rgba(148,163,184,.16); }
        .morph-undo-checks {
            color:#67e8f9;
            border-color:rgba(103,232,249,.34);
            background:rgba(103,232,249,.07);
            font-size:15px!important;
        }
        .morph-undo-checks:disabled { opacity:.28; cursor:default; }
        .morph-nav .morph-settings-panel {
            max-width:calc(100vw - 16px);
            max-height:calc(100dvh - 16px);
            overflow-y:auto;
            overflow-x:hidden;
            overscroll-behavior:contain;
            scrollbar-gutter:stable;
        }




        /* v91 — Morphing topology switches are independent multi-select toggles. */
        .morph-shape-options .morph-segmented-switch button.active {
            box-shadow: inset 0 0 0 1px rgba(255,255,255,.16), 0 0 0 1px rgba(99,102,241,.18);
        }

                /* v149 — half-width audio routing, compact File menu, playlist chooser */
        .audio-routing-panel {
            left:8px!important;
            right:auto!important;
            width:50vw!important;
            min-width:0!important;
            max-width:calc(100vw - 16px)!important;
        }
        .audio-routing-main {
            overflow-y:auto!important;
            overflow-x:auto!important;
        }
        .audio-route-row {
            min-width:0!important;
            grid-template-columns:22px 18px minmax(68px,88px) minmax(130px,1.5fr) minmax(108px,.95fr) minmax(100px,1fr) 64px 24px!important;
        }
        .audio-route-row > * { min-width:0; max-width:100%; }
        .audio-route-row > input[type="number"] { width:100%!important; }
        #projectMenu,
        #projectMenu:has(#fileMorphingBlock:not(.hidden)) {
            width:260px!important;
            min-width:260px!important;
            max-width:calc(100vw - 24px)!important;
        }
        #projectMenu .file-morphing-block,
        #projectMenu .file-settings-block,
        #projectMenu .file-shapes-block,
        #projectMenu .file-defaults-block { width:100%!important; }
        .preset-chooser-panel,.project-chooser-panel,.morph-type-nav{display:inline-flex;align-items:center;gap:3px;}
        .project-chooser-panel select { min-width:190px; max-width:250px; }
        .project-chooser-panel select.project-folder-empty { color:var(--text-muted); }
        @media (max-width: 1050px) {
            .project-chooser-panel select { min-width:145px; max-width:180px; }
        }
        @media (max-width:1200px) {
            .audio-routing-layout { grid-template-columns:112px minmax(0,1fr)!important; }
            .audio-route-row {
                grid-template-columns:22px 18px 76px minmax(0,1fr) 64px 24px!important;
                grid-template-rows:auto auto;
            }
            .audio-route-row > :nth-child(1){grid-column:1;grid-row:1;}
            .audio-route-row > :nth-child(2){grid-column:2;grid-row:1;}
            .audio-route-row > :nth-child(3){grid-column:3;grid-row:1;}
            .audio-route-row > :nth-child(4){grid-column:4 / 6;grid-row:1;}
            .audio-route-row > :nth-child(5){grid-column:1 / 4;grid-row:2;justify-content:flex-start;}
            .audio-route-row > :nth-child(6){grid-column:4;grid-row:2;}
            .audio-route-row > :nth-child(7){grid-column:5;grid-row:2;width:100%!important;}
            .audio-route-row > :nth-child(8){grid-column:6;grid-row:1;}
        }
        @media (max-width:760px) {
            .audio-routing-panel{left:4px!important;right:4px!important;top:4px!important;bottom:4px!important;width:auto!important;}
            .audio-routing-layout{grid-template-columns:92px minmax(0,1fr)!important;}
            .project-chooser-panel select { min-width:132px; max-width:155px; }
            #projectMenu { width:min(260px,calc(100vw - 12px))!important; min-width:0!important; }
        }


        /* v92 — compact File menu actions are left-aligned; obsolete folder chooser removed. */
        #projectMenu > button,
        #projectMenu .file-settings-block > button,
        #projectMenu .file-shapes-block > button,
        #projectMenu .file-morphing-actions > button,
        #projectMenu .file-defaults-block > button,
        #projectMenu .file-morphing-reset {
            justify-content:flex-start!important;
            text-align:left!important;
        }
        #projectMenu .file-setting-toggle {
            justify-content:flex-start!important;
            text-align:left!important;
        }

    
        /* v102 — mobile UI mirrors the current desktop control set. */
        @media (max-width:760px) {
            .sidebar-tool-rail { width:46px !important; }
            aside#settingsSidebar { left:46px !important; width:min(calc(96vw - 46px), 390px) !important; max-width:390px !important; }
            aside#settingsSidebar .sidebar-content { padding:10px 10px calc(72px + env(safe-area-inset-bottom)) !important; }
            aside#settingsSidebar .control-group { padding:10px !important; gap:9px !important; }
            aside#settingsSidebar .control-row { gap:5px !important; }
            .profile-library-tabs { display:grid !important; grid-template-columns:repeat(5,minmax(0,1fr)) !important; gap:3px !important; width:100% !important; }
            .profile-library-tab { min-width:0 !important; padding:5px 2px !important; font-size:9px !important; line-height:1.12 !important; white-space:normal !important; }
            .contour-mode-toggle { grid-template-columns:repeat(4,minmax(0,1fr)) !important; }
            .contour-mode-toggle button { min-height:38px !important; font-size:9px !important; padding:4px 2px !important; }
            .spiral-settings-block { padding:7px !important; gap:7px !important; }
            .spiral-settings-row { grid-template-columns:minmax(0,1fr) 78px !important; }
            .spiral-settings-row input[type=number] { width:78px !important; min-height:34px !important; font-size:16px !important; }
            .morph-profile-group-switch { grid-template-columns:repeat(4,minmax(0,1fr)) !important; }
            .morph-profile-group-switch button { min-width:0 !important; padding:4px 2px !important; font-size:9px !important; }
            .morph-shape-options { grid-template-columns:1fr 1fr !important; }
            .morph-settings-panel, .random-settings-panel, .tunnel-settings-panel, .tap-settings-panel {
                left:max(6px,env(safe-area-inset-left)) !important; right:max(6px,env(safe-area-inset-right)) !important; top:calc(58px + env(safe-area-inset-top)) !important; max-height:calc(100dvh - 66px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
            }
            .morph-settings-grid { grid-template-columns:1fr !important; }
            .floating-display-controls #paramBoundingCircleColor { display:none !important; }
        }
        @media (max-width:430px) {
            aside#settingsSidebar { width:calc(100vw - 46px) !important; max-width:none !important; }
            .profile-library-tab { font-size:8px !important; }
            .morph-shape-options { grid-template-columns:1fr !important; }
        }


        /* v107 — separated Shape/Line tool modules and persistent feature-state icons */
        .shape-star-icon { font-size:23px; line-height:1; transform:translateY(-1px); }
        #btnSidebarShape.feature-enabled .shape-star-icon { color:#f8fafc; text-shadow:0 0 8px rgba(129,140,248,.85); }
        .rainbow-line-icon { width:22px; height:4px; border-radius:999px; display:block; transform:rotate(-18deg); background:#64748b; box-shadow:none; transition:background .15s ease, box-shadow .15s ease, filter .15s ease; }
        #btnSidebarLines.feature-enabled .rainbow-line-icon { background:linear-gradient(90deg,#ef4444,#f59e0b,#84cc16,#06b6d4,#6366f1,#d946ef); box-shadow:0 0 8px rgba(103,232,249,.55); }
        #btnSidebarLines.graffiti-enabled .rainbow-line-icon { height:7px; filter:saturate(1.25); box-shadow:0 0 10px rgba(244,114,182,.72); }
        #btnSidebarLamps.feature-enabled { color:#fff59d; }
        #btnSidebarLamps.feature-enabled .lamp-dot-icon { background:#fde047; box-shadow:0 0 5px #fde047,0 0 13px #f59e0b; }
        #btnSidebarWeb.feature-enabled { color:#f8fafc; }
        #btnSidebarWeb.feature-enabled .web-icon { filter:drop-shadow(0 0 4px rgba(248,250,252,.9)); }
        #btnSidebarSweep.feature-enabled { color:#e0f2fe; }
        #btnSidebarSweep.feature-enabled .sweep-icon::after { box-shadow:0 0 7px currentColor,0 0 14px currentColor; }
        .sidebar-tool-btn.active { box-shadow:inset 0 0 0 1px rgba(129,140,248,.18); }
        #settingsSidebar.sidebar-mode-shape .sidebar-content > .control-group:not(.shape-settings-group) { display:none !important; }
        #settingsSidebar.sidebar-mode-lines .sidebar-content > .control-group:not(.line-settings-group) { display:none !important; }
        #settingsSidebar.sidebar-mode-lamps .sidebar-content > .control-group:not(.lamp-settings-group) { display:none !important; }
        #settingsSidebar.sidebar-mode-web .sidebar-content > .control-group:not(.web-settings-group) { display:none !important; }
        #settingsSidebar.sidebar-mode-sweep .sidebar-content > .control-group:not(.sweep-settings-group) { display:none !important; }
        .graffiti-nib-row { margin-top:6px; padding:8px; border:1px solid rgba(245,158,11,.28); border-radius:7px; background:rgba(120,53,15,.08); display:grid; gap:9px; }
        .graffiti-nib-row.hidden { display:none !important; }
        .graffiti-raster-option { display:flex; align-items:center; gap:6px; padding:5px 6px; border:1px solid rgba(245,158,11,.18); border-radius:6px; background:rgba(120,53,15,.055); font-size:10px; color:var(--text-main); cursor:pointer; }
        .graffiti-raster-option input { width:13px; height:13px; margin:0; accent-color:#f59e0b; }
        .graffiti-raster-option span { white-space:nowrap; }
        .graffiti-nib-row > label { display:grid; grid-template-columns:minmax(0,1fr) minmax(150px,1.35fr); gap:8px; align-items:center; font-size:10px; color:var(--text-muted); }
        .graffiti-nib-row select { width:100%; min-width:0; }
        .graffiti-wide-slider { display:grid; gap:5px; min-width:0; }
        .graffiti-wide-slider .row-label { font-size:10px; }
        .graffiti-range-with-multiplier { display:grid; grid-template-columns:minmax(150px,1fr) auto 64px; gap:7px; align-items:center; min-width:0; }
        .graffiti-range-with-multiplier input[type="range"] { width:100%; min-width:0; accent-color:#f59e0b; }
        .graffiti-range-with-multiplier input[type="number"] { width:64px !important; min-width:0; }
        .graffiti-variation { margin-top:2px; padding-top:8px; border-top:1px solid rgba(245,158,11,.20); display:grid; gap:8px; }
        .graffiti-variation-title { font-size:10px; font-weight:700; color:#fde68a; }
        .graffiti-variation-scope { display:grid; gap:6px; padding:6px; border:1px solid rgba(245,158,11,.18); border-radius:6px; background:rgba(120,53,15,.055); }
        .graffiti-variation-scope select { width:100%; }
        .graffiti-variation-every-n.hidden { display:none !important; }
        .graffiti-variation-every-n input[type="range"] { width:100%; min-width:0; accent-color:#f59e0b; }
        .graffiti-variation-block { padding:7px; border:1px solid rgba(245,158,11,.18); border-radius:6px; display:grid; gap:7px; background:rgba(120,53,15,.055); }
        .graffiti-variation-head { display:flex; align-items:center; gap:6px; font-size:10px; color:var(--text-main); }
        .graffiti-variation-head input { accent-color:#f59e0b; }
        .graffiti-variation-control { display:grid; gap:4px; min-width:0; font-size:9px; color:var(--text-muted); }
        .graffiti-variation-control .row-label { font-size:9px; }
        .graffiti-variation-control input[type="range"] { width:100%; min-width:0; accent-color:#f59e0b; }
        .graffiti-variation-control .text-mono { text-align:right; color:#fbbf24; font-size:9px; }
        .graffiti-rotation-strength { display:grid; grid-template-columns:minmax(150px,1fr) auto 64px; gap:7px; align-items:center; min-width:0; }
        .graffiti-rotation-strength input[type="range"] { width:100%; min-width:0; }
        .graffiti-rotation-strength input[type="number"] { width:64px !important; }
        .graffiti-variation-block.variation-disabled .graffiti-variation-control,
        .graffiti-variation-block.variation-disabled .graffiti-rotation-strength { opacity:.38; pointer-events:none; }
        @media (max-width:760px) {
            .sidebar-tool-rail.mobile-open { pointer-events:auto !important; filter:none !important; backdrop-filter:none !important; -webkit-backdrop-filter:none !important; opacity:1 !important; background:#0b1220 !important; isolation:isolate; }
            .sidebar-tool-rail .sidebar-tool-btn { pointer-events:auto !important; touch-action:manipulation !important; filter:none !important; opacity:1 !important; }
            .mobile-sidebar-backdrop { backdrop-filter:none !important; -webkit-backdrop-filter:none !important; }
            .morph-settings-panel { width:min(96vw,560px) !important; }
            .morph-setting-row, .morph-setting-row label, .morph-settings-note, .morph-settings-subtitle { font-size:11px !important; line-height:1.35 !important; }
            .morph-settings-panel select, .morph-settings-panel button { font-size:11px !important; min-height:30px; }
            .morph-profile-group-switch { grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
            .profile-library-tabs { grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
            #btnMobileMic { order:-19; }
            #btnMobileAudioRouting { order:-18; }
            #btnMobileFullscreen { order:-17; }
            #btnMobileMic, #btnMobileAudioRouting { display:inline-flex !important; }
            .graffiti-nib-row > label { grid-template-columns:1fr; }
        }

        #btnSidebarLines.active:not(.feature-enabled), #btnSidebarLamps.active:not(.feature-enabled), #btnSidebarWeb.active:not(.feature-enabled), #btnSidebarSweep.active:not(.feature-enabled) { color:var(--text-muted) !important; background:rgba(99,102,241,.19) !important; border-color:rgba(129,140,248,.70) !important; }

        /* v119 — consistent boolean settings + mobile parity cleanup. */
        .file-setting-toggle {
            width:100%; min-width:0; min-height:32px; padding:6px 8px;
            border-radius:6px; border:1px solid transparent;
            display:flex; align-items:center; gap:8px;
            overflow-wrap:anywhere; line-height:1.25;
        }
        .file-setting-toggle:hover { background:rgba(51,65,85,.42); border-color:rgba(71,85,105,.45); }
        .file-setting-toggle input[type="checkbox"] {
            width:16px; height:16px; flex:0 0 16px; margin:0; accent-color:#818cf8;
        }
        .file-setting-toggle > span { min-width:0; flex:1 1 auto; }
        #fpsLimitSetting { width:64px !important; flex:0 0 64px; text-align:center !important; }

        @media (max-width:760px) {
            /* Every desktop module remains reachable; only layout changes. */
            header, .header-actions, .app-container, main#mainContainer { max-width:100vw; }
            .header-actions { overflow-x:hidden !important; }
            #projectMenu {
                left:max(6px,env(safe-area-inset-left)) !important;
                right:max(6px,env(safe-area-inset-right)) !important;
                width:auto !important; max-width:none !important; min-width:0 !important;
                top:calc(58px + env(safe-area-inset-top)) !important;
                max-height:calc(100dvh - 66px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
                padding-bottom:calc(8px + env(safe-area-inset-bottom));
            }
            #projectMenu > button,
            #projectMenu .file-shapes-block button,
            #projectMenu .file-morphing-actions button,
            #projectMenu .file-morphing-reset {
                width:100%; min-width:0; min-height:42px !important;
                white-space:normal; overflow-wrap:anywhere; text-align:left;
            }
            #projectMenu .file-setting-toggle {
                min-height:42px; padding:9px 8px; font-size:12px; align-items:center;
            }
            #projectMenu .file-setting-toggle input[type="checkbox"] {
                width:19px; height:19px; flex-basis:19px;
            }
            .graffiti-range-with-multiplier, .graffiti-rotation-strength {
                grid-template-columns:minmax(0,1fr) auto 58px !important; width:100%;
            }
            .graffiti-range-with-multiplier input[type="number"],
            .graffiti-rotation-strength input[type="number"] { width:58px !important; }
            .graffiti-wide-slider, .graffiti-variation, .graffiti-variation-block, .graffiti-variation-control {
                min-width:0; max-width:100%;
            }
            .morph-size-row > label, .morph-rotation-row > label { gap:6px; }
            .morph-effect-control { width:100%; margin-left:0; }
            .morph-rotation-number-controls {
                width:100%; margin-left:0;
                grid-template-columns:minmax(46px,1fr) auto minmax(46px,1fr) auto auto minmax(52px,1fr);
            }
            .morph-rotation-direction { width:100%; margin-left:0; }
            .morph-line-palette, .morph-harmony-palette { max-width:100%; }
            .floating-controls { max-height:calc(100dvh - 140px); }
        }
        .morph-profile-group-switch { grid-template-columns:repeat(2,minmax(0,1fr)); }
        .morph-profile-group-check {
            min-width:0; min-height:30px; padding:5px 6px; border-radius:5px;
            display:flex; align-items:center; gap:6px; color:var(--text-main);
            font-size:9px; cursor:pointer; background:rgba(15,23,42,.28);
        }
        .morph-profile-group-check input[type="checkbox"] { width:15px; height:15px; flex:0 0 15px; margin:0; accent-color:#67e8f9; }
        .morph-profile-group-check span { min-width:0; overflow-wrap:anywhere; }

        @media (max-width:760px) {
            .morph-settings-panel * { box-sizing:border-box; }
            .morph-settings-panel .morph-settings-grid { width:100%; min-width:0; overflow-x:hidden; }
            .morph-setting-row.compact-morph-row {
                flex-direction:column !important; align-items:stretch !important; justify-content:flex-start !important;
                width:100%; min-width:0;
            }
            .morph-setting-row.compact-morph-row > label,
            .morph-setting-row.compact-morph-row .morph-row-check {
                width:100% !important; max-width:100%; margin-left:0 !important; white-space:normal !important;
            }
            .morph-setting-row.compact-morph-row .morph-row-check { justify-content:flex-start; }
            .morph-setting-row.compact-morph-row .morph-range-controls {
                width:100%; max-width:100%; margin-left:0; flex-wrap:wrap;
            }
            .morph-profile-group-switch { grid-template-columns:1fr 1fr !important; }
            .morph-profile-group-check { min-height:38px; font-size:11px; }
            .morph-profile-group-check input[type="checkbox"] { width:18px; height:18px; flex-basis:18px; }

            /* Keep close controls in their panel header instead of floating over content. */
            .morph-settings-panel .morph-settings-title,
            .random-settings-panel .morph-settings-title {
                position:sticky; top:-7px; z-index:12;
                margin:-7px -7px 6px; padding:7px;
                background:rgba(15,23,42,.985); border-bottom:1px solid rgba(51,65,85,.7);
            }
            .mobile-panel-close {
                position:static !important; top:auto !important; right:auto !important;
                margin-left:auto !important; flex:0 0 38px;
            }

            /* The bottom-left mobile Settings launcher must never cover an open panel. */
            body:has(#settingsSidebar.mobile-open) #btnMobileControls,
            body:has(#projectMenu:not(.hidden)) #btnMobileControls,
            body:has(#morphSettingsPanel:not(.hidden)) #btnMobileControls,
            body:has(#randomSettingsPanel:not(.hidden)) #btnMobileControls,
            body:has(#tunnelSettingsPanel:not(.hidden)) #btnMobileControls,
            body:has(#tapSettingsPanel:not(.hidden)) #btnMobileControls,
            body:has(#audioReactivePanel:not(.hidden)) #btnMobileControls,
            body:has(#audioRoutingPanel:not(.hidden)) #btnMobileControls,
            body:has(#libraryModal:not(.hidden)) #btnMobileControls { display:none !important; }
        }
        @media (max-width:360px) {
            aside#settingsSidebar { width:calc(100vw - 46px) !important; }
            .graffiti-range-with-multiplier, .graffiti-rotation-strength { grid-template-columns:minmax(0,1fr) auto 54px !important; gap:5px; }
            .morph-rotation-number-controls { gap:3px; grid-template-columns:44px auto 44px auto auto 48px; }
            .morph-rotation-number-controls input[type="number"] { width:44px !important; }
            .morph-rotation-number-controls .rotation-multiplier { width:48px !important; }
            .morph-profile-group-switch { grid-template-columns:1fr !important; }
        }

        /* v123 — compact Morph panel + deterministic rounding refresh. */
        .morph-mode-card .morph-top-row { display:flex; align-items:center; gap:8px; }
        .morph-mode-card .morph-top-row > label[for="morphMode"] { flex:1 1 auto; min-width:0; }
        .morph-mode-inline-check {
            width:auto !important; flex:0 0 auto !important; display:inline-flex !important;
            align-items:center; gap:4px; white-space:nowrap; color:var(--text-muted); font-size:9px;
        }
        .morph-mode-inline-check.hidden { display:none !important; }
        .morph-default-diversity-row { grid-column:1 / -1; display:flex; align-items:center; justify-content:space-between; gap:12px; }
        .morph-default-diversity-row > label { width:auto !important; flex:0 0 auto; white-space:nowrap; }
        .morph-default-diversity-row > label:last-child { margin-left:auto; }
        .morph-compact-pair-row {
            grid-column:1 / -1; display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:3px; min-width:0;
        }
        .morph-compact-pair-row .morph-pair-cell {
            min-width:0; padding:3px 5px; gap:3px; flex-wrap:wrap;
        }
        .morph-compact-pair-row .morph-pair-cell > label:first-child { min-width:0; flex:1 1 150px; }
        .morph-compact-pair-row .morph-pair-cell .morph-range-controls { margin-left:5px; }
        .morph-compact-pair-row .morph-pair-cell .morph-row-check { flex:0 0 auto; font-size:8px; }
        .morph-pair-title { white-space:nowrap; color:#cbd5e1; }
        .morph-shape-row { padding:3px 5px !important; }
        .morph-shape-checkline { display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:4px; align-items:center; min-width:0; }
        .morph-shape-master-check {
            display:inline-flex !important; width:auto !important; min-height:26px; padding:3px 5px;
            border:1px solid rgba(51,65,85,.62); border-radius:5px; background:rgba(15,23,42,.35); white-space:nowrap;
        }
        .morph-inline-section-title { color:#cbd5e1; font-size:9px; font-weight:600; white-space:nowrap; padding:0 2px; }
        .morph-right-check { margin-left:auto !important; }
        .morph-speed-slide-row .morph-pair-cell { min-width:0; }
        .morph-speed-slide-row .morph-pair-cell > label { width:100%; min-width:0; }
        .morph-speed-slide-row select { margin-left:auto; min-width:0; width:min(178px,58%); max-width:178px; }
        .morph-shape-checkline .morph-profile-group-switch { grid-template-columns:repeat(4,minmax(0,1fr)); margin:0; }
        .morph-shape-checkline .morph-profile-group-check { min-height:26px; padding:3px 5px; }
        .morph-shape-meta-line { display:flex; align-items:center; gap:8px; margin-top:3px; min-width:0; }
        .morph-shape-family-label { width:auto !important; flex:1 1 auto; min-width:0; }
        .morph-shape-family-label select { margin-left:auto; min-width:105px; max-width:145px; }
        .morph-shape-meta-line .morph-spline-points-row { margin:0 0 0 auto; flex:0 1 220px; justify-content:flex-end; }
        .morph-shape-meta-line .morph-spline-points-switch { width:min(132px,55%); }
        .morph-shape-meta-line .morph-spline-point-input { width:58px !important; }
        .morph-spiral-row { gap:5px; flex-wrap:wrap; }
        .morph-spiral-row > label:first-child { min-width:145px; }
        .morph-spiral-preserve { margin-left:0 !important; }
        .morph-spiral-morph-check { margin-left:auto !important; flex:0 0 auto; }
        @media (max-width:760px) {
            .morph-compact-pair-row { grid-template-columns:1fr; }
            .morph-compact-pair-row .morph-pair-cell { flex-direction:row !important; align-items:center !important; }
            .morph-compact-pair-row .morph-pair-cell > label:first-child { width:auto !important; flex:1 1 auto; }
            .morph-compact-pair-row .morph-pair-cell .morph-row-check { width:auto !important; margin-left:auto !important; }
            .morph-shape-checkline { grid-template-columns:minmax(0,1fr) auto; }
            .morph-shape-checkline .morph-inline-section-title { grid-column:1; grid-row:1; }
            .morph-shape-checkline .morph-right-check { grid-column:2; grid-row:1; }
            .morph-shape-checkline .morph-profile-group-switch { grid-column:1 / -1; grid-row:2; grid-template-columns:1fr 1fr !important; }
            .morph-shape-meta-line { flex-wrap:wrap; }
            .morph-shape-family-label { width:100% !important; }
            .morph-shape-meta-line .morph-spline-points-row { width:100%; flex:1 1 100%; justify-content:space-between; }
            .morph-mode-card .morph-top-row { flex-wrap:wrap; }
            .morph-mode-inline-check { margin-left:auto; }
        }
        @media (max-width:360px) {
            .morph-shape-checkline .morph-profile-group-switch { grid-template-columns:1fr 1fr !important; }
        }


        /* v140 — fixed mobile tool launcher + compact rail + bottom FPS */
        @media (max-width: 760px), (max-height: 480px) and (hover: none) and (pointer: coarse) {
            header { position:relative; }
            .header-actions {
                padding-left: 44px !important;
                box-sizing: border-box !important;
            }
            .mobile-controls-toggle {
                position: fixed !important;
                top: max(7px, env(safe-area-inset-top)) !important;
                left: max(7px, env(safe-area-inset-left)) !important;
                bottom: auto !important;
                width: 44px !important;
                height: 44px !important;
                min-width: 44px !important;
                min-height: 44px !important;
                padding: 0 !important;
                z-index: 245 !important;
                display: inline-flex !important;
                align-items:center !important;
                justify-content:center !important;
                font: 700 22px/1 system-ui,sans-serif !important;
                white-space: nowrap;
                border-radius: 8px !important;
                background: rgba(15,23,42,.96) !important;
                box-shadow: 0 6px 18px rgba(0,0,0,.38) !important;
            }
            /* The launcher must remain visible even when a settings panel is open. */
            body:has(#settingsSidebar.mobile-open) #btnMobileControls,
            body:has(#projectMenu:not(.hidden)) #btnMobileControls,
            body:has(#morphSettingsPanel:not(.hidden)) #btnMobileControls,
            body:has(#randomSettingsPanel:not(.hidden)) #btnMobileControls,
            body:has(#tunnelSettingsPanel:not(.hidden)) #btnMobileControls,
            body:has(#tapSettingsPanel:not(.hidden)) #btnMobileControls,
            body:has(#audioReactivePanel:not(.hidden)) #btnMobileControls,
            body:has(#audioRoutingPanel:not(.hidden)) #btnMobileControls,
            body:has(#libraryModal:not(.hidden)) #btnMobileControls { display:inline-flex !important; }

            .sidebar-tool-rail {
                top: calc(48px + env(safe-area-inset-top)) !important;
                bottom: auto !important;
                left: max(6px, env(safe-area-inset-left)) !important;
                width: 42px !important;
                height: auto !important;
                padding: 4px !important;
                border: 1px solid rgba(51,65,85,.72) !important;
                border-radius: 10px !important;
                background: rgba(15,23,42,.96) !important;
                box-shadow: 0 10px 28px rgba(0,0,0,.46) !important;
                transform: translate3d(-140%,0,0) !important;
                visibility: hidden !important;
                z-index: 244 !important;
            }
            .sidebar-tool-rail.mobile-rail-open,
            .sidebar-tool-rail.mobile-open {
                transform: translate3d(0,0,0) !important;
                visibility: visible !important;
            }
            .sidebar-tool-rail .sidebar-tool-btn {
                width: 32px !important;
                height: 32px !important;
                min-height: 32px !important;
            }
            aside#settingsSidebar {
                left: 48px !important;
                width: calc(100vw - 48px) !important;
                max-width: calc(100vw - 48px) !important;
                z-index: 240 !important;
            }
            .mobile-sidebar-backdrop { z-index: 235 !important; }

            .fps-counter {
                position: fixed !important;
                left: max(7px, env(safe-area-inset-left)) !important;
                bottom: max(8px, env(safe-area-inset-bottom)) !important;
                min-width: 46px !important;
                padding: 4px 5px !important;
                z-index: 45 !important;
                font-size: 9px !important;
            }
            .floating-controls {
                max-width: calc(100vw - 68px - env(safe-area-inset-left) - env(safe-area-inset-right)) !important;
                gap: 2px !important;
                padding: 3px !important;
            }
            .floating-controls .btn-icon,
            .floating-display-controls .display-control,
            .floating-display-controls .display-check,
            .floating-display-controls .display-color-control {
                width: 32px !important;
                height: 32px !important;
                min-width: 32px !important;
                min-height: 32px !important;
                flex: 0 0 32px !important;
                padding: 3px !important;
            }
            .floating-display-controls { gap:2px !important; }
        }
        @media (max-width: 360px) {
            .floating-controls {
                max-width: calc(100vw - 64px - env(safe-area-inset-left) - env(safe-area-inset-right)) !important;
            }
            .floating-controls .btn-icon,
            .floating-display-controls .display-control,
            .floating-display-controls .display-check,
            .floating-display-controls .display-color-control {
                width: 30px !important;
                height: 30px !important;
                min-width: 30px !important;
                min-height: 30px !important;
                flex-basis: 30px !important;
            }
        }


        /* v141 — mobile interaction/bounds fixes */
        @media (max-width: 760px) {
            /* Restore native horizontal panning of the one-row top toolbar. */
            .header-actions {
                overflow-x: auto !important;
                overflow-y: hidden !important;
                -webkit-overflow-scrolling: touch !important;
                overscroll-behavior-x: contain;
                touch-action: pan-x !important;
                scroll-padding-left: 48px;
            }

            /* Keep Auto-TAP ear reachable beside the fixed launcher while the toolbar scrolls. */
            #btnAutoTapListen {
                position: sticky;
                left: 0;
                z-index: 3;
                flex: 0 0 auto !important;
                box-shadow: 0 0 0 4px var(--panel-bg);
            }

            /* Audio popups must begin below the top toolbar, including safe-area inset. */
            #audioReactivePanel,
            #audioRoutingPanel {
                top: calc(58px + env(safe-area-inset-top)) !important;
                box-sizing: border-box !important;
            }
            #audioReactivePanel {
                left: max(6px, env(safe-area-inset-left)) !important;
                right: max(6px, env(safe-area-inset-right)) !important;
                width: auto !important;
                max-width: none !important;
                max-height: calc(100dvh - 66px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
                overflow-y: auto !important;
                overscroll-behavior: contain;
                -webkit-overflow-scrolling: touch;
            }
            #audioRoutingPanel {
                left: max(6px, env(safe-area-inset-left)) !important;
                right: max(6px, env(safe-area-inset-right)) !important;
                bottom: max(6px, env(safe-area-inset-bottom)) !important;
                width: auto !important;
                max-width: none !important;
                max-height: none !important;
            }

            /* Keep the layers/settings drawer inside the visible viewport and below the top bar. */
            aside#settingsSidebar {
                top: calc(58px + env(safe-area-inset-top)) !important;
                bottom: env(safe-area-inset-bottom) !important;
                height: auto !important;
                max-height: calc(100dvh - 58px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
                padding-top: 0 !important;
                padding-bottom: 0 !important;
                overflow: hidden !important;
                box-sizing: border-box !important;
            }
            #settingsSidebar > .section-header {
                display: grid !important;
                grid-template-columns: minmax(0, 1fr) auto;
                grid-template-areas:
                    "layer-title layer-master"
                    "layer-actions layer-actions";
                align-items: center !important;
                gap: 6px !important;
                min-width: 0 !important;
                width: 100% !important;
                padding: 8px 54px 8px 10px !important;
                box-sizing: border-box !important;
                overflow: hidden !important;
            }
            #settingsSidebar .sidebar-section-title {
                grid-area: layer-title;
                min-width: 0;
            }
            #settingsSidebar .master-layer-btn {
                grid-area: layer-master;
                min-width: 0;
                max-width: 100%;
            }
            #settingsSidebar .sidebar-layer-actions {
                grid-area: layer-actions;
                width: 100% !important;
                max-width: 100% !important;
                min-width: 0 !important;
                margin-left: 0 !important;
                justify-content: flex-start !important;
                flex-wrap: wrap !important;
                overflow: hidden !important;
            }
            #settingsSidebar .mobile-sidebar-close {
                top: 7px !important;
                right: 8px !important;
                z-index: 20 !important;
            }
            #layerList {
                width: 100% !important;
                max-width: 100% !important;
                min-width: 0 !important;
                max-height: min(28dvh, 180px) !important;
                overflow-x: hidden !important;
                overflow-y: auto !important;
                box-sizing: border-box !important;
                overscroll-behavior: contain;
                -webkit-overflow-scrolling: touch;
            }
            #layerList .layer-item {
                width: 100% !important;
                max-width: 100% !important;
                min-width: 0 !important;
                gap: 6px;
                overflow: hidden !important;
                box-sizing: border-box !important;
            }
            #layerList .layer-item > div:first-child {
                flex: 1 1 auto !important;
                min-width: 0 !important;
                overflow: hidden !important;
            }
            #layerList .layer-item > div:first-child > span:last-child {
                display: block;
                min-width: 0;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
            }
            #layerList .layer-item > div:last-child {
                flex: 0 0 auto !important;
            }
        }



        /* v142 — compact mobile layers, scrolling ear and mobile default framing */
        .mobile-layer-list-toggle { display:none; }
        @media (max-width: 760px) {
            /* The ear is part of the same horizontal rail; it must scroll with everything else. */
            #btnAutoTapListen {
                position: static !important;
                left: auto !important;
                z-index: auto !important;
                box-shadow: none !important;
                flex: 0 0 auto !important;
            }

            /* Keep the settings drawer inside the phone viewport beside the 44px tool rail. */
            aside#settingsSidebar {
                left: 44px !important;
                right: 0 !important;
                width: auto !important;
                max-width: none !important;
                min-width: 0 !important;
            }

            /* One compact row: title, master, count, add/copy/delete, layers arrow, close. */
            #settingsSidebar > .section-header {
                display: flex !important;
                flex-flow: row nowrap !important;
                align-items: center !important;
                justify-content: flex-start !important;
                gap: 3px !important;
                min-height: 38px !important;
                width: 100% !important;
                padding: 5px !important;
                overflow: hidden !important;
                box-sizing: border-box !important;
            }
            #settingsSidebar .sidebar-section-title {
                flex: 1 1 auto !important;
                min-width: 26px !important;
                max-width: 42px !important;
                overflow: hidden !important;
                white-space: nowrap !important;
                text-overflow: ellipsis !important;
                font-size: 10px !important;
            }
            #settingsSidebar .master-layer-btn {
                position: static !important;
                flex: 0 0 auto !important;
                width: auto !important;
                min-width: 44px !important;
                max-width: 48px !important;
                height: 28px !important;
                min-height: 28px !important;
                padding: 2px 5px !important;
                font-size: 9px !important;
            }
            #settingsSidebar .sidebar-layer-actions {
                display: contents !important;
            }
            #settingsSidebar #layerCountBadge {
                flex: 0 0 auto !important;
                min-width: 20px !important;
                padding: 2px 4px !important;
                text-align: center !important;
                font-size: 9px !important;
            }
            #settingsSidebar #btnAddLayer,
            #settingsSidebar #btnDuplicateLayer,
            #settingsSidebar #btnDeleteLayer,
            #settingsSidebar .mobile-layer-list-toggle,
            #settingsSidebar .mobile-sidebar-close {
                position: static !important;
                display: inline-flex !important;
                flex: 0 0 28px !important;
                width: 28px !important;
                min-width: 28px !important;
                max-width: 28px !important;
                height: 28px !important;
                min-height: 28px !important;
                padding: 0 !important;
                align-items: center !important;
                justify-content: center !important;
                margin: 0 !important;
                font-size: 15px !important;
                line-height: 1 !important;
            }
            #settingsSidebar .mobile-layer-list-toggle {
                color: #cbd5e1;
                font-size: 18px !important;
            }
            #settingsSidebar .mobile-sidebar-close {
                flex: 0 0 44px !important;
                width: 44px !important;
                min-width: 44px !important;
                max-width: 44px !important;
                height: 44px !important;
                min-height: 44px !important;
                font-size: 20px !important;
            }

            /* Layers start hidden on phones and can be unfolded with the arrow. */
            #settingsSidebar.mobile-layers-collapsed #layerList {
                display: none !important;
            }
            #layerList {
                flex: 0 0 auto !important;
                max-height: min(26dvh, 156px) !important;
                padding: 5px !important;
                gap: 3px !important;
                overflow-y: auto !important;
                overflow-x: hidden !important;
            }
            #layerList .layer-item {
                min-height: 27px !important;
                padding: 3px 7px !important;
                gap: 5px !important;
                font-size: 10px !important;
                line-height: 1.1 !important;
            }
            #layerList .layer-item button.btn-icon {
                width: 18px !important;
                min-width: 18px !important;
                height: 18px !important;
                min-height: 18px !important;
                padding: 0 !important;
                font-size: 10px !important;
                line-height: 1 !important;
            }
            #layerList .layer-item > div:first-child {
                gap: 5px !important;
            }
            #layerList .layer-item > div:first-child > span[style*="width:10px"] {
                width: 8px !important;
                height: 8px !important;
            }
        }
    
        /* v158 — Project Morph: playlist-to-playlist smooth project transitions */
        .project-morph-nav { position:relative; display:inline-flex; align-items:center; gap:2px; flex:0 0 auto; }
        .project-morph-btn, .project-morph-settings-btn {
            width:30px; height:28px; min-height:28px; padding:5px; justify-content:center;
            color:#4ade80; border-color:rgba(74,222,128,.36); background:rgba(34,197,94,.07);
            font-size:16px; line-height:1;
        }
        .project-morph-btn:hover, .project-morph-settings-btn:hover {
            color:#bbf7d0; background:rgba(34,197,94,.16); border-color:rgba(74,222,128,.62);
        }
        .project-morph-btn.active {
            color:#052e16; background:#4ade80; border-color:#86efac;
            box-shadow:0 0 0 1px rgba(134,239,172,.18),0 0 14px rgba(34,197,94,.30);
        }
        .project-morph-settings-panel {
            position:fixed; top:52px; left:50%; transform:translateX(-50%);
            width:min(360px,calc(100vw - 24px)); max-height:calc(100vh - 64px); overflow:auto;
            padding:10px; background:rgba(15,23,42,.98); border:1px solid rgba(74,222,128,.38);
            border-radius:10px; box-shadow:0 16px 35px rgba(0,0,0,.48); z-index:108; backdrop-filter:blur(10px);
        }
        .project-morph-settings-panel.hidden { display:none!important; }
        .project-morph-settings-head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:8px; }
        .project-morph-settings-head strong { color:#86efac; font-size:12px; }
        .project-morph-setting {
            display:flex; align-items:center; justify-content:space-between; gap:10px; margin:7px 0; padding:7px;
            border:1px solid rgba(51,65,85,.58); border-radius:7px; background:rgba(30,41,59,.36);
            font-size:10px; color:var(--text-muted);
        }
        .project-morph-setting label { display:flex; align-items:center; gap:6px; color:var(--text-main); cursor:pointer; }
        .project-morph-setting input[type="checkbox"] { accent-color:#22c55e; }
        .project-morph-setting input[type="number"] { width:72px; }
        .project-morph-setting select { max-width:178px; min-width:0; }
        .project-morph-setting.image-softness-row { display:grid; grid-template-columns:minmax(118px,auto) minmax(80px,1fr) 38px; gap:7px; }
        .project-morph-setting.image-softness-row input[type="range"] { width:100%; min-width:0; }
        .project-morph-setting.image-softness-row .text-mono { text-align:right; }
        .project-morph-setting.image-softness-row.hidden { display:none !important; }
        .project-morph-status { margin-top:7px; font-size:9px; line-height:1.4; color:#86efac; }
        @media (max-width:760px) {
            .project-morph-settings-panel { top:calc(52px + env(safe-area-inset-top,0px)); width:calc(100vw - 16px); }
            .project-morph-btn,.project-morph-settings-btn { width:38px; height:38px; min-height:38px; padding:7px; }
        }

        /* v149 playlist / isolation */
        .playlist-chooser-panel { gap:3px; }
        .playlist-chooser-panel > .btn-icon { flex:0 0 28px; }
        .playlist-chooser-panel #btnSavePlaylistProject { color:#86efac; }
        .playlist-chooser-panel #btnQuickNewProject { color:#fff; }
        .playlist-chooser-panel #btnQuickNewProject svg { width:15px; height:15px; display:block; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linejoin:round; }
        .playlist-chooser-panel #btnSavePlaylistProjectAsNew { color:#67e8f9; font-weight:800; }
        .playlist-chooser-panel #btnDeletePlaylistProject { color:#fca5a5; font-size:18px; }
        #layerList .layer-item.isolated { border-color:rgba(245,158,11,.78); box-shadow:inset 0 0 0 1px rgba(245,158,11,.16); }
        #layerList .layer-item.isolated .toggle-vis { color:#fbbf24; font-weight:900; }
        @media (max-width:980px){ .playlist-chooser-panel #projectSelect{min-width:125px;max-width:155px;} }

        /* v169 — shared playlist palette editor */
        .palette-editor {
            position:fixed; z-index:260; width:min(360px, calc(100vw - 20px)); max-height:min(520px, calc(100dvh - 20px));
            overflow:auto; padding:9px; border:1px solid var(--border-light); border-radius:10px;
            background:rgba(15,23,42,.985); box-shadow:0 20px 52px rgba(0,0,0,.58); backdrop-filter:blur(10px);
            overscroll-behavior:contain;
        }
        .palette-editor.hidden { display:none!important; }
        .palette-editor-head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:7px; }
        .palette-editor-head strong { font-size:11px; color:#f8fafc; }
        .palette-editor-note { margin-bottom:7px; font-size:8.5px; line-height:1.35; color:var(--text-muted); }
        .palette-editor-colors { display:grid; gap:5px; }
        .palette-editor-color { display:grid; grid-template-columns:34px minmax(0,1fr) 30px; gap:6px; align-items:center; padding:5px; border:1px solid rgba(51,65,85,.62); border-radius:6px; background:rgba(30,41,59,.42); }
        .palette-editor-color input[type="color"] { width:32px; height:26px; }
        .palette-editor-hex { font:9px/1 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; color:#cbd5e1; }
        .palette-editor-remove { width:30px; height:26px; padding:0; justify-content:center; color:#fecaca; border-color:rgba(248,113,113,.34); background:rgba(127,29,29,.12); }
        .palette-editor-add { width:100%; margin-top:7px; justify-content:center; color:#dbeafe; }
        #minimalMorphLinePalette { justify-content:flex-end; flex:1 1 320px; }
        .minimal-morph-palette-row { grid-column:1 / -1; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
        .minimal-morph-palette-row > label { width:auto; flex:0 0 auto; }
        .morph-line-palette-btn[data-line-morph-palette="holy"],
        .morph-line-palette-btn[data-minimal-morph-palette="holy"] { border-color:rgba(250,204,21,.78); box-shadow:inset 0 0 0 1px rgba(255,255,255,.10); }
        .morph-line-palette-btn[data-minimal-morph-palette="fire"] { border-color:rgba(249,115,22,.55); }
        .morph-line-palette-btn[data-minimal-morph-palette="ice"] { border-color:rgba(56,189,248,.55); }
        .morph-line-palette-btn[data-minimal-morph-palette="sex"] { border-color:rgba(244,63,94,.55); }



        /* v177 — Mobile long-press parameter focus mode */
        #mobileParameterFocusOverlay { display:none; }
        @media (max-width:760px), (max-height:480px) and (hover:none) and (pointer:coarse) {
            body.mobile-parameter-focus {
                background: var(--bg-dark) !important;
                overflow: hidden !important;
                touch-action: none;
            }
            body.mobile-parameter-focus > *:not(#mobileParameterFocusOverlay) {
                visibility: hidden !important;
                opacity: 0 !important;
                pointer-events: none !important;
            }
            #mobileParameterFocusOverlay.mobile-parameter-focus-active {
                position: fixed;
                inset: 0;
                z-index: 2147483000;
                display: block;
                visibility: visible !important;
                opacity: 1 !important;
                pointer-events: auto !important;
                background: var(--bg-dark);
                padding: 0;
                margin: 0;
                touch-action: manipulation;
                -webkit-tap-highlight-color: transparent;
            }
            .mobile-parameter-focus-dock {
                position: absolute;
                left: max(10px, env(safe-area-inset-left));
                right: max(10px, env(safe-area-inset-right));
                bottom: max(10px, env(safe-area-inset-bottom));
                min-width: 0;
                padding: 12px;
                border: 1px solid rgba(99,102,241,.52);
                border-radius: 14px;
                background: rgba(15,23,42,.98);
                box-shadow: 0 18px 45px rgba(0,0,0,.56);
                backdrop-filter: blur(12px);
                transform: translate3d(0,0,0);
                opacity: 1;
                transition: transform .30s cubic-bezier(.2,.8,.2,1), opacity .20s ease;
                will-change: transform, opacity;
                box-sizing: border-box;
            }
            .mobile-parameter-focus-title {
                min-width: 0;
                margin: 0 0 10px;
                color: var(--text-main);
                font-size: 14px;
                line-height: 1.25;
                font-weight: 700;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                text-align: center;
            }
            .mobile-parameter-focus-controls {
                display: grid;
                grid-template-columns: 44px minmax(0,1fr) 44px;
                gap: 8px;
                align-items: center;
                min-width: 0;
            }
            .mobile-parameter-focus-step {
                width: 44px !important;
                height: 44px !important;
                min-height: 44px !important;
                padding: 0 !important;
                justify-content: center !important;
                border-radius: 10px !important;
                font: 800 25px/1 system-ui, sans-serif !important;
                color: var(--text-main) !important;
                background: rgba(30,41,59,.96) !important;
                border-color: rgba(129,140,248,.42) !important;
                touch-action: manipulation;
            }
            .mobile-parameter-focus-step:active {
                transform: scale(.94);
                background: var(--card-bg-light) !important;
            }
            .mobile-parameter-focus-range-slot {
                display:flex;
                align-items:center;
                min-width:0;
                width:100%;
                min-height:44px;
            }
            .mobile-parameter-focus-range-slot > input[type="range"] {
                display:block !important;
                width:100% !important;
                min-width:0 !important;
                max-width:none !important;
                min-height:44px !important;
                margin:0 !important;
                touch-action:none;
            }
            .mobile-parameter-focus-multiplier {
                display:flex;
                align-items:center;
                justify-content:center;
                gap:7px;
                min-width:0;
                margin-top:9px;
            }
            .mobile-parameter-focus-multiplier.hidden { display:none !important; }
            .mobile-parameter-focus-multiplier > span {
                color:var(--text-muted);
                font-size:14px;
                font-weight:700;
            }
            .mobile-parameter-focus-multiplier > input[type="number"] {
                width:88px !important;
                min-width:88px !important;
                min-height:42px !important;
                height:42px !important;
                padding:5px 8px !important;
                font-size:16px !important;
                text-align:center !important;
            }
            body.mobile-parameter-focus .mobile-parameter-focus-dock * {
                visibility: visible !important;
                opacity: 1;
            }
        }


        /* v186 — playlist palette studio */
        .sidebar-tool-separator{width:28px;height:1px;flex:0 0 1px;background:rgba(71,85,105,.78);margin:2px 0;}
        .sidebar-tool-btn[data-sidebar-mode="palette"].active{background:rgba(236,72,153,.16);border-color:rgba(244,114,182,.72);color:#fbcfe8;}
        #settingsSidebar.sidebar-mode-palette .sidebar-content > .control-group:not(.palette-settings-group){display:none!important;}
        .palette-settings-group{border-color:rgba(244,114,182,.34);}

        /* v215 — global linear motion / camera wander / palette cycling */
        .sidebar-tool-btn[data-sidebar-mode="motion"] .motion-arrow-icon{
            display:block;font-size:22px;line-height:1;color:#64748b;transition:color .15s ease,text-shadow .15s ease,transform .15s ease;
        }
        #btnSidebarMotion.feature-enabled .motion-arrow-icon{color:#22c55e;text-shadow:0 0 8px rgba(34,197,94,.78);}
        .sidebar-tool-btn[data-sidebar-mode="motion"].active{background:rgba(34,197,94,.08);border-color:rgba(100,116,139,.72);color:#94a3b8;}
        .sidebar-tool-btn[data-sidebar-mode="motion"].active.feature-enabled{background:rgba(34,197,94,.16);border-color:rgba(74,222,128,.72);color:#dcfce7;}
        #settingsSidebar.sidebar-mode-motion .sidebar-content > .control-group:not(.motion-settings-group){display:none!important;}
        .motion-settings-group{border-color:rgba(34,197,94,.34);}
        .motion-settings-group .group-title-toggle input,.motion-toggle input{accent-color:#22c55e;}
        .motion-block{display:grid;gap:7px;padding:8px;border:1px solid rgba(51,65,85,.62);border-radius:7px;background:rgba(15,23,42,.45);}
        .motion-block.disabled .motion-dependent{opacity:.4;}
        .motion-head{display:flex;align-items:center;justify-content:space-between;gap:8px;min-width:0;}
        .motion-toggle{display:flex;align-items:center;gap:7px;cursor:pointer;color:var(--text-main);font-size:11px;min-width:0;}
        .motion-direction{min-width:154px!important;max-width:190px!important;justify-content:center;white-space:nowrap;}
        .motion-direction[data-direction="ccw"]{color:#a7f3d0;border-color:rgba(74,222,128,.42);background:rgba(34,197,94,.08);}
        .motion-direction[data-direction="cw"]{color:#bfdbfe;border-color:rgba(96,165,250,.42);background:rgba(59,130,246,.08);}
        .motion-lag-row{margin-top:1px;padding-top:7px;border-top:1px solid rgba(51,65,85,.48);}
        .motion-slider-mult{display:grid;grid-template-columns:minmax(0,1fr) auto 62px;gap:6px;align-items:center;min-width:0;}
        .motion-slider-mult input[type="range"]{width:100%;min-width:0;accent-color:#22c55e;}
        .motion-slider-mult input[type="number"]{width:62px!important;text-align:right!important;}
        .motion-palette-host{display:block;min-width:0;}
        .motion-palette-host select{width:100%;max-width:none!important;min-width:0!important;}
        .motion-note{font-size:9px;line-height:1.35;color:var(--text-muted);}
        @media(max-width:760px){.motion-head{align-items:flex-start;flex-direction:column}.motion-direction{width:100%;max-width:none!important}.motion-slider-mult{grid-template-columns:minmax(0,1fr) auto 58px;}}

        /* v212 — global Fourier wave rendering */
        .sidebar-tool-btn[data-sidebar-mode="fourier"]{
            font:700 12px/1 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
            letter-spacing:-.6px;color:#94a3b8;
        }
        .sidebar-tool-btn[data-sidebar-mode="fourier"].active{
            background:rgba(34,211,238,.12);border-color:rgba(103,232,249,.52);color:#cffafe;
        }
        .sidebar-tool-btn[data-sidebar-mode="fourier"].fourier-on{
            color:#67e8f9;border-color:rgba(34,211,238,.72);background:rgba(8,145,178,.16);
            box-shadow:0 0 0 1px rgba(103,232,249,.10),0 0 12px rgba(34,211,238,.16);
        }
        .sidebar-tool-btn[data-sidebar-mode="fourier"].active.fourier-on{
            background:rgba(8,145,178,.28);border-color:#67e8f9;color:#ecfeff;
        }
        #settingsSidebar.sidebar-mode-fourier .sidebar-content > .control-group:not(.fourier-settings-group){display:none!important;}
        .fourier-settings-group{border-color:rgba(34,211,238,.34);}
        .fourier-mode-toggle{display:flex;align-items:center;gap:7px;cursor:pointer;color:var(--text-main);font-size:11px;}
        .fourier-mode-toggle input{accent-color:#22d3ee;}
        .fourier-strength-row{margin-top:2px;}
        .fourier-strength-row .lamp-slider-mult{grid-template-columns:minmax(0,1fr);}
        .fourier-strength-row .hint-text{margin-top:2px;}
        .playlist-global-hue-control{display:grid;gap:5px;padding:7px 8px;border:1px solid rgba(56,189,248,.28);border-radius:8px;background:rgba(14,116,144,.08);}
        .playlist-global-hue-control .row-label{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:10px;color:#e2e8f0;}
        .playlist-global-hue-inputs{display:grid;grid-template-columns:minmax(0,1fr) 58px;gap:7px;align-items:center;}
        .playlist-global-hue-inputs input[type=range]{width:100%;min-width:0;}
        .playlist-global-hue-inputs input[type=number]{width:58px!important;text-align:right!important;}
        .palette-studio-note{font-size:9px;line-height:1.4;color:var(--text-muted);}
        .palette-studio-list{display:flex;flex-direction:column;gap:5px;}
        .palette-studio-item{border:1px solid rgba(51,65,85,.7);border-radius:8px;background:rgba(15,23,42,.52);overflow:hidden;}
        .palette-studio-head{display:grid;grid-template-columns:22px minmax(75px,1fr) 112px;gap:6px;align-items:center;padding:6px;cursor:pointer;}
        .palette-studio-head:hover{background:rgba(51,65,85,.28);}
        .palette-studio-head input[type="checkbox"]{accent-color:#f472b6;}
        .palette-studio-name{font-size:10px;color:#f8fafc;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;}
        .palette-key-mini{display:flex;align-items:center;justify-content:flex-start;gap:3px;width:112px;height:18px;overflow:hidden;background:transparent;padding-left:5px;padding-right:2px;box-sizing:border-box;}
        .palette-key-mini i{flex:0 0 12px;width:12px;height:12px;border-radius:50%;display:block;border:1px solid rgba(255,255,255,.24);box-shadow:0 0 5px rgba(255,255,255,.08);}
        .palette-studio-editor{display:grid;gap:8px;padding:8px;border-top:1px solid rgba(51,65,85,.58);background:rgba(30,41,59,.32);}
        .palette-studio-editor.hidden{display:none!important;}
        .palette-name-input{width:100%!important;text-align:left!important;color:#f8fafc!important;background:#0f172a!important;border:1px solid #475569!important;border-radius:5px!important;padding:5px 7px!important;font-size:10px!important;}
        .palette-name-row{display:grid;grid-template-columns:minmax(0,1fr) 30px;gap:6px;align-items:center;width:min(270px,100%);max-width:100%;}
        .palette-reset-btn{width:30px;height:28px;min-width:30px;padding:0!important;display:inline-flex!important;align-items:center;justify-content:center;font-size:16px!important;line-height:1;color:#fbcfe8;border-color:rgba(244,114,182,.42);background:rgba(190,24,93,.08);}
        .palette-reset-btn:hover{background:rgba(190,24,93,.22);border-color:rgba(244,114,182,.72);color:#fff;}
        .palette-key-strip{display:flex;width:240px;max-width:100%;height:34px;border-radius:6px;overflow:visible;border:1px solid rgba(255,255,255,.18);background:#020617;position:relative;touch-action:none;user-select:none;}
        .palette-key-segment{position:relative;flex:1 1 0;min-width:10px;height:100%;cursor:grab;z-index:1;touch-action:none;}
        .palette-key-segment:active{cursor:grabbing;}
        .palette-key-segment input[type="color"]{position:absolute;width:1px;height:1px;left:50%;top:50%;opacity:0;pointer-events:none;}
        .palette-key-segment.selected{z-index:4;outline:3px solid #ef4444;outline-offset:2px;box-shadow:0 0 0 1px rgba(255,255,255,.72),0 0 10px rgba(239,68,68,.55);}
        .palette-key-segment.left-dragging{z-index:5;cursor:grabbing;box-shadow:0 0 0 2px rgba(96,165,250,.95),0 6px 16px rgba(0,0,0,.5);transform:translateY(-1px);}

        /* v189 — universal persistent color picker. Right-click any color control. */
        .app-color-picker{position:fixed;z-index:2147482500;width:min(430px,calc(100vw - 20px));max-height:calc(100dvh - 20px);overflow:auto;padding:10px;border:1px solid #64748b;border-radius:11px;background:rgba(15,23,42,.992);box-shadow:0 22px 60px rgba(0,0,0,.68);backdrop-filter:blur(12px);display:grid;gap:8px;overscroll-behavior:contain;}
        .app-color-picker.hidden{display:none!important;}
        .app-color-picker-head{display:flex;align-items:center;justify-content:space-between;gap:8px;}
        .app-color-picker-head strong{font-size:11px;color:#f8fafc;}
        .app-color-picker-preview{width:34px;height:26px;border:1px solid rgba(255,255,255,.35);border-radius:6px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.18);flex:0 0 auto;}
        .app-color-picker-mode{display:grid;grid-template-columns:1fr 1fr;gap:3px;padding:2px;border:1px solid #334155;border-radius:7px;background:#0b1220;}
        .app-color-picker-mode button{justify-content:center;min-height:27px;padding:4px 7px;font-size:10px;background:transparent;border:0;color:#94a3b8;}
        .app-color-picker-mode button.active{background:#334155;color:#fff;box-shadow:inset 0 0 0 1px rgba(148,163,184,.28);}
        .app-color-picker-view{display:grid;gap:8px;}
        .app-color-picker-view.hidden{display:none!important;}
        .app-color-picker-row{display:grid;grid-template-columns:72px minmax(0,1fr) 52px;gap:7px;align-items:center;font-size:9px;color:#cbd5e1;}
        .app-color-picker-row input[type="range"]{width:100%;min-width:0;touch-action:none;cursor:ew-resize;}
        .app-color-picker-row input[type="number"]{width:52px!important;}
        .app-color-picker-hex{display:grid;grid-template-columns:72px minmax(0,1fr);gap:7px;align-items:center;font-size:9px;color:#cbd5e1;}
        .app-color-picker-hex input{width:100%;background:#0b1220;border:1px solid #475569;border-radius:5px;color:#f8fafc;padding:5px 7px;font:10px ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;text-transform:uppercase;}
        .app-color-picker-standard-title{font-size:9px;font-weight:700;color:#e2e8f0;margin-top:1px;}
        .app-color-picker-standard{display:grid;grid-template-columns:repeat(13,minmax(0,1fr));gap:4px;}
        .app-color-standard-swatch{aspect-ratio:1/1;min-width:0;padding:0!important;border-radius:4px!important;border:1px solid rgba(255,255,255,.22)!important;box-shadow:inset 0 0 0 1px rgba(0,0,0,.18);}
        .app-color-standard-swatch:hover{transform:scale(1.12);z-index:2;border-color:#fff!important;}
        .app-color-radial-layout{display:grid;grid-template-columns:200px minmax(82px,1fr) 34px;gap:10px;align-items:stretch;min-width:0;}
        .app-color-wheel{width:200px;height:200px;max-width:100%;aspect-ratio:1/1;border-radius:50%;position:relative;cursor:crosshair;touch-action:none;box-shadow:0 0 0 1px rgba(255,255,255,.32),0 8px 24px rgba(0,0,0,.38);background:radial-gradient(circle at 50% 50%,#fff 0%,rgba(255,255,255,.96) 2%,rgba(255,255,255,0) 70.7%),conic-gradient(from 90deg,#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00);overflow:hidden;}
        .app-color-wheel-point{position:absolute;width:13px;height:13px;border-radius:50%;border:2px solid #fff;box-shadow:0 0 0 1px #020617,0 2px 5px rgba(0,0,0,.65);transform:translate(-50%,-50%);pointer-events:none;}
        .app-color-rgb-fields{display:grid;align-content:center;gap:8px;min-width:0;}
        .app-color-rgb-field{display:grid;grid-template-columns:18px minmax(48px,1fr);gap:5px;align-items:center;font-size:10px;color:#cbd5e1;}
        .app-color-rgb-field input{width:100%!important;min-width:0!important;padding:4px 5px!important;text-align:center!important;font-variant-numeric:tabular-nums;}
        .app-color-rgb-field.r span{color:#f87171}.app-color-rgb-field.g span{color:#4ade80}.app-color-rgb-field.b span{color:#60a5fa}
        .app-color-value-wrap{display:grid;grid-template-rows:1fr auto;justify-items:center;gap:5px;font-size:8px;color:#94a3b8;min-height:200px;}
        .app-color-value{appearance:none;-webkit-appearance:none;writing-mode:vertical-lr;direction:rtl;width:24px!important;height:176px!important;min-height:130px;touch-action:none;cursor:ns-resize;border-radius:7px;background:linear-gradient(to top,#000,#fff)!important;}
        .app-color-value::-webkit-slider-runnable-track{width:8px;height:100%;background:transparent!important;}
        .app-color-value::-webkit-slider-thumb{width:20px;height:10px;margin:0 0 0 -6px;border-radius:3px;background:#fff;border:2px solid #0f172a;box-shadow:0 0 0 1px rgba(255,255,255,.55);}
        @media(max-width:520px){.app-color-picker{width:min(390px,calc(100vw - 12px));}.app-color-picker-standard{grid-template-columns:repeat(10,minmax(0,1fr));}.app-color-picker-row{grid-template-columns:62px minmax(0,1fr) 48px;}.app-color-radial-layout{grid-template-columns:minmax(150px,190px) minmax(68px,1fr) 30px;gap:7px}.app-color-wheel{width:100%;height:auto}.app-color-value{height:155px!important;}}
        .palette-key-actions{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px!important;}
        .palette-key-actions button{min-width:0;padding:5px 4px;font-size:9px!important;white-space:normal;line-height:1.15;}
        .palette-delete-palette-btn{width:100%;justify-content:center;color:#fecaca;border-color:rgba(248,113,113,.34);background:rgba(127,29,29,.12);}
        .palette-key-actions{display:flex;gap:5px;flex-wrap:wrap;}
        .palette-key-actions button,.palette-create-btn{justify-content:center;font-size:10px;}
        .palette-create-btn{width:100%;color:#fbcfe8;border-color:rgba(244,114,182,.4);background:rgba(190,24,93,.08);}
        .palette-editor-control{display:grid;grid-template-columns:minmax(94px,1fr) minmax(90px,1fr) 48px;gap:6px;align-items:center;font-size:9px;color:var(--text-muted);}
        .palette-editor-control input[type="range"]{width:100%;min-width:0;}
        .palette-editor-control input[type="number"]{width:54px!important;}
        .palette-total-text{font:9px/1.3 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;color:#cbd5e1;}
        .palette-dropdown-host{display:flex!important;gap:6px!important;align-items:center!important;min-width:150px;}
        .palette-dropdown-host select{min-width:145px!important;max-width:210px!important;height:24px!important;font-size:9px!important;}
        .palette-cycle-check{width:auto!important;display:inline-flex!important;gap:4px!important;align-items:center!important;white-space:nowrap;color:#cbd5e1!important;font-size:9px!important;}
        .palette-cycle-check input{accent-color:#f472b6;}
        .palette-quick-menu{position:fixed;z-index:240;width:220px;max-height:min(420px,calc(100vh - 30px));overflow:auto;padding:6px;border:1px solid #475569;border-radius:9px;background:rgba(15,23,42,.98);box-shadow:0 18px 45px rgba(0,0,0,.55);}
        .palette-quick-item{display:grid;grid-template-columns:minmax(70px,1fr) 112px;gap:6px;align-items:center;padding:6px;border-radius:6px;font-size:9px;color:#e2e8f0;}
        .palette-quick-item:hover{background:rgba(51,65,85,.42);}
        .palette-quick-swatches{display:flex;gap:2px;width:112px;height:18px;overflow:hidden;border-radius:5px;background:#0b1220;}
        .palette-quick-swatch{flex:1 1 0;min-width:7px;cursor:context-menu;border:1px solid rgba(255,255,255,.16)!important;border-radius:3px!important;padding:0!important;height:18px!important;}
        @media(max-width:760px){
            .palette-studio-head{grid-template-columns:22px minmax(0,1fr) minmax(76px,92px);gap:5px;padding:6px 5px;}
            .palette-key-mini,.palette-quick-swatches{width:100%;min-width:0;}
            .palette-key-mini{padding-left:7px;padding-right:1px;}
            .palette-studio-name{min-width:0;font-size:9.5px;}
            .palette-studio-editor{padding:7px 6px;gap:7px;overflow:hidden;}
            .palette-name-row{width:100%;grid-template-columns:minmax(0,1fr) 32px;}
            .palette-name-input{min-width:0!important;width:100%!important;}
            .palette-reset-btn{width:32px;min-width:32px;height:30px;}
            .palette-key-strip{width:100%;max-width:100%;height:38px;}
            .palette-key-actions{grid-template-columns:repeat(2,minmax(0,1fr))!important;}
            .palette-key-actions button{min-height:32px;font-size:9px!important;}
            .palette-editor-control{grid-template-columns:minmax(0,1fr) 50px;gap:5px;}
            .palette-editor-control>span:first-child{grid-column:1/-1;}
            .palette-editor-control input[type=range]{grid-column:1;min-width:0;}
            .palette-editor-control input[type=number]{grid-column:2;width:50px!important;}
            .palette-total-text{white-space:normal;line-height:1.45;}
            .palette-quick-menu{width:min(220px,calc(100vw - 16px));max-height:min(70dvh,420px);}
        }
        @media(max-width:430px){
            .palette-studio-head{grid-template-columns:20px minmax(0,1fr) minmax(68px,82px);}
            .palette-key-mini i{flex-basis:10px;width:10px;height:10px;}
            .palette-studio-editor{padding:6px 5px;}
            .palette-key-strip{height:40px;}
            .palette-key-actions{gap:4px!important;}
        }


        /* v194 — raster Graffiti toggle in Lines header + compact morph palette rows */
        .line-display-group .control-group-title { gap:6px; min-width:0; }
        .line-display-group .line-raster-toggle { margin-left:auto; margin-right:5px; min-width:0; }
        .line-display-group .line-raster-toggle input { accent-color:#f59e0b; }
        .line-display-group .line-raster-toggle:has(input:checked) { color:#fde68a; }
        .line-display-group .line-raster-toggle span { max-width:92px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

        .palette-morph-compact-row {
            display:grid!important;
            grid-template-columns:auto minmax(92px,150px) auto!important;
            align-items:center!important;
            justify-content:stretch!important;
            gap:6px!important;
            min-width:0!important;
            overflow:hidden!important;
        }
        .palette-morph-compact-row > label,
        .palette-morph-compact-row .palette-morph-label,
        .palette-morph-compact-row .palette-cycle-check {
            width:auto!important;
            min-width:0!important;
            max-width:none!important;
            flex:0 0 auto!important;
            flex-wrap:nowrap!important;
            white-space:nowrap!important;
            overflow:hidden!important;
            text-overflow:ellipsis!important;
        }
        .palette-morph-compact-row .palette-dropdown-host {
            display:block!important;
            width:100%!important;
            min-width:0!important;
            max-width:150px!important;
            margin:0!important;
            overflow:hidden!important;
        }
        .palette-morph-compact-row .palette-dropdown-host select,
        .palette-morph-compact-row .playlist-palette-select {
            display:block!important;
            width:100%!important;
            min-width:0!important;
            max-width:100%!important;
            height:24px!important;
            min-height:24px!important;
            padding:1px 22px 1px 6px!important;
            font-size:9px!important;
            line-height:20px!important;
            overflow:hidden!important;
            text-overflow:ellipsis!important;
            white-space:nowrap!important;
        }
        .palette-morph-compact-row .palette-cycle-check { gap:3px!important; font-size:9px!important; }
        .palette-morph-compact-row .palette-cycle-check input { flex:0 0 12px; width:12px; height:12px; margin:0; }
        .minimal-morph-palette-row.palette-morph-compact-row { flex-wrap:nowrap!important; }
        @media(max-width:760px) {
            .palette-morph-compact-row {
                grid-template-columns:auto minmax(82px,1fr) auto!important;
                gap:5px!important;
                padding:4px 5px!important;
                min-height:30px!important;
            }
            .palette-morph-compact-row .palette-dropdown-host { max-width:none!important; width:100%!important; }
            .palette-morph-compact-row .palette-dropdown-host select,
            .palette-morph-compact-row .playlist-palette-select { font-size:10px!important; height:28px!important; min-height:28px!important; }
            .palette-morph-compact-row .palette-morph-label,
            .palette-morph-compact-row .palette-cycle-check { font-size:10px!important; }
            .line-display-group .line-raster-toggle span { max-width:76px; }
        }
        @media(max-width:390px) {
            .palette-morph-compact-row { grid-template-columns:auto minmax(70px,1fr) auto!important; gap:4px!important; }
            .palette-morph-compact-row .palette-morph-label span { max-width:62px; overflow:hidden; text-overflow:ellipsis; }
            .line-display-group .line-raster-toggle span { max-width:62px; }
        }



        /* v286 — compact color-music panel, compact Morphing grid, viewport-safe floating panels. */
        @media (min-width:761px) {
            #audioReactivePanel.audio-panel {
                width:min(520px, calc(100vw - 16px));
                padding:10px;
            }
            #audioReactivePanel .audio-custom-band-row {
                grid-template-columns:72px minmax(0,1fr) 116px;
                gap:5px;
            }
            #audioReactivePanel .audio-custom-dual { min-width:0; }
            #audioReactivePanel .audio-custom-band-values {
                grid-template-columns:50px 10px 50px;
                gap:3px;
            }
            #audioReactivePanel .audio-custom-band-values input[type="number"] {
                width:50px !important;
                padding-left:2px;
                padding-right:2px;
            }
        }
        #audioReactivePanel,
        #morphSettingsPanel,
        #randomSettingsPanel,
        #tunnelSettingsPanel,
        #tapSettingsPanel,
        #projectMorphSettingsPanel {
            overflow-y:auto;
            overflow-x:hidden;
            overscroll-behavior:contain;
            scrollbar-gutter:stable;
            -webkit-overflow-scrolling:touch;
        }
        #audioRoutingPanel .audio-routing-main,
        #audioRoutingPanel .audio-routing-layers {
            overscroll-behavior:contain;
            scrollbar-gutter:stable;
            -webkit-overflow-scrolling:touch;
        }
        .morph-compact-control-line {
            display:flex; align-items:center; gap:5px; width:100%; min-width:0;
            font-size:9px; color:var(--text-muted);
        }
        .morph-compact-control-line > label {
            display:inline-flex; align-items:center; gap:4px; width:auto; min-width:0; cursor:pointer;
        }
        .morph-compact-control-line > label:first-child { color:#cbd5e1; flex:0 0 auto; }
        .morph-inline-check-title { display:inline-flex !important; align-items:center; gap:4px; cursor:pointer; width:auto !important; }
        .morph-compact-control-line .morph-range-controls { margin-left:auto; }
        .morph-compact-control-line .morph-normalize-check { margin-left:auto; white-space:nowrap; color:var(--text-muted); }
        .morph-size-percent-input { width:52px !important; text-align:right !important; }
        .morph-reset-compact {
            flex:0 0 auto; min-width:24px; height:24px; min-height:24px; padding:1px 6px !important;
            color:#fecaca; border-color:rgba(248,113,113,.48); background:rgba(127,29,29,.18);
        }
        .morph-reset-compact:hover { color:white; border-color:#f87171; background:rgba(185,28,28,.36); }
        .morph-reset-cross { width:24px; min-width:24px; padding:0 !important; font-size:15px; justify-content:center; }
        .morph-opacity-rounding-row .morph-pair-cell { align-items:center; }
        .morph-opacity-rounding-row .morph-range-controls input { width:44px !important; }
        .morph-orbit-rotation-row .morph-pair-cell { align-items:center; }
        .morph-orbit-rotation-row .morph-rotation-number-controls {
            display:grid; grid-template-columns:40px auto 40px auto auto 42px; gap:2px; align-items:center; margin-left:auto;
        }
        .morph-orbit-rotation-row .morph-rotation-number-controls input[type="number"] { width:40px !important; }
        .morph-orbit-rotation-row .morph-rotation-number-controls .rotation-multiplier { width:42px !important; }
        .morph-rotation-direction-compact { margin-left:3px !important; white-space:nowrap; font-size:8px; }
        .morph-lamp-chaos-row .morph-pair-cell { display:block; min-width:0; }
        .morph-lamp-chaos-row .morph-lamp-morph-inner,
        .morph-lamp-chaos-row .morph-chaos-morph-inner { gap:5px; flex-wrap:wrap; }
        .morph-lamp-chaos-row .lamp-morph-settings { min-width:0 !important; flex:1 1 100% !important; }
        .morph-fill-harmony-select {
            flex:1 1 170px; min-width:150px; max-width:240px; height:25px; padding:2px 5px; font-size:9px;
        }
        #morphFillColorRow { flex-wrap:nowrap; gap:5px; padding-top:4px; padding-bottom:4px; }
        #morphFillColorRow .morph-fill-counts { flex:0 0 auto; }
        #morphFillColorRow .morph-fill-counts input { width:40px !important; }
        @media (max-width:760px) {
            #morphFillColorRow { flex-wrap:wrap; }
            .morph-orbit-rotation-row .morph-rotation-number-controls { grid-template-columns:44px auto 44px auto auto 46px; }
            .morph-lamp-chaos-row { grid-template-columns:1fr !important; }
        }

        /* v293 — GPU clipping composite for inside/outside lightning; v292 — uniform lightning joins */
        .project-title-dropdown { position:relative; display:inline-flex; min-width:0; }
        #projectNameButton { min-width:190px; max-width:250px; justify-content:space-between; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
        #projectNameButton.project-folder-empty { color:var(--text-muted); }
        #projectSelect { display:none !important; }
        .project-name-dropdown-menu, .project-name-context-menu { position:fixed; z-index:420; min-width:190px; max-width:min(320px,calc(100vw - 16px)); max-height:min(420px,calc(100vh - 16px)); overflow-y:auto; overflow-x:hidden; padding:5px; background:rgba(15,23,42,.99); border:1px solid var(--border-light); border-radius:8px; box-shadow:0 16px 36px rgba(0,0,0,.55); overscroll-behavior:contain; scrollbar-gutter:stable; }
        .project-name-dropdown-menu.hidden, .project-name-context-menu.hidden { display:none !important; }
        .project-name-dropdown-menu button, .project-name-context-menu button { width:100%; justify-content:flex-start; border:0; background:transparent; padding:7px 9px; }
        .project-name-dropdown-menu button:hover, .project-name-context-menu button:hover { background:var(--card-bg-light); }
        .project-name-dropdown-menu button.active { color:#c7d2fe; background:rgba(99,102,241,.16); }
        .library-item .library-actions { display:flex; align-items:center; justify-content:flex-end; gap:4px; flex-wrap:wrap; }
        .library-item .library-actions button { padding:5px 7px; font-size:10px; white-space:nowrap; }
        .morph-size-multiplier { width:46px !important; text-align:right !important; }
        .morph-size-mult-wrap { display:inline-flex; align-items:center; gap:3px; margin-left:2px; }
        .morph-vertex-mult-wrap { display:inline-flex; align-items:center; gap:3px; margin-left:2px; }
        .morph-vertex-multiplier { width:42px !important; text-align:right !important; }
        @media (max-width:980px){ #projectNameButton { min-width:125px; max-width:155px; } }
        @media (max-width:760px){
            .morph-stroke-size-row,
            .morph-orbit-rotation-row,
            .morph-opacity-rounding-row,
            .morph-lamp-chaos-row { grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
        }


        /* v288 — blue Morphing cleanup: requested pairs always stay two-up. */
        .morph-stroke-size-row,
        .morph-orbit-rotation-row,
        .morph-opacity-rounding-row,
        .morph-lamp-chaos-row {
            grid-template-columns:repeat(2,minmax(0,1fr)) !important;
            align-items:stretch;
        }
        .morph-stroke-size-row > .morph-pair-cell,
        .morph-orbit-rotation-row > .morph-pair-cell,
        .morph-opacity-rounding-row > .morph-pair-cell,
        .morph-lamp-chaos-row > .morph-pair-cell {
            min-width:0 !important;
            width:auto !important;
            overflow:hidden;
        }
        .morph-stroke-size-row .morph-compact-control-line,
        .morph-orbit-rotation-row .morph-compact-control-line,
        .morph-opacity-rounding-row .morph-compact-control-line {
            flex-wrap:nowrap;
        }
        .morph-stroke-size-row .morph-range-controls,
        .morph-orbit-rotation-row .morph-range-controls,
        .morph-opacity-rounding-row .morph-range-controls {
            min-width:0;
        }
        .morph-stroke-size-row .morph-normalize-check {
            margin-left:3px;
            font-size:8px;
        }
        .morph-opacity-rounding-row .morph-pair-title {
            white-space:normal;
            line-height:1.05;
        }
        @media (max-width:560px) {
            .morph-stroke-size-row,
            .morph-orbit-rotation-row,
            .morph-opacity-rounding-row,
            .morph-lamp-chaos-row {
                grid-template-columns:repeat(2,minmax(0,1fr)) !important;
            }
            .morph-stroke-size-row .morph-pair-cell,
            .morph-orbit-rotation-row .morph-pair-cell,
            .morph-opacity-rounding-row .morph-pair-cell,
            .morph-lamp-chaos-row .morph-pair-cell {
                padding-left:4px !important;
                padding-right:4px !important;
            }
        }

        /* v290 — the four requested Morph pairs are real two-column rows.
           Older feature classes used grid-column:1/-1 and overrode the pair grid. */
        .morph-stroke-size-row,
        .morph-orbit-rotation-row,
        .morph-opacity-rounding-row,
        .morph-lamp-chaos-row {
            display:grid !important;
            grid-template-columns:minmax(0,1fr) minmax(0,1fr) !important;
            gap:3px !important;
        }
        .morph-stroke-size-row > .morph-pair-cell,
        .morph-orbit-rotation-row > .morph-pair-cell,
        .morph-opacity-rounding-row > .morph-pair-cell,
        .morph-lamp-chaos-row > .morph-pair-cell {
            grid-column:auto !important;
            min-width:0 !important;
            max-width:none !important;
        }
        .morph-stroke-size-row .morph-size-row,
        .morph-orbit-rotation-row .morph-rotation-row,
        .morph-opacity-rounding-row .morph-opacity-row,
        .morph-lamp-chaos-row .morph-lamp-morph-row,
        .morph-lamp-chaos-row .morph-chaos-morph-row {
            grid-column:auto !important;
        }
        .library-head { gap:8px; }
        .library-head-title { flex:0 0 auto; }
        .library-head-actions { display:flex; align-items:center; gap:5px; margin-left:auto; min-width:0; }
        .library-head-actions button:not(.btn-icon) { padding:5px 8px; font-size:10px; white-space:nowrap; }
        @media (max-width:620px) {
            .library-head-actions button:not(.btn-icon) { padding:5px 6px; font-size:9px; }
        }
    
        /* v427 — GPU-native line Sprite / Moving Line blocks. Backend telemetry paints
           these white on direct WebGPU and orange only if a future fallback is introduced. */
        .gpu-line-fx-block{border:1px solid rgba(34,211,238,.28);background:rgba(8,47,73,.15);border-radius:8px;padding:8px;display:flex;flex-direction:column;gap:7px;}
        .gpu-line-fx-head{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:11px;color:var(--text-main);}
        .gpu-line-fx-head label{display:flex;align-items:center;gap:6px;cursor:pointer;font-weight:650;}
        .gpu-line-fx-head input[type="checkbox"]{accent-color:#22d3ee;}
        .gpu-line-fx-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;}
        .gpu-line-fx-grid .control-row{min-width:0;}
        .gpu-line-fx-grid select{width:100%;min-width:0;}
        .gpu-line-fx-color{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:6px;}
        .gpu-line-fx-color label{display:flex;align-items:center;gap:5px;font-size:10px;color:var(--text-muted);white-space:nowrap;}
        .gpu-line-fx-color input[type="color"]{width:25px;height:25px;}
        .line-sprite-preview-card{display:flex;flex-direction:column;gap:6px;padding:7px;border:1px solid rgba(34,211,238,.24);border-radius:7px;background:rgba(2,6,23,.42);}
        .line-sprite-preview-art{width:100%;height:58px;border-radius:6px;overflow:hidden;border:1px solid rgba(148,163,184,.28);background:linear-gradient(135deg,rgba(15,23,42,.98),rgba(8,47,73,.85));display:flex;align-items:center;justify-content:center;}
        .line-sprite-preview-art svg{width:100%;height:54px;display:block;}
        .line-sprite-preview-art img{width:100%;height:100%;object-fit:fill;display:none;}
        .line-sprite-preview-meta{min-width:0;display:flex;align-items:center;justify-content:space-between;gap:6px;flex-wrap:wrap;}
        .line-sprite-preview-name{font-size:10px;color:var(--text-main);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1 1 120px;}
        .line-sprite-preview-actions{display:flex;gap:5px;flex-wrap:wrap;}
        .line-sprite-preview-actions button{padding:4px 6px;font-size:9px;min-height:24px;}
        .line-sprite-gallery-title{font-size:9px;color:var(--text-muted);letter-spacing:.03em;}
        .line-sprite-preset-grid{display:flex;flex-direction:column;gap:5px;}
        .line-sprite-preset{width:100%;min-width:0;display:grid;grid-template-columns:minmax(0,1fr) 74px;align-items:center;gap:7px;padding:4px 6px;border:1px solid rgba(51,65,85,.72);border-radius:7px;background:rgba(15,23,42,.55);}
        .line-sprite-preset:hover{background:rgba(30,41,59,.72);border-color:rgba(34,211,238,.48);}
        .line-sprite-preset.active{background:rgba(8,145,178,.16);border-color:rgba(34,211,238,.82);box-shadow:inset 0 0 0 1px rgba(34,211,238,.15);}
        .line-sprite-preset svg{width:100%;height:37px;display:block;overflow:visible;}
        .line-sprite-preset span{font-size:9px;text-align:right;white-space:nowrap;color:var(--text-muted);}
        .line-sprite-preset.active span{color:#cffafe;}
        .line-sprite-size-mult{display:grid;grid-template-columns:minmax(0,1fr) auto 58px;align-items:center;gap:5px;}
        .line-sprite-size-mult input[type="range"]{width:100%;min-width:0;}
        .line-sprite-size-mult input[type="number"]{width:58px!important;min-width:0;}
        .gpu-line-fx-color.sprite-palette{grid-template-columns:auto 25px auto 25px auto;}
        .gpu-line-fx-color.sprite-palette .sprite-secondary-label{font-size:9px;color:var(--text-muted);white-space:nowrap;}
        .gpu-line-fx-disabled>.gpu-line-fx-grid,.gpu-line-fx-disabled>.gpu-line-fx-color,.gpu-line-fx-disabled>.gpu-line-fx-extra{opacity:.42;pointer-events:none;}

    
/* v523 — independent Web branches */
.web-branch-row{align-items:stretch;}
.web-branch-toggles{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;width:100%;}
.web-branch-toggle{min-width:0;display:flex;align-items:center;justify-content:center;gap:5px;padding:6px 5px;border:1px solid rgba(51,65,85,.62);border-radius:6px;background:rgba(15,23,42,.48);color:var(--text-muted);font-size:9px;line-height:1.18;cursor:pointer;text-align:center;}
.web-branch-toggle:has(input:checked){color:#f8fafc;border-color:rgba(226,232,240,.62);background:rgba(148,163,184,.15);box-shadow:0 0 10px rgba(226,232,240,.05) inset;}
.web-branch-toggle input{accent-color:#f8fafc;flex:0 0 auto;}
@media(max-width:520px){.web-branch-toggles{grid-template-columns:1fr;}.web-branch-toggle{justify-content:flex-start;}}

/* v524 — GPU contour particles */
#particleGpuOverlayCanvas{
    position:absolute;inset:0;width:100%;height:100%;display:none;z-index:6;
    pointer-events:none;opacity:1;mix-blend-mode:normal;transform:translateZ(0);backface-visibility:hidden;
}
.sidebar-tool-btn[data-sidebar-mode="particles"].active{background:rgba(30,41,59,.72);border-color:rgba(100,116,139,.72);color:#cbd5e1;}
.sidebar-tool-btn[data-sidebar-mode="particles"].feature-enabled{border-color:rgba(103,232,249,.78);box-shadow:inset 0 0 0 1px rgba(34,211,238,.22),0 0 11px rgba(34,211,238,.14);}
.particle-star-icon{display:inline-block;width:12px;height:12px;border:1px solid #64748b;border-radius:2px;background:#475569;box-shadow:none;filter:none;transition:background .12s ease,border-color .12s ease,box-shadow .12s ease;}
.sidebar-tool-btn[data-sidebar-mode="particles"].feature-enabled .particle-star-icon{background:#67e8f9;border-color:#a5f3fc;box-shadow:0 0 5px rgba(34,211,238,.95),0 0 12px rgba(34,211,238,.62);}
#settingsSidebar.sidebar-mode-particles .sidebar-content > .control-group:not(.particle-settings-group){display:none!important;}

/* v527 — project palette selection and new Web controls */
.palette-quick-item.active-project-palette{outline:1px solid currentColor;background:rgba(148,163,184,.16);font-weight:650;}
#btnSidebarPalette.palette-project-active{box-shadow:inset 0 0 0 1px currentColor,0 0 12px color-mix(in srgb,currentColor 30%,transparent);}
#webSecondaryColorRow:not(.hidden),#webSunDegreesRow:not(.hidden){display:flex;}

/* v634 additions: audio master-edit, monoradius rounding, spiral morph selector */
.audio-routing-head-actions{display:flex;align-items:center;gap:6px;min-width:0;}
.audio-routing-head .audio-master-edit-btn{min-width:132px!important;max-width:170px;white-space:nowrap;color:#fde68a;border-color:rgba(234,179,8,.45);background:rgba(113,63,18,.12);}
.audio-routing-head .audio-master-edit-btn.active{color:#fff7c2;background:rgba(234,179,8,.22);border-color:rgba(250,204,21,.9);box-shadow:0 0 12px rgba(234,179,8,.22);}
.audio-routing-head .audio-master-edit-btn.hidden{display:none!important;}
.rounding-mode-row{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:7px;}
.rounding-mode-row select{min-width:122px;}
.morph-spiral-type{display:flex;align-items:center;gap:7px;min-width:0;}
.morph-spiral-type select{max-width:190px;min-width:150px;}


/* Somata 6.6 — Spiral Morph controls are intentionally split into two stable rows. */
.morph-spiral-row-primary,.morph-spiral-row-secondary{grid-column:1 / -1;}
.morph-spiral-row-primary{align-items:center;}
.morph-spiral-row-secondary{align-items:center;justify-content:flex-start;gap:12px;}
.morph-spiral-rotation-compensation{display:inline-flex!important;align-items:center;gap:6px;width:auto!important;flex:0 0 auto!important;white-space:nowrap;margin-left:auto;}
@media(max-width:760px){
  .morph-spiral-row-secondary{align-items:flex-start;}
  .morph-spiral-row-secondary .morph-spiral-type{width:100%;justify-content:space-between;}
  .morph-spiral-row-secondary .morph-spiral-type select{max-width:none;flex:1 1 150px;}
  .morph-spiral-rotation-compensation{margin-left:0;}
}

/* Somata 7.3.20 hf9 — FreezeLight blocks */
.lamp-freeze-block{margin-top:6px;padding:6px 7px;border:1px solid rgba(148,163,184,.18);border-radius:7px;background:rgba(15,23,42,.28);}
.lamp-freeze-rain-block{margin-top:5px;}
.lamp-freeze-block-toggle{margin:0!important;padding:0!important;width:100%;}
.lamp-freeze-rain-toggle{margin:0!important;padding:0!important;width:100%;}
.lamp-freeze-details{display:grid;gap:5px;margin-top:6px;padding-top:6px;border-top:1px solid rgba(148,163,184,.14);}
.lamp-freeze-details.hidden{display:none!important;}
.lamp-freeze-row.hidden{display:none!important;}
.lamp-freeze-row.disabled{opacity:.46;}
.lamp-freeze-chromatic-toggle{margin-top:2px!important;}
.lamp-rain-angle-control{display:grid;grid-template-columns:minmax(0,1fr) 58px auto;gap:5px;align-items:center;}
.lamp-rain-angle-control input[type="range"]{width:100%;min-width:0;}
.lamp-rain-angle-control input[type="number"]{width:58px!important;text-align:right;}
.lamp-rain-angle-control>span{font-size:11px;color:var(--muted,#94a3b8);}

/* Somata 7.0 — on-canvas error console. Created only after the first real error. */
#screenErrorOverlay{
    position:fixed;
    left:12px;
    right:12px;
    bottom:12px;
    z-index:2147483000;
    display:flex;
    flex-direction:column;
    max-height:min(46vh, 420px);
    overflow:hidden;
    overscroll-behavior:contain;
    border:1px solid rgba(248,113,113,.8);
    border-radius:8px;
    background:rgba(20,3,7,.92);
    box-shadow:0 10px 34px rgba(0,0,0,.55), inset 0 0 0 1px rgba(127,29,29,.28);
    user-select:text;
    -webkit-user-select:text;
    pointer-events:auto;
    touch-action:pan-y;
}
#screenErrorOverlay[hidden]{display:none!important;}
#screenErrorOverlay.is-collapsed{max-height:none;}
#screenErrorOverlayHeader{
    flex:0 0 auto;
    min-height:34px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    padding:5px 6px 5px 10px;
    border-bottom:1px solid rgba(248,113,113,.28);
    background:rgba(58,7,14,.72);
    cursor:default;
    user-select:none;
    -webkit-user-select:none;
}
#screenErrorOverlay.is-collapsed #screenErrorOverlayHeader{border-bottom:0;}
#screenErrorOverlayTitle{
    min-width:0;
    color:#ff8585;
    font:700 12px/1.2 ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;
}
#screenErrorOverlayCount{
    display:inline-flex;
    min-width:20px;
    height:20px;
    padding:0 6px;
    align-items:center;
    justify-content:center;
    border-radius:999px;
    background:rgba(248,113,113,.17);
    color:#ffaaaa;
    font-size:11px;
}
#screenErrorOverlayActions{display:flex;align-items:center;gap:5px;}
#screenErrorOverlayActions button{
    min-width:28px;
    height:26px;
    padding:0 8px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border:1px solid rgba(248,113,113,.42);
    border-radius:5px;
    background:rgba(40,5,10,.78);
    color:#ffb0b0;
    font:700 11px/1 ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;
    cursor:pointer;
}
#screenErrorOverlayActions button:hover{background:rgba(127,29,29,.5);color:#fff;}
#screenErrorOverlayCopy{min-width:112px!important;}
#screenErrorOverlayClear{min-width:94px!important;}
#screenErrorOverlayClose{font-size:18px!important;font-family:Arial,sans-serif!important;}
#screenErrorOverlayBody{
    flex:1 1 auto;
    min-height:0;
    overflow:auto;
    overscroll-behavior:contain;
    padding:9px 12px 11px;
    scrollbar-gutter:stable;
    cursor:text;
    user-select:text;
    -webkit-user-select:text;
}
#screenErrorOverlayBody[hidden]{display:none!important;}
#screenErrorOverlayText{
    margin:0;
    min-width:0;
    white-space:pre-wrap;
    overflow-wrap:anywhere;
    word-break:break-word;
    color:#ff6b6b;
    font:600 12px/1.42 ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;
    text-shadow:0 0 8px rgba(248,113,113,.18);
    user-select:text;
    -webkit-user-select:text;
}
@media(max-width:620px){
    #screenErrorOverlay{left:6px;right:6px;bottom:6px;max-height:42%;}
    #screenErrorOverlayHeader{padding-left:8px;gap:5px;}
    #screenErrorOverlayBody{padding:8px 9px 9px;}
    #screenErrorOverlayCopy{min-width:92px!important;padding:0 5px!important;font-size:10px!important;}
    #screenErrorOverlayClear{min-width:78px!important;padding:0 5px!important;font-size:10px!important;}
    #screenErrorOverlayText{font-size:10px;line-height:1.38;}
}

/* Somata — FPS counter is the entry point for the in-app error console. */
.fps-counter{
    pointer-events:auto!important;
    cursor:pointer;
    z-index:2147482999!important;
    user-select:none;
    -webkit-user-select:none;
}
.fps-counter:hover{border-color:rgba(148,163,184,.9);background:rgba(15,23,42,.92);}
.fps-counter:focus-visible{outline:2px solid rgba(148,163,184,.9);outline-offset:2px;}
.fps-counter.has-errors{border-color:rgba(248,113,113,.9);color:#fecaca;}
.fps-counter.has-errors::after{
    content:"!" attr(data-error-count);
    position:absolute;
    left:100%;
    top:0;
    transform:translate(-35%,-45%);
    min-width:17px;
    height:17px;
    padding:0 4px;
    display:flex;
    align-items:center;
    justify-content:center;
    border:1px solid rgba(254,202,202,.9);
    border-radius:999px;
    background:#991b1b;
    color:#fff;
    font:700 9px/1 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
    box-shadow:0 2px 8px rgba(0,0,0,.45);
}


/* v7.2.4 hotfix — compact confirmation for mobile FPS error-copy action. */
#somataErrorCopyToast{
    position:fixed;
    left:50%;
    bottom:calc(58px + env(safe-area-inset-bottom));
    transform:translate(-50%,8px);
    z-index:2147483001;
    pointer-events:none;
    opacity:0;
    padding:7px 10px;
    border:1px solid rgba(148,163,184,.55);
    border-radius:9px;
    background:rgba(15,23,42,.96);
    color:#e2e8f0;
    box-shadow:0 6px 18px rgba(0,0,0,.38);
    font:600 11px/1.2 system-ui,sans-serif;
    white-space:nowrap;
    transition:opacity .14s ease,transform .14s ease;
}
#somataErrorCopyToast.is-visible{opacity:1;transform:translate(-50%,0);}

/* Somata 7.3.16 — in-client release certification controls. */
.file-self-test{display:grid;gap:6px;padding:8px 9px;border:1px solid rgba(148,163,184,.22);border-radius:7px;background:rgba(15,23,42,.42)}
.file-self-test-title{font-size:11px;font-weight:700;color:#e2e8f0}
.file-self-test-actions{display:grid;grid-template-columns:1fr 1fr;gap:6px}
.file-self-test-actions button{min-width:0;padding:6px 7px;font-size:11px}
.file-self-test-actions button:disabled{opacity:.55;cursor:wait}
.file-self-test-status{font-size:10px;line-height:1.35;color:#94a3b8;overflow-wrap:anywhere}
.file-self-test-status.pass{color:#86efac}
.file-self-test-status.fail{color:#fca5a5}

/* =========================================================
   HOTFIX 11 — iPhone presentation/fullscreen compatibility
   iPhone Safari still does not expose element Fullscreen API for arbitrary
   HTML.  Somata therefore falls back to an app-owned presentation mode that
   fills the real VisualViewport.  Home-screen/standalone launch then has no
   Safari browser chrome and this mode is effectively full-screen.
   ========================================================= */
#btnPseudoFullscreenExit {
    display: none;
}

html.app-pseudo-fullscreen,
html.app-pseudo-fullscreen body {
    width: var(--somata-viewport-width, 100vw) !important;
    height: var(--somata-viewport-height, 100dvh) !important;
    min-width: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    background: #090d16 !important;
}

html.app-pseudo-fullscreen body {
    padding: 0 !important;
    margin: 0 !important;
}

html.app-pseudo-fullscreen header,
html.app-pseudo-fullscreen aside,
html.app-pseudo-fullscreen .sidebar-tool-rail,
html.app-pseudo-fullscreen .floating-controls,
html.app-pseudo-fullscreen .info-pill,
html.app-pseudo-fullscreen .audio-panel,
html.app-pseudo-fullscreen .audio-routing-panel,
html.app-pseudo-fullscreen .tunnel-settings-panel,
html.app-pseudo-fullscreen .tap-settings-panel,
html.app-pseudo-fullscreen .project-morph-settings-panel,
html.app-pseudo-fullscreen .library-modal,
html.app-pseudo-fullscreen .shortcut-toast,
html.app-pseudo-fullscreen .mobile-controls-toggle,
html.app-pseudo-fullscreen .mobile-sidebar-close,
html.app-pseudo-fullscreen .mobile-sidebar-backdrop {
    display: none !important;
}

html.app-pseudo-fullscreen .app-container {
    position: fixed !important;
    inset: 0 !important;
    width: var(--somata-viewport-width, 100vw) !important;
    height: var(--somata-viewport-height, 100dvh) !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: none !important;
}

html.app-pseudo-fullscreen main#mainContainer {
    position: fixed !important;
    inset: 0 !important;
    width: var(--somata-viewport-width, 100vw) !important;
    height: var(--somata-viewport-height, 100dvh) !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

html.app-pseudo-fullscreen #mainCanvas {
    width: var(--somata-viewport-width, 100vw) !important;
    height: var(--somata-viewport-height, 100dvh) !important;
}

html.app-pseudo-fullscreen .fps-counter {
    left: max(10px, env(safe-area-inset-left)) !important;
    bottom: max(10px, env(safe-area-inset-bottom)) !important;
}

html.app-pseudo-fullscreen #btnPseudoFullscreenExit {
    position: fixed;
    z-index: 2147483000;
    top: max(8px, env(safe-area-inset-top));
    right: max(8px, env(safe-area-inset-right));
    display: inline-flex !important;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid rgba(148,163,184,.44);
    background: rgba(15,23,42,.68);
    color: #f8fafc;
    font-size: 20px;
    line-height: 1;
    box-shadow: 0 4px 16px rgba(0,0,0,.34);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    touch-action: manipulation;
}

/* Older/prefixed WebKit fullscreen must receive the same sizing rules as the
   standards path.  Previously only controls were hidden in this branch. */
:-webkit-full-screen body {
    width: 100vw !important;
    height: 100vh !important;
    padding: 0 !important;
}
:-webkit-full-screen .app-container {
    width: 100vw !important;
    height: 100vh !important;
    flex: none !important;
}
:-webkit-full-screen main#mainContainer {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
}
:-webkit-full-screen #mainCanvas {
    width: 100vw !important;
    height: 100vh !important;
}
:-webkit-full-screen .fps-counter {
    left: 12px !important;
    bottom: 12px !important;
}


/* 7.4.22 — desktop brand/output launcher.  The header artwork fills the
   existing 28 px toolbar row without adding a framed button.  Detached output
   keeps rendering/capture alive while the local presentation surfaces are
   visually suppressed behind the centered brand stage. */
.desktop-brand-logo-button,
.desktop-brand-logo { display: none; }
@media (min-width: 761px) {
    header { gap: 10px; }
    .desktop-brand-logo-button {
        display: inline-flex;
        width: 52px;
        min-width: 52px;
        height: 28px;
        min-height: 28px;
        flex: 0 0 52px;
        padding: 0;
        overflow: visible;
        align-items: center;
        justify-content: center;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }
    .desktop-brand-logo-button:hover,
    .desktop-brand-logo-button.active {
        border: 0;
        background: transparent;
        box-shadow: none;
    }
    .desktop-brand-logo-button:hover .desktop-brand-logo,
    .desktop-brand-logo-button.active .desktop-brand-logo {
        filter: brightness(1.08);
        transform: scale(1.02);
    }
    .desktop-brand-logo {
        display: block;
        width: 52px;
        height: 28px;
        object-fit: contain;
        object-position: center;
        pointer-events: none;
        user-select: none;
        -webkit-user-drag: none;
        transform-origin: center;
        transition: filter .15s ease, transform .15s ease;
    }
    .header-actions {
        width: auto;
        min-width: 0;
        flex: 1 1 auto;
    }
}
@media (max-width: 760px), (max-height: 480px) and (hover: none) and (pointer: coarse) {
    .desktop-brand-logo-button,
    .desktop-brand-logo { display: none !important; }
}

.desktop-brand-stage {
    position: absolute;
    inset: 0;
    z-index: 9;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    overflow: hidden;
}
.desktop-brand-stage.active { display: flex; }
.desktop-brand-stage-logo {
    width: min(72%, 900px);
    max-width: calc(100% - 48px);
    max-height: 68%;
    object-fit: contain;
    border-radius: 0;
    user-select: none;
    -webkit-user-drag: none;
    box-shadow: none;
}

/* The capture source must keep drawing for captureStream(), so this mode does
   not stop GPU rendering.  It removes the duplicate local presentation from
   the main-window compositor while the detached output consumes the same live
   canvas stream. */
#mainContainer.desktop-output-local-hidden > .grid-pattern,
#mainContainer.desktop-output-local-hidden > #projectMorphBackgroundSource,
#mainContainer.desktop-output-local-hidden > #projectMorphBackgroundTarget,
#mainContainer.desktop-output-local-hidden > #viewportBackgroundImage,
#mainContainer.desktop-output-local-hidden > #sceneBlendCanvas,
#mainContainer.desktop-output-local-hidden > #mainCanvas,
#mainContainer.desktop-output-local-hidden > #finalGpuCanvas,
#mainContainer.desktop-output-local-hidden > #graffitiGpuOverlayCanvas,
#mainContainer.desktop-output-local-hidden > #pathFxOverlayCanvas,
#mainContainer.desktop-output-local-hidden > #particleGpuOverlayCanvas,
#mainContainer.desktop-output-local-hidden > #lampGlCanvas,
#mainContainer.desktop-output-local-hidden > #geometryGlCanvas,
#mainContainer.desktop-output-local-hidden > #sweepGlCanvas {
    opacity: 0 !important;
    pointer-events: none !important;
}
@media (max-width: 760px), (max-height: 480px) and (hover: none) and (pointer: coarse) {
    .desktop-brand-stage { display: none !important; }
}

/* v7.5 — independent Orange Morph family + multi-pool selector */
.minimal-morph-family-row label{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;}
.minimal-morph-family-row select{min-width:128px;max-width:170px;}
.minimal-morph-pools-row{overflow:visible!important;}
.orange-profile-group-dropdown{width:100%;max-width:none;}
#minimalMorphProfileGroupSummary{font-weight:600;color:#fdba74;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:150px;}

/* v7.4.29 — Mandala library, compact profile-group selector and in-place Blue Morph ranges */
.profile-library-tabs{grid-template-columns:repeat(5,minmax(0,1fr));}
.profile-library-tab{display:flex;align-items:center;justify-content:center;gap:3px;border:1px solid var(--border-light);border-radius:6px;cursor:pointer;box-sizing:border-box;}
.profile-library-tab input[type="checkbox"]{width:12px;height:12px;flex:0 0 12px;margin:0;accent-color:#38bdf8;cursor:pointer;}
.profile-library-tab > span{min-width:0;}

.morph-profile-group-dropdown{position:relative;min-width:155px;max-width:250px;}
.morph-profile-group-dropdown > summary{list-style:none;display:flex;align-items:center;gap:6px;min-height:28px;padding:4px 8px;border:1px solid rgba(71,85,105,.75);border-radius:6px;background:rgba(15,23,42,.86);cursor:pointer;color:#cbd5e1;}
.morph-profile-group-dropdown > summary::-webkit-details-marker{display:none;}
.morph-profile-group-dropdown > summary::after{content:'▾';margin-left:auto;color:#94a3b8;font-size:10px;}
.morph-profile-group-dropdown[open] > summary::after{transform:rotate(180deg);}
#morphProfileGroupSummary{font-weight:600;color:#67e8f9;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:118px;}
.morph-profile-group-menu{position:absolute;z-index:60;top:calc(100% + 4px);left:0;min-width:190px;display:grid;grid-template-columns:1fr;gap:3px;padding:6px;border:1px solid rgba(71,85,105,.9);border-radius:8px;background:#0f172a;box-shadow:0 12px 28px rgba(0,0,0,.35);}
.morph-profile-group-check{display:flex;align-items:center;gap:7px;min-height:28px;padding:4px 7px;border-radius:5px;background:rgba(30,41,59,.62);}
.morph-profile-group-check.browsed{box-shadow:inset 0 0 0 1px rgba(56,189,248,.48);background:rgba(14,165,233,.10);}
.morph-reset-defaults{color:#7dd3fc;border-color:rgba(125,211,252,.38);background:rgba(56,189,248,.08);font-size:16px!important;}
.morph-reset-defaults:hover{background:rgba(56,189,248,.18);}

.profile-mode-transition-percent-row{display:grid;grid-template-columns:auto minmax(80px,1fr) auto;align-items:center;gap:8px;}
.profile-mode-transition-percent-row input[type="range"]{width:100%;accent-color:#38bdf8;}

/* Outline/background only: no border-width changes, therefore no sidebar reflow. */
.control-row.blue-morph-enabled,
#profileSettingsGroup.blue-morph-enabled,
.fill-settings-block.blue-morph-enabled{
    box-shadow:inset 0 0 0 1px rgba(56,189,248,.58);
    background-color:rgba(14,165,233,.075);
}
.control-row.blue-morph-live,
#profileSettingsGroup.blue-morph-live,
.fill-settings-block.blue-morph-live{
    box-shadow:inset 0 0 0 1px rgba(103,232,249,.92),0 0 12px rgba(56,189,248,.10);
    background-color:rgba(14,165,233,.115);
}
.blue-morph-parameter-name{cursor:context-menu;border-radius:4px;}
.blue-morph-enabled .blue-morph-parameter-name{color:#bae6fd;text-shadow:0 0 8px rgba(56,189,248,.22);}

.blue-morph-range-host{
  position:relative;
  display:grid!important;
  grid-template-columns:minmax(0,1fr);
  align-items:center;
  min-width:0;
  width:100%;
  isolation:isolate;
  pointer-events:auto;
}
/*
 * The original value slider and the Morph interval slider are two separate controls
 * occupying exactly the same slot.  The original input remains the authoritative
 * layer-value control whenever Blue Morph is not actively driving this parameter.
 * These selectors intentionally override older row-input rules such as
 * `.row-inputs input[type=range]{width:0}` which otherwise made the re-parented
 * current-value slider effectively impossible to drag.
 */
.blue-morph-range-host > .blue-morph-current-slider{
  grid-area:1/1!important;
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  display:block!important;
  visibility:visible;
  opacity:1;
  pointer-events:auto!important;
  position:relative;
  z-index:2;
}
.blue-morph-range-host > .blue-morph-dual{
  display:none!important;
  grid-area:1/1;
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  margin:0;
  appearance:none;
  -webkit-appearance:none;
  background:transparent;
  pointer-events:none!important;
  position:absolute;
  left:0;
  right:0;
  top:50%;
  transform:translateY(-50%);
  z-index:4;
}
.blue-morph-range-host.morph-live > .blue-morph-current-slider{
  visibility:hidden!important;
  opacity:0;
  pointer-events:none!important;
}
.blue-morph-range-host.morph-live > .blue-morph-dual{
  display:block!important;
}
.blue-morph-range-host.morph-live::before{
  content:'';
  position:absolute;
  left:0;
  right:0;
  top:50%;
  height:4px;
  transform:translateY(-50%);
  border-radius:999px;
  background:linear-gradient(to right,#334155 0 var(--morph-low),#38bdf8 var(--morph-low) var(--morph-high),#334155 var(--morph-high) 100%);
  box-shadow:0 0 8px rgba(56,189,248,.28);
  z-index:3;
  pointer-events:none;
}
.blue-morph-range-host > .blue-morph-dual::-webkit-slider-runnable-track{height:4px;background:transparent;border:0;}
.blue-morph-range-host > .blue-morph-dual::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:15px;height:15px;margin-top:-5.5px;border-radius:50%;border:2px solid #e0f2fe;background:#38bdf8;box-shadow:0 0 0 2px rgba(56,189,248,.20),0 0 10px rgba(56,189,248,.40);pointer-events:auto;cursor:ew-resize;}
.blue-morph-range-host > .blue-morph-dual::-moz-range-track{height:4px;background:transparent;border:0;}
.blue-morph-range-host > .blue-morph-dual::-moz-range-thumb{width:13px;height:13px;border-radius:50%;border:2px solid #e0f2fe;background:#38bdf8;box-shadow:0 0 0 2px rgba(56,189,248,.20);pointer-events:auto;cursor:ew-resize;}
/* Preserve the exact layout role formerly occupied by the original range. */
.row-inputs > .blue-morph-range-host{flex:1 1 auto;min-width:0;width:0;}
.control-row > .blue-morph-range-host{width:100%;min-width:0;display:grid!important;}
.line-slider-mult > .blue-morph-range-host,.lamp-slider-mult > .blue-morph-range-host{width:100%;min-width:0;}


@media(max-width:820px){
  .profile-library-tabs{grid-template-columns:repeat(2,minmax(0,1fr))!important;}
  .morph-profile-group-dropdown{max-width:none;width:100%;}
  .morph-profile-group-menu{position:static;box-shadow:none;margin-top:4px;min-width:0;}
}


/* 7.5 mobile interaction regression: reachable touch targets + scrollable bottom dock. */
@media (max-width: 760px), (max-height: 480px) and (hover: none) and (pointer: coarse) {
  #floatingViewportControls.floating-controls {
    position: fixed !important;
    left: auto !important;
    right: max(8px, env(safe-area-inset-right)) !important;
    bottom: max(8px, env(safe-area-inset-bottom)) !important;
    width: auto !important;
    max-width: calc(100vw - max(72px, env(safe-area-inset-left) + 64px) - max(8px, env(safe-area-inset-right))) !important;
    min-height: 44px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    touch-action: pan-x;
    z-index: 90 !important;
  }
  #floatingViewportControls.floating-controls::-webkit-scrollbar { display: none; }
  #floatingViewportControls .btn-icon,
  #floatingViewportControls button,
  #floatingViewportControls label {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    flex: 0 0 44px !important;
    touch-action: manipulation;
  }
  #fpsCounter.fps-counter {
    min-width: 52px !important;
    min-height: 44px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    touch-action: manipulation;
    cursor: pointer;
    z-index: 91 !important;
  }
}

/* 7.5.4 narrow-phone dock: flex-end overflow escapes left and cannot be scrolled back. */
@media (max-width: 360px) and (hover: none) and (pointer: coarse) {
  #floatingViewportControls.floating-controls { justify-content: flex-start !important; }
}

/* 7.5.2 mobile transition safety: closed drawers must never intercept the dock while sliding out. */
@media (max-width: 760px), (max-height: 480px) and (hover: none) and (pointer: coarse) {
  aside#settingsSidebar:not(.mobile-open),
  aside#settingsSidebar:not(.mobile-open) * { pointer-events: none !important; }
  .sidebar-tool-rail:not(.mobile-open):not(.mobile-rail-open),
  .sidebar-tool-rail:not(.mobile-open):not(.mobile-rail-open) * { pointer-events: none !important; }
}

/* 7.5.7 — mobile header controls must remain finger-reachable in portrait and
   short coarse-touch landscape. Keep one scrollable row instead of wrapping
   desktop-sized controls into two rows. */
@media (max-width: 760px), (max-height: 480px) and (hover: none) and (pointer: coarse) {
  header {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 56px !important;
    padding: 6px 8px !important;
    overflow: hidden !important;
  }
  .header-actions {
    display: flex !important;
    flex-flow: row nowrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    gap: 5px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 0 0 3px !important;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
  }
  .header-actions::-webkit-scrollbar { display: none; }
  .header-actions > * { flex: 0 0 auto !important; }
  .header-actions button,
  .header-actions select {
    min-width: 44px !important;
    min-height: 44px !important;
    height: 44px !important;
    touch-action: manipulation;
  }
  .header-actions button.btn-icon,
  .header-actions .random-preset-btn,
  .header-actions .minimal-morph-btn,
  .header-actions .morph-settings-btn,
  .header-actions .morph-btn,
  .header-actions .project-morph-btn,
  .header-actions .project-morph-settings-btn,
  .header-actions .random-settings-btn {
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
  }
}

/* 7.5.9 — mobile audio panels follow the same portrait/short-landscape touch contract. */
@media (max-width: 760px), (max-height: 480px) and (hover: none) and (pointer: coarse) {
  #audioReactivePanel,
  #audioRoutingPanel {
    /* The mobile header occupies two rows (about 104px in landscape).
       A 60px offset hid the top portion of these panels under the header. */
    top: calc(106px + env(safe-area-inset-top)) !important;
    box-sizing: border-box !important;
  }
  #audioReactivePanel {
    left: max(6px, env(safe-area-inset-left)) !important;
    right: max(6px, env(safe-area-inset-right)) !important;
    width: auto !important;
    max-width: none !important;
    max-height: calc(100dvh - 112px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  #audioRoutingPanel {
    left: max(6px, env(safe-area-inset-left)) !important;
    right: max(6px, env(safe-area-inset-right)) !important;
    bottom: max(6px, env(safe-area-inset-bottom)) !important;
    width: auto !important;
    max-width: none !important;
    max-height: none !important;
  }
  #btnCloseAudioPanel,
  #btnCloseAudioRouting {
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    touch-action: manipulation;
  }
  .audio-routing-head { min-height: 44px !important; height: auto !important; }
}

/* 7.5.10 — Spiral controls use the same finger-reachable contract as the rest
   of the mobile UI in portrait and short coarse-touch landscape. */
@media (max-width: 760px), (max-height: 480px) and (hover: none) and (pointer: coarse) {
  .contour-mode-toggle button {
    min-height: 44px !important;
    height: 44px !important;
    touch-action: manipulation;
  }
  .spiral-settings-row input[type="number"],
  .spiral-settings-row select {
    min-height: 44px !important;
    height: 44px !important;
    touch-action: manipulation;
  }
  #spiralSettingsBlock .spiral-step-link,
  #spiralSettingsBlock .spiral-tangent-toggle,
  #spiralSettingsBlock .spiral-seam-round-toggle,
  #spiralSettingsBlock .spiral-fill-toggle {
    min-height: 44px !important;
    touch-action: manipulation;
  }
}

/* 7.5.11 — Project Morph settings follow the same finger-reachable mobile
   contract as Spiral controls in portrait and short coarse-touch landscape. */
@media (max-width: 760px), (max-height: 480px) and (hover: none) and (pointer: coarse) {
  #projectMorphSettingsPanel {
    top: calc(60px + env(safe-area-inset-top)) !important;
    left: max(6px, env(safe-area-inset-left)) !important;
    right: max(6px, env(safe-area-inset-right)) !important;
    width: auto !important;
    max-width: none !important;
    max-height: calc(100dvh - 66px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    box-sizing: border-box !important;
    transform: none !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  #projectMorphSettingsPanel .project-morph-setting {
    min-height: 44px !important;
  }
  #projectMorphSettingsPanel .project-morph-setting > label {
    min-height: 44px !important;
    align-items: center !important;
  }
  #projectMorphSettingsPanel .project-morph-setting input[type="number"],
  #projectMorphSettingsPanel .project-morph-setting select {
    min-height: 44px !important;
    height: 44px !important;
    touch-action: manipulation;
  }
}


/* Somata 7.8.1 — FPS console load analyzer. */
#screenErrorOverlayTabs{display:flex;align-items:center;gap:6px;position:sticky;top:0;z-index:2;margin:-9px -12px 10px;padding:7px 10px;border-bottom:1px solid rgba(148,163,184,.18);background:rgba(15,23,42,.96);user-select:none;-webkit-user-select:none;}
#screenErrorOverlayTabs button{height:26px;min-width:78px;padding:0 9px;border:1px solid rgba(148,163,184,.3);border-radius:5px;background:rgba(15,23,42,.8);color:#cbd5e1;font:700 11px/1 ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;cursor:pointer;}
#screenErrorOverlayTabs button:hover{background:rgba(30,41,59,.95);color:#fff;}
#screenErrorOverlayTabs button.is-active{border-color:rgba(56,189,248,.72);background:rgba(8,47,73,.78);color:#bae6fd;}
#screenErrorOverlayAnalyze{margin-left:auto;min-width:112px!important;}
#screenErrorOverlayAnalyze.is-enabled{border-color:rgba(74,222,128,.72)!important;background:rgba(20,83,45,.72)!important;color:#bbf7d0!important;}
#screenErrorOverlayErrorsPanel[hidden],#screenErrorOverlayLoadPanel[hidden]{display:none!important;}
#screenErrorOverlayLoadText{margin:0;min-width:0;white-space:pre;overflow-wrap:normal;color:#cbd5e1;font:600 11px/1.48 ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;user-select:text;-webkit-user-select:text;}
#screenErrorOverlayLoadPanel{min-width:max-content;}
@media(max-width:620px){#screenErrorOverlayTabs{margin:-8px -9px 8px;padding:6px 7px;gap:4px;overflow-x:auto;}#screenErrorOverlayTabs button{min-width:70px;padding:0 6px;font-size:10px;}#screenErrorOverlayAnalyze{min-width:100px!important;margin-left:0;}#screenErrorOverlayLoadText{font-size:9.5px;line-height:1.38;}}

#screenErrorOverlay.is-load-tab{border-color:rgba(56,189,248,.72);background:rgba(3,12,24,.94);box-shadow:0 10px 34px rgba(0,0,0,.55),inset 0 0 0 1px rgba(14,116,144,.24);}
#screenErrorOverlay.is-load-tab #screenErrorOverlayHeader{border-bottom-color:rgba(56,189,248,.25);background:rgba(8,47,73,.72);}
#screenErrorOverlay.is-load-tab #screenErrorOverlayTitle{color:#7dd3fc;}


/* File → Settings → artistic effect stack (bottom → top). */
.effect-order-setting{margin-top:10px;padding-top:10px;border-top:1px solid rgba(148,163,184,.22);min-width:260px}
.effect-order-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:3px}
.effect-order-heading button{font-size:11px;padding:3px 7px;white-space:nowrap}
.effect-order-hint{font-size:10px;opacity:.68;margin-bottom:6px}
.effect-order-list{display:flex;flex-direction:column;gap:4px}
.effect-order-row{display:grid;grid-template-columns:20px 24px minmax(0,1fr);align-items:center;gap:5px;padding:5px 7px;border:1px solid rgba(148,163,184,.25);border-radius:5px;background:rgba(15,23,42,.46);cursor:grab;user-select:none}
.effect-order-row:active{cursor:grabbing}
.effect-order-row.dragging{opacity:.42}
.effect-order-row.drag-over{outline:1px solid currentColor;outline-offset:1px}
.effect-order-handle{font-size:14px;opacity:.72;text-align:center}
.effect-order-index{font:10px/1 ui-monospace,SFMono-Regular,Menlo,monospace;opacity:.62;text-align:right}
.effect-order-label{min-width:0;font-size:11px;line-height:1.2}

/* 7.9.1 — unified Morph Profile / Parameter Routing shell */
.morph-profile-toolbar{display:flex;align-items:center;gap:6px;position:relative;margin:4px 0 6px;padding:6px;border:1px solid rgba(34,211,238,.18);border-radius:8px;background:rgba(8,15,28,.62)}
.morph-profile-select-wrap{display:flex;align-items:center;gap:6px;min-width:0;flex:1;color:var(--text-muted);font-size:10px}.morph-profile-select-wrap select{min-width:120px;max-width:220px;flex:1}
.morph-profile-action{min-height:28px;padding:3px 7px;border-radius:6px;white-space:nowrap}.morph-profile-engine-badge{font-size:9px;color:#67e8f9;border:1px solid rgba(103,232,249,.3);border-radius:999px;padding:2px 6px;white-space:nowrap}
.morph-profile-create-menu{position:fixed;z-index:12050;display:flex;flex-direction:column;gap:3px;padding:5px;border:1px solid rgba(103,232,249,.28);border-radius:8px;background:#0b1220;box-shadow:0 10px 30px rgba(0,0,0,.45)}.morph-profile-create-menu.hidden{display:none!important}.morph-profile-create-menu button{text-align:left;min-width:190px}
.morph-parameter-routing-panel{margin:0 0 6px;padding:6px;border:1px solid rgba(56,189,248,.16);border-radius:8px;background:rgba(15,23,42,.42)}
.morph-routing-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:5px;font-size:10px}.morph-routing-head button{min-height:26px}
.morph-parameter-picker{margin-bottom:6px;padding:5px;border:1px solid rgba(148,163,184,.18);border-radius:6px;background:rgba(2,6,23,.7)}.morph-parameter-picker.hidden{display:none!important}.morph-parameter-picker input{width:100%;margin-bottom:4px}
.morph-parameter-options{max-height:180px;overflow:auto;display:flex;flex-direction:column;gap:2px}.morph-param-group-title{position:sticky;top:0;padding:3px 4px;color:#94a3b8;background:#0b1220;font-size:9px;text-transform:uppercase;letter-spacing:.04em}.morph-param-option{display:flex;justify-content:space-between;gap:8px;text-align:left}.morph-param-option.active{color:#67e8f9}
.morph-profile-bindings{display:flex;flex-direction:column;gap:3px}.morph-binding-row{display:grid;grid-template-columns:minmax(110px,1fr) auto auto;align-items:center;gap:5px;padding:4px 5px;border-radius:6px;background:rgba(15,23,42,.72);box-shadow:inset 2px 0 0 rgba(34,211,238,.72)}.morph-binding-label{min-width:0;font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.morph-binding-range{display:inline-flex;align-items:center;gap:3px}.morph-binding-range input{width:58px!important;min-width:0}.morph-binding-legacy{font-size:9px;color:#67e8f9}.morph-binding-remove{width:26px;height:26px;padding:0}
.morph-orange-profile-summary{display:flex;flex-direction:column;gap:5px;font-size:10px;color:var(--text-muted)}.morph-orange-profile-summary.hidden{display:none!important}
#morphSettingsPanel.morph-profile-orange .morph-settings-grid{display:none!important}#morphSettingsPanel.morph-profile-orange #btnAddMorphParameter{display:none!important}#morphSettingsPanel.morph-profile-orange .morph-profile-bindings{display:none!important}
.blue-morph-parameter-name.morph-route-enabled{box-shadow:inset 0 0 0 1px rgba(34,211,238,.65);border-radius:4px}.control-row.morph-route-enabled,.fill-settings-block.morph-route-enabled{box-shadow:inset 0 0 0 1px rgba(34,211,238,.55)!important}
@media(max-width:760px),(max-height:480px) and (hover:none) and (pointer:coarse){.morph-profile-toolbar{flex-wrap:wrap}.morph-profile-select-wrap{flex-basis:100%}.morph-profile-action{min-width:44px;min-height:44px}.morph-binding-row{grid-template-columns:1fr auto}.morph-binding-range{grid-column:1/-1}.morph-binding-remove{width:44px;height:44px}}

#morphSettingsPanel.morph-profile-orange .morph-checkbox-tools{display:none!important}

/* Exact control marker for the shared Morph Parameter Registry. A row may contain several independent parameters. */
.morph-route-control-enabled{outline:1px solid rgba(34,211,238,.85);outline-offset:2px;border-radius:4px}

/* 7.9.2 — Morph routing panel mirrors Audio Link; Blue-engine-only controls live in the sidebar. */
#morphSettingsPanel.morph-audio-routing-panel{
    top:48px!important;bottom:8px!important;left:8px!important;right:auto!important;width:50vw!important;min-width:640px!important;max-width:calc(100vw - 16px)!important;max-height:none!important;
    padding:0!important;overflow:hidden!important;display:flex;flex-direction:column;background:rgba(15,23,42,.985);border:1px solid rgba(34,211,238,.42);border-radius:10px;box-shadow:0 20px 60px rgba(0,0,0,.62);backdrop-filter:blur(12px);z-index:86;
}
#morphSettingsPanel.morph-audio-routing-panel.hidden{display:none!important}
#morphSettingsPanel.morph-audio-routing-panel .morph-settings-title{height:38px;margin:0;padding:6px 8px 6px 10px;border-bottom:1px solid rgba(71,85,105,.58);background:rgba(8,145,178,.11);font-size:12px}
#morphSettingsPanel.morph-audio-routing-panel .morph-settings-title>span:first-child{color:#cffafe}
#morphSettingsPanel.morph-audio-routing-panel .morph-settings-subtitle{color:#67e8f9;opacity:.72}
#morphSettingsPanel.morph-audio-routing-panel .morph-checkbox-tools{display:none!important}
.morph-routing-layout{display:grid;grid-template-columns:118px minmax(0,1fr);min-height:0;flex:1 1 auto;overflow:hidden}
.morph-routing-targets{padding:7px;overflow:auto;border-right:1px solid rgba(71,85,105,.58);background:rgba(2,6,23,.40)}
.morph-routing-target{color:#cbd5e1}.morph-routing-target.active{color:#fff;border-color:#22d3ee;background:rgba(8,145,178,.34)}
.morph-routing-target-disabled{opacity:.46;cursor:not-allowed}.morph-routing-target-disabled:hover{background:rgba(30,41,59,.45);border-color:rgba(71,85,105,.55)}
.morph-routing-main{min-width:0;overflow:auto;padding:8px}
#morphSettingsPanel .morph-profile-toolbar.morph-routing-preset-bar{margin:0 0 8px;padding:6px;border-color:rgba(34,211,238,.24);background:rgba(8,145,178,.07);display:flex;flex-wrap:wrap}
#morphSettingsPanel .morph-profile-select-wrap{min-width:190px;flex:1}
#morphSettingsPanel .morph-profile-select-wrap select{max-width:none!important;min-width:130px;height:27px;font-size:10px}
#morphSettingsPanel .morph-profile-engine-badge{color:#67e8f9;border-color:rgba(34,211,238,.4)}
#morphSettingsPanel .morph-order-mode{display:inline-flex;align-items:center;gap:2px;padding:2px;border:1px solid rgba(71,85,105,.62);border-radius:6px;background:rgba(2,6,23,.34)}
#morphSettingsPanel .morph-order-mode.hidden{display:none!important}
#morphSettingsPanel .morph-order-mode-btn{height:25px;min-height:25px;padding:2px 8px;border:1px solid transparent;border-radius:4px;background:transparent;color:#94a3b8;font-size:9px;white-space:nowrap}
#morphSettingsPanel .morph-order-mode-btn:hover{color:#e2e8f0;background:rgba(51,65,85,.55)}
#morphSettingsPanel .morph-order-mode-btn.active{color:#ecfeff;border-color:rgba(34,211,238,.52);background:rgba(8,145,178,.28);box-shadow:inset 0 0 0 1px rgba(103,232,249,.08)}
#morphSettingsPanel .morph-routing-shell{margin:0;padding:0;border:0;background:transparent}
#morphSettingsPanel .morph-routing-groups{margin-bottom:4px}
#morphSettingsPanel .morph-routing-groups .audio-route-group-btn{border-color:rgba(34,211,238,.34);background:rgba(8,145,178,.09);color:#cffafe}
#morphSettingsPanel .morph-routing-groups .audio-route-group-btn:hover{border-color:#22d3ee;background:rgba(8,145,178,.2)}
#morphSettingsPanel .audio-route-group-menu{border-color:rgba(34,211,238,.44)}
#morphSettingsPanel .audio-param-option:hover,#morphSettingsPanel .audio-param-option.active{background:rgba(8,145,178,.24);color:#ecfeff}
#morphSettingsPanel .audio-param-group-title{color:#67e8f9}
#morphProfileBindings.audio-routing-rows{margin-top:7px;display:grid;gap:6px}
#morphProfileBindings .morph-route-row{grid-template-columns:16px 22px 14px minmax(150px,1.55fr) 72px 72px 72px 24px!important;min-width:540px!important;padding:5px;border-color:rgba(71,85,105,.50);background:rgba(30,41,59,.34)}
#morphProfileBindings .morph-route-row::before{background:#22d3ee}
#morphProfileBindings .morph-route-dot{background:#22d3ee!important;color:#22d3ee!important;box-shadow:0 0 8px rgba(34,211,238,.75)}
#morphProfileBindings .morph-route-mode{font-size:8px;color:#67e8f9;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#morphProfileBindings .morph-route-number{width:100%!important;min-width:0;color:#cffafe}
#morphProfileBindings .morph-route-discrete{grid-column:6/8;color:#94a3b8;font-size:9px;text-align:center;white-space:nowrap}
#morphProfileBindings .morph-route-drag-handle{width:14px;height:22px;display:inline-flex;align-items:center;justify-content:center;color:#64748b;font-size:12px;line-height:1;user-select:none;cursor:grab}
#morphProfileBindings.morph-order-free .morph-route-row{cursor:grab}
#morphProfileBindings.morph-order-free .morph-route-row:active,#morphProfileBindings.morph-order-free .morph-route-drag-handle:active{cursor:grabbing}
#morphProfileBindings.morph-order-type .morph-route-drag-handle{color:#475569}
#morphProfileBindings.morph-order-drag-locked .morph-route-row,#morphProfileBindings .morph-drag-forbidden{cursor:not-allowed!important}
#morphProfileBindings .morph-route-row.dragging{opacity:.48}
#morphProfileBindings .morph-route-row.morph-drag-before::after,#morphProfileBindings .morph-route-row.morph-drag-after::after{content:'';position:absolute;left:4px;right:4px;height:2px;border-radius:2px;background:#22d3ee;box-shadow:0 0 8px rgba(34,211,238,.75);z-index:4}
#morphProfileBindings .morph-route-row.morph-drag-before::after{top:-4px}
#morphProfileBindings .morph-route-row.morph-drag-after::after{bottom:-4px}
#morphProfileBindings .morph-binding-remove{width:24px;height:24px;min-height:24px;padding:0;color:#fca5a5}
#morphSettingsPanel #btnAddMorphParameter{width:auto;margin-top:8px;border-color:#22d3ee;background:rgba(8,145,178,.36);color:#fff}
#morphSettingsPanel #btnAddMorphParameter:hover{background:#0891b2}
#morphSettingsPanel #morphParameterPicker{position:fixed!important;z-index:12050;width:min(330px,70vw);max-height:360px;overflow:auto;margin:0!important;padding:6px!important;background:#0b1220!important;border:1px solid rgba(34,211,238,.46)!important;border-radius:7px!important;box-shadow:0 16px 38px rgba(0,0,0,.55)!important}
#morphSettingsPanel #morphParameterPicker.hidden{display:none!important}
#morphSettingsPanel #morphParameterOptions{max-height:300px}
#morphSettingsPanel .morph-orange-profile-summary{margin-top:8px;padding:8px;border:1px solid rgba(251,146,60,.35);border-radius:7px;background:rgba(124,45,18,.12)}
#morphSettingsPanel .morph-compat-grid{display:none!important}

.morph-sidebar-section{margin-top:8px;padding:7px;border:1px solid rgba(34,211,238,.16);border-radius:7px;background:rgba(8,15,28,.42)}
.morph-sidebar-section-title{margin:-1px 0 6px;color:#67e8f9;font-size:10px;font-weight:700;letter-spacing:.02em}
.morph-sidebar-section>.morph-setting-row,.morph-sidebar-section>.morph-mode-card,.morph-sidebar-section>.morph-compact-pair-row,.morph-sidebar-section>.morph-fill-block{margin-bottom:5px;width:100%;box-sizing:border-box}
.morph-sidebar-section .morph-compact-pair-row{display:grid;grid-template-columns:1fr;gap:5px}
.morph-sidebar-section .morph-pair-cell{width:100%;box-sizing:border-box}
.morph-sidebar-section .morph-setting-row{min-height:30px;font-size:10px}
.morph-sidebar-section .morph-setting-row select{max-width:100%;font-size:10px}
.morph-sidebar-section .morph-mode-card{padding:5px;border:1px solid rgba(51,65,85,.55);border-radius:5px;background:rgba(30,41,59,.45)}
.morph-sidebar-section .morph-shape-meta-line{display:grid;gap:5px}
.morph-sidebar-section .morph-profile-group-dropdown{width:100%}
.morph-sidebar-section .morph-compat-hidden{display:none!important}
.morph-sidebar-section .morph-fill-counts{display:inline-flex;align-items:center;gap:4px}

@media(max-width:1300px) and (min-width:761px){#morphSettingsPanel.morph-audio-routing-panel{width:calc(100vw - 16px)!important;min-width:0!important}}
@media(max-width:760px){#morphSettingsPanel.morph-audio-routing-panel{top:6px!important;bottom:6px!important;left:6px!important;width:calc(100vw - 12px)!important;min-width:0!important}.morph-routing-layout{grid-template-columns:104px minmax(0,1fr)}#morphProfileBindings .morph-route-row{min-width:520px!important}.morph-sidebar-section .morph-setting-row{min-height:42px}}
.morph-binding-compat-label{display:none!important}
#morphSettingsPanel.morph-audio-routing-panel:not(.hidden){display:flex!important}
.morph-sidebar-actions{display:flex;align-items:center;gap:6px;justify-content:flex-end;margin:2px 0 8px!important;padding:0!important;}
.morph-sidebar-actions .morph-clear-checks,.morph-sidebar-actions .morph-undo-checks,.morph-sidebar-actions .morph-reset-defaults{position:static!important;inset:auto!important;}

/* v793 — independent Glint / Lightning tools and shared Morph routing pictograms */
.sidebar-tool-btn[data-sidebar-mode="lightning"].active { background:rgba(147,197,253,.14); border-color:rgba(191,219,254,.76); color:#f8fbff; }
.sidebar-tool-btn .lightning-icon { width:21px; height:21px; display:block; overflow:visible; }
.sidebar-tool-btn .lightning-icon .lightning-bolt { fill:currentColor; stroke:currentColor; stroke-width:.45; stroke-linejoin:round; }
.sidebar-tool-btn .lightning-icon .lightning-branch { fill:none; stroke:currentColor; stroke-width:1.15; stroke-linecap:round; stroke-linejoin:round; opacity:.8; }
/* v794 — Lightning reads as a live electrical state, not just the selected panel. */
#btnSidebarLightning.feature-enabled {
    color:#ff312e;
    background:rgba(255,35,35,.16);
    border-color:rgba(255,69,58,.92);
    box-shadow:inset 0 0 0 1px rgba(255,120,110,.22),0 0 10px rgba(255,35,35,.28),0 0 18px rgba(255,35,35,.12);
}
#btnSidebarLightning.feature-enabled .lightning-bolt { fill:#ff312e; stroke:#ffd1ce; }
#btnSidebarLightning.feature-enabled .lightning-branch { stroke:#ff746b; opacity:1; }
#btnSidebarLightning.feature-enabled .lightning-icon { filter:drop-shadow(0 0 3px rgba(255,214,210,.95)) drop-shadow(0 0 7px rgba(255,49,46,.95)) drop-shadow(0 0 13px rgba(255,20,20,.58)); }
#settingsSidebar.sidebar-mode-lightning .sidebar-content > .control-group:not(.lightning-settings-group) { display:none !important; }
.lightning-settings-group { border-color:rgba(147,197,253,.42); }
.lightning-settings-group .group-title-toggle input { accent-color:#93c5fd; }
#settingsSidebar.sidebar-mode-lines .lightning-settings-group { display:none; }

/* Morph routing: the icon is semantic metadata, never a control. */
.morph-routing-group-label { display:flex; align-items:center; justify-content:center; gap:4px; min-width:0; pointer-events:none; }
.morph-routing-group-name { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.morph-routing-group-icon,
.morph-route-row-icon { width:18px; height:18px; flex:0 0 18px; display:inline-flex; align-items:center; justify-content:center; color:#cbd5e1; pointer-events:none; user-select:none; }
.morph-route-row-icon { width:14px; height:18px; flex-basis:14px; }
.morph-routing-group-icon .shape-star-icon,.morph-route-row-icon .shape-star-icon { font-size:16px; transform:none; }
.morph-routing-group-icon .rainbow-line-icon,.morph-route-row-icon .rainbow-line-icon { width:15px; height:3px; transform:rotate(-18deg); background:linear-gradient(90deg,#ef4444,#f59e0b,#84cc16,#06b6d4,#6366f1,#d946ef); box-shadow:0 0 5px rgba(103,232,249,.45); }
.morph-routing-group-icon .lamp-dot-icon,.morph-route-row-icon .lamp-dot-icon { width:9px; height:9px; border-radius:50%; background:#fde047; box-shadow:0 0 5px #fde047,0 0 9px rgba(245,158,11,.75); }
.morph-routing-group-icon .web-icon,.morph-route-row-icon .web-icon { width:16px; height:16px; display:block; fill:none; stroke:currentColor; stroke-width:1.25; }
.morph-routing-group-icon .sweep-icon,.morph-route-row-icon .sweep-icon { position:relative; width:10px; height:16px; border:1px solid currentColor; border-radius:2px; overflow:hidden; display:block; }
.morph-routing-group-icon .sweep-icon::after,.morph-route-row-icon .sweep-icon::after { content:''; position:absolute; width:16px; height:3px; left:-4px; top:6px; transform:rotate(-35deg); background:currentColor; box-shadow:0 0 5px currentColor; }
.morph-routing-group-icon .lightning-icon,.morph-route-row-icon .lightning-icon { width:16px; height:16px; display:block; }
.morph-routing-group-icon .lightning-bolt,.morph-route-row-icon .lightning-bolt { fill:currentColor; stroke:currentColor; stroke-width:.4; }
.morph-routing-group-icon .lightning-branch,.morph-route-row-icon .lightning-branch { fill:none; stroke:currentColor; stroke-width:1.1; stroke-linecap:round; stroke-linejoin:round; }
.morph-routing-group-icon .particle-star-icon,.morph-route-row-icon .particle-star-icon { font-size:15px; line-height:1; }
.morph-routing-group-icon .motion-arrow-icon,.morph-route-row-icon .motion-arrow-icon { font-size:14px; line-height:1; }
.morph-routing-fill-icon { width:11px; height:11px; display:block; border-radius:3px 7px 7px 7px; transform:rotate(45deg); background:currentColor; opacity:.9; }
.morph-routing-graffiti-icon { width:15px; height:6px; display:block; border-radius:70% 30% 70% 30%; transform:rotate(-18deg); background:currentColor; box-shadow:0 0 4px currentColor; }
.morph-routing-corridor-icon { font-size:15px; line-height:1; font-family:system-ui,sans-serif; }
.morph-routing-snake-icon { font-size:15px; line-height:1; filter:saturate(.85); }
#morphProfileBindings .morph-route-row { grid-template-columns:16px 22px 14px minmax(150px,1.55fr) 72px 72px 72px 24px!important; }
#morphProfileBindings .morph-route-dot { display:none!important; }
.morph-symbol-star::before{content:'☆'}
.morph-symbol-motion::before{content:'➜'}
.morph-symbol-particle::before{content:'✦'}
.morph-routing-corridor-icon::before{content:'◎'}
.morph-routing-snake-icon::before{content:'🐍'}
.morph-routing-fallback-icon::before{content:'•'}

/* v795 — Morph routing group state and RMB batch enable/disable. */
#morphSettingsPanel .morph-routing-groups .audio-route-group-btn.morph-group-active {
    border-color:rgba(74,222,128,.92);
    color:#dcfce7;
    background:rgba(22,163,74,.24);
    box-shadow:inset 0 0 0 1px rgba(74,222,128,.12),0 0 8px rgba(34,197,94,.12);
}
#morphSettingsPanel .morph-routing-groups .audio-route-group-btn.morph-group-active:hover {
    border-color:#4ade80;
    background:rgba(22,163,74,.34);
}
#morphSettingsPanel .morph-routing-groups .audio-route-group-btn.morph-group-idle {
    border-color:rgba(250,204,21,.9);
    color:#fef9c3;
    background:rgba(161,98,7,.24);
    box-shadow:inset 0 0 0 1px rgba(250,204,21,.10),0 0 7px rgba(234,179,8,.10);
}
#morphSettingsPanel .morph-routing-groups .audio-route-group-btn.morph-group-idle:hover {
    border-color:#facc15;
    background:rgba(161,98,7,.34);
}

/* v796 — Audio Link and Standard Morph share one parameter catalog and one icon vocabulary. */
.audio-routing-group-label{display:flex;align-items:center;justify-content:center;gap:4px;min-width:0;pointer-events:none;width:100%}
.audio-routing-group-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#audioRoutingPanel .audio-routing-group-icon{width:16px;height:18px;flex:0 0 16px}
#audioRoutingPanel .audio-route-row-icon{width:14px;height:18px;flex:0 0 14px;color:#cbd5e1}
#audioRoutingPanel .audio-routing-tools{grid-template-columns:repeat(auto-fit,minmax(92px,1fr));gap:4px}
#audioRoutingPanel .audio-route-group-btn{display:flex;align-items:center;justify-content:center;gap:3px;min-width:0}
#audioRoutingPanel .audio-master-route-label{display:flex;align-items:center;gap:5px}
#audioRoutingPanel .audio-master-route-label>span:last-child{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media (min-width:1201px){
  #audioRoutingPanel.audio-routing-panel{width:68vw!important;max-width:1180px!important;min-width:760px!important}
  #audioRoutingPanel .audio-route-row{grid-template-columns:22px 18px 18px minmax(68px,88px) minmax(155px,1.55fr) minmax(108px,.95fr) minmax(105px,1fr) 64px 24px!important;min-width:0!important}
}
@media (max-width:1200px) and (min-width:761px){
  #audioRoutingPanel.audio-routing-panel{width:calc(100vw - 16px)!important;max-width:calc(100vw - 16px)!important}
  #audioRoutingPanel .audio-route-row{grid-template-columns:22px 18px 18px 76px minmax(0,1fr) minmax(90px,1fr) 64px 24px!important;grid-template-rows:auto auto;min-width:0!important}
  #audioRoutingPanel .audio-route-row>:nth-child(1){grid-column:1;grid-row:1}
  #audioRoutingPanel .audio-route-row>:nth-child(2){grid-column:2;grid-row:1}
  #audioRoutingPanel .audio-route-row>:nth-child(3){grid-column:3;grid-row:1}
  #audioRoutingPanel .audio-route-row>:nth-child(4){grid-column:4;grid-row:1}
  #audioRoutingPanel .audio-route-row>:nth-child(5){grid-column:5 / 8;grid-row:1}
  #audioRoutingPanel .audio-route-row>:nth-child(6){grid-column:1 / 5;grid-row:2;justify-content:flex-start}
  #audioRoutingPanel .audio-route-row>:nth-child(7){grid-column:5 / 7;grid-row:2}
  #audioRoutingPanel .audio-route-row>:nth-child(8){grid-column:7;grid-row:2;width:100%!important}
  #audioRoutingPanel .audio-route-row>:nth-child(9){grid-column:8;grid-row:1}
}
@media (max-width:760px){
  #audioRoutingPanel .audio-route-row{min-width:690px!important;grid-template-columns:22px 18px 18px 76px minmax(150px,1fr) 92px 112px 64px 24px!important}
  #audioRoutingPanel .audio-routing-tools{grid-template-columns:repeat(2,minmax(0,1fr))}
}


/* v797 — Audio Link group state mirrors Standard Morph: green / yellow / neutral. */
#audioRoutingPanel .audio-routing-tools .audio-route-group-btn.audio-group-active {
    border-color:rgba(74,222,128,.92);
    color:#dcfce7;
    background:rgba(22,163,74,.24);
    box-shadow:inset 0 0 0 1px rgba(74,222,128,.12),0 0 8px rgba(34,197,94,.12);
}
#audioRoutingPanel .audio-routing-tools .audio-route-group-btn.audio-group-active:hover {
    border-color:#4ade80;
    background:rgba(22,163,74,.34);
}
#audioRoutingPanel .audio-routing-tools .audio-route-group-btn.audio-group-idle {
    border-color:rgba(250,204,21,.9);
    color:#fef9c3;
    background:rgba(161,98,7,.24);
    box-shadow:inset 0 0 0 1px rgba(250,204,21,.10),0 0 7px rgba(234,179,8,.10);
}
#audioRoutingPanel .audio-routing-tools .audio-route-group-btn.audio-group-idle:hover {
    border-color:#facc15;
    background:rgba(161,98,7,.34);
}

/* v798 — one routing surface on every routable parameter: neutral / Morph / Audio / both. */
.parameter-routing-capable{
    --routing-border:rgba(248,250,252,.62);
    --routing-fill:rgba(248,250,252,.055);
    border-radius:6px!important;
    box-shadow:0 0 0 1px var(--routing-border),inset 0 0 0 1px rgba(255,255,255,.018)!important;
    background-color:var(--routing-fill)!important;
    transition:background .16s ease,box-shadow .16s ease,border-color .16s ease,filter .16s ease;
}
.parameter-routing-capable.parameter-routing-neutral{--routing-border:rgba(248,250,252,.62);--routing-fill:rgba(248,250,252,.055)}
.parameter-routing-capable.parameter-routing-morph{--routing-border:rgba(103,232,249,.92);--routing-fill:rgba(14,165,233,.20);box-shadow:0 0 0 1px rgba(103,232,249,.92),0 0 10px rgba(14,165,233,.12),inset 0 0 10px rgba(14,165,233,.08)!important}
.parameter-routing-capable.parameter-routing-audio{--routing-border:rgba(190,54,98,.96);--routing-fill:rgba(117,20,55,.24);box-shadow:0 0 0 1px rgba(190,54,98,.96),0 0 10px rgba(145,25,65,.14),inset 0 0 10px rgba(117,20,55,.10)!important}
.parameter-routing-capable.parameter-routing-orange{--routing-border:rgba(251,146,60,.96);--routing-fill:rgba(154,52,18,.22);box-shadow:0 0 0 1px rgba(251,146,60,.96),0 0 10px rgba(249,115,22,.14),inset 0 0 10px rgba(154,52,18,.10)!important}
.parameter-routing-capable.parameter-routing-both{
    --routing-border:rgba(181,98,185,.94);
    background:linear-gradient(135deg,rgba(14,165,233,.22) 0%,rgba(14,165,233,.16) 44%,rgba(117,20,55,.19) 56%,rgba(117,20,55,.27) 100%)!important;
    box-shadow:-1px 0 0 rgba(103,232,249,.95),1px 0 0 rgba(190,54,98,.95),0 0 11px rgba(91,92,196,.16),inset 0 0 10px rgba(97,49,127,.10)!important;
}
.parameter-routing-capable.parameter-routing-blue-orange{
    background:linear-gradient(135deg,rgba(14,165,233,.20) 0 46%,rgba(154,52,18,.18) 54% 100%)!important;
    box-shadow:-1px 0 0 rgba(103,232,249,.95),1px 0 0 rgba(251,146,60,.95),0 0 11px rgba(125,100,90,.15)!important;
}
.parameter-routing-capable.parameter-routing-audio-orange{
    background:linear-gradient(135deg,rgba(117,20,55,.22) 0 46%,rgba(154,52,18,.18) 54% 100%)!important;
    box-shadow:-1px 0 0 rgba(190,54,98,.95),1px 0 0 rgba(251,146,60,.95),0 0 11px rgba(140,65,75,.15)!important;
}
.parameter-routing-capable.parameter-routing-all{
    background:linear-gradient(120deg,rgba(14,165,233,.20) 0 31%,rgba(117,20,55,.20) 35% 64%,rgba(154,52,18,.20) 68% 100%)!important;
    box-shadow:-1px 0 0 rgba(103,232,249,.95),1px 0 0 rgba(251,146,60,.95),0 -1px 0 rgba(190,54,98,.92),0 0 12px rgba(122,74,111,.16)!important;
}
/* Range controls use the existing host as their routing field, preserving the native slider itself. */
.blue-morph-range-host.parameter-routing-capable{padding:3px 5px;border-radius:7px!important;box-sizing:border-box;min-height:25px}
.blue-morph-range-host.parameter-routing-capable > .blue-morph-current-slider{border-radius:5px}
/* Direct controls keep their content readable. Color swatches preserve the authored color and use the routing tint as a halo. */
input.parameter-routing-capable:not([type="range"]):not([type="color"]),select.parameter-routing-capable,button.parameter-routing-capable{padding-inline:5px}
input[type="color"].parameter-routing-capable{background:transparent!important;outline:0!important}
input[type="checkbox"].parameter-routing-capable{outline:1px solid var(--routing-border);outline-offset:2px;background:transparent!important}
/* Old Blue row-level tint is superseded by per-control routing states. */
.control-row.morph-route-enabled,.fill-settings-block.morph-route-enabled{box-shadow:none!important}
.control-row.blue-morph-enabled,.fill-settings-block.blue-morph-enabled{background-color:transparent}

/* iPhone-like value bubble for live dual Morph sliders. */
.morph-slider-value-bubble{
    position:absolute;z-index:18;top:-34px;transform:translateX(-50%) translateY(4px);min-width:34px;max-width:92px;padding:5px 8px;border-radius:11px;
    color:#f8fafc;background:rgba(15,23,42,.96);border:1px solid rgba(186,230,253,.76);box-shadow:0 8px 22px rgba(0,0,0,.40),0 0 13px rgba(56,189,248,.22);
    font-size:10px;font-weight:700;line-height:1;text-align:center;font-variant-numeric:tabular-nums;white-space:nowrap;pointer-events:none;opacity:0;visibility:hidden;
    transition:opacity .11s ease,transform .11s ease,visibility 0s linear .11s;
}
.morph-slider-value-bubble::after{content:'';position:absolute;left:50%;bottom:-5px;width:9px;height:9px;transform:translateX(-50%) rotate(45deg);background:rgba(15,23,42,.96);border-right:1px solid rgba(186,230,253,.66);border-bottom:1px solid rgba(186,230,253,.66);border-radius:0 0 2px 0}
.morph-slider-value-bubble.visible{opacity:1;visibility:visible;transform:translateX(-50%) translateY(0);transition-delay:0s}
/* Outside Morph the bubble is fixed above the native authored thumb. */
.standard-slider-value-bubble{position:fixed;top:0;z-index:14040;transform:translate(-50%,-100%) translateY(-4px)}
.standard-slider-value-bubble.visible{transform:translate(-50%,-100%) translateY(-8px)}
.standard-slider-value-bubble::after{bottom:-5px}
.blue-morph-range-host.morph-live{overflow:visible!important}

/* Multi-select routing popup: Audio and Blue Morph are independent toggles, not radio choices. */
.parameter-routing-context-menu{
    position:fixed;z-index:14050;width:262px;padding:7px;border-radius:13px;border:1px solid rgba(148,163,184,.34);
    background:linear-gradient(180deg,rgba(17,24,39,.985),rgba(8,15,28,.985));box-shadow:0 24px 65px rgba(0,0,0,.62),inset 0 1px 0 rgba(255,255,255,.045);backdrop-filter:blur(18px);color:#e5e7eb;
}
.parameter-routing-context-menu.hidden{display:none!important}
.parameter-routing-popup-head{display:flex;align-items:center;gap:8px;padding:6px 7px 8px;margin-bottom:4px;border-bottom:1px solid rgba(148,163,184,.16)}
.parameter-routing-popup-head .morph-route-row-icon{width:18px;height:20px;flex-basis:18px}
.parameter-routing-popup-title{display:flex;flex-direction:column;min-width:0;gap:2px}.parameter-routing-popup-title strong{font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.parameter-routing-popup-title span{font-size:9px;color:#94a3b8}
.parameter-routing-popup-option{width:100%;display:grid;grid-template-columns:20px 10px minmax(0,1fr);align-items:center;gap:8px;padding:7px 8px;margin:2px 0;border:1px solid transparent;border-radius:9px;background:rgba(30,41,59,.46);text-align:left;color:#e5e7eb;min-height:43px}
.parameter-routing-popup-option:hover:not(:disabled){background:rgba(51,65,85,.62);border-color:rgba(148,163,184,.24)}
.parameter-routing-popup-option[aria-checked="true"].routing-morph{background:rgba(14,165,233,.15);border-color:rgba(103,232,249,.42)}
.parameter-routing-popup-option[aria-checked="true"].routing-audio{background:rgba(117,20,55,.22);border-color:rgba(190,54,98,.48)}
.parameter-routing-popup-option[aria-checked="true"].routing-orange{background:rgba(154,52,18,.20);border-color:rgba(251,146,60,.52)}
.parameter-routing-popup-option:disabled{opacity:.42;cursor:not-allowed}
.parameter-routing-popup-check{width:18px;height:18px;border-radius:5px;border:1px solid rgba(203,213,225,.42);display:inline-flex;align-items:center;justify-content:center;font-size:12px;font-weight:800;background:rgba(2,6,23,.56)}
.routing-morph[aria-checked="true"] .parameter-routing-popup-check{color:#e0f2fe;border-color:#67e8f9;background:#0284c7;box-shadow:0 0 8px rgba(14,165,233,.28)}
.routing-audio[aria-checked="true"] .parameter-routing-popup-check{color:#fff1f2;border-color:#fb7185;background:#881337;box-shadow:0 0 8px rgba(190,24,93,.32)}
.routing-orange[aria-checked="true"] .parameter-routing-popup-check{color:#fff7ed;border-color:#fdba74;background:#9a3412;box-shadow:0 0 8px rgba(249,115,22,.30)}
.parameter-routing-popup-swatch{width:8px;height:24px;border-radius:999px;background:var(--routing-accent);box-shadow:0 0 8px color-mix(in srgb,var(--routing-accent) 55%,transparent)}
.parameter-routing-popup-option-text{display:flex;flex-direction:column;gap:2px;min-width:0}.parameter-routing-popup-option-text strong{font-size:10px}.parameter-routing-popup-option-text small{font-size:8px;color:#94a3b8;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.parameter-routing-popup-foot{padding:6px 8px 3px;color:#64748b;font-size:8px;text-align:center}
.parameter-routing-control{cursor:context-menu}
@media(max-width:760px){.parameter-routing-context-menu{width:min(290px,calc(100vw - 16px));padding:8px}.parameter-routing-popup-option{min-height:48px}.morph-slider-value-bubble{font-size:11px;padding:6px 9px;top:-38px}}

/* 7.9.10 — explicit Morph Profile save/reset + Master in panel header. */
#morphSettingsPanel .morph-header-master{
    margin-left:auto;min-width:72px;height:26px;padding:2px 10px;border-radius:999px;
    border:1px solid rgba(34,211,238,.5);background:rgba(8,145,178,.16);color:#cffafe;
    font:700 10px/1 system-ui,sans-serif;letter-spacing:.02em;box-shadow:inset 0 0 0 1px rgba(103,232,249,.06);
}
#morphSettingsPanel .morph-header-master.active{background:rgba(8,145,178,.34);border-color:#22d3ee;box-shadow:0 0 14px rgba(34,211,238,.16),inset 0 0 0 1px rgba(207,250,254,.08)}
#morphSettingsPanel .morph-profile-save,#morphSettingsPanel .morph-profile-reset{padding-inline:9px}
#morphSettingsPanel .morph-profile-save.dirty{color:#d9f99d;border-color:rgba(163,230,53,.58);background:rgba(77,124,15,.22);box-shadow:0 0 12px rgba(163,230,53,.10)}
#morphSettingsPanel.morph-profile-dirty .morph-profile-toolbar{border-color:rgba(250,204,21,.40);box-shadow:inset 0 0 0 1px rgba(250,204,21,.05)}
#morphSettingsPanel .morph-profile-reset:not(:disabled){color:#fde68a;border-color:rgba(245,158,11,.46);background:rgba(120,53,15,.18)}
#morphSettingsPanel .morph-profile-action:disabled{opacity:.38;cursor:default}
@media(max-width:760px),(max-height:480px) and (hover:none) and (pointer:coarse){
    #morphSettingsPanel .morph-header-master{min-width:76px;height:34px}
    #morphSettingsPanel .morph-profile-save,#morphSettingsPanel .morph-profile-reset{flex:1 1 145px}
}
/* v7.9.12 — shared Palette routing icon */
.parameter-group-icon .palette-routing-icon,
.morph-routing-group-icon .palette-routing-icon,
.audio-routing-group-icon .palette-routing-icon{
    width:14px;height:14px;display:block;overflow:visible;
    fill:none;stroke:currentColor;stroke-width:1.45;stroke-linecap:round;stroke-linejoin:round;
}
.parameter-group-icon .palette-routing-icon circle,
.morph-routing-group-icon .palette-routing-icon circle,
.audio-routing-group-icon .palette-routing-icon circle{fill:currentColor;stroke:none;}

/* 7.9.13 — Blue row order visibility + independent Orange profile shell */
.morph-profile-action.morph-profile-icon{width:30px;min-width:30px;height:28px;padding:4px;display:inline-flex;align-items:center;justify-content:center}
.morph-profile-action.morph-profile-icon svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}
#morphSettingsPanel .morph-routing-visible-head{display:flex!important;align-items:center;gap:8px;margin:0 0 6px;padding:5px 6px;border:1px solid rgba(34,211,238,.22);border-radius:7px;background:rgba(8,145,178,.065)}
#morphSettingsPanel .morph-routing-visible-head strong{margin-right:auto;color:#cffafe}
#morphSettingsPanel .morph-order-mode-prominent{display:inline-flex!important;flex:0 0 auto;border-color:rgba(34,211,238,.52);background:rgba(2,6,23,.7)}
#morphSettingsPanel .morph-order-label{padding:0 5px;color:#94a3b8;font-size:9px;text-transform:uppercase;letter-spacing:.05em}
#morphSettingsPanel .morph-order-mode-btn{min-width:58px}
#morphProfileBindings .morph-route-drag-handle{cursor:grab;border:1px solid transparent;border-radius:4px}
#morphProfileBindings .morph-route-drag-handle:hover{color:#e0f2fe;border-color:rgba(34,211,238,.4);background:rgba(8,145,178,.16)}
#morphProfileBindings.morph-order-type .morph-route-drag-handle{cursor:not-allowed}
.morph-legacy-geometry-compat{display:none!important}

.random-settings-panel{width:min(980px,72vw);max-width:calc(100vw - 18px);padding:0!important;border-color:rgba(249,115,22,.42)!important;background:rgba(7,12,22,.98)!important;box-shadow:0 18px 46px rgba(0,0,0,.48)}
.random-settings-panel .orange-morph-title{height:38px;margin:0;padding:6px 8px 6px 10px;border-bottom:1px solid rgba(249,115,22,.32);background:rgba(194,65,12,.11)}
.random-settings-panel .orange-master{margin-left:auto;border-color:rgba(249,115,22,.48);background:rgba(194,65,12,.22);color:#ffedd5}
.random-settings-panel .orange-master.active{border-color:#fb923c;background:rgba(234,88,12,.36);box-shadow:0 0 12px rgba(249,115,22,.16)}
.random-settings-panel .orange-profile-toolbar{margin:7px 8px 6px;border-color:rgba(249,115,22,.25);background:rgba(124,45,18,.10);display:flex;flex-wrap:wrap;gap:6px}
.random-settings-panel .orange-profile-toolbar .morph-profile-save.dirty{color:#fed7aa;border-color:#fb923c;box-shadow:0 0 0 1px rgba(251,146,60,.12)}
.random-settings-panel .orange-create-composition{margin-left:auto;color:#fdba74;border-color:rgba(249,115,22,.4)}
.random-settings-panel .orange-create-composition svg{width:17px;height:17px}
.random-settings-panel .orange-routing-shell{margin:0 8px 7px;padding:6px;border:1px solid rgba(249,115,22,.18);border-radius:8px;background:rgba(67,20,7,.12)}
.random-settings-panel .orange-routing-head{display:flex;align-items:center;gap:8px;margin-bottom:5px}.random-settings-panel .orange-routing-head strong{color:#ffedd5}.random-settings-panel .orange-routing-head .hint-text{margin-left:auto;font-size:9px}
.random-settings-panel .orange-routing-groups{display:flex;flex-wrap:wrap;gap:4px}
.random-settings-panel .orange-routing-groups .audio-route-group-btn{display:inline-flex;align-items:center;gap:5px;border-color:rgba(249,115,22,.28);background:rgba(124,45,18,.14);color:#fed7aa}
.random-settings-panel .orange-routing-groups .audio-route-group-btn:hover,.random-settings-panel .orange-routing-groups .audio-route-group-btn.active-filter{border-color:#fb923c;background:rgba(234,88,12,.28);color:#fff7ed}
.random-settings-panel .orange-routing-rows{display:flex;flex-direction:column;gap:4px;margin-top:6px}
.random-settings-panel .orange-route-row{grid-template-columns:16px 22px 14px minmax(150px,1.55fr) 72px 72px 24px;align-items:center;gap:5px;min-width:540px;padding:5px;border-color:rgba(71,85,105,.50);background:rgba(30,41,59,.34);box-shadow:inset 2px 0 0 rgba(251,146,60,.72)}
.random-settings-panel .orange-route-row>.morph-binding-remove{margin-left:auto}
.random-settings-panel .orange-route-picker{min-width:0}.random-settings-panel .orange-route-picker>.audio-param-picker-button{width:100%;text-align:left}
.random-settings-panel .orange-route-row.disabled{opacity:.56}
.random-settings-panel .orange-route-param-label{display:flex;flex-direction:column;min-width:0;line-height:1.1}
.random-settings-panel .orange-route-param-label small{font-size:8px;color:#b98b6f}
.random-settings-panel .orange-route-param-label strong{font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#fff7ed}
.random-settings-panel .orange-route-range{display:flex;align-items:center;gap:4px}
.random-settings-panel .orange-route-range input{width:62px}
.random-settings-panel .orange-route-static-note{font-size:9px;color:#fdba74}
.random-settings-panel .orange-routing-empty{padding:8px;border:1px dashed rgba(251,146,60,.22);border-radius:7px}

.random-settings-panel .orange-fixed-settings{margin:0 8px 8px;padding:6px;border:1px solid rgba(71,85,105,.45);border-radius:8px;background:rgba(15,23,42,.46);display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
.random-settings-panel .orange-fixed-settings>.morph-setting-row{margin:0;min-width:0}
.random-settings-panel .orange-group-filter-hidden{display:none!important}.random-settings-panel .orange-group-empty-note{grid-column:1/-1;padding:10px;text-align:center}
@media(max-width:760px){.random-settings-panel{width:calc(100vw - 8px)!important;max-width:none!important}.random-settings-panel .orange-fixed-settings{grid-template-columns:1fr}.random-settings-panel .orange-profile-toolbar{overflow-x:auto;flex-wrap:nowrap}.random-settings-panel .orange-routing-groups{flex-wrap:nowrap;overflow-x:auto;padding-bottom:2px}}

/* 7.9.15 — compact Blue profile header, transient profile lifecycle, Spiral routing group. */
#morphSettingsPanel .morph-header-master{
    display:inline-flex;align-items:center;justify-content:center;text-align:center;line-height:1!important;
    margin-left:auto!important;align-self:center;min-width:78px;
}
#morphSettingsPanel .morph-routing-target-master{opacity:1!important;cursor:default!important;font-weight:800;color:#ecfeff;border-color:#22d3ee;background:rgba(8,145,178,.30)}
#morphSettingsPanel .morph-master-dot{background:#22d3ee!important;color:#22d3ee!important;box-shadow:0 0 9px rgba(34,211,238,.7)}
#morphSettingsPanel .morph-routing-visible-head{align-items:center;gap:6px;overflow-x:auto;overflow-y:hidden;padding:5px 6px}
#morphSettingsPanel .morph-compact-profile-controls{display:flex;align-items:center;gap:5px;min-width:0;flex:1 1 auto;white-space:nowrap}
#morphSettingsPanel .morph-compact-profile-field{display:inline-flex;align-items:center;gap:4px;min-width:0;height:27px;padding:2px 5px;border:1px solid rgba(71,85,105,.56);border-radius:6px;background:rgba(2,6,23,.42);font-size:8px;color:#94a3b8}
#morphSettingsPanel .morph-compact-profile-field>span{white-space:nowrap}
#morphSettingsPanel .morph-compact-profile-field select{height:23px;min-height:23px;max-width:132px;padding:1px 4px;font-size:8px}
#morphSettingsPanel .morph-compact-profile-check{cursor:pointer;color:#cbd5e1}
#morphSettingsPanel .morph-compact-profile-check input{margin:0;width:13px;height:13px}
#morphSettingsPanel .morph-compact-source-row{display:none!important}
#morphSettingsPanel .morph-mode-card-compact-source>.morph-top-row{display:none!important}
#morphSettingsPanel .morph-routing-tools-meta{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:27px;margin:0 0 6px;padding:1px 2px}
#morphSettingsPanel .morph-routing-tools-meta .audio-routing-tools-hint{flex:1 1 auto;font-size:9px;color:#94a3b8}
#morphSettingsPanel .morph-order-mode-prominent{display:inline-flex!important;flex:0 0 auto;padding:0!important;border:0!important;background:transparent!important}
#morphSettingsPanel .morph-order-toggle{height:25px;min-height:25px;padding:2px 9px;border-radius:6px;border:1px solid rgba(34,211,238,.42);background:rgba(8,145,178,.12);color:#cffafe;font-size:9px;white-space:nowrap}
#morphSettingsPanel .morph-order-toggle:hover{border-color:#22d3ee;background:rgba(8,145,178,.24)}
#morphSettingsPanel .morph-order-toggle.free{color:#dbeafe;border-color:rgba(96,165,250,.5);background:rgba(30,64,175,.18)}
#morphSettingsPanel #btnAddMorphParameter{flex:0 0 auto;white-space:nowrap}

.morph-transient-decision-overlay{position:fixed;inset:0;z-index:15050;display:flex;align-items:center;justify-content:center;padding:16px;background:rgba(2,6,23,.56);backdrop-filter:blur(5px)}
.morph-transient-decision-card{width:min(430px,calc(100vw - 24px));display:flex;flex-direction:column;gap:10px;padding:14px;border:1px solid rgba(148,163,184,.30);border-radius:13px;background:linear-gradient(180deg,#111827,#08101d);box-shadow:0 28px 80px rgba(0,0,0,.62);color:#e5e7eb}
.morph-transient-decision-card>strong{font-size:13px;color:#f8fafc}.morph-transient-decision-card>span{font-size:10px;line-height:1.4;color:#94a3b8}
.morph-transient-decision-actions{display:flex;gap:7px;justify-content:flex-end;flex-wrap:wrap}.morph-transient-decision-actions button{min-height:32px;padding:5px 10px;border-radius:8px}
.morph-transient-decision-actions .primary{color:#ecfeff;border-color:#22d3ee;background:rgba(8,145,178,.28)}
.morph-transient-decision-actions .danger{color:#fee2e2;border-color:#ef4444;background:rgba(127,29,29,.24)}
#morphSettingsPanel.morph-profile-transient .morph-profile-toolbar{border-color:rgba(250,204,21,.52);box-shadow:inset 0 0 0 1px rgba(250,204,21,.07)}
.random-settings-panel.morph-profile-transient .orange-profile-toolbar{border-color:rgba(250,204,21,.48)}

.parameter-group-icon .spiral-routing-icon,
.morph-routing-group-icon .spiral-routing-icon,
.audio-routing-group-icon .spiral-routing-icon{
    width:15px;height:15px;display:block;overflow:visible;fill:none;stroke:currentColor;stroke-width:1.45;stroke-linecap:round;stroke-linejoin:round;
}
.parameter-group-icon .spiral-routing-icon circle,
.morph-routing-group-icon .spiral-routing-icon circle,
.audio-routing-group-icon .spiral-routing-icon circle{fill:currentColor;stroke:none}
#morphSettingsPanel .morph-spiral-fixed-settings{margin-top:6px;padding-top:6px;border-top:1px solid rgba(34,211,238,.20);display:flex;flex-direction:column;gap:5px;min-width:330px}
#morphSettingsPanel .morph-spiral-fixed-title{font-size:8px;color:#67e8f9;text-transform:uppercase;letter-spacing:.05em;padding:1px 3px}
#morphSettingsPanel .morph-spiral-fixed-settings .morph-setting-row{margin:0!important;padding:5px!important;background:rgba(8,145,178,.05);border:1px solid rgba(34,211,238,.16);border-radius:6px}

@media(max-width:900px){
  #morphSettingsPanel .morph-compact-profile-controls{min-width:560px}
  #morphSettingsPanel .morph-routing-visible-head{overflow-x:auto}
}

/* 7.9.15 — give the compact Morph profile header the same desktop breathing room as Audio Link. */
@media (min-width:1301px){
  #morphSettingsPanel.morph-audio-routing-panel{width:68vw!important;max-width:1180px!important;min-width:860px!important}
}

/* 7.9.16 — compact Morph binding rows with inline sub-settings. */
#morphSettingsPanel .morph-profile-toolbar{
  display:flex;align-items:center;gap:5px;flex-wrap:nowrap;
}
#morphSettingsPanel .morph-profile-select-wrap{
  flex:0 1 330px!important;min-width:180px!important;max-width:330px!important;
}
#morphSettingsPanel .morph-profile-select-wrap select{
  width:220px!important;min-width:130px!important;max-width:240px!important;flex:0 1 240px!important;
}
#morphSettingsPanel .morph-profile-toolbar-flags{
  margin-left:auto;display:flex;align-items:center;gap:5px;flex:0 0 auto;
}
#morphSettingsPanel .morph-profile-toolbar-check{
  display:inline-flex;align-items:center;gap:4px;height:27px;padding:2px 7px;border:1px solid rgba(71,85,105,.55);border-radius:6px;background:rgba(2,6,23,.38);font-size:8px;color:#cbd5e1;white-space:nowrap;cursor:pointer;
}
#morphSettingsPanel .morph-profile-toolbar-check input{width:13px;height:13px;margin:0}
#morphSettingsPanel .morph-compact-profile-controls{gap:4px!important;min-width:0!important;flex-wrap:nowrap}
#morphSettingsPanel .morph-compact-profile-field{padding:2px 4px!important}
#morphSettingsPanel .morph-compact-profile-field select{max-width:118px!important;min-width:88px!important}
#morphSettingsPanel .morph-compact-profile-field:has(#morphSpiralMorphType) select{max-width:150px!important;min-width:120px!important}

#morphProfileBindings .morph-route-row{
  display:flex!important;align-items:center;gap:5px;grid-template-columns:none!important;min-width:0!important;width:100%;padding:5px 6px!important;
}
#morphProfileBindings .morph-route-drag-handle{flex:0 0 14px}
#morphProfileBindings .morph-route-drag-placeholder{opacity:.25;cursor:default!important}
#morphProfileBindings .morph-route-row>input[type=checkbox]{flex:0 0 16px;width:16px;height:16px;margin:0}
#morphProfileBindings .morph-route-row-icon{flex:0 0 15px}
#morphProfileBindings .morph-route-compact-picker{flex:0 1 260px;width:auto;min-width:118px;max-width:280px}
#morphProfileBindings .morph-route-compact-picker .audio-param-picker-button{width:100%;font-size:9px;font-weight:650}
#morphProfileBindings .morph-route-number{flex:0 0 56px!important;width:56px!important;min-width:48px!important;text-align:center}
#morphProfileBindings .morph-route-range-sep{flex:0 0 auto;color:#64748b;font-size:9px}
#morphProfileBindings .morph-route-inline-control,
#morphProfileBindings .morph-route-inline-check{
  display:inline-flex;align-items:center;gap:3px;flex:0 0 auto;min-width:0;height:25px;padding:1px 4px;border:1px solid rgba(71,85,105,.42);border-radius:5px;background:rgba(2,6,23,.34);font-size:8px;color:#94a3b8;white-space:nowrap;
}
#morphProfileBindings .morph-route-inline-control>span{font-size:8px;color:#94a3b8}
#morphProfileBindings .morph-route-inline-number{width:48px!important;height:21px!important;min-height:21px!important;padding:1px 3px!important;text-align:center;font-size:9px!important}
#morphProfileBindings .morph-route-inline-select select,
#morphProfileBindings .morph-route-palette-select select,
#morphProfileBindings .morph-route-harmony-select select{height:21px;min-height:21px;max-width:125px;min-width:70px;padding:1px 3px;font-size:8px}
#morphProfileBindings .morph-route-palette-select select{max-width:115px}
#morphProfileBindings .morph-route-harmony-select select{max-width:120px}
#morphProfileBindings .morph-route-inline-check{padding:1px 5px;color:#cbd5e1;cursor:pointer}
#morphProfileBindings .morph-route-inline-check input{width:13px;height:13px;margin:0}
#morphProfileBindings .morph-route-multiplier{margin-left:auto;border-color:rgba(34,211,238,.30);color:#cffafe}
#morphProfileBindings .morph-route-multiplier + .morph-binding-remove{margin-left:0}
#morphProfileBindings .morph-route-multiplier>span{color:#67e8f9;font-weight:800}
#morphProfileBindings .morph-binding-remove{flex:0 0 24px;margin-left:auto}
#morphProfileBindings .morph-special-config-row{border-color:rgba(167,139,250,.34)!important;background:rgba(76,29,149,.08)!important}
#morphProfileBindings .morph-special-config-name{flex:0 1 150px;min-width:108px;font-size:9px;font-weight:700;color:#ddd6fe;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#morphProfileBindings .morph-special-config-range{display:inline-flex;align-items:center;gap:3px;flex:0 0 auto}
#morphProfileBindings .morph-special-config-range .morph-route-inline-control{border-color:rgba(139,92,246,.24)}
#morphProfileBindings .morph-special-order-range{margin-left:2px}
#morphProfileBindings .morph-route-mode{display:none!important}
#morphProfileBindings .morph-binding-compat-label{display:none!important}

/* Spiral settings no longer live as a separate popup card: they are inline in the profile rows/common header. */
#morphSettingsPanel .morph-spiral-fixed-settings{display:none!important}

@media(max-width:1050px){
  #morphSettingsPanel .morph-profile-toolbar{overflow-x:auto}
  #morphSettingsPanel .morph-profile-toolbar-flags{margin-left:0}
  #morphProfileBindings .morph-route-row{min-width:760px!important}
}
/* 7.9.16 — tighter name column; leave room for useful row controls. */
#morphProfileBindings .morph-route-compact-picker{flex:0 1 220px;max-width:220px}
#morphProfileBindings .morph-route-binding-multiplier{order:98}
#morphProfileBindings .morph-binding-remove{order:99}

/* 7.9.16 — compact dependent controls stay inside their parent Morph row. */
#morphProfileBindings .morph-route-child-binding{border-color:rgba(56,189,248,.24);background:rgba(14,116,144,.08);}
#morphProfileBindings .morph-route-dependent-check>span{font-weight:700;color:#bae6fd;}
#morphProfileBindings .morph-route-row[data-morph-parameter="spiral.step"] .morph-route-dependent-check,
#morphProfileBindings .morph-route-row[data-morph-parameter="spiral.fillEnabled"] .morph-route-dependent-check{margin-left:2px;}
#morphProfileBindings .morph-shape-inline-groups{position:relative;flex:0 0 auto}
#morphProfileBindings .morph-shape-inline-groups-btn{height:25px;min-width:92px;max-width:126px;padding:2px 7px;border:1px solid rgba(139,92,246,.26);border-radius:5px;background:rgba(2,6,23,.34);color:#ddd6fe;font-size:8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.morph-shape-inline-groups-menu{min-width:150px!important;padding:5px!important}
.morph-shape-inline-group-option{display:flex;align-items:center;gap:6px;padding:5px 6px;color:#cbd5e1;font-size:9px;cursor:pointer}
.morph-shape-inline-group-option:hover{background:rgba(56,189,248,.08)}
.morph-shape-inline-group-option input{width:13px;height:13px;margin:0}

/* 7.9.17 — more compound Blue rows restored from the dense legacy Morph UI. */
#morphProfileBindings .morph-route-inline-range{gap:3px}
#morphProfileBindings .morph-route-inline-range .morph-route-inline-number{width:42px!important}
#morphProfileBindings .morph-route-inline-range-sep{color:#64748b;font-size:8px}
#morphProfileBindings .morph-route-dependent-range{border-color:rgba(56,189,248,.20);background:rgba(14,116,144,.06)}
#morphProfileBindings .morph-route-row[data-morph-parameter="layer.radius"] .morph-route-dependent-check{border-color:rgba(56,189,248,.24);background:rgba(14,116,144,.08)}

/* 7.10 — compound Morph rows: one artistic concept, one row. */
#morphProfileBindings .morph-route-compound-binding{
  display:inline-flex;align-items:center;gap:4px;flex:0 0 auto;min-height:25px;padding:2px 5px;
  border:1px solid rgba(56,189,248,.22);border-radius:5px;background:rgba(8,47,73,.14);white-space:nowrap;
}
#morphProfileBindings .morph-route-compound-toggle,
#morphProfileBindings .morph-route-compound-range,
#morphProfileBindings .morph-route-compound-amplitude{
  display:inline-flex;align-items:center;gap:3px;white-space:nowrap;
}
#morphProfileBindings .morph-route-compound-toggle{font-size:8px;color:#bae6fd;font-weight:700;cursor:pointer}
#morphProfileBindings .morph-route-compound-toggle input{width:13px;height:13px;margin:0}
#morphProfileBindings .morph-route-compound-caption,
#morphProfileBindings .morph-route-compound-amplitude>span{font-size:8px;color:#94a3b8}
#morphProfileBindings .morph-route-compound-number{width:44px!important}
#morphProfileBindings .morph-route-compound-amplitude{padding-left:4px;border-left:1px solid rgba(71,85,105,.45)}
#morphProfileBindings .morph-route-dependent-control>span,
#morphProfileBindings .morph-route-dependent-check>span{font-size:8px;line-height:1.1}
#morphProfileBindings .morph-route-multiplier>span{font-weight:700;white-space:nowrap}
#morphProfileBindings .morph-route-row{overflow:visible}

/* 7.10.3 — multipliers in compound Morph rows are always-on neutral coefficients. */
#morphProfileBindings .morph-route-always-on-multiplier{gap:5px;background:rgba(15,23,42,.28)}
#morphProfileBindings .morph-route-compound-static-label{font-size:8px;color:#bae6fd;font-weight:700;white-space:nowrap}
#morphProfileBindings .morph-route-compound-static-multiplier{width:52px!important}

/* 7.10.3 — compact multiplier language and right-edge row actions. */
#morphProfileBindings .morph-route-multiplier>span,#morphProfileBindings .morph-route-compound-static-label{min-width:9px;text-align:center;font-size:10px;font-weight:800}
#morphProfileBindings .morph-route-row>.morph-binding-remove{margin-left:auto}
#morphProfileBindings .morph-route-row>.morph-route-multiplier~.morph-binding-remove{margin-left:0}

/* 7.10.3 — any visible X coefficient lives in the right action cluster immediately before the row close button. */
#morphProfileBindings .morph-route-row>.morph-route-always-on-multiplier,#morphProfileBindings .morph-route-row>.morph-route-multiplier{margin-left:auto!important;order:98!important;}
#morphProfileBindings .morph-route-row>.morph-route-always-on-multiplier~.morph-binding-remove,#morphProfileBindings .morph-route-row>.morph-route-multiplier~.morph-binding-remove{margin-left:0!important;order:99!important;}
/* 7.10.5: stable-7.9 Shape Morph remains a single compound Standard row. */
#morphProfileBindings .morph-special-profile-groups{display:inline-flex;align-items:center;gap:3px;flex-wrap:wrap;min-width:0}
#morphProfileBindings .morph-special-config-caption{font-size:8px;color:#94a3b8;white-space:nowrap}
#morphProfileBindings .morph-special-profile-check{padding:1px 4px}


/* 7.10.7 — restore the stable-7.9 Blue Morph speed selector as a dedicated top row. */
#morphSettingsPanel .morph-speed-toolbar{
  display:flex;align-items:center;gap:8px;margin:5px 0 6px;padding:5px 7px;
  border:1px solid rgba(34,211,238,.24);border-radius:8px;background:rgba(8,145,178,.07);
}
#morphSettingsPanel .morph-speed-toolbar-field{
  display:flex;align-items:center;gap:10px;min-width:310px;color:#cffafe;font-size:10px;font-weight:700;
}
#morphSettingsPanel .morph-speed-toolbar-field>span{white-space:nowrap}
#morphSettingsPanel .morph-speed-toolbar-field select{
  min-width:220px;max-width:340px;height:28px;min-height:28px;padding:2px 7px;font-size:10px;
}
@media(max-width:760px){
  #morphSettingsPanel .morph-speed-toolbar{overflow-x:auto}
  #morphSettingsPanel .morph-speed-toolbar-field{min-width:360px}
}

/* 7.10.8 — direct Audio target routing from the unified RMB menu. */
.parameter-routing-popup-audio{
    margin:3px 0;padding:8px;border:1px solid rgba(190,54,98,.34);border-radius:9px;background:rgba(117,20,55,.12);
}
.parameter-routing-popup-audio.disabled{opacity:.42}
.parameter-routing-popup-audio-head{display:flex;align-items:baseline;justify-content:space-between;gap:8px;margin-bottom:7px}
.parameter-routing-popup-audio-head strong{font-size:10px;color:#fff1f2}
.parameter-routing-popup-audio-head small{font-size:8px;color:#b98a9a;text-align:right}
.parameter-routing-popup-target-bubbles{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.parameter-routing-target-bubble{
    width:24px;height:24px;padding:0;border-radius:999px;border:1px solid rgba(251,113,133,.46);background:rgba(55,13,28,.72);color:#fecdd3;
    display:inline-flex;align-items:center;justify-content:center;font:800 10px/1 system-ui,sans-serif;box-shadow:inset 0 0 0 1px rgba(255,255,255,.025);cursor:pointer;
}
.parameter-routing-target-bubble:hover:not(:disabled){border-color:#fb7185;background:rgba(117,20,55,.72)}
.parameter-routing-target-bubble.active{color:#fff;border-color:#fda4af;background:#881337;box-shadow:0 0 9px rgba(190,24,93,.35),inset 0 0 0 1px rgba(255,255,255,.08)}
.parameter-routing-target-bubble:disabled{cursor:not-allowed}

/* Burgundy per-target badges stay on the lower-left edge of the original left-panel parameter. */
.parameter-routing-badge-row{position:relative!important;padding-bottom:7px!important}
.parameter-routing-audio-bubbles{
    position:absolute;z-index:12;bottom:0;transform:translateY(42%);display:flex;align-items:center;justify-content:flex-start;gap:3px;pointer-events:none;overflow:visible;
}
.parameter-routing-audio-bubble{
    width:13px;height:13px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;flex:0 0 13px;
    color:#fff1f2;background:#881337;border:1px solid #fb7185;box-shadow:0 0 5px rgba(190,24,93,.38);font:800 7px/1 system-ui,sans-serif;
}

/* 7.11.0 — restore stable Blue timing visibility and normalize special Geometry rows. */
#morphSettingsPanel .morph-speed-toolbar{
  flex-direction:column;align-items:stretch;gap:5px;
}
#morphSettingsPanel .morph-speed-toolbar-field{
  width:100%;min-width:0;
}
#morphSettingsPanel .morph-top-cycle-row{
  display:flex!important;align-items:center;justify-content:space-between;gap:10px;
  width:100%;margin:0!important;padding:5px 7px!important;border:1px solid rgba(71,85,105,.42)!important;
  border-radius:6px;background:rgba(15,23,42,.48)!important;color:#cbd5e1;font-size:10px;
}
#morphSettingsPanel .morph-top-cycle-row>.morph-cycle-controls{
  margin-left:auto;display:inline-flex;align-items:center;gap:5px;flex-wrap:nowrap;
}
#morphSettingsPanel .morph-top-cycle-row .tap-auto-badge{flex:0 0 auto}

#morphProfileBindings .morph-special-config-row{
  border-color:rgba(34,211,238,.18)!important;background:rgba(15,23,42,.72)!important;
}
#morphProfileBindings .morph-special-config-name{color:#e2e8f0!important}
#morphProfileBindings .morph-special-config-range .morph-route-inline-control{border-color:rgba(71,85,105,.42)!important}
#morphProfileBindings .morph-shape-route-profile-dropdown{
  flex:0 1 245px;min-width:165px;max-width:245px;
}
#morphProfileBindings .morph-shape-route-profile-dropdown>summary{
  min-height:25px;height:25px;padding:2px 6px;font-size:8px;
}
#morphProfileBindings .morph-shape-route-profile-dropdown>summary strong{
  color:#67e8f9;font-weight:650;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:128px;
}
#morphProfileBindings .morph-shape-route-profile-dropdown .morph-profile-group-menu{z-index:16060}
/* 7.11.0: routing catalogs share the same visible group set. */
#resourceSettingsPanel .audio-route-group.hidden,
#audioRoutingPanel .audio-routing-tools .audio-route-group.hidden{display:none!important}

/* 7.11.0 — dual interface presentation layer.
   Pro keeps the existing dense workstation UI. Easy is a progressive-disclosure
   view over the exact same authored/runtime state: no renderer or parameter fork. */
.header-brand-zone{
    display:flex;
    align-items:center;
    gap:8px;
    flex:0 0 auto;
}
.ui-mode-switch{
    display:inline-flex;
    align-items:center;
    gap:2px;
    padding:2px;
    border:1px solid rgba(71,85,105,.72);
    border-radius:9px;
    background:rgba(15,23,42,.72);
    box-shadow:inset 0 1px 0 rgba(255,255,255,.025);
}
.ui-mode-switch button{
    min-width:48px;
    height:24px;
    padding:0 9px;
    justify-content:center;
    border:0;
    border-radius:6px;
    background:transparent;
    color:#94a3b8;
    font-size:10px;
    font-weight:700;
    letter-spacing:.02em;
}
.ui-mode-switch button:hover{background:rgba(51,65,85,.58);color:#e2e8f0}
.ui-mode-switch button.active{
    background:linear-gradient(180deg,rgba(99,102,241,.32),rgba(79,70,229,.22));
    color:#eef2ff;
    box-shadow:0 0 0 1px rgba(129,140,248,.35),0 4px 12px rgba(15,23,42,.35);
}
.easy-only{display:none!important}

/* Easy — navigation by recognition instead of icon memorisation. */
body.ui-easy .easy-only{display:flex!important}
body.ui-easy header{
    min-height:48px;
    padding:8px 12px;
    gap:10px;
    background:rgba(8,13,24,.98);
    border-bottom-color:rgba(71,85,105,.58);
}
body.ui-easy .ui-mode-switch{
    border-color:rgba(56,189,248,.30);
    background:rgba(14,30,48,.78);
}
body.ui-easy .ui-mode-switch button[data-ui-mode="easy"].active{
    background:linear-gradient(180deg,rgba(14,165,233,.30),rgba(8,145,178,.20));
    box-shadow:0 0 0 1px rgba(56,189,248,.38),0 4px 14px rgba(8,145,178,.12);
    color:#ecfeff;
}
body.ui-easy .header-actions{gap:6px;align-items:center}
body.ui-easy .header-actions button[data-easy-label]{
    width:auto;
    min-width:30px;
    padding:6px 9px;
    border-radius:8px;
}
body.ui-easy .header-actions button[data-easy-label]::after{
    content:attr(data-easy-label);
    font-size:10px;
    font-weight:650;
    color:#cbd5e1;
    white-space:nowrap;
}
body.ui-easy .header-actions button[data-easy-label][aria-pressed="true"]::after{color:#f8fafc}

@media (min-width: 1101px){
    body.ui-easy .sidebar-tool-rail{
        width:126px;
        flex:0 0 126px;
        padding:7px 6px;
        gap:4px;
        background:rgba(8,13,24,.98);
        border-right:1px solid rgba(71,85,105,.50);
    }
    body.ui-easy .sidebar-tool-rail .sidebar-tool-btn,
    body.ui-easy .sidebar-tool-rail .sidebar-collapse-btn{
        width:100%;
        min-width:0;
        height:38px;
        padding:0 10px;
        justify-content:flex-start;
        gap:9px;
        border-radius:9px;
        border:1px solid transparent;
        background:transparent;
        color:#94a3b8;
        overflow:hidden;
    }
    body.ui-easy .sidebar-tool-rail .sidebar-tool-btn::after,
    body.ui-easy .sidebar-tool-rail .sidebar-collapse-btn::after{
        content:attr(data-easy-label);
        font-size:11px;
        font-weight:650;
        line-height:1;
        white-space:nowrap;
        color:inherit;
    }
    body.ui-easy .sidebar-tool-rail .sidebar-tool-btn:hover,
    body.ui-easy .sidebar-tool-rail .sidebar-collapse-btn:hover{
        background:rgba(30,41,59,.74);
        border-color:rgba(71,85,105,.55);
        color:#e2e8f0;
    }
    body.ui-easy .sidebar-tool-rail .sidebar-tool-btn.active{
        background:linear-gradient(90deg,rgba(14,165,233,.18),rgba(30,41,59,.72));
        border-color:rgba(56,189,248,.38);
        color:#f0f9ff;
        box-shadow:inset 3px 0 0 #38bdf8;
    }
    body.ui-easy .sidebar-tool-separator{width:calc(100% - 10px);height:1px;margin:5px;background:rgba(71,85,105,.46)}
}

body.ui-easy aside#settingsSidebar{
    width:410px;
    background:rgba(10,16,29,.975);
    border-right-color:rgba(71,85,105,.52);
    box-shadow:12px 0 34px rgba(0,0,0,.32);
}
body.ui-easy #settingsSidebar .section-header{
    min-height:52px;
    padding:8px 10px;
    text-transform:none;
    letter-spacing:0;
    background:rgba(12,20,35,.98);
    border-bottom-color:rgba(71,85,105,.55);
    gap:6px;
}
body.ui-easy #settingsSidebar .sidebar-section-title{
    font-size:13px;
    font-weight:750;
    color:#e2e8f0;
}
body.ui-easy #settingsSidebar .sidebar-layer-actions{gap:4px}
body.ui-easy #settingsSidebar .sidebar-layer-actions .btn-icon{
    width:auto;
    min-width:32px;
    height:30px;
    padding:0 8px;
}
body.ui-easy #settingsSidebar .sidebar-layer-actions .btn-icon::after{
    content:attr(data-easy-label);
    display:none;
}
body.ui-easy #layerList{
    background:rgba(15,23,42,.46);
    border-bottom:1px solid rgba(71,85,105,.42);
}
body.ui-easy #settingsSidebar .sidebar-content{
    padding:10px;
    gap:10px;
    scrollbar-gutter:stable;
}
body.ui-easy .easy-section-intro{
    flex-direction:column;
    gap:8px;
    padding:11px 12px;
    margin-bottom:1px;
    border:1px solid rgba(56,189,248,.22);
    border-radius:12px;
    background:linear-gradient(145deg,rgba(14,165,233,.10),rgba(15,23,42,.64));
    box-shadow:inset 0 1px 0 rgba(255,255,255,.025);
}
body.ui-easy .easy-section-copy{display:flex;flex-direction:column;gap:3px}
body.ui-easy .easy-section-copy strong{font-size:15px;line-height:1.15;color:#f8fafc;font-weight:760}
body.ui-easy .easy-section-copy span{font-size:11px;line-height:1.35;color:#94a3b8}
body.ui-easy .easy-routing-guide{
    display:flex;
    align-items:center;
    gap:7px;
    font-size:10px;
    color:#a5b4fc;
}
body.ui-easy .easy-mouse-key{
    display:inline-flex;
    align-items:center;
    min-height:21px;
    padding:0 6px;
    border:1px solid rgba(129,140,248,.34);
    border-radius:6px;
    background:rgba(79,70,229,.13);
    color:#c7d2fe;
    font-size:9px;
    font-weight:800;
}
body.ui-easy .easy-advanced-toggle{
    align-self:flex-start;
    min-height:29px;
    padding:5px 9px;
    border-color:rgba(71,85,105,.62);
    background:rgba(15,23,42,.72);
    color:#cbd5e1;
    font-size:10px;
}
body.ui-easy .easy-advanced-toggle[aria-pressed="true"]{
    border-color:rgba(56,189,248,.38);
    color:#e0f2fe;
}
body.ui-easy .easy-advanced-toggle .easy-chevron{transition:transform .16s ease}
body.ui-easy .easy-advanced-toggle[aria-pressed="true"] .easy-chevron{transform:rotate(180deg)}

/* Easy — settings become readable cards with one clear hierarchy. */
body.ui-easy #settingsSidebar .control-group{
    padding:0;
    gap:0;
    overflow:visible;
    border:1px solid rgba(71,85,105,.50)!important;
    border-radius:12px;
    background:rgba(15,23,42,.56);
    box-shadow:0 4px 18px rgba(0,0,0,.08);
}
body.ui-easy #settingsSidebar .control-group-title{
    min-height:43px;
    padding:10px 12px;
    margin:0;
    border-bottom:1px solid rgba(71,85,105,.42);
    border-radius:11px 11px 0 0;
    background:rgba(30,41,59,.42);
    color:#e2e8f0;
    font-size:13px;
    font-weight:730;
    letter-spacing:0;
}
body.ui-easy #settingsSidebar .control-group-title .group-title-toggle{font-size:13px;font-weight:730}
body.ui-easy #settingsSidebar .easy-technical-badge{display:none!important}
body.ui-easy #settingsSidebar .control-row{
    position:relative;
    min-height:52px;
    margin:0;
    padding:10px 12px;
    gap:8px;
    border:0;
    border-bottom:1px solid rgba(51,65,85,.44);
    border-radius:0;
    background:transparent!important;
}
body.ui-easy #settingsSidebar .control-row:last-child{border-bottom:0}
body.ui-easy #settingsSidebar .control-row:hover{background:rgba(30,41,59,.28)!important}
body.ui-easy #settingsSidebar .row-label,
body.ui-easy #settingsSidebar .hint-text{
    font-size:11px;
    line-height:1.35;
}
body.ui-easy #settingsSidebar .row-label>span:first-child,
body.ui-easy #settingsSidebar .control-row>.hint-text:first-child{
    color:#cbd5e1;
    font-weight:620;
}
body.ui-easy #settingsSidebar .text-mono{color:#93c5fd;font-size:10px}
body.ui-easy #settingsSidebar input[type="range"]{
    min-height:18px;
    accent-color:#38bdf8;
}
body.ui-easy #settingsSidebar input[type="number"],
body.ui-easy #settingsSidebar select{
    min-height:31px;
    border-radius:7px;
    border-color:rgba(71,85,105,.68);
    background:#0c1526;
}
body.ui-easy #settingsSidebar button:not(.sidebar-tool-btn){min-height:30px;border-radius:7px}
body.ui-easy #settingsSidebar .btn-group-toggle,
body.ui-easy #settingsSidebar .contour-mode-toggle,
body.ui-easy #settingsSidebar .morph-segmented-switch{
    gap:4px;
    padding:3px;
    border-radius:9px;
    background:rgba(8,15,28,.64);
}
body.ui-easy #settingsSidebar .profile-canvas-container{border-radius:10px;overflow:hidden;border:1px solid rgba(71,85,105,.54)}

/* Progressive disclosure. Advanced state never changes authored values; it only reveals controls. */
body.ui-easy:not(.easy-show-advanced) #settingsSidebar .easy-advanced-row:not(.easy-advanced-active){display:none!important}
body.ui-easy:not(.easy-show-advanced) #settingsSidebar .easy-multiplier-control:not(.easy-multiplier-active),
body.ui-easy:not(.easy-show-advanced) #settingsSidebar .easy-multiplier-token:not(.easy-multiplier-active),
body.ui-easy:not(.easy-show-advanced) #settingsSidebar .lamp-mult-label{display:none!important}
body.ui-easy:not(.easy-show-advanced) #settingsSidebar .motion-slider-mult>.easy-multiplier-control,
body.ui-easy:not(.easy-show-advanced) #settingsSidebar .lamp-slider-mult>.easy-multiplier-control{display:none!important}
body.ui-easy:not(.easy-show-advanced) #settingsSidebar .motion-slider-mult>input[type="range"],
body.ui-easy:not(.easy-show-advanced) #settingsSidebar .lamp-slider-mult>input[type="range"]{flex:1 1 auto;width:100%}

/* Right-click routing should be discoverable without permanent labels on every row. */
body.ui-easy #settingsSidebar .easy-routable-param{position:relative}
body.ui-easy #settingsSidebar .easy-routable-param:hover::after,
body.ui-easy #settingsSidebar .easy-routable-param:focus-within::after{
    content:attr(data-easy-route-hint);
    position:absolute;
    right:9px;
    bottom:4px;
    z-index:4;
    padding:2px 5px;
    border:1px solid rgba(129,140,248,.28);
    border-radius:5px;
    background:rgba(30,27,75,.88);
    color:#c7d2fe;
    font-size:8px;
    font-weight:700;
    line-height:1.2;
    pointer-events:none;
}

/* Easy — Blue / Orange / Audio panels share the same calmer visual grammar. */
body.ui-easy .morph-settings-panel,
body.ui-easy .random-settings-panel,
body.ui-easy .audio-routing-panel,
body.ui-easy .project-morph-settings-panel,
body.ui-easy .tunnel-settings-panel,
body.ui-easy .tap-settings-panel{
    border-radius:14px!important;
    border-color:rgba(71,85,105,.60)!important;
    background:rgba(8,14,25,.985)!important;
    box-shadow:0 24px 70px rgba(0,0,0,.48)!important;
}
body.ui-easy #morphSettingsPanel.morph-audio-routing-panel,
body.ui-easy .random-settings-panel,
body.ui-easy #audioRoutingPanel.audio-routing-panel{
    width:min(1080px,86vw)!important;
    max-width:calc(100vw - 24px)!important;
}
body.ui-easy .morph-settings-title,
body.ui-easy .random-settings-panel .orange-morph-title,
body.ui-easy .audio-routing-head{
    min-height:46px!important;
    padding:8px 12px!important;
    font-size:13px!important;
}
body.ui-easy .morph-profile-toolbar,
body.ui-easy .random-settings-panel .orange-profile-toolbar{
    padding:8px!important;
    margin:8px 10px!important;
    gap:6px!important;
    border-radius:10px!important;
}
body.ui-easy .morph-routing-groups,
body.ui-easy .audio-routing-groups{
    gap:5px!important;
}
body.ui-easy .morph-routing-groups button,
body.ui-easy .audio-routing-groups button,
body.ui-easy .random-settings-panel .orange-routing-groups .audio-route-group-btn{
    min-height:31px!important;
    padding:5px 9px!important;
    border-radius:8px!important;
    font-size:10px!important;
}
body.ui-easy .morph-route-row,
body.ui-easy .audio-route-row,
body.ui-easy .random-settings-panel .orange-route-row{
    min-height:42px!important;
    padding:7px 8px!important;
    gap:7px!important;
    border-radius:8px!important;
}
body.ui-easy .morph-route-param-label strong,
body.ui-easy .audio-route-param-label strong,
body.ui-easy .random-settings-panel .orange-route-param-label strong{font-size:11px!important}
body.ui-easy .morph-route-param-label small,
body.ui-easy .audio-route-param-label small,
body.ui-easy .random-settings-panel .orange-route-param-label small{font-size:9px!important}

/* Easy — keep routing/state feedback visible and calm rather than neon-heavy. */
body.ui-easy .control-row.blue-morph-live,
body.ui-easy .control-row.morph-route-enabled,
body.ui-easy .fill-settings-block.morph-route-enabled{
    outline-offset:-1px;
}

@media (max-width:1100px){
    body.ui-easy aside#settingsSidebar{width:360px}
    body.ui-easy .sidebar-tool-rail{width:48px!important;flex:0 0 48px!important}
    body.ui-easy .sidebar-tool-rail .sidebar-tool-btn::after,
    body.ui-easy .sidebar-tool-rail .sidebar-collapse-btn::after{display:none!important}
    body.ui-easy .header-actions button[data-easy-label]::after{display:none}
}
@media (max-width:760px){
    .header-brand-zone{gap:4px}
    body.ui-easy aside#settingsSidebar{width:min(92vw,390px)}
    body.ui-easy #settingsSidebar .sidebar-content{padding:8px}
    body.ui-easy #morphSettingsPanel.morph-audio-routing-panel,
    body.ui-easy .random-settings-panel,
    body.ui-easy #audioRoutingPanel.audio-routing-panel{width:calc(100vw - 8px)!important;max-width:none!important}
}

body.ui-easy:not(.easy-show-advanced) #settingsSidebar .easy-advanced-row.easy-advanced-active{
    box-shadow:inset 2px 0 0 rgba(56,189,248,.46);
}
body.ui-easy:not(.easy-show-advanced) #settingsSidebar .easy-advanced-row.easy-advanced-active::before{
    content:"Изменено";
    position:absolute;
    right:9px;
    top:5px;
    color:#7dd3fc;
    font-size:7px;
    font-weight:800;
    letter-spacing:.04em;
    text-transform:uppercase;
    pointer-events:none;
}
body.ui-easy #settingsSidebar .easy-advanced-row{position:relative}

/* 7.11.2 — mobile has one UI (full Pro controls), no Easy/Pro switch.
   Match the app's mobile portrait and coarse-pointer landscape breakpoints. */
@media (max-width:760px), (max-height:480px) and (hover:none) and (pointer:coarse){
    #uiModeSwitch{display:none!important}
}

/* 7.11.9 — Blue / Orange: a single visual language for individual parameter rows.
   Data sources and generated range defaults intentionally remain independent. */
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-row{
  display:flex!important;align-items:center;gap:5px;grid-template-columns:none!important;
  min-width:0!important;width:100%;padding:5px 6px!important;overflow:visible;
}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-drag-handle{flex:0 0 14px}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-drag-placeholder{opacity:.25;cursor:default!important}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-row>input[type=checkbox]{flex:0 0 16px;width:16px;height:16px;margin:0}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-row-icon{flex:0 0 15px}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-compact-picker{flex:0 1 220px;width:auto;min-width:118px;max-width:220px}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-compact-picker .audio-param-picker-button{width:100%;font-size:9px;font-weight:650}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-number{flex:0 0 56px!important;width:56px!important;min-width:48px!important;text-align:center}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-range-sep{flex:0 0 auto;color:#64748b;font-size:9px}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-inline-control,
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-inline-check{
  display:inline-flex;align-items:center;gap:3px;flex:0 0 auto;min-width:0;height:25px;
  padding:1px 4px;border:1px solid rgba(71,85,105,.42);border-radius:5px;
  background:rgba(2,6,23,.34);font-size:8px;color:#94a3b8;white-space:nowrap;
}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-inline-control>span{font-size:8px;color:#94a3b8}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-inline-number{
  width:48px!important;height:21px!important;min-height:21px!important;padding:1px 3px!important;text-align:center;font-size:9px!important;
}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-inline-select select,
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-palette-select select,
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-harmony-select select{
  height:21px;min-height:21px;max-width:125px;min-width:70px;padding:1px 3px;font-size:8px;
}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-palette-select select{max-width:115px}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-inline-check{padding:1px 5px;color:#cbd5e1;cursor:pointer}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-inline-check input{width:13px;height:13px;margin:0}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-binding-remove{flex:0 0 24px;margin-left:auto}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-compound-binding{
  display:inline-flex;align-items:center;gap:4px;flex:0 0 auto;min-height:25px;padding:2px 5px;
  border:1px solid rgba(56,189,248,.22);border-radius:5px;background:rgba(8,47,73,.14);white-space:nowrap;
}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-compound-toggle,
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-compound-range{display:inline-flex;align-items:center;gap:3px;white-space:nowrap}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-compound-toggle{font-size:8px;color:#bae6fd;font-weight:700;cursor:pointer}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-compound-toggle input{width:13px;height:13px;margin:0}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-compound-caption{font-size:8px;color:#94a3b8}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-compound-number{width:44px!important}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-inline-range-sep{color:#64748b;font-size:8px}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-always-on-multiplier{gap:5px;background:rgba(15,23,42,.28)}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-compound-static-label{font-size:10px;color:#bae6fd;font-weight:800;min-width:9px;text-align:center}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-compound-static-multiplier{width:52px!important}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-row>.morph-route-always-on-multiplier{
  margin-left:auto!important;order:98!important;
}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-row>.morph-route-always-on-multiplier~.morph-binding-remove{
  margin-left:0!important;order:99!important;
}
#orangeMorphBindings .morph-route-compound-binding{border-color:rgba(251,146,60,.24);background:rgba(124,45,18,.12)}
#orangeMorphBindings .morph-route-compound-toggle{color:#fed7aa}
#orangeMorphBindings .morph-route-always-on-multiplier{background:rgba(15,23,42,.28)}
@media(max-width:1050px){#orangeMorphBindings .morph-route-row{min-width:760px!important}}
@media(max-width:760px){.random-settings-panel .orange-routing-rows{overflow-x:auto;overflow-y:visible}}
/* Wide compound rows scroll within Orange instead of overlapping the neighbouring panel. */
.random-settings-panel .orange-routing-rows{overflow-x:auto;overscroll-behavior-x:contain}

/* 7.11.12 — Audio subsettings use the same compact nesting vocabulary as Blue/Orange. */
.audio-param-menu .audio-param-option:disabled { color:#64748b; cursor:not-allowed; opacity:.68; }

/* 7.11.14: Orbit is a regular, non-interactive text label in both editors. */
:is(#morphProfileBindings,#orangeMorphBindings) .morph-orbit-plain-label{
  display:flex;align-items:center;flex:0 1 220px;min-width:118px;max-width:220px;
  min-height:25px;padding:2px 5px;border:0;background:transparent;
  color:#e2e8f0;font-size:9px;font-weight:650;cursor:default;user-select:text;
}

/* 7.11.15 — Orange adopts the compact Blue header; old generator controls stay
   mounted for source compatibility but never create a second visible toolbar. */
#randomSettingsPanel.orange-unified-header .orange-compat-hidden{display:none!important}
#randomSettingsPanel.orange-unified-header .orange-profile-toolbar{
  display:flex;align-items:center;flex-wrap:wrap;gap:5px;
}
#randomSettingsPanel.orange-unified-header .morph-profile-toolbar-flags{margin-left:auto;display:flex;align-items:center;gap:5px}
#randomSettingsPanel.orange-unified-header .morph-profile-toolbar-check{
  display:inline-flex;align-items:center;gap:4px;height:27px;padding:2px 7px;
  border:1px solid rgba(71,85,105,.55);border-radius:6px;background:rgba(2,6,23,.38);
  font-size:9px;color:#fed7aa;white-space:nowrap;cursor:pointer;
}
#randomSettingsPanel.orange-unified-header .morph-profile-toolbar-check input{width:13px;height:13px;margin:0}
#orangeMorphHeaderTiming{display:flex;flex-direction:column;gap:5px;margin:3px 8px 8px;padding:7px;
  border:1px solid rgba(249,115,22,.28);border-radius:8px;background:rgba(2,6,23,.34)}
#orangeMorphHeaderTiming .orange-top-cycle-row{display:flex!important;align-items:center;justify-content:space-between;
  gap:8px;padding:3px 5px;margin:0;flex-wrap:wrap}
#orangeMorphHeaderTiming .orange-top-cycle-row>.morph-cycle-controls{display:flex;align-items:center;gap:4px;flex-wrap:wrap}
#orangeMorphHeaderTiming .morph-quick-btn{font-size:9px;min-width:25px;min-height:24px;padding:2px 5px}
#orangeMorphHeaderTiming .morph-quick-btn.active{color:#fed7aa;border-color:#fb923c;background:rgba(194,65,12,.30)}
#orangeMorphHeaderTiming .orange-header-basics{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
#orangeMorphHeaderTiming .orange-header-basics>.morph-setting-row{margin:0;min-height:30px;padding:4px 6px;
  border:1px solid rgba(71,85,105,.45);border-radius:6px;background:rgba(15,23,42,.48)}
#orangeMorphHeaderTiming .orange-header-basics .morph-interval{max-width:70px}
#randomSettingsPanel.orange-unified-header .orange-routing-shell{display:flex;flex-direction:column;gap:5px}
#randomSettingsPanel.orange-unified-header #btnAddOrangeMorphParameter{align-self:flex-start;margin-top:4px;
  padding:5px 10px;border:1px solid rgba(251,146,60,.5);border-radius:6px;background:rgba(124,45,18,.14);
  font-size:10px;color:#fed7aa}
#randomSettingsPanel.orange-unified-header #btnAddOrangeMorphParameter:hover{background:rgba(194,65,12,.30)}
#randomSettingsPanel.orange-unified-header .orange-morph-title{height:auto;min-height:38px}
@media(max-width:760px){#orangeMorphHeaderTiming .orange-header-basics{align-items:stretch}#orangeMorphHeaderTiming .orange-header-basics>.morph-setting-row{flex:1 1 145px}}
/* The FPS/console launcher must never cover controls in any Morph dialog. */
body:has(#randomSettingsPanel:not(.hidden)) #fpsCounter,
body:has(#morphSettingsPanel:not(.hidden)) #fpsCounter,
body:has(#projectMorphSettingsPanel:not(.hidden)) #fpsCounter{display:none!important}

/* V8 same-row percentage coverage for Blue and Orange. */
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-layer-coverage{gap:3px;flex:0 0 auto}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-layer-coverage>span{white-space:nowrap}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-layer-percent{width:38px!important;min-width:38px!important;max-width:38px!important;height:21px!important;min-height:21px!important;padding:1px 2px!important;text-align:center;font-size:9px!important;font-variant-numeric:tabular-nums}
@media(max-width:760px){:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-row{flex-wrap:wrap}}

/* 8.19.3 — Forma / Orbits: same parameter chip and row rhythm as regular routes. */
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-row[data-morph-special="shape"],
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-row[data-orange-special="shape"],
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-row[data-morph-special="orbits"],
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-row[data-orange-special="orbits"] {
  background:rgba(30,41,59,.34)!important;
  border-color:rgba(71,85,105,.50)!important;
}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-row:is([data-morph-special="shape"],[data-orange-special="shape"],[data-morph-special="orbits"],[data-orange-special="orbits"]) .morph-special-config-name{
  display:flex;align-items:center;flex:0 1 220px!important;width:auto!important;
  min-width:118px!important;max-width:220px!important;min-height:25px;height:25px;
  padding:2px 6px!important;border:1px solid rgba(71,85,105,.58)!important;
  border-radius:6px!important;background:#1e293b!important;
  color:#e2e8f0!important;font-size:9px!important;font-weight:650!important;
  line-height:19px;box-sizing:border-box;white-space:nowrap;
}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-row:is([data-morph-special="shape"],[data-orange-special="shape"],[data-morph-special="orbits"],[data-orange-special="orbits"]) .morph-route-layer-coverage{
  margin-left:0;
}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-route-row:is([data-morph-special="shape"],[data-orange-special="shape"],[data-morph-special="orbits"],[data-orange-special="orbits"]) .morph-binding-remove{margin-left:auto!important}

/* v8.20 ambient, refractive foreground and geometry test-morph */
#settingsSidebar.sidebar-mode-ambient .sidebar-content > .control-group:not(.ambient-settings-group),
#settingsSidebar.sidebar-mode-prism .sidebar-content > .control-group:not(.prism-settings-group){display:none!important;}
.sidebar-tool-btn[data-sidebar-mode="ambient"].active{background:#ec489939;border-color:#f472b6;color:#fbcfe8;}
.sidebar-tool-btn[data-sidebar-mode="prism"].active{background:#eab30839;border-color:#facc15;color:#fef08a;}
.ambient-settings-group .ambient-effect-row{display:grid;gap:9px;border:1px solid rgba(244,114,182,.2);border-radius:8px;padding:10px;margin:5px 0;}
.ambient-settings-group .ambient-effect-row label{display:flex;gap:8px;justify-content:space-between;align-items:center;font-size:12px;}
.ambient-settings-group .ambient-effect-row input[type="range"]{width:min(150px,60%);}
.ambient-settings-group .ambient-effect-row input[type="number"]{width:72px;}
.ambient-settings-group .ambient-colors{display:flex;justify-content:center;gap:8px;}
.prism-settings-group .control-row{display:flex;justify-content:space-between;}
.prism-settings-group .control-row label{display:flex;width:100%;justify-content:space-between;align-items:center;gap:7px;}
.prism-settings-group input[type="range"]{width:48%;}
.test-morph-heading{display:inline-flex;align-items:center;gap:5px;font-size:11px;font-weight:500;text-transform:none;white-space:nowrap;}
.test-morph-controls{border:1px solid #818cf680;border-radius:8px;padding:8px;display:grid;gap:8px;}
.test-morph-controls.hidden,.test-morph-controls .hidden{display:none!important;}
.test-morph-controls label{display:flex;gap:8px;align-items:center;justify-content:space-between;}
#ambientOverlayCanvas,#prismOverlayCanvas{position:absolute;inset:0;width:100%;height:100%;z-index:7;pointer-events:none;}
#prismOverlayCanvas{z-index:8;}
#ambientOverlayCanvas.is-off,#prismOverlayCanvas.is-off{display:none;}

.ambient-tool-btn svg{display:block;width:24px;height:24px;filter:drop-shadow(0 0 3px #f472b677)}

/* 8.20.4: independent per-parameter multiplier for ambient and 3D controls. */
.somata-effect-multiplier{margin-inline-start:6px;min-width:69px;max-width:78px;padding:4px 2px;border:1px solid #536278;border-radius:6px;background:#18253b;color:#eef3ff;font:inherit;font-size:12px;vertical-align:middle;cursor:pointer;}
.ambient-effect-row label:has(.somata-effect-multiplier),.prism-settings-group .control-row label:has(.somata-effect-multiplier){display:inline-flex;align-items:center;flex-wrap:wrap;gap:3px;}
.ambient-effect-row input[type=range],.prism-settings-group input[type=range]{min-width:88px;flex:1 1 80px;}

/* 8.20.5: independent 2D sprite/legacy vs optical WebGPU 3D, never silently conflated. */
.prism-mode-switch{display:grid;grid-template-columns:1fr 1fr;gap:5px;margin:10px 0;}
.prism-mode-switch button{background:#19263a;border:1px solid #61738d;border-radius:7px;color:#e4ebff;padding:9px 7px;cursor:pointer;}
.prism-mode-switch button.active{background:#274174;border-color:#8daeff;color:white;box-shadow:inset 0 0 0 1px #7397e5;}
.prism-2d-controls{padding:7px;border:1px solid #394a66;border-radius:7px;margin:8px 0;}
.prism-2d-controls input[type=file]{max-width:194px;font-size:11px;}
.prism-2d-controls .control-row{align-items:center;gap:8px;flex-wrap:wrap;}
.prism-2d-controls .control-row label{align-items:center;flex-wrap:wrap;}
.prism-2d-controls button{color:#f3efff;background:#283853;border:1px solid #566d91;border-radius:6px;padding:5px 9px;}
.prism-settings-group [hidden]{display:none!important;}


/* 8.20.7: selection opens settings; ONLY feature-enabled lights the icon. */
#btnSidebarPrism, #btnSidebarAmbient,
#btnSidebarPrism.active, #btnSidebarAmbient.active {
    color:#9aa4b3!important;
    border-color:rgba(91,108,135,.48)!important;
    background:rgba(15,23,42,.56)!important;
    box-shadow:none!important;
}
#btnSidebarPrism { font-size:23px; }
#btnSidebarPrism .prism-skull-icon {display:block;filter:grayscale(1) brightness(.65);}
#btnSidebarPrism:not(.feature-enabled) { opacity:.67; }
#btnSidebarPrism.feature-enabled {
    opacity:1;
    color:#fff!important; text-shadow:0 0 6px #fff,0 0 13px rgba(226,232,240,.85);
}
#btnSidebarAmbient:not(.feature-enabled) svg {filter:grayscale(1) brightness(.57)!important; opacity:.7;}
#btnSidebarAmbient.feature-enabled svg {
    filter:drop-shadow(0 0 4px #f9a8d4) drop-shadow(0 0 9px #ec4899)!important;
    opacity:1;
}
#btnSidebarAmbient.feature-enabled {border-color:rgba(244,114,182,.46)!important;}
.prism-live-status{font-size:11px;line-height:1.35;padding:5px 7px;border-radius:5px;
  background:rgba(15,23,42,.5);border:1px solid rgba(71,85,105,.6);color:#cbd5e1;margin:5px 0;}
.prism-live-status[data-status="failed"] {border-color:rgba(248,113,113,.75);color:#fecaca;}
.prism-live-status[data-status="ready"] {border-color:rgba(45,212,191,.4);color:#a7f3d0;}

#btnSidebarPrism.feature-enabled .prism-skull-icon {filter:grayscale(1) brightness(2.8) drop-shadow(0 0 3px #fff) drop-shadow(0 0 8px #fff);}

/* Somata 8.20.11 — effect sliders use the established Lamp controls layout. */
#prismSettingsGroup .somata-effect-control,#ambientSettingsGroup .somata-effect-control{display:block;margin:8px 0;min-width:0;}
#prismSettingsGroup .somata-effect-control .row-label,#ambientSettingsGroup .somata-effect-control .row-label{display:flex;justify-content:space-between;align-items:center;width:100%;gap:8px;margin-bottom:5px;font-size:12px;}
#prismSettingsGroup .somata-effect-control .row-label .text-mono,#ambientSettingsGroup .somata-effect-control .row-label .text-mono{font-size:11px;color:#b6c7df;white-space:nowrap;}
#prismSettingsGroup .somata-effect-control .lamp-slider-mult,#ambientSettingsGroup .somata-effect-control .lamp-slider-mult{display:grid;grid-template-columns:minmax(0,1fr) auto 62px;align-items:center;gap:7px;width:100%;}
#prismSettingsGroup .somata-effect-control input[type=range],#ambientSettingsGroup .somata-effect-control input[type=range]{width:100%;min-width:0;max-width:none;flex:1 1 auto;}
#prismSettingsGroup .somata-effect-control .lamp-slider-mult input[type=number],#ambientSettingsGroup .somata-effect-control .lamp-slider-mult input[type=number]{width:62px!important;min-width:0!important;padding:5px!important;}
#prismSettingsGroup .somata-effect-control .prism-hue-slider{width:100%;background:linear-gradient(to right,#f33,#ff3,#3f3,#3ff,#33f,#f3f,#f33);}
#prismShapeRow{display:flex;flex-direction:column;align-items:stretch;gap:7px;}
#prismShapeRow .row-label{margin:0;font-size:13px;}
.prism-shape-picker{display:grid;grid-template-columns:34px minmax(0,1fr) 34px;align-items:center;gap:6px;width:100%;}
.prism-shape-picker button{border:1px solid #536b93;border-radius:7px;min-height:34px;background:#182b45;color:#e8f5ff;cursor:pointer;}
.prism-shape-picker button:active{background:#405b86;}
.prism-shape-picker select{width:100%;min-width:0;max-width:100%;}
.prism-color-grid{padding:6px 9px;margin:7px 0;border:1px solid #394c66;border-radius:7px;}

#ambientSettingsGroup .ambient-numeric-control .lamp-slider-mult{grid-template-columns:minmax(0,1fr) auto 62px;}
#ambientSettingsGroup .ambient-numeric-control .lamp-slider-mult input[type=number]:first-child{width:100%!important;max-width:none!important;}


/* 8.20.12: independent figure controls use compact Lamp-like spacing. */
#prismSettingsGroup { padding:9px 11px!important; }
#prismSettingsGroup .control-group-title {margin:0 0 5px!important; padding:0!important; line-height:1.15!important; font-size:12px!important;}
#prismSettingsGroup .prism-mode-switch {margin:5px 0!important;gap:4px!important;}
#prismSettingsGroup .prism-mode-switch button {padding:5px 6px!important;min-height:28px!important;font-size:12px!important;}
#prismSettingsGroup #prismModeExplanation {margin:2px 0 5px!important;line-height:1.2!important;font-size:10px!important;}
#prismSettingsGroup .somata-effect-control {margin:3px 0 5px!important;padding:0!important;gap:2px!important;}
#prismSettingsGroup .somata-effect-control .row-label {margin:0 0 2px!important;line-height:1.15!important;font-size:11.5px!important;}
#prismSettingsGroup .somata-effect-control .row-label .text-mono {font-size:10.5px!important;}
#prismSettingsGroup .somata-effect-control .lamp-slider-mult {grid-template-columns:minmax(0,1fr) auto 52px!important;gap:4px!important;}
#prismSettingsGroup .somata-effect-control .lamp-slider-mult:not(:has(> .lamp-mult-label)) {grid-template-columns:minmax(0,1fr)!important;}
#prismSettingsGroup .somata-effect-control .lamp-slider-mult input[type=number] {width:52px!important;padding:2px 3px!important;font-size:11px!important;height:25px!important;}
#prismSettingsGroup .somata-effect-control input[type=range] {height:20px!important;min-height:20px!important;}
#prismSettingsGroup .prism-color-grid {padding:3px 6px!important;margin:4px 0!important;}
#prismSettingsGroup .prism-shape-picker {grid-template-columns:27px minmax(0,1fr) 27px;gap:4px;}
#prismSettingsGroup .prism-shape-picker button {min-height:26px!important;border-radius:5px!important;}
#prismSettingsGroup #prismShapeRow {display:grid!important;grid-template-columns:auto minmax(0,1fr);gap:8px!important;align-items:center!important;margin:3px 0 7px!important;}
#prismSettingsGroup #prismShapeRow .row-label {font-size:12px!important;line-height:1.15!important;margin:0!important;}
#prismSettingsGroup #prismShapeRow select {min-height:27px!important;font-size:12px!important;}
#prismSettingsGroup > .control-row:not(.somata-effect-control):not(#prismShapeRow) {margin:3px 0!important;min-height:23px!important;}
#prismSettingsGroup #prism3dLiveStatus,#prismSettingsGroup #prism3dBackendInfo {display:none!important;}
#prismSettingsGroup .prism-2d-controls {margin:4px 0!important;padding:5px!important;}


/* Somata 8.20.13 — compact ambience sliders, matching the Lamp/prism controls. */
#ambientSettingsGroup{padding:9px 11px!important;}
#ambientSettingsGroup .control-group-title{margin:0 0 5px!important;padding:0!important;line-height:1.15!important;font-size:12px!important;}
#ambientSettingsGroup .ambient-effect-row{gap:3px!important;padding:6px 7px!important;margin:4px 0!important;border-radius:6px!important;}
#ambientSettingsGroup .ambient-effect-row>label:first-child{min-height:24px!important;font-size:12px!important;justify-content:flex-start!important;gap:7px!important;}
#ambientSettingsGroup .somata-effect-control{margin:3px 0 5px!important;padding:0!important;gap:2px!important;}
#ambientSettingsGroup .somata-effect-control .row-label{margin:0 0 2px!important;line-height:1.15!important;font-size:11.5px!important;}
#ambientSettingsGroup .somata-effect-control .row-label .text-mono{font-size:10.5px!important;}
#ambientSettingsGroup .somata-effect-control .lamp-slider-mult{grid-template-columns:minmax(0,1fr) auto 52px!important;gap:4px!important;}
#ambientSettingsGroup .somata-effect-control .lamp-slider-mult:not(:has(> .lamp-mult-label)){grid-template-columns:minmax(0,1fr)!important;}
#ambientSettingsGroup .somata-effect-control .lamp-slider-mult input[type=number]{width:52px!important;padding:2px 3px!important;font-size:11px!important;height:25px!important;}
#ambientSettingsGroup .somata-effect-control input[type=range]{height:20px!important;min-height:20px!important;width:100%!important;max-width:none!important;}
#ambientSettingsGroup .ambient-numeric-control .lamp-slider-mult:not(:has(> .lamp-mult-label)) input[type=number]{width:100%!important;max-width:none!important;}
#ambientSettingsGroup .ambient-colors{gap:4px!important;}
/* Rain switch replaces the stock square checkbox; keyboard/labels remain functional. */
#ambientSettingsGroup .ambient-rain-toggle input[type=checkbox]{appearance:none;-webkit-appearance:none;width:25px;height:14px;min-width:25px;margin:0;position:relative;cursor:pointer;background:#475569;border:1px solid #64748b;border-radius:9px;transition:background .15s;}
#ambientSettingsGroup .ambient-rain-toggle input[type=checkbox]::after{content:'';position:absolute;top:2px;left:2px;width:8px;height:8px;border-radius:50%;background:#cbd5e1;transition:transform .15s;}
#ambientSettingsGroup .ambient-rain-toggle input[type=checkbox]:checked{background:#db2777;border-color:#f472b6;}
#ambientSettingsGroup .ambient-rain-toggle input[type=checkbox]:checked::after{transform:translateX(11px);background:white;}
#ambientSettingsGroup .ambient-rain-toggle input[type=checkbox]:focus-visible{outline:2px solid #f9a8d4;outline-offset:2px;}

/* 8.20.14: Ambients use the compact Lamp controls; a true overlay-order toggle. */
#ambientSettingsGroup .control-group-title.ambient-heading{display:flex!important;align-items:center!important;justify-content:space-between!important;gap:6px;padding-bottom:6px!important;}
#ambientSettingsGroup .ambient-over-lens{display:flex;align-items:center;gap:5px;font-size:11px;font-weight:500;white-space:nowrap;color:#fbcfe8;cursor:pointer;}
#ambientSettingsGroup .ambient-over-lens input{accent-color:#ec4899;width:14px;height:14px;margin:0;}
#ambientSettingsGroup .ambient-effect-row{padding:6px 8px!important;gap:2px!important;}
#ambientSettingsGroup .ambient-effect-row .row-label{font-size:11px!important;}
#ambientSettingsGroup .ambient-vignette-row .lamp-slider-mult{width:100%;}
#ambientSettingsGroup .ambient-vignette-row input[type=range]{min-width:0;}

/* v9.0.6: lightning trigger selection lives in the heading, not in the appearance controls. */
.lightning-trigger-header{display:flex;align-items:center;gap:7px;flex-wrap:wrap;}
.lightning-trigger-header .lightning-trigger-control{display:inline-flex;align-items:center;gap:5px;margin-left:auto;font-size:11px;white-space:nowrap;min-width:0;}
.lightning-trigger-header .lightning-trigger-control select{min-width:112px;max-width:154px;font-size:11px;padding:3px 4px;}
.lightning-trigger-header .badge{margin-left:0;}

/* 9.0.11: the finite Spiral animation selector must remain inside the sidebar. */
#testMorphControls{box-sizing:border-box;min-width:0;max-width:100%;width:100%;grid-template-columns:minmax(0,1fr);overflow:hidden;}
#testMorphControls .control-row{min-width:0;max-width:100%;width:100%;}
#testMorphControls .control-row > label{display:grid;grid-template-columns:minmax(0,1fr);gap:5px;min-width:0;max-width:100%;width:100%;justify-items:stretch;white-space:normal;overflow-wrap:anywhere;}
#testMorphControls select,#testMorphControls input[type=number]{box-sizing:border-box;display:block;min-width:0;max-width:100%;width:100%;margin:0;font-size:11px;}
#testMorphSpiralRow select{font-size:10px;}


/* Somata 9.1 — clean menus and compact star-geometry layout. */
#presetChooserPanel,
#morphTypeTopNav,
.somata-removed-menu,
.somata-removed-row,
#gcdNotice,
#roundingGuideControls,
#fileSettingsBlock > input[hidden] {
    display: none !important;
}
/* The audio routing preset selector is intentionally visible (restored from 7.11.16). */

/* Somata 9.1: clean geometry (no Morphing sidebar), long N slider
   bracketed with −/+ and visible multiplier arrow buttons. */
#geometrySettingsGroup > .morph-sidebar-section { display:none!important; }
#geometrySettingsGroup .geometry-n-row { width:100%; min-width:0; }
#geometrySettingsGroup .geometry-n-heading {
    width:100%; display:flex; align-items:center; gap:5px; min-width:0;
}
#geometrySettingsGroup .geometry-n-title {
    flex:0 1 auto; min-width:0; color:var(--text-muted);
    font-size:11px; line-height:1.2; white-space:nowrap;
}
#geometrySettingsGroup .geometry-n-result {
    flex:0 0 auto; margin-left:auto; position:relative; top:-4px;
    color:#b6c1da; font-size:9px; line-height:1; white-space:nowrap;
}
#geometrySettingsGroup .geometry-n-values {
    display:grid; grid-template-columns:42px 8px 61px;
    gap:4px; flex:0 0 auto; align-items:center; min-width:0;
}
#geometrySettingsGroup .geometry-n-values > #numN {
    box-sizing:border-box; width:42px!important; min-width:0!important;
    height:27px; padding:2px 3px; font-size:11px; text-align:center;
    appearance:textfield; -moz-appearance:textfield;
}
#geometrySettingsGroup .geometry-n-values > #numN::-webkit-inner-spin-button,
#geometrySettingsGroup .geometry-n-values > #numN::-webkit-outer-spin-button { -webkit-appearance:none; margin:0; }
#geometrySettingsGroup .geometry-n-values > .lamp-mult-label {
    min-width:0; width:8px; justify-self:center; margin:0; padding:0;
}
#geometrySettingsGroup .geometry-n-slider-controls {
    width:100%; min-width:0; display:grid;
    grid-template-columns:28px minmax(0,1fr) 28px;
    gap:6px; align-items:center;
}
#geometrySettingsGroup .geometry-n-slider-controls > #paramN {
    width:100%; min-width:0; margin:0;
}
#geometrySettingsGroup .geometry-n-slider-controls > .geometry-n-step {
    width:28px; min-width:0; height:28px; min-height:28px;
    padding:0; font-size:14px; line-height:1; border-radius:6px;
}
#geometrySettingsGroup .geometry-n-multiplier-stepper {
    width:61px; min-width:0; display:flex; align-items:stretch; overflow:hidden;
    border:1px solid var(--border-light); border-radius:6px;
    background:var(--panel-bg);
}
#geometrySettingsGroup .geometry-n-multiplier-stepper > #paramNMultiplier {
    appearance:textfield; -moz-appearance:textfield; box-sizing:border-box;
    flex:1 1 auto; width:40px!important; min-width:0!important;
    height:25px; margin:0; padding:2px 1px 2px 3px;
    border:0; border-radius:0; text-align:center; font-size:11px;
}
#geometrySettingsGroup .geometry-n-multiplier-stepper > #paramNMultiplier::-webkit-inner-spin-button,
#geometrySettingsGroup .geometry-n-multiplier-stepper > #paramNMultiplier::-webkit-outer-spin-button { -webkit-appearance:none; margin:0; }
#geometrySettingsGroup .geometry-n-spin-actions {
    display:flex; flex:0 0 17px; flex-direction:column; min-width:0;
    border-left:1px solid var(--border-light);
}
#geometrySettingsGroup .geometry-n-spin-actions button {
    display:flex; justify-content:center; align-items:center;
    box-sizing:border-box; flex:1 1 50%; min-width:0; min-height:0;
    padding:0; margin:0; border:0; border-radius:0;
    background:rgba(75,89,122,.15); color:#cbd5e1;
    font:8px/1 sans-serif; cursor:pointer;
}
#geometrySettingsGroup .geometry-n-spin-actions button+button { border-top:1px solid var(--border-light); }
#geometrySettingsGroup .geometry-n-spin-actions button:hover { background:rgba(99,102,241,.45); color:#fff; }
#geometrySettingsGroup .geometry-n-spin-actions button:focus-visible { outline:2px solid #818cf8; outline-offset:-2px; }
@media(max-width:430px){
    #geometrySettingsGroup .geometry-n-title { font-size:10px; }
    #geometrySettingsGroup .geometry-n-heading { gap:3px; }
    #geometrySettingsGroup .geometry-n-values { grid-template-columns:37px 8px 55px; gap:3px; }
    #geometrySettingsGroup .geometry-n-values > #numN { width:37px!important; }
    #geometrySettingsGroup .geometry-n-multiplier-stepper { width:55px; }
    #geometrySettingsGroup .geometry-n-slider-controls { grid-template-columns:27px minmax(0,1fr) 27px; gap:5px; }
    #geometrySettingsGroup .geometry-n-slider-controls > .geometry-n-step { width:27px; height:27px; min-height:27px; }
}
#geometrySettingsGroup .geometry-radius-rotation {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    width: 100%;
}
#geometrySettingsGroup .geometry-radius-rotation > .control-row { width: 100%; min-width: 0; }
#geometrySettingsGroup .geometry-radius-rotation .lamp-slider-mult { width: 100%; min-width: 0; }
#geometrySettingsGroup .geometry-radius-rotation #paramRotation { width: 100%; }

/* v9.2 — three contour families and one shared two-position choice. */
.contour-family-toggle { display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:4px; }
.contour-family-toggle button { min-width:0;font-size:10px;white-space:normal; }
.contour-variant-toggle { display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:4px; }
.rounding-extension-guide {display:flex;align-items:center;gap:7px;margin-top:7px;font-size:10px;}
#btnSidebarMirror {font-size:24px;line-height:1;color:#93c5fd;}
#btnSidebarMirror.active {color:#e0f2fe; background:rgba(56,189,248,.19);box-shadow:inset 0 0 0 1px rgba(56,189,248,.65),0 0 12px rgba(14,165,233,.25);}
#somataMirrorCanvas {position:absolute;inset:0;width:100%;height:100%;display:none;pointer-events:none;z-index:8;transform:translateZ(0);}

/* v9.2.1 — finite geometry animation: three compact horizontal rows. */
#geometrySettingsGroup #testMorphControls {
    box-sizing:border-box; width:100%; min-width:0; padding:6px;
    display:grid; grid-template-columns:minmax(0,1fr); gap:4px;
    border-radius:7px;
}
#geometrySettingsGroup #testMorphControls .test-morph-row {
    display:grid; grid-template-columns:minmax(0,1fr) minmax(118px,55%);
    align-items:center; column-gap:8px; min-width:0;
    min-height:27px; margin:0!important; padding:0!important;
}
#geometrySettingsGroup #testMorphControls .test-morph-row.hidden {display:none!important;}
#geometrySettingsGroup #testMorphControls .test-morph-row > label {
    display:block; width:auto; min-width:0; padding:0; margin:0;
    font-size:10.5px; line-height:1.15; font-weight:500;
    white-space:normal; overflow-wrap:normal;
}
#geometrySettingsGroup #testMorphControls .test-morph-row > select,
#geometrySettingsGroup #testMorphControls .test-morph-row input[type=number] {
    display:block; box-sizing:border-box; width:100%; min-width:0; max-width:100%;
    height:27px; min-height:0; margin:0; padding:2px 23px 2px 7px;
    font-size:10.5px; line-height:1.1;
}
#geometrySettingsGroup #testMorphControls .test-morph-row > select {text-overflow:ellipsis;}
#geometrySettingsGroup #testMorphControls .test-morph-duration {
    display:flex; min-width:0; justify-content:flex-end; align-items:center; gap:5px;
}
#geometrySettingsGroup #testMorphControls .test-morph-duration input[type=number] {
    width:78px; flex:0 1 78px; text-align:center; padding:2px 5px;
}
#geometrySettingsGroup #testMorphControls .test-morph-duration span {
    flex:0 0 auto; font-size:10.5px; color:var(--text-muted);
}
@media(max-width:360px){
    #geometrySettingsGroup #testMorphControls .test-morph-row {grid-template-columns:minmax(0,1fr) minmax(112px,52%);column-gap:4px;}
    #geometrySettingsGroup #testMorphControls .test-morph-row > label {font-size:10px;}
    #geometrySettingsGroup #testMorphControls .test-morph-row > select {font-size:10px;}
}

/* 9.2.4 — single-row two-position rounding mode control. */
.rounding-mode-row{display:flex;align-items:center;justify-content:space-between;gap:7px;margin-top:7px}
.rounding-mode-row #paramRoundingMode{display:none!important}
.rounding-mode-toggle{display:grid;grid-template-columns:1fr 1fr;gap:2px;min-width:178px;border:1px solid rgba(148,163,184,.4);border-radius:6px;padding:2px}
.rounding-mode-btn{padding:4px 6px;font:inherit;font-size:10px;line-height:1.2;border-radius:4px;background:transparent;color:inherit;border:0;cursor:pointer}
.rounding-mode-btn.active{background:#2563eb;color:#fff}

/* 9.2.8: Spiral and polygon sliding selectors have separate carriers. */
.morph-spiral-slide-label {display:flex;align-items:center;justify-content:space-between;gap:8px;min-width:0;}
.morph-spiral-slide-label select {max-width:160px;}

/* 9.2.14: one editor for spiral counts/order, shared with Blue Morph binding. */
.morph-spiral-row-primary { display:none !important; }
#morphProfileBindings .morph-special-config-row[data-morph-special="spiralLayers"] .morph-spiral-compact-range {
    display:inline-flex;align-items:center;gap:3px;min-width:0;white-space:nowrap;
}
#morphProfileBindings .morph-special-config-row[data-morph-special="spiralLayers"] .morph-spiral-compact-range > span:first-child {
    font-size:10px;color:var(--text-muted);margin-right:2px;
}
#morphProfileBindings .morph-special-config-row[data-morph-special="spiralLayers"] .morph-route-inline-control {
    width:42px !important;min-width:35px !important;max-width:48px !important;padding:2px 3px !important;
}
#morphProfileBindings .morph-special-config-row[data-morph-special="spiralLayers"] .morph-special-config-name {flex:0 0 auto;}

/* 9.2.22: two lightning colors in one compact header row. */
.lightning-color-row .lightning-color-pair{display:inline-flex;align-items:center;gap:10px;margin-left:auto}.lightning-color-row input[type=color]{width:42px;height:29px;padding:2px;flex:none}

/* 9.2.22 — Lightning: all dropdowns, numeric fields and colors first, then sliders by group. */
.lightning-v922-layout{gap:9px}
.lightning-v922-layout .lightning-text-settings{display:grid;gap:6px;padding:5px 4px}
.lightning-v922-layout .lightning-text-settings .control-row{margin:0;min-width:0}
.lightning-v922-layout .lightning-text-settings .control-row>select{max-width:62%;min-width:0}
.lightning-v922-layout .lightning-text-settings .control-row>input[type=number]{width:72px;margin-left:auto}
.lightning-v922-layout .lightning-slider-block{gap:7px}
.lightning-v922-layout .lightning-slider-block .row-inputs{min-width:0;width:100%}
.lightning-v922-layout .lightning-slider-block .row-inputs input[type=range]{flex:1;min-width:0}
.lightning-v922-layout .lightning-slider-block .row-inputs input[type=number]{flex:0 0 58px}

/* 9.2.24 — compact lightning: frequency first, compact controls, no General block. */
.lightning-v924-layout{display:flex;flex-direction:column;gap:8px}
.lightning-v924-layout .lightning-rate-top{padding:4px 2px 5px;border-bottom:1px solid rgba(147,197,253,.18)}
.lightning-v924-layout .lightning-rate-top>.control-row{margin:0}
.lightning-v924-layout .lightning-text-settings{display:flex;flex-direction:column;gap:7px;padding:3px 2px}
.lightning-v924-layout .lightning-top-pair,.lightning-v924-layout .lightning-colors-micro{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px;align-items:end}
.lightning-v924-layout .lightning-top-pair>label,.lightning-v924-layout .lightning-colors-micro>label{min-width:0;display:flex;flex-direction:column;gap:4px;font-size:11px;color:var(--text-muted)}
.lightning-v924-layout .lightning-top-pair select{width:100%;min-width:0;font-size:12px;max-width:100%}
.lightning-v924-layout .lightning-color-pair{display:flex;gap:6px;align-items:center}
.lightning-v924-layout .lightning-color-pair input[type=color]{width:40px;min-width:0;height:29px;padding:2px}
.lightning-v924-layout .lightning-micro-compact input[type=number]{width:76px;max-width:100%;height:29px}
.lightning-v924-layout .lightning-duration-top{padding:4px 2px 9px;margin:0;border-bottom:1px solid rgba(147,197,253,.18)}
.lightning-v924-layout .lightning-duration-top .row-inputs,.lightning-v924-layout .lightning-slider-block .row-inputs{min-width:0;width:100%}
.lightning-v924-layout .lightning-duration-top input[type=range],.lightning-v924-layout .lightning-slider-block input[type=range]{flex:1;min-width:0}
.lightning-v924-layout .lightning-duration-top input[type=number],.lightning-v924-layout .lightning-slider-block .row-inputs input[type=number]{flex:0 0 58px}
.lightning-v924-layout .lightning-slider-block{gap:7px}

/* Numeric lightning multiplier: use the original compact log-stepping editor, not a dropdown. */
#sweepLightningRateMultiplier,#sweepLightningDurationMultiplier{
  box-sizing:border-box;width:72px!important;min-width:60px;max-width:80px;
  flex:0 0 72px;font-size:11px;font-variant-numeric:tabular-nums;
}

/* Spiral Morph: one line wherever it fits, no discarded numeric controls.
   Narrow dialogs wrap whole control groups instead of clipping or overlapping. */
#morphProfileBindings .morph-route-row[data-morph-special="spiralLayers"],
#morphProfileBindings .morph-route-row[data-morph-special="spiralOrder"]{
  display:flex!important;align-items:center!important;flex-wrap:wrap!important;
  gap:4px 7px!important;width:100%!important;min-width:0!important;
  max-width:100%!important;height:auto!important;padding:5px 8px!important;
  overflow:visible!important;
}
#morphProfileBindings .morph-route-row[data-morph-special="spiralLayers"] > .morph-special-config-name,
#morphProfileBindings .morph-route-row[data-morph-special="spiralOrder"] > .morph-special-config-name{
  flex:0 0 auto;min-width:130px!important;white-space:nowrap!important;font-size:11px!important;
}
#morphProfileBindings .morph-route-row[data-morph-special="spiralLayers"] > .morph-binding-remove,
#morphProfileBindings .morph-route-row[data-morph-special="spiralOrder"] > .morph-binding-remove{
  flex:0 0 26px!important;margin:0 0 0 auto!important;
}
#morphProfileBindings .morph-spiral-compact-controls{
  display:flex;flex:1 1 390px;flex-wrap:wrap;align-items:center;
  gap:4px 7px;min-width:0;width:auto;overflow:visible;
}
#morphProfileBindings .morph-spiral-compact-controls .morph-spiral-compact-range{
  width:auto!important;max-width:none!important;flex:0 0 auto!important;gap:3px!important;
}
#morphProfileBindings .morph-spiral-compact-controls .morph-spiral-compact-range > span:first-child{
  min-width:0!important;max-width:none!important;flex:0 0 auto!important;
  margin-right:1px;font-size:10px!important;
}
#morphProfileBindings .morph-spiral-compact-controls .morph-route-inline-control{
  width:43px!important;min-width:43px!important;max-width:43px!important;
  flex:0 0 43px!important;padding:0!important;
}
#morphProfileBindings .morph-spiral-compact-controls .morph-route-inline-number{
  width:100%!important;min-width:0!important;max-width:100%!important;
  height:23px!important;font-size:11px!important;padding:1px 3px!important;
}
#morphProfileBindings .morph-spiral-compact-controls .morph-route-layer-coverage{
  flex:0 0 auto;white-space:nowrap;margin-left:0;
}
.lightning-v924-layout .lightning-top-pair > label:only-child{grid-column:1/-1;}

/* Spiral Morph specials use the same ordinary binding picker instead of a
   larger bold special-row title. Preserve the compact shared numeric editor. */
#morphProfileBindings .morph-route-row[data-morph-special="spiralLayers"] > .morph-spiral-picker,
#morphProfileBindings .morph-route-row[data-morph-special="spiralOrder"] > .morph-spiral-picker{
  flex:0 1 205px!important;min-width:130px!important;max-width:205px!important;
  width:auto!important;margin:0!important;
}
#morphProfileBindings .morph-route-row[data-morph-special="spiralLayers"] > .morph-spiral-picker .audio-param-picker-button,
#morphProfileBindings .morph-route-row[data-morph-special="spiralOrder"] > .morph-spiral-picker .audio-param-picker-button{
  font-size:9px!important;font-weight:650!important;color:#e2e8f0!important;
  min-height:25px;height:25px;padding:2px 6px;
}
#morphProfileBindings .morph-spiral-picker > .audio-param-picker-button {cursor:pointer}

/* 10.4.19: same compact spiral special-row anatomy in Blue and Orange. */
:is(#morphProfileBindings,#orangeMorphBindings) .morph-special-config-row:is([data-morph-special="spiralLayers"],[data-morph-special="spiralOrder"],[data-orange-special="spiralLayers"],[data-orange-special="spiralOrder"]){
 display:flex!important;align-items:center!important;flex-wrap:wrap!important;gap:4px 7px!important;
 width:100%!important;min-width:0!important;height:auto!important;overflow:visible!important;
 padding:5px 8px!important;box-sizing:border-box;
}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-special-config-row .morph-spiral-compact-controls{
 display:flex;flex:1 1 250px;flex-wrap:wrap;gap:4px 7px;align-items:center;min-width:0;width:auto;overflow:visible;
}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-special-config-row .morph-spiral-compact-range{
 display:inline-flex;align-items:center;gap:3px;min-width:0;max-width:none;flex:0 0 auto;white-space:nowrap;
}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-special-config-row .morph-spiral-compact-range .morph-route-inline-number{
 box-sizing:border-box;width:43px!important;min-width:43px!important;max-width:43px!important;height:23px!important;
 padding:1px 3px!important;font-size:11px!important;
}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-special-config-row > .morph-binding-remove{
 margin:0 0 0 auto!important;flex:0 0 26px!important;
}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-special-config-row > .morph-spiral-picker{
 flex:0 1 205px!important;min-width:130px!important;max-width:205px!important;width:auto!important;
}
:is(#morphProfileBindings,#orangeMorphBindings) .morph-special-config-row > .morph-spiral-picker .audio-param-picker-button{
 font-size:9px!important;font-weight:650!important;color:#e2e8f0!important;min-height:25px;height:25px;padding:2px 6px;
}
