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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: #000;
    color: #fff;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Toolbar */
.toolbar {
    background: #1a1a1a;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #333;
}

.tool-btn {
    background: #2a2a2a;
    border: 1px solid #404040;
    color: #ccc;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: #353535;
    border-color: #555;
}

.record-btn {
    color: #ff3333;
    font-size: 18px;
}

.fps-counter {
    color: #ffcc00;
    font-size: 12px;
    padding: 0 12px;
    font-weight: bold;
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    background: #333;
    margin: 0 4px;
}

.toolbar-spacer {
    flex-grow: 1;
}

.impressum-link {
    color: #888;
    font-size: 11px;
    text-decoration: none;
    padding: 4px 8px;
    transition: color 0.2s;
}

.impressum-link:hover {
    color: #ccc;
}

.video-format-selector,
.resolution-selector {
    display: flex;
    align-items: center;
    gap: 6px;
}

.video-format-selector label,
.resolution-selector label {
    font-size: 11px;
    color: #999;
    font-weight: 500;
}

.video-format-selector select,
.resolution-selector select {
    background: #2a2a2a;
    border: 1px solid #404040;
    color: #ccc;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
}

.video-format-selector select:hover,
.resolution-selector select:hover {
    background: #353535;
    border-color: #555;
}

.video-format-selector select:focus,
.resolution-selector select:focus {
    outline: none;
    border-color: #ffcc00;
}

/* Top Section */
/* Main Layout - 3 Column Grid */
.main-layout {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(280px, 320px) 1fr minmax(280px, 320px);
    gap: 0;
    min-height: 0;
    max-width: 100vw;
    overflow: hidden;
}

/* Left Sidebar - Modulation Panel */
.left-sidebar {
    background: #0f0f0f;
    border-right: 1px solid #1a1a1a;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-width: 0;
    max-width: 100%;
}

/* Center Area - Preview + Bottom Panel */
.center-area {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

/* Preview Container */
.preview-container {
    flex: 1;
    background: #000;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

#shaderCanvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.preview-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 60px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 20px rgba(255,255,255,0.5);
    pointer-events: none;
    font-family: Arial, sans-serif;
    letter-spacing: -2px;
}

/* Sidebar */
.sidebar {
    background: #0a0a0a;
    border-left: 1px solid #222;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-width: 0;
    max-width: 100%;
}

.sidebar-header {
    padding: 8px 12px;
    background: #151515;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #222;
}

.sidebar-header h3 {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #999;
}

.minimize-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
}

.properties-panel {
    flex: 1;
    overflow-y: auto;
}

.property-section {
    border-bottom: 1px solid #1a1a1a;
}

.property-header {
    padding: 12px 16px;
    background: #0f0f0f;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    font-size: 12px;
    font-weight: 500;
}

.property-header:hover {
    background: #151515;
}

.property-actions {
    display: flex;
    gap: 8px;
}

.pin-btn, .reset-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 4px;
}

.pin-btn:hover, .reset-btn:hover {
    color: #aaa;
}

.property-content {
    padding: 16px;
    background: #0a0a0a;
}

.property-content label {
    display: block;
    font-size: 11px;
    color: #999;
    margin-bottom: 6px;
    margin-top: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.property-content label:first-child {
    margin-top: 0;
}

.property-content select,
.property-content input[type="text"] {
    width: 100%;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #fff;
    padding: 8px;
    border-radius: 4px;
    font-size: 12px;
}

.property-content select:focus,
.property-content input[type="text"]:focus {
    outline: none;
    border-color: #555;
}

.param-slider,
input[type="range"] {
    width: 100%;
    height: 4px;
    background: #1a1a1a;
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: #ffcc00;
    cursor: pointer;
    border-radius: 50%;
}

input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #ffcc00;
    cursor: pointer;
    border-radius: 50%;
    border: none;
}

.import-btn {
    width: 100%;
    padding: 10px;
    background: #2a2a2a;
    border: 1px solid #404040;
    color: #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.import-btn:hover {
    background: #353535;
}

