
        :root {
            /* PianoRoll layout vars (read by PianoRoll._resolveBottomLayout via readCSSPx). */
            --keyboard-height: 150px;
            --statusbar-height: 40px;
            --effects-drawer-open-height: 220px;
            --effects-drawer-height: 0px;

            /* Prophet-5 control scaling — each var uses clamp(min, Nvw, max)
             * where N is sized so the max is hit at a 1600px viewport and the
             * min is hit at ~992px (62% scale). Every measurement uses the same
             * proportion so they shrink together as the viewport narrows.
             * Standalone prophet5.html and the in-app Prophet5Panel both pick
             * this up.
             *
             * Why each var has its own clamp(): a single unitless --scale
             * variable can't be multiplied against `px` reliably across
             * browsers, because clamp(0.62, calc(100vw/1600), 1) mixes a
             * unitless float with a length and is invalid. Per-var clamps
             * keep units consistent (all length) and clamp at the same
             * 62%-of-original floor.
             */
            /* Text-size floors are intentionally generous — after the
             * panel's transform: scale (~0.65 typical), 11px text renders
             * around 7px effective which is the legibility floor. Below
             * that labels become unreadable, so the floor is bumped so
             * even at scale 0.5 the text stays >= 5.5px effective. */
            --prophet5-knob-size: clamp(32px, 2.8vw, 45px);
            --prophet5-knob-pointer-h: clamp(11px, 0.94vw, 15px);
            --prophet5-toggle-w: clamp(26px, 2.19vw, 35px);
            --prophet5-toggle-h: clamp(15px, 1.25vw, 20px);
            --prophet5-toggle-dot: clamp(10px, 0.88vw, 14px);
            --prophet5-toggle-dot-offset: clamp(10px, 0.81vw, 13px);
            --prophet5-section-padding: clamp(10px, 0.94vw, 15px);
            --prophet5-section-gap: clamp(10px, 0.94vw, 15px);
            --prophet5-area-gap: clamp(14px, 1.25vw, 20px);
            --prophet5-col-mod-width: clamp(160px, 13.75vw, 220px);
            --prophet5-col-right-width: clamp(200px, 17.5vw, 280px);
            --prophet5-section-title-size: clamp(11px, 0.75vw, 13px);
            --prophet5-label-size: clamp(10px, 0.56vw, 11px);
            --prophet5-value-size: clamp(9px, 0.5vw, 10px);
            --prophet5-large-knob-size: clamp(42px, 3.75vw, 60px);
            --prophet5-large-knob-pointer-h: clamp(14px, 1.25vw, 20px);
            --prophet5-large-toggle-w: clamp(36px, 3.13vw, 50px);
            --prophet5-large-toggle-h: clamp(21px, 1.88vw, 30px);
            --prophet5-large-toggle-dot: clamp(14px, 1.25vw, 20px);
            --prophet5-large-toggle-dot-offset: clamp(12px, 1vw, 16px);
            /* Synthetic scale ratio for the few spots that still need it
             * (rare: a couple of derived margins). Computed by dividing the
             * dynamic knob size by its max — same proportion as everything
             * else and tolerated by browsers because it's length/length. */
            --prophet5-scale: calc(var(--prophet5-knob-size) / 45px);
        }

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

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #1a1a1a, #2d2d2d);
            color: #ffffff;
            overflow-x: auto;
            min-height: 100vh;
        }

        :root.prophet5-fx-open {
            --effects-drawer-height: var(--effects-drawer-open-height);
        }

        /* Piano Roll Styles */
        #pianoRollContainer {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 150px; /* Match integrated player exactly */
            background: #000;
            border-top: 2px solid #444;
            z-index: 100;
        }

        #pianoRollCanvas {
            display: block;
            width: 100%;
            height: 100%;
        }

        .main-container {
            display: flex;
            flex-direction: column;
            min-height: 100vh;
            padding: 70px 20px calc(var(--keyboard-height) + var(--statusbar-height) + var(--effects-drawer-height) + 20px) 20px;
            gap: 20px;
            transition: padding-bottom 220ms ease;
        }

        /* Header Section */
        .header {
            background: linear-gradient(45deg, #333, #444);
            border-radius: 10px;
            padding: 20px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 15px;
        }

        .header h1 {
            font-size: 2.2em;
            font-weight: 300;
            color: #ffffff;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
        }

        .header-controls {
            display: flex;
            align-items: center;
            gap: 15px;
            flex-wrap: wrap;
        }

        .preset-selector {
            padding: 8px 15px;
            background: #2a2a2a;
            border: 2px solid #555;
            border-radius: 5px;
            color: #ffffff;
            font-size: 14px;
            min-width: 180px;
        }

        .preset-selector:hover {
            border-color: #777;
        }

        .btn {
            background: linear-gradient(45deg, #4a4a4a, #5a5a5a);
            border: none;
            border-radius: 6px;
            color: #ffffff;
            padding: 10px 20px;
            cursor: pointer;
            font-size: 14px;
            transition: all 0.2s ease;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
        }

        .btn:hover {
            background: linear-gradient(45deg, #5a5a5a, #6a6a6a);
            transform: translateY(-1px);
        }

        .btn:active {
            transform: translateY(0);
        }

        .chorus-btn.btn {
            padding: 4px 10px;
            font-size: 12px;
            min-width: 38px;
        }

        .chorus-btn.btn.active {
            background: linear-gradient(45deg, #2d6dff, #3a8eff);
            box-shadow: 0 0 10px rgba(58, 142, 255, 0.6);
        }

        .audio-info {
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 14px;
            color: #ccc;
        }

        .audio-meter {
            width: 100px;
            height: 8px;
            background: #333;
            border-radius: 4px;
            overflow: hidden;
        }

        .audio-meter-fill {
            height: 100%;
            background: linear-gradient(90deg, #00ff00, #ffff00, #ff0000);
            width: 0%;
            transition: width 0.1s ease;
        }

        .pianoroll-canvas {
            transition: none;
        }

        .prophet-fx-drawer {
            position: fixed;
            left: 0;
            right: 0;
            bottom: var(--statusbar-height);
            height: var(--effects-drawer-height);
            min-height: var(--effects-drawer-height);
            max-height: var(--effects-drawer-height);
            z-index: 12;
            overflow: hidden;
            pointer-events: none;
            border-top: 1px solid rgba(255, 255, 255, 0.14);
            background:
                radial-gradient(circle at 12% -50%, rgba(255, 197, 114, 0.2), transparent 38%),
                linear-gradient(180deg, rgba(34, 26, 22, 0.97), rgba(17, 14, 12, 0.98));
            box-shadow: 0 -10px 26px rgba(0, 0, 0, 0.42);
            transition: height 220ms ease;
        }

        :root.prophet5-fx-open .prophet-fx-drawer {
            pointer-events: auto;
        }

        .prophet-fx-drawer__inner {
            padding: 12px 14px;
            height: 100%;
            overflow-x: hidden;
            overflow-y: auto;
        }

        .prophet-fx-chain {
            min-height: max-content;
            display: flex;
            align-items: flex-start;
            gap: 12px;
            overflow-x: auto;
            overflow-y: visible;
            scrollbar-width: thin;
            scrollbar-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.35);
        }

        .prophet-fx-chain::-webkit-scrollbar {
            height: 8px;
        }

        .prophet-fx-chain::-webkit-scrollbar-track {
            background: rgba(0, 0, 0, 0.35);
            border-radius: 999px;
        }

        .prophet-fx-chain::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.28);
            border-radius: 999px;
        }

        .prophet-fx-pedal {
            position: relative;
            flex: 0 0 300px;
            min-width: 250px;
            border-radius: 10px 10px 15px 15px;
            border: 1px solid rgba(255, 255, 255, 0.15);
            background: linear-gradient(180deg, rgba(70, 52, 39, 0.97), rgba(32, 24, 19, 0.98));
            padding: 10px 12px 12px;
            box-shadow:
                inset 0 1px 0 rgba(255, 255, 255, 0.13),
                inset 0 -6px 16px rgba(0, 0, 0, 0.32),
                0 8px 15px rgba(0, 0, 0, 0.34);
        }

        .prophet-fx-pedal::before {
            content: '';
            position: absolute;
            left: 10px;
            right: 10px;
            top: 6px;
            height: 5px;
            border-radius: 999px;
            background: linear-gradient(90deg, rgba(255, 220, 160, 0.35), rgba(196, 122, 90, 0.16));
            pointer-events: none;
        }

        .prophet-fx-pedal--chorus {
            flex-basis: 250px;
            background: linear-gradient(180deg, rgba(42, 58, 66, 0.96), rgba(21, 30, 34, 0.98));
        }

        .prophet-fx-pedal--delay {
            background: linear-gradient(180deg, rgba(50, 42, 61, 0.96), rgba(25, 21, 33, 0.98));
        }

        .prophet-fx-pedal__title {
            margin: 6px 0 10px;
            font-size: 12px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: rgba(255, 245, 220, 0.92);
            text-align: center;
        }

        .prophet-fx-row {
            display: grid;
            grid-template-columns: 90px 1fr 64px;
            gap: 8px;
            align-items: center;
            margin-bottom: 7px;
        }

        .prophet-fx-row:last-child {
            margin-bottom: 0;
        }

        .prophet-fx-row label,
        .prophet-fx-label {
            font-size: 11px;
            font-weight: 600;
            color: rgba(255, 255, 255, 0.78);
            letter-spacing: 0.02em;
        }

        .prophet-fx-row .value {
            font-size: 11px;
            text-align: right;
            color: rgba(255, 255, 255, 0.86);
            font-variant-numeric: tabular-nums;
            white-space: nowrap;
        }

        .prophet-fx-row input[type="range"] {
            width: 100%;
            accent-color: #cf8b4a;
        }

        .prophet-fx-row select {
            width: 100%;
            height: 26px;
            border-radius: 6px;
            border: 1px solid rgba(255, 255, 255, 0.16);
            background: rgba(14, 14, 17, 0.65);
            color: rgba(247, 236, 218, 0.96);
            font-size: 11px;
            font-weight: 600;
            padding: 0 8px;
        }

        .prophet-fx-row--chorus {
            grid-template-columns: 1fr;
            gap: 6px;
        }

        .prophet-fx-chorus-modes {
            display: grid;
            grid-template-columns: repeat(4, minmax(0, 1fr));
            gap: 6px;
        }

        .prophet-fx-chorus-modes .chorus-btn.btn {
            min-width: 0;
            padding: 6px 0;
            font-size: 11px;
            border-radius: 8px;
            border: 1px solid rgba(255, 255, 255, 0.2);
            background: linear-gradient(180deg, rgba(51, 55, 59, 0.97), rgba(24, 27, 30, 0.98));
            box-shadow: none;
        }

        .prophet-fx-chorus-modes .chorus-btn.btn.active {
            border-color: rgba(255, 186, 94, 0.9);
            background: linear-gradient(180deg, rgba(190, 110, 62, 0.98), rgba(107, 56, 37, 0.98));
            box-shadow: 0 0 0 1px rgba(255, 186, 94, 0.45), 0 0 7px rgba(255, 164, 98, 0.45);
        }

        #status-bar .status-bar__item--effects {
            flex: 0 0 auto;
        }

        #status-bar .status-bar__effects-toggle {
            height: 26px;
            min-width: 84px;
            padding: 0 10px;
            border-radius: 6px;
            font-size: 10px;
            font-weight: 700;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            border: 1px solid rgba(255, 255, 255, 0.25);
            background: rgba(255, 255, 255, 0.06);
            color: rgba(244, 247, 252, 0.92);
        }

        #status-bar .status-bar__effects-toggle:hover {
            background: rgba(255, 255, 255, 0.11);
            border-color: rgba(255, 255, 255, 0.34);
        }

        #status-bar .status-bar__effects-toggle.is-open {
            background: linear-gradient(180deg, rgba(193, 114, 68, 0.98), rgba(119, 64, 40, 0.98));
            border-color: rgba(255, 186, 94, 0.92);
            color: rgba(255, 245, 232, 0.98);
        }

        #status-bar .status-bar__effects-toggle:focus-visible {
            outline: 2px solid rgba(255, 196, 115, 0.95);
            outline-offset: 1px;
        }

        /* Main Content Area */
        .content-area {
            display: grid;
            grid-template-columns: 1fr;
            gap: 20px;
            flex: 1;
        }

        /* Authentic Prophet-5 Layout */
        .parameters-panel {
            display: flex;
            gap: var(--prophet5-area-gap);
            justify-content: center;
            align-items: flex-start;
            flex-wrap: wrap;
            max-width: 1400px;
            margin: 0 auto;
        }

        /* Left Column - Modulation Stack */
        .modulation-column {
            display: flex;
            flex-direction: column;
            gap: var(--prophet5-section-gap);
            flex: 0 0 var(--prophet5-col-mod-width);
        }

        /* Center Area - Oscillators & Mixer */
        .center-area {
            display: flex;
            gap: var(--prophet5-area-gap);
            flex: 1 1 auto;
            justify-content: center;
            flex-wrap: wrap;
        }

        /* Right Area - Filter & Envelopes */
        .right-area {
            display: flex;
            flex-direction: column;
            gap: var(--prophet5-section-gap);
            flex: 0 0 var(--prophet5-col-right-width);
        }

        /* Individual Sections */
        .prophet-section {
            background: linear-gradient(135deg, #2a2a2a, #333333);
            border: 2px solid #444;
            border-radius: 8px;
            padding: var(--prophet5-section-padding);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
        }

        .prophet-section h3 {
            color: #ffffff;
            font-size: var(--prophet5-section-title-size);
            margin-bottom: calc(12px * var(--prophet5-scale));
            text-align: center;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 1px;
            border-bottom: 1px solid #555;
            padding-bottom: calc(8px * var(--prophet5-scale));
        }

        /* Section-specific layouts */
        .poly-mod-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
            margin-bottom: 8px;
        }

        .poly-mod-switches {
            display: flex;
            gap: 8px;
            justify-content: space-between;
        }

        .lfo-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
            margin-bottom: 8px;
        }

        .lfo-switches {
            display: flex;
            gap: 8px;
            justify-content: space-between;
        }

        .wheel-mod-grid {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .wheel-mod-switches {
            display: flex;
            gap: 6px;
            justify-content: space-between;
        }

        .oscillator-grid {
            display: flex;
            flex-direction: column;
            gap: 12px;
            align-items: center;
        }

        .oscillator-switches {
            display: flex;
            gap: 8px;
            justify-content: center;
        }

        .mixer-grid {
            display: flex;
            flex-direction: column;
            gap: 12px;
            align-items: center;
        }

        .filter-grid {
            display: flex;
            gap: 12px;
            justify-content: space-between;
        }

        .envelope-grid {
            display: flex;
            gap: 12px;
            justify-content: space-between;
        }

        /* Compact controls for authentic layout */
        .compact-knob {
            width: var(--prophet5-knob-size);
            height: var(--prophet5-knob-size);
            border-radius: 50%;
            background: radial-gradient(circle at 30% 30%, #4a4a4a, #2a2a2a);
            border: 2px solid #555;
            position: relative;
            cursor: pointer;
            transition: all 0.1s ease;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
        }

        .compact-knob:hover {
            border-color: #777;
            transform: scale(1.05);
        }

        .compact-knob::before {
            content: '';
            position: absolute;
            top: 3px;
            left: 50%;
            transform: translateX(-50%) rotate(var(--rotation, 0deg));
            width: 2px;
            height: var(--prophet5-knob-pointer-h);
            background: linear-gradient(180deg, #ffffff, #cccccc);
            border-radius: 1px;
            transform-origin: bottom center;
            transition: transform 0.1s ease;
        }

        .compact-toggle {
            width: var(--prophet5-toggle-w);
            height: var(--prophet5-toggle-h);
            border-radius: calc(var(--prophet5-toggle-h) / 2);
            background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
            border: 1px solid #444;
            position: relative;
            cursor: pointer;
            transition: all 0.2s ease;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
        }

        .compact-toggle:hover {
            border-color: #666;
            transform: scale(1.05);
        }

        .compact-toggle::before {
            content: '';
            position: absolute;
            top: 50%;
            left: calc(4px * var(--prophet5-scale));
            transform: translateY(-50%) translateX(var(--toggle-x, 0px));
            width: var(--prophet5-toggle-dot);
            height: var(--prophet5-toggle-dot);
            border-radius: 50%;
            background: linear-gradient(135deg, #6a6a6a, #4a4a4a);
            border: 1px solid #888;
            transition: all 0.2s ease;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
        }

        .compact-toggle.on {
            background: linear-gradient(135deg, #4a6a4a, #3a5a3a);
            border-color: #6a8a6a;
        }

        .compact-toggle.on::before {
            --toggle-x: var(--prophet5-toggle-dot-offset);
            background: linear-gradient(135deg, #8aaa8a, #6a9a6a);
            border-color: #aaccaa;
        }

        .control-container {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
        }

        .control-label {
            font-size: var(--prophet5-label-size);
            color: #ccc;
            text-align: center;
            font-weight: 500;
            max-width: 60px;
            line-height: 1.2;
        }

        .control-value {
            font-size: var(--prophet5-value-size);
            color: #888;
            text-align: center;
            min-height: 10px;
        }

        .control-value.on {
            color: #8a8;
        }

        /* Knob Styles */
        .knob-container {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
        }

        .knob {
            width: var(--prophet5-large-knob-size);
            height: var(--prophet5-large-knob-size);
            border-radius: 50%;
            background: radial-gradient(circle at 30% 30%, #4a4a4a, #2a2a2a);
            border: 3px solid #555;
            position: relative;
            cursor: pointer;
            transition: all 0.1s ease;
            box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
        }

        .knob:hover {
            border-color: #777;
            transform: scale(1.05);
        }

        .knob::before {
            content: '';
            position: absolute;
            top: 4px;
            left: 50%;
            transform: translateX(-50%) rotate(var(--rotation, 0deg));
            width: 3px;
            height: var(--prophet5-large-knob-pointer-h);
            background: linear-gradient(180deg, #ffffff, #cccccc);
            border-radius: 2px;
            transform-origin: bottom center;
            transition: transform 0.1s ease;
        }

        .knob-label {
            font-size: calc(11px * var(--prophet5-scale));
            color: #ccc;
            text-align: center;
            font-weight: 500;
            max-width: 80px;
        }

        .knob-value {
            font-size: calc(10px * var(--prophet5-scale));
            color: #888;
            text-align: center;
            min-height: 14px;
        }

        /* Toggle Switch Styles */
        .toggle-container {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
        }

        .toggle {
            width: var(--prophet5-large-toggle-w);
            height: var(--prophet5-large-toggle-h);
            border-radius: calc(var(--prophet5-large-toggle-h) / 2);
            background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
            border: 2px solid #444;
            position: relative;
            cursor: pointer;
            transition: all 0.2s ease;
            box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
        }

        .toggle:hover {
            border-color: #666;
            transform: scale(1.05);
        }

        .toggle::before {
            content: '';
            position: absolute;
            top: 50%;
            left: calc(6px * var(--prophet5-scale));
            transform: translateY(-50%) translateX(var(--toggle-x, 0px));
            width: var(--prophet5-large-toggle-dot);
            height: var(--prophet5-large-toggle-dot);
            border-radius: 50%;
            background: linear-gradient(135deg, #6a6a6a, #4a4a4a);
            border: 1px solid #888;
            transition: all 0.2s ease;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
        }

        .toggle.on {
            background: linear-gradient(135deg, #4a6a4a, #3a5a3a);
            border-color: #6a8a6a;
        }

        .toggle.on::before {
            --toggle-x: var(--prophet5-large-toggle-dot-offset);
            background: linear-gradient(135deg, #8aaa8a, #6a9a6a);
            border-color: #aaccaa;
        }

        .toggle-label {
            font-size: 11px;
            color: #ccc;
            text-align: center;
            font-weight: 500;
            max-width: 80px;
        }

        .toggle-value {
            font-size: 10px;
            color: #888;
            text-align: center;
            min-height: 14px;
        }

        .toggle-value.on {
            color: #8a8;
        }


        /* Responsive Design */
        @media (max-width: 1200px) {
            .content-area {
                grid-template-columns: 1fr;
            }
            
            .parameters-panel {
                grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            }

            .prophet-fx-pedal {
                flex-basis: 280px;
            }
        }

        /* Navigation Menu Styles */
        .nav-menu {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            background: rgba(26, 26, 26, 0.95);
            backdrop-filter: blur(10px);
            border-bottom: 2px solid #444;
            padding: 10px 20px;
            display: flex;
            gap: 20px;
            align-items: center;
            z-index: 1000;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }
        
        .nav-menu a {
            color: #888;
            text-decoration: none;
            padding: 8px 16px;
            border: 1px solid #444;
            border-radius: 4px;
            transition: all 0.3s;
            font-size: 14px;
        }
        
        .nav-menu a:hover {
            color: #fff;
            border-color: #666;
            background: rgba(255, 255, 255, 0.1);
        }
        
        .nav-menu a.active {
            color: #fff;
            border-color: #666;
            background: rgba(255, 255, 255, 0.2);
            box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
        }

        @media (max-width: 768px) {
            .header {
                flex-direction: column;
                text-align: center;
            }

            .prophet-fx-drawer__inner {
                padding: 10px 10px 12px;
            }

            .prophet-fx-pedal {
                min-width: 220px;
            }
            
            .parameters-panel {
                grid-template-columns: 1fr;
            }
            
            .piano-key.white {
                width: 25px;
                height: 80px;
            }
            
            .piano-key.black {
                width: 15px;
                height: 50px;
            }
        }

        @media (prefers-reduced-motion: reduce) {
            .main-container,
            .pianoroll-canvas,
            .prophet-fx-drawer {
                transition: none;
            }
        }
    