/* Bottom Panel */
.bottom-panel {
    height: 280px;
    min-height: 280px;
    max-height: 280px;
    background: #0a0a0a;
    border-top: 1px solid #222;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.panel-tabs {
    display: flex;
    gap: 2px;
    background: #000;
    padding: 4px;
}

.panel-tab {
    padding: 8px 16px;
    background: #1a1a1a;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    transition: all 0.2s;
}

.panel-tab:hover {
    background: #252525;
    color: #999;
}

.panel-tab.active {
    background: #2a2a2a;
    color: #fff;
}

.panel-content {
    flex: 1;
    display: flex;
    min-height: 0;
    overflow: hidden;
}

.panel-content.hidden {
    display: none;
}

/* Mixer Panel */
.mixer-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    gap: 8px;
    min-height: 0;
    overflow: hidden;
}

.mixer-params {
    display: flex;
    gap: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #1a1a1a;
    flex-shrink: 0;
}

.param-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.param-group label {
    font-size: 9px;
    color: #999;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.param-knob {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #1a1a1a;
    border: 2px solid #333;
    position: relative;
    cursor: pointer;
    transition: border-color 0.2s;
}

.param-knob:hover {
    border-color: #555;
}

.knob-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 50%;
    background: #ffcc00;
    transform-origin: top center;
    transform: translate(-50%, 0) rotate(0deg);
}

.trigger-btn {
    padding: 8px 16px;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #999;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
}

/* Layer Slots */
.layer-slots {
    display: flex;
    gap: 6px;
    align-items: stretch;
    flex: 1;
    min-height: 0;
    overflow-x: auto;
    padding: 4px 0;
}

.layer-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 65px;
    max-width: 80px;
    flex: 1;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.layer-slot:hover {
    background: rgba(255, 255, 255, 0.05);
}

.slot-preview {
    width: 100%;
    height: 45px;
    background: #1a1a1a;
    border: 2px solid #333;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.slot-preview:hover {
    border-color: #555;
}

.slot-preview.active {
    border-color: #ffcc00;
}

.layer-slot.active .slot-preview {
    border-color: #ff3333;
    box-shadow: 0 0 8px rgba(255, 51, 51, 0.5);
}

/* Shader preview backgrounds */
.slot-preview.test-preview {
    background: linear-gradient(to bottom, #1a0033 0%, #ff6600 40%, #ff0080 60%, #1a0033 100%);
}

.slot-preview.tunnel-preview {
    background: radial-gradient(circle, #ffcc00 0%, #ff6600 30%, #000 70%);
}

.slot-preview.plasma-preview {
    background: linear-gradient(45deg, #ff0080, #7928ca, #ff0080, #7928ca);
    background-size: 400% 400%;
}

.slot-preview.kaleidoscope-preview {
    background: conic-gradient(from 0deg, #ff0080, #7928ca, #00ff88, #ffcc00, #ff0080);
}

.slot-preview.warp-preview {
    background: radial-gradient(ellipse at center, #0080ff 0%, #00ffff 50%, #000 100%);
}

.slot-preview.mandelbrot-preview {
    background: linear-gradient(135deg, #000033, #0066ff, #00ffff, #ffffff);
}

.slot-preview.voronoi-preview {
    background: linear-gradient(to right, #ff00ff, #00ffff, #ffff00);
}

.slot-controls {
    display: flex;
    gap: 2px;
    align-items: center;
    flex-wrap: nowrap;
    justify-content: center;
}

.slot-number {
    width: 16px;
    height: 16px;
    background: #ffcc00;
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: bold;
    flex-shrink: 0;
}

.layer-slot.active .slot-number {
    background: #ff3333;
    color: #fff;
}

.on-btn {
    width: 24px;
    height: 16px;
    background: #2a2a2a;
    border: 1px solid #404040;
    color: #666;
    border-radius: 3px;
    font-size: 7px;
    font-weight: bold;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.on-btn:hover {
    background: #353535;
    border-color: #555;
}

.on-btn.active {
    background: #00cc00;
    color: #000;
    border-color: #00cc00;
}

.solo-btn {
    width: 16px;
    height: 16px;
    background: #2a2a2a;
    border: 1px solid #404040;
    color: #666;
    border-radius: 3px;
    font-size: 9px;
    font-weight: bold;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.solo-btn:hover {
    background: #353535;
    border-color: #555;
}

.solo-btn.active {
    background: #ffcc00;
    color: #000;
    border-color: #ffcc00;
}

/* Custom Vertical Fader */
.layer-fader {
    position: relative;
    width: 24px;
    height: 100px;
    display: flex;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    touch-action: none;
}

.fader-track {
    position: absolute;
    width: 8px;
    height: 100%;
    background: linear-gradient(to top, #1a1a1a 0%, #2a2a2a 50%, #333 100%);
    border-radius: 4px;
    border: 1px solid #404040;
    overflow: hidden;
}

.fader-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0%;
    background: linear-gradient(to top,
        rgba(255, 204, 0, 0.3) 0%,
        rgba(255, 204, 0, 0.5) 50%,
        rgba(255, 204, 0, 0.7) 100%
    );
    border-radius: 0 0 3px 3px;
    transition: height 0.05s ease-out;
}

.fader-thumb {
    position: absolute;
    width: 22px;
    height: 12px;
    background: linear-gradient(to bottom,
        #ffee66 0%,
        #ffcc00 30%,
        #cc9900 70%,
        #aa7700 100%
    );
    border: 1px solid #aa8800;
    border-radius: 3px;
    box-shadow:
        0 0 8px rgba(255, 204, 0, 0.8),
        0 2px 4px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    cursor: grab;
    left: 50%;
    transform: translateX(-50%) translateY(50%);
    bottom: 0%;
    transition: bottom 0.05s ease-out;
}

.fader-thumb:active {
    cursor: grabbing;
    box-shadow:
        0 0 12px rgba(255, 204, 0, 1),
        0 2px 4px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.layer-fader:hover .fader-thumb {
    box-shadow:
        0 0 10px rgba(255, 204, 0, 1),
        0 2px 4px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.layer-fader:hover .fader-track {
    border-color: #555;
}

/* Modulation Panel */
.modulation-panel {
    background: #0f0f0f;
    border-right: 1px solid #1a1a1a;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.mod-header {
    padding: 12px 16px;
    background: #151515;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #999;
    border-bottom: 1px solid #1a1a1a;
}

.mod-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: #0a0a0a;
}

.mod-tab {
    flex: 1;
    padding: 6px;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #666;
    cursor: pointer;
    font-size: 10px;
    font-weight: 600;
    border-radius: 4px;
    transition: all 0.2s;
}

.mod-tab:hover {
    background: #252525;
    color: #999;
}

.mod-tab.active {
    background: #2a2a2a;
    color: #fff;
    border-color: #555;
}

.mod-content {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    min-height: 0;
}

.mod-content.hidden {
    display: none;
}

.frequency-bars {
    height: 200px;
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    border-radius: 4px;
    display: flex;
    align-items: flex-end;
    gap: 2px;
    padding: 8px;
}

.frequency-bar {
    flex: 1;
    background: linear-gradient(to top, #ffcc00, #ff6600);
    border-radius: 2px;
    min-height: 5px;
    min-width: 3px;
    transition: height 0.05s;
    box-shadow: 0 0 4px rgba(255, 204, 0, 0.8);
}

.freq-labels {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: #666;
    padding: 4px 0;
}

.mod-params {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.mod-param {
    padding: 6px 10px;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #999;
    font-size: 9px;
    font-weight: 600;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
}

.mod-param:hover {
    background: #252525;
    border-color: #555;
}

.mod-icons {
    display: flex;
    gap: 6px;
    padding-top: 8px;
}

.mod-icon {
    width: 32px;
    height: 32px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.mod-icon:hover {
    background: #252525;
    border-color: #555;
}

.player-select {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #1a1a1a;
}

.player-select label {
    font-size: 9px;
    color: #666;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: block;
}

.player-slots {
    display: flex;
    gap: 6px;
}

.player-slot {
    flex: 1;
    padding: 8px;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #666;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
    transition: all 0.2s;
}

.player-slot:hover {
    background: #252525;
}

.player-slot.active {
    background: #ffcc00;
    color: #000;
    border-color: #ffcc00;
}

/* Audio Player */
.audio-player {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 16px;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #1a1a1a;
}

.player-btn {
    width: 36px;
    height: 36px;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #ccc;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.player-btn:hover {
    background: #252525;
    border-color: #555;
}

.player-btn.active {
    background: #ffcc00;
    color: #000;
    border-color: #ffcc00;
}

.time-display {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #ccc;
    padding: 0 12px;
}

.waveform-container {
    flex: 1;
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    border-radius: 4px;
    position: relative;
    min-height: 120px;
}

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

.playhead {
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: #ffcc00;
    pointer-events: none;
}

.audio-files {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.file-tag {
    padding: 6px 12px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 16px;
    font-size: 11px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-tag button {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    line-height: 1;
}

.file-tag button:hover {
    color: #ff3333;
}

.audio-file-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 120px;
    overflow-y: auto;
}

.audio-file-item {
    padding: 8px 12px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    font-size: 11px;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.audio-file-item:hover {
    border-color: #555;
    background: #222;
}

.audio-file-item.active {
    border-color: #ffcc00;
    background: #2a2a1a;
    color: #ffcc00;
}

.audio-file-item .file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audio-file-item .file-remove-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    line-height: 1;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.audio-file-item .file-remove-btn:hover {
    color: #ff3333;
}

.am-source-selectors {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
    padding: 12px;
    background: #0f0f0f;
    border-radius: 4px;
}

.am-source-selector {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.am-source-selector label {
    font-size: 10px;
    color: #666;
    font-weight: bold;
}

.am-source-selector select {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    color: #ccc;
    padding: 6px 8px;
    font-size: 11px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
}

.am-source-selector select:hover {
    border-color: #555;
}

.am-source-selector select:focus {
    outline: none;
    border-color: #ffcc00;
}

/* New AM UI Styles */
.am-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.am-tab {
    padding: 8px 16px;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #999;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.am-tab:hover {
    border-color: #555;
}

.am-tab.active {
    background: #ffcc00;
    border-color: #ffcc00;
    color: #0a0a0a;
}

.am-visualizer-container {
    position: relative;
    margin-bottom: 16px;
}

#amVisualizerCanvas {
    width: 100%;
    height: 300px;
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    border-radius: 4px;
    display: block;
}

.am-freq-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #666;
    padding: 4px 0;
    margin-top: 4px;
}

.am-controls-scrollable {
    /* Remove fixed height to allow full panel scrolling */
    display: flex;
    flex-direction: column;
    gap: 0;
}

.am-control-group {
    margin-bottom: 20px;
}

.am-control-group label {
    display: block;
    font-size: 11px;
    color: #999;
    font-weight: 600;
    margin-bottom: 8px;
}

.am-control-group label span {
    color: #ffcc00;
    float: right;
}

.am-slider {
    width: 100%;
    height: 4px;
    background: #1a1a1a;
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

.am-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #ffcc00;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 4px rgba(255, 204, 0, 0.8);
}

.am-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #ffcc00;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 4px rgba(255, 204, 0, 0.8);
}

.am-slider:hover::-webkit-slider-thumb {
    background: #ffdd33;
    box-shadow: 0 0 8px rgba(255, 204, 0, 1);
}

.am-slider:hover::-moz-range-thumb {
    background: #ffdd33;
    box-shadow: 0 0 8px rgba(255, 204, 0, 1);
}

.am-input-select {
    width: 100%;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    color: #ccc;
    padding: 8px 12px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
}

.am-input-select:hover {
    border-color: #555;
}

.am-input-select:focus {
    outline: none;
    border-color: #ffcc00;
}

.am-freq-range-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.freq-range-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.freq-range-row > span:first-child {
    min-width: 40px;
    font-size: 10px;
    color: #999;
    font-weight: 600;
}

.freq-range-row > span:last-child {
    min-width: 30px;
    text-align: right;
    font-size: 10px;
    color: #ffcc00;
    font-weight: 600;
}

.am-freq-slider {
    flex: 1;
}

/* Status Bar */
.status-bar {
    background: #0a0a0a;
    border-top: 1px solid #1a1a1a;
    padding: 6px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    color: #666;
}

.status-info, .audio-status {
    display: flex;
    gap: 16px;
}

.status-info span, .audio-status span {
    display: flex;
    gap: 4px;
}

.status-info span span, .audio-status span span {
    color: #999;
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    max-width: 80%;
    max-height: 80%;
    overflow: auto;
}

/* Shader selection modal - wider layout */
#shaderModal .modal-content {
    width: 90vw;
    max-width: 1400px;
    max-height: 85vh;
}

.modal-header {
    padding: 16px 20px;
    background: #0f0f0f;
    border-bottom: 1px solid #222;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #999;
}

.modal-close {
    background: none;
    border: none;
    color: #999;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
}

.modal-close:hover {
    color: #fff;
}

.shader-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    padding: 24px;
    overflow-y: auto;
}

.shader-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 12px;
    border-radius: 8px;
    background: #0f0f0f;
    transition: background 0.2s, transform 0.2s;
}

.shader-item:hover {
    background: #1f1f1f;
    transform: translateY(-2px);
}

.shader-item:hover .shader-preview {
    border-color: #ffcc00;
    box-shadow: 0 0 20px rgba(255, 204, 0, 0.3);
}

.shader-preview {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 2px solid #333;
    border-radius: 6px;
    background: #0a0a0a;
    transition: border-color 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.shader-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Loading state for shader previews */
.shader-preview:empty {
    background: linear-gradient(90deg, #1a1a1a 25%, #2a2a2a 50%, #1a1a1a 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.test-preview {
    background: linear-gradient(to bottom, #1a0033 0%, #ff6600 40%, #ff0080 60%, #1a0033 100%);
}

.tunnel-preview {
    background: linear-gradient(135deg, #ff6600 0%, #ffcc00 50%, #ff6600 100%);
}

.plasma-preview {
    background: radial-gradient(circle, #ff00ff 0%, #00ffff 50%, #ff00ff 100%);
}

.kaleidoscope-preview {
    background: conic-gradient(from 45deg, #ff0000, #00ff00, #0000ff, #ff0000);
}

.warp-preview {
    background: radial-gradient(ellipse at center, #0080ff 0%, #000000 70%);
}

.mandelbrot-preview {
    background: linear-gradient(45deg, #000 0%, #003366 50%, #66ccff 100%);
}

.voronoi-preview {
    background: repeating-linear-gradient(45deg, #111 0%, #333 10%, #111 20%);
}

.shader-item span {
    font-size: 12px;
    font-weight: 500;
    color: #ccc;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Inspector Tabs */
.blend-mode-control {
    padding: 8px 12px;
    background: #0f0f0f;
    border-bottom: 1px solid #1a1a1a;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.blend-mode-control label {
    font-size: 9px;
    font-weight: 600;
    color: #999;
    letter-spacing: 1px;
}

.blend-mode-select {
    width: 100%;
    padding: 8px 12px;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #fff;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.blend-mode-select:hover {
    background: #252525;
    border-color: #555;
}

.blend-mode-select:focus {
    border-color: #ffcc00;
}

/* Shader Code Editor */
.shader-code-control {
    padding: 8px 12px;
    background: #0f0f0f;
    border-bottom: 1px solid #1a1a1a;
}

.edit-shader-btn {
    width: 100%;
    padding: 10px;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #ffcc00;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.edit-shader-btn:hover {
    background: #252525;
    border-color: #ffcc00;
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.3);
}

/* Shader Colors Section */
.shader-colors-section {
    background: #0f0f0f;
    border-bottom: 1px solid #1a1a1a;
}

.shader-colors-header {
    padding: 8px 12px;
    border-bottom: 1px solid #1a1a1a;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #888;
}

.shader-colors-container {
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
}

.no-colors-msg {
    font-size: 10px;
    color: #555;
    text-align: center;
    padding: 8px;
}

.color-picker-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-picker-label {
    flex: 1;
    font-size: 9px;
    color: #888;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.color-picker-input {
    width: 32px;
    height: 24px;
    padding: 0;
    border: 2px solid #333;
    border-radius: 4px;
    cursor: pointer;
    background: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.color-picker-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker-input::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

.color-picker-input::-moz-color-swatch {
    border: none;
    border-radius: 2px;
}

.color-picker-input:hover {
    border-color: #ffcc00;
}

.color-picker-input:focus {
    outline: none;
    border-color: #ffcc00;
    box-shadow: 0 0 6px rgba(255, 204, 0, 0.4);
}

.shader-code-modal-content {
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
}

.shader-code-editor-container {
    padding: 16px;
    background: #0a0a0a;
    height: 600px;
    max-height: 70vh;
}

.shader-code-textarea {
    width: 100%;
    height: 100%;
    background: #0f0f0f;
    border: 1px solid #333;
    color: #fff;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 13px;
    line-height: 1.5;
    padding: 12px;
    resize: none;
    outline: none;
    border-radius: 4px;
}

.shader-code-textarea:focus {
    border-color: #ffcc00;
}

.shader-code-actions {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: #0a0a0a;
    border-top: 1px solid #1a1a1a;
}

.shader-code-btn {
    flex: 1;
    padding: 12px 24px;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.shader-code-btn:hover {
    background: #252525;
    border-color: #555;
}

.apply-btn {
    background: #1a4d1a;
    border-color: #2a6d2a;
    color: #6f6;
}

.apply-btn:hover {
    background: #2a6d2a;
    border-color: #3a8d3a;
    box-shadow: 0 0 10px rgba(102, 255, 102, 0.3);
}

.reset-btn {
    background: #4d1a1a;
    border-color: #6d2a2a;
    color: #f66;
}

.reset-btn:hover {
    background: #6d2a2a;
    border-color: #8d3a3a;
    box-shadow: 0 0 10px rgba(255, 102, 102, 0.3);
}

.inspector-tabs {
    display: flex;
    gap: 2px;
    background: #0a0a0a;
    padding: 6px;
    border-bottom: 1px solid #1a1a1a;
}

.inspector-tab {
    flex: 1;
    padding: 6px 8px;
    background: #1a1a1a;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-radius: 4px;
    transition: all 0.2s;
}

.inspector-tab:hover {
    background: #252525;
    color: #999;
}

.inspector-tab.active {
    background: #2a2a2a;
    color: #fff;
    border: 1px solid #444;
}

.inspector-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.inspector-content.hidden {
    display: none;
}

/* Modulation Matrix */
.modulation-matrix {
    width: 100%;
}

.matrix-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
}

.matrix-table thead th {
    background: #0f0f0f;
    color: #999;
    padding: 6px 3px;
    font-weight: 600;
    font-size: 8px;
    border-bottom: 1px solid #1a1a1a;
    position: sticky;
    top: 0;
    z-index: 1;
}

.matrix-table thead th:first-child {
    text-align: left;
    padding-left: 6px;
}

.matrix-table tbody td {
    padding: 3px;
    border-bottom: 1px solid #0a0a0a;
}

.matrix-table tbody tr:hover {
    background: #0f0f0f;
}

.param-label {
    font-weight: 600;
    color: #999;
    font-size: 8px;
    text-align: left;
    padding-left: 6px !important;
    min-width: 70px;
}

.matrix-input {
    width: 100%;
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    color: #ccc;
    padding: 3px 4px;
    border-radius: 3px;
    font-size: 8px;
    font-family: 'Courier New', monospace;
    text-align: center;
    -moz-appearance: textfield;
    cursor: ew-resize;
}

.matrix-input::-webkit-inner-spin-button,
.matrix-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.matrix-input:focus {
    outline: none;
    border-color: #ffcc00;
    background: #0f0f0f;
    cursor: text;
}

.matrix-input:not([value="0.000"]) {
    background: #1a1a0a;
    border-color: #333;
}

/* Layer Color Indicator */
.layer-color-indicator {
    width: 24px;
    height: 24px;
    background: #ffcc00;
    border: 2px solid #ffcc00;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
}

/* EG Container */
.eg-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.eg-group {
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    border-radius: 8px;
    padding: 12px;
}

.eg-envelope-display {
    width: 100%;
    height: 80px;
    background: #000;
    border: 1px solid #1a1a1a;
    border-radius: 4px;
    margin-bottom: 12px;
}

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

.eg-controls {
    display: flex;
    gap: 12px;
    justify-content: space-around;
}

.eg-param {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.eg-param label {
    font-size: 8px;
    color: #999;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.eg-label {
    text-align: center;
    font-size: 11px;
    color: #ffcc00;
    font-weight: 600;
    margin-top: 8px;
    letter-spacing: 1px;
}

/* Small Knobs */
.small-knob {
    width: 28px !important;
    height: 28px !important;
}

.small-knob .knob-indicator {
    width: 2px;
    height: 40%;
}

/* LFO Waveform Display */
.lfo-waveform-display {
    width: 100%;
    height: 140px;
    background: #000;
    border: 1px solid #1a1a1a;
    border-radius: 4px;
    margin-bottom: 12px;
}

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

/* LFO Controls Grid */
.lfo-controls-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

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

.lfo-control label {
    font-size: 8px;
    color: #999;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-align: center;
}

.lfo-select {
    width: 100%;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #ccc;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 9px;
    cursor: pointer;
}

.lfo-select:focus {
    outline: none;
    border-color: #ffcc00;
}

.lfo-toggle {
    width: 100%;
    padding: 6px 8px;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #999;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.lfo-toggle:hover {
    background: #252525;
}

.lfo-toggle.active {
    background: #ffcc00;
    color: #000;
    border-color: #ffcc00;
}

/* LFO Selector */
.lfo-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #1a1a1a;
}

.lfo-selector label {
    font-size: 9px;
    color: #999;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.lfo-tabs {
    display: flex;
    gap: 4px;
    flex: 1;
}

.lfo-tab {
    flex: 1;
    padding: 6px;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #666;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.lfo-tab:hover {
    background: #252525;
    color: #999;
}

.lfo-tab.active {
    background: #ffcc00;
    color: #000;
    border-color: #ffcc00;
}

/* Mod Parameter Active State */
.mod-param.active {
    background: #ffcc00;
    color: #000;
    border-color: #ffcc00;
}

.mod-icon.active {
    background: #ffcc00;
    color: #000;
    border-color: #ffcc00;
}

/* Help Button in Mod Header */
.mod-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.help-btn {
    width: 20px;
    height: 20px;
    background: none;
    border: 1px solid #333;
    border-radius: 50%;
    color: #666;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.help-btn:hover {
    border-color: #ffcc00;
    color: #ffcc00;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #0a0a0a;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #444;
}

/* Responsive adjustments */
@media (max-width: 1400px) {
    .main-layout {
        grid-template-columns: minmax(260px, 280px) 1fr minmax(260px, 280px);
    }
}

@media (max-width: 1200px) {
    .main-layout {
        grid-template-columns: minmax(240px, 260px) 1fr minmax(240px, 260px);
    }
}
