* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Georgia', serif;
}

body {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    color: #e6e6e6;
    min-height: 100vh;
    padding: 15px;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ===== HEADER & LAYOUT ===== */
header {
    text-align: center;
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(10, 10, 10, 0.8);
    border-radius: 15px;
    border: 1px solid #393e46;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(74, 107, 136, 0.1) 50%, transparent 70%);
    animation: shimmer 8s infinite linear;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

h1 {
    font-size: 2.2rem;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    color: #f5e8c8;
}

.subtitle {
    font-size: 1rem;
    font-style: italic;
    color: #d4af37;
}

.app-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

     .sequence-panel {
            width: 100%;
            max-width: 900px;
         
            background: rgba(30, 30, 46, 0.8);
            border-radius: 12px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
            overflow: hidden;
            margin-bottom: 20px;
        }
        
        .panel-title {
            text-align: center;
            padding: 15px;
            background: linear-gradient(to right, #8b6b2c, #d4af37, #8b6b2c);
            color: #1a1a2e;
            font-size: 1.5rem;
            font-weight: bold;
            letter-spacing: 1px;
        }
        
        /* ===== TOP PANEL ===== */
        .top-panel {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            align-items: center;
            gap: 15px;
            padding: 20px;
            background: rgba(212, 175, 55, 0.1);
            border-bottom: 1px solid rgba(212, 175, 55, 0.3);
        }
        
        /* ===== BOTTOM PANEL ===== */
        .bottom-panel {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            align-items: center;
            gap: 12px;
            padding: 20px;
            background: rgba(0, 0, 0, 0.2);
        }
        
        /* ===== CONTROL GROUPS ===== */
        .control-group {
            display: flex;
            align-items: center;
            gap: 8px;
            background: rgba(0, 0, 0, 0.2);
            padding: 8px 12px;
            border-radius: 6px;
            border: 1px solid #5a7d36;
        }
        
        .control-group.compact {
            display: flex;
            align-items: center;
            gap: 5px;
            min-width: 140px;
        }
        
        /* ===== BUTTONS ===== */
        button {
            background: linear-gradient(to bottom, #8b6b2c, #6d4c1e);
            color: #f5e8c8;
            border: none;
            padding: 8px 16px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 0.9rem;
            font-weight: bold;
            transition: all 0.3s;
            box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
        }
        
        button:hover {
            background: linear-gradient(to bottom, #9e7b35, #7d5924);
            transform: translateY(-2px);
            box-shadow: 0 5px 10px rgba(0, 0, 0, 0.4);
        }
        
        button:active {
            transform: translateY(1px);
        }
        
        .small-btn {
            padding: 6px 12px;
            font-size: 0.8rem;
        }
        
        .toggle-btn {
            position: relative;
            overflow: hidden;
        }
        
        .toggle-btn.active {
            background: linear-gradient(to bottom, #8b6b2c, #6d4c1e);
            border-color: #d4af37;
            box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
        }
        
        .toggle-btn.automation-active {
            background: linear-gradient(to bottom, #2d8c3f, #1a5f23);
            border-color: #4caf50;
            box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
        }
        
        .toggle-btn.randomization-active {
            background: linear-gradient(to bottom, #8b2c2c, #5f1a1a);
            border-color: #af4c4c;
            box-shadow: 0 0 10px rgba(175, 76, 76, 0.5);
        }
        
        .help-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(to bottom, #2c578b, #1e3c6d);
            color: #f5e8c8;
            text-decoration: none;
            padding: 8px 16px;
            border-radius: 4px;
            font-size: 0.9rem;
            font-weight: bold;
            transition: all 0.3s;
            box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
        }
        
        .help-btn:hover {
            background: linear-gradient(to bottom, #356b9e, #24497d);
            transform: translateY(-2px);
            box-shadow: 0 5px 10px rgba(0, 0, 0, 0.4);
        }
        
        /* ===== SLIDER STYLING ===== */
        input[type="range"] {
            -webkit-appearance: none;
            width: 120px;
            height: 6px;
            background: rgba(0, 0, 0, 0.3);
            border-radius: 3px;
            outline: none;
        }
        
        input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 16px;
            height: 16px;
            background: #d4af37;
            border-radius: 50%;
            cursor: pointer;
            box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
        }
        
        /* ===== RESPONSIVE DESIGN ===== */
        @media (max-width: 768px) {
            .top-panel, .bottom-panel {
                flex-direction: column;
                align-items: stretch;
            }
            
            .control-group {
                justify-content: center;
            }
        }

/* ===== TRACKS CONTAINER ===== */
.tracks-container {
    flex: 2;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
    min-width: 280px;
}

.track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 0;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

.track::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(to right, #8b6b2c, #d4af37, #8b6b2c);
}

.track.playing {
    border-color: #ff6b6b;
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.4);
    background: rgba(255, 107, 107, 0.1);
}

.track.playing::before {
    background: linear-gradient(to right, #ff6b6b, #ff8e8e, #ff6b6b);
}

.track-title {
    text-align: center;
    font-size: 1.1em;
    margin-bottom: 10px;
    color: #d4af37;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track.playing .track-title {
    color: #ff8e8e;
    text-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
}

.track-controls {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* ===== CONTROL ROWS ===== */
.control-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.control-row label {
    min-width: 70px;
    flex-shrink: 0;
    font-size: 0.8em;
    color: #ccc;
}

.control-row input[type="range"] {
    flex: 1;
    min-width: 0;
    max-width: 120px;
    margin: 0;
}

.control-row span {
    min-width: 35px;
    flex-shrink: 0;
    text-align: center;
    font-size: 0.8em;
    color: #d4af37;
}

/* ===== FORM ELEMENTS ===== */
select, input {
    background: rgba(0, 0, 0, 0.4);
    color: #f5e8c8;
    border: 1px solid #8b6b2c;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 0.9rem;
}

input[type="file"] {
    width: 100%;
    padding: 4px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    font-size: 0.85rem;
}

/* ===== SLIDER STYLES ===== */
/* Base slider styles */
input[type="range"] {
    height: 6px;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Volume Sliders - Green */
input[type="range"]:not(.pause-slider):not(.curve-slider):not(.reverb-slider):not(.target-bpm-slider) {
    background: linear-gradient(to right, #1a5f23, #2d8c3f) !important;
}

input[type="range"]:not(.pause-slider):not(.curve-slider):not(.reverb-slider):not(.target-bpm-slider)::-webkit-slider-thumb {
    background: #2d8c3f !important;
    border: 2px solid #4caf50 !important;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.6) !important;
}

/* Repetition Sliders - Orange */
input[type="range"].repetition-slider {
    background: linear-gradient(to right, #1a5f23, #e67e22) !important;
}

input[type="range"].repetition-slider::-webkit-slider-thumb {
    background: #e67e22 !important;
    border: 2px solid #f39c12 !important;
    box-shadow: 0 0 8px rgba(243, 156, 18, 0.6) !important;
}

/* Pause Sliders - Yellow */
input[type="range"].pause-slider {
    background: linear-gradient(to right, #1a5f23, #f1c40f) !important;
}

input[type="range"].pause-slider::-webkit-slider-thumb {
    background: #f1c40f !important;
    border: 2px solid #f39c12 !important;
    box-shadow: 0 0 8px rgba(243, 156, 18, 0.6) !important;
}

/* Curve Sliders - Purple */
input[type="range"].curve-slider {
    background: linear-gradient(to right, #1a5f23, #8e44ad) !important;
}

input[type="range"].curve-slider::-webkit-slider-thumb {
    background: #8e44ad !important;
    border: 2px solid #9b59b6 !important;
    box-shadow: 0 0 8px rgba(155, 89, 182, 0.6) !important;
}

/* Target BPM Sliders - Blue */
input[type="range"].target-bpm-slider {
    background: linear-gradient(to right, #1a5f23, #3498db) !important;
}

input[type="range"].target-bpm-slider::-webkit-slider-thumb {
    background: #3498db !important;
    border: 2px solid #2980b9 !important;
    box-shadow: 0 0 8px rgba(52, 152, 219, 0.6) !important;
}



/* Main Tempo Slider - Red */
#tempo {
    background: linear-gradient(to right, #1a5f23, #e74c3c) !important;
}

#tempo::-webkit-slider-thumb {
    background: #e74c3c !important;
    border: 2px solid #c0392b !important;
    box-shadow: 0 0 8px rgba(192, 57, 43, 0.6) !important;
}

/* Master Volume Slider */
.master-volume-slider {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    -webkit-appearance: none;
}

.master-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #d4af37;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Panning Slider */
.panning-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #ff6b6b, #d4af37, #4caf50);
    outline: none;
    -webkit-appearance: none;
}

.panning-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* ===== SAMPLE POOL ===== */
.sample-pool {
    margin-bottom: 12px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border: 1px solid #5a7d36;
}

.pool-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 5px;
    flex-wrap: wrap;
}

.pool-file-input {
    flex: 1;
    display: none;
}

.pool-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 0.8rem;
}

.pool-count {
    color: #d4af37;
    font-style: italic;
}

.pool-randomize {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
}

.pool-list {
    margin-top: 8px;
    max-height: 60px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    padding: 5px;
    font-size: 0.75em;
}

.pool-item {
    padding: 2px 5px;
    margin: 1px 0;
    background: rgba(139, 107, 44, 0.3);
    border-radius: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pool-item.current {
    background: rgba(45, 140, 63, 0.5);
    border-left: 2px solid #4caf50;
}

/* ===== RANDOMIZATION ===== */
.randomize-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.randomize-control label {
    font-size: 0.85rem;
}

.randomize-info {
    font-size: 0.75rem;
    color: #d4af37;
    font-style: italic;
    margin-top: 4px;
}

.randomizing {
    animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
    0% { 
        background-color: rgba(139, 107, 44, 0.4);
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.7);
    }
    50% { 
        background-color: rgba(212, 175, 55, 0.3);
        box-shadow: 0 0 0 10px rgba(212, 175, 55, 0);
    }
    100% { 
        background-color: rgba(139, 107, 44, 0.4);
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0);
    }
}

.track.randomizing {
    animation: trackPulse 0.8s ease-in-out;
}

@keyframes trackPulse {
    0% { 
        border-color: #5a7d36;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    50% { 
        border-color: #d4af37;
        box-shadow: 0 4px 20px rgba(212, 175, 55, 0.5);
    }
    100% { 
        border-color: #5a7d36;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
}

/* ===== TEMPO AUTOMATION ===== */
.tempo-automation {
    margin-top: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border: 1px solid #5a7d36;
}

.automation-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.automation-toggle label {
    font-size: 0.9rem;
}

.automation-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.automation-row label {
    min-width: 80px;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.curve-control,
.tempo-target {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.curve-slider,
.target-bpm-slider {
    flex: 1;
    min-width: 0;
    max-width: 100px;
}

.curve-value,
.target-bpm-value {
    min-width: 40px;
    text-align: center;
    font-size: 0.8rem;
    color: #d4af37;
    font-weight: bold;
}

/* ===== VISUALIZER ===== */
.visualizer {
    height: 40px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #5a7d36;
}

.wave {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 8px;
}

.bar {
    width: 5px;
    background: linear-gradient(to top, #8b6b2c, #d4af37);
    border-radius: 3px 3px 0 0;
    transition: height 0.2s;
}

.bar.active {
    background: linear-gradient(to top, #ff6b6b, #ff8e8e);
}

.track.playing .bar.active {
    background: linear-gradient(to top, #ff6b6b, #ff8e8e);
}

/* ===== SEQUENCE PANEL ===== */
.sequence-panel {
    width: 100%;
    max-width: 900px;
    background: rgba(30, 30, 46, 0.8);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    margin: 50px auto; /* Center horizontally with top margin */
}


.panel-title {
    text-align: center;
    margin-bottom: 15px;
    color: #535046;
    font-size: 1.3em;
}

/* Global Controls */
.global-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

/* Playback Modes */
.playback-modes {
    display: flex;
    gap: 4px;
    margin-bottom: 15px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: 6px;
    
}

.mode-btn {
    flex: 1;
    padding: 6px 8px;
    background: transparent;
    border: none;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.3s ease;
}

.mode-btn.active {
    background: rgba(212, 175, 55, 0.3);
    color: #d4af37;
}

.mode-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
}



.dropdown-toggle {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85em;
    transition: all 0.3s;
}

.dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.dropdown-toggle.active {
    border-color: #d4af37;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(40, 40, 40, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
    font-size: 0.85em;
    color: #f5e8c8;
}

.dropdown-item:hover {
    background: rgba(212, 175, 55, 0.2);
    color: #d4af37;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item.active {
    background: rgba(212, 175, 55, 0.3);
    color: #f5e8c8;
    border-left: 3px solid #d4af37;
}

.dropdown-separator {
    padding: 6px 12px;
    color: #667eea;
    font-size: 0.75rem;
    font-weight: bold;
    border-bottom: 1px solid rgba(102, 126, 234, 0.3);
    margin: 4px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.dropdown-separator:not(:first-child) {
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid rgba(102, 126, 234, 0.2);
}

.scale-dropdown {
    position: relative;
    display: flex;
    width: 100%;
    margin: 10px 0;
        margin-bottom: 20px;
     
}

.scale-controls h3 {
    margin-bottom: 6px;
    color: #d4af37;
    font-size: 0.9em;
    text-align: center;
    font-weight: normal;
    margin-top: 0;
}

.scale-dropdown .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid #d4af37;
    border-radius: 8px;
    padding: 10px;
    min-width: 200px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);

}

.scale-info {
    font-size: 0.8em;
    color: #d4af37;
    text-align: center;
    font-style: italic;
    background: rgba(139, 107, 44, 0.2);
    padding: 4px 8px;
    border-radius: 4px;
    margin-top: 8px;
     margin-bottom: 16px;
}

/* ===== SEQUENCE BUILDER ===== */
.sequence-builder {
    margin-bottom: 15px;
    margin-top: 15px;
}

.sequence-builder h3 {
    margin-bottom: 8px;
    color: #d4af37;
    font-size: 0.9em;
    text-align: center;
}

.builder-controls {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.track-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    font-size: 0.8em;
    transition: all 0.3s ease;
}

.track-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sequence-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
    min-height: 32px;
    border: 1px dashed rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 6px;
}

.sequence-item {
    background: rgba(212, 175, 55, 0.3);
    border: 1px solid #d4af37;
    color: #d4af37;
    padding: 4px 8px;
    border-radius: 3px;
    text-align: center;
    font-size: 0.8em;
    min-width: 24px;
}

.control-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* ===== CURRENT SEQUENCE & PREVIEW ===== */
.current-sequence {
    margin-bottom: 15px;
}

.current-sequence h3 {
   margin-bottom: 6px;
    color: #d4af37;
    font-size: 0.9em;
    text-align: center;
    font-weight: normal;
    margin-top: 16;
}

.sequence-display {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-height: 50px;
    font-size: 0.85em;
}

#current-track {
    font-size: 0.9em;
    text-align: center;
    min-height: 20px;
    font-weight: bold;
    color: #d4af37;
}

#sequence-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    align-items: center;
    justify-content: center;
}

.sequence-step {
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 6px;
    border-radius: 3px;
    text-align: center;
    font-size: 0.8em;
    min-width: 24px;
    transition: all 0.3s ease;
}

.sequence-step.current-step {
    background: rgba(212, 175, 55, 0.3);
    border: 1px solid #d4af37;
    transform: scale(1.1);
}



/* ===== MIDI CONTROLS ===== */
.midi-controls {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.midi-port-selection {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.midi-port-selection label {
    font-size: 0.85em;
    color: #d4af37;
    white-space: nowrap;
}

.midi-port-selection select {
    width: 100%;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.85em;
    max-width: 200px;
}

.midi-status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

#midi-refresh {
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    white-space: nowrap;
}

#midi-refresh:hover {
    background: rgba(255, 255, 255, 0.2);
}

#midi-status {
    flex: 1;
    font-size: 0.8em;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    min-width: 120px;
    text-align: center;
}

.midi-clock-control {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
}

.midi-clock-control label {
    font-size: 0.85em;
    color: #d4af37;
    white-space: nowrap;
}

#toggle-midi-clock {
    padding: 4px 12px;
    font-size: 0.8em;
    min-width: 60px;
}

/* ===== SAVE & LOAD ===== */
.save-load-section {
    margin-bottom: 15px;
}

.save-load-section h3 {
    margin-bottom: 8px;
    color: #d4af37;
    font-size: 0.9em;
    text-align: center;
}

.save-load-controls.stacked {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.save-load-row.stacked {
    display: flex;
    gap: 8px;
    align-items: center;
}

.save-load-row.stacked input,
.save-load-row.stacked select {
    flex: 1;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.85em;
    min-width: 0;
    box-sizing: border-box;
}

.save-load-row.stacked input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.button-group {
    display: flex;
    gap: 4px;
}

/* ===== MASTER VOLUME ===== */
.master-controls {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.master-volume-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.master-volume-value {
    min-width: 40px;
    text-align: center;
    font-weight: bold;
    color: #d4af37;
}

/* ===== PANNING CONTROLS ===== */
.panning-control {
    margin: 8px 0;
}

.panning-value {
    display: block;
    text-align: center;
    font-size: 0.8em;
    margin-top: 5px;
    color: #d4af37;
}

/* ===== RANDOM PAUSE ===== */
.random-pause-control {
    margin-top: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border: 1px solid #5a7d36;
}

.pause-info {
    font-size: 0.75rem;
    color: #d4af37;
    font-style: italic;
    margin-top: 4px;
    text-align: center;
}

/* ===== DECORATIVE ELEMENTS ===== */
.nature-decoration {
    position: fixed;
    pointer-events: none;
    z-index: -1;
}

.olive-branch {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 120px;
    height: 120px;
    opacity: 0.3;
}

.olive-branch.right {
    left: auto;
    right: 10px;
    transform: scaleX(-1);
}

.mountain {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120px;
    background: linear-gradient(to top, #1a472a, transparent);
    z-index: -1;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1200px) {
    .tracks-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sequence-panel {
        margin-left: 0;
        margin-top: 20px;
        min-width: auto;
    }
    
    .builder-controls {
        grid-template-columns: repeat(8, 1fr);
    }
}

@media (max-width: 768px) {
    .tracks-container {
        grid-template-columns: 1fr;
    }
    
    .app-container {
        flex-direction: column;
    }
    
    .track {
        min-width: 100%;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .save-load-row.stacked {
        flex-direction: column;
    }
    
    .save-load-row.stacked input,
    .save-load-row.stacked select,
    .save-load-row.stacked button {
        width: 100%;
        flex: none;
    }
    
    .sequence-panel {
        min-width: 100%;
        margin: 10px 0;
    }
    
    .global-controls {
        flex-direction: column;
    }
    
    .builder-controls {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .playback-modes {
        flex-direction: column;
    }
    
    .automation-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .pool-controls {
        flex-direction: column;
    }
    
    .control-row input[type="range"] {
        max-width: none;
    }
}

/* Ensure dropdowns don't cause overflow */
.dropdown-menu {
    max-width: 100%;
    box-sizing: border-box;
}

.dropdown-item {
    white-space: normal;
    word-wrap: break-word;
}

/* Scrollbar styling */
.dropdown-menu::-webkit-scrollbar {
    width: 6px;
}

.dropdown-menu::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.dropdown-menu::-webkit-scrollbar-thumb {
    background: #8b6b2c;
    border-radius: 3px;
}

.dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: #d4af37;
}

/* Randomize Everything button styles */
#randomize-everything {
    background: linear-gradient(45deg, #8b2c8b, #2c8b8b, #8b8b2c);
    border: 2px solid #d4af37;
    font-weight: bold;
    animation: pulse-glow 2s infinite;
}

#randomize-everything:hover {
    animation: none;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.8);
}

@keyframes pulse-glow {
    0% { box-shadow: 0 0 5px rgba(212, 175, 55, 0.5); }
    50% { box-shadow: 0 0 20px rgba(212, 175, 55, 0.8); }
    100% { box-shadow: 0 0 5px rgba(212, 175, 55, 0.5); }
}

.randomizing-all {
    animation: rainbow-pulse 0.5s ease-in-out;
}

@keyframes rainbow-pulse {
    0% { background: linear-gradient(45deg, #ff6b6b, #ffa500, #ffff00); }
    25% { background: linear-gradient(45deg, #ffff00, #00ff00, #00ffff); }
    50% { background: linear-gradient(45deg, #00ffff, #0000ff, #8a2be2); }
    75% { background: linear-gradient(45deg, #8a2be2, #ff00ff, #ff6b6b); }
    100% { background: linear-gradient(45deg, #ff6b6b, #ffa500, #ffff00); }
}

/* Recording Section Styles */
.recording-section {
    background: rgba(42, 42, 42, 0.8);
    border: 1px solid #d4af37;
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
}

.recording-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.record-btn {
    background: #333;
    color: white;
    border: 1px solid #555;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.record-btn:hover:not(:disabled) {
    background: #444;
    border-color: #d4af37;
}

.record-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#start-recording:not(:disabled) {
    background: #ff4444;
    color: white;
}

#start-recording.recording {
    background: #ff4444;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.recording-status {
    text-align: center;
    margin: 15px 0;
}

#recording-timer {
    font-size: 2em;
    font-weight: bold;
    font-family: monospace;
    color: #d4af37;
}

#recording-status {
    margin: 10px 0;
    font-weight: bold;
}

.level-meter {
    width: 100%;
    height: 20px;
    background: #333;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.level-bar {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #ffeb3b, #ff4444);
    width: 0%;
    transition: width 0.1s ease;
}

.recording-options {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    font-size: 0.9em;
}

.recording-options label {
    display: flex;
    align-items: center;
    gap: 5px;
}

.recording-options select {
    background: #333;
    color: white;
    border: 1px solid #555;
    padding: 3px 8px;
    border-radius: 3px;
}

/* Help Button Styles */
.help-btn {
    display: inline-block;
    background: linear-gradient(135deg, #d4af37 0%, #b8941f 100%);
    color: #1a1a2e !important;
    text-decoration: none;
    border: none;
    padding: 10.8px 18px; /* 10% smaller than 12px 20px */
    border-radius: 22.5px; /* 10% smaller than 25px */
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 3.6px 13.5px rgba(0, 0, 0, 0.3); /* 10% smaller */
    transition: all 0.3s ease;
    font-size: 12.6px; /* 10% smaller than 14px */
    text-align: center;
}

.help-btn:hover {
    transform: translateY(-1.8px); /* 10% smaller lift */
    box-shadow: 0 5.4px 18px rgba(0, 0, 0, 0.4); /* 10% smaller */
    background: linear-gradient(135deg, #e6c158 0%, #c9a42a 100%);
    color: #1a1a2e !important;
    text-decoration: none;
}

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

/* Mobile responsive */
@media (max-width: 768px) {
    .help-btn {
        padding: 9px 13.5px; /* 10% smaller than 10px 15px */
        font-size: 10.8px; /* 10% smaller than 12px */
    }
}

.recording-dropdown {
    position: relative;
    display: inline-block;
    margin: 10px 0;
}

.recording-toggle {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.recording-toggle:hover {
    background: linear-gradient(135deg, #ff5252, #e53935);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.recording-toggle.recording {
    background: linear-gradient(135deg, #4caf50, #45a049);
    animation: pulse 2s infinite;
}

.recording-toggle.paused {
    background: linear-gradient(135deg, #ffa500, #ff8c00);
}

.recording-dropdown-content {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    background: rgba(40, 40, 40, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid #d4af37;
    border-radius: 15px;
    padding: 20px;
    min-width: 300px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    margin-bottom: 10px;
}

.recording-dropdown-content.show {
    display: block;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(76, 175, 80, 0); }
    100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
}

.recording-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.recording-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.record-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
    flex: 1;
}

.record-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#start-recording {
    background: #ff6b6b;
    color: white;
}

#pause-recording {
    background: #ffa500;
    color: white;
}

#stop-recording {
    background: #6b6bff;
    color: white;
}

#bounce-audio {
    background: #d4af37;
    color: white;
}

.record-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.recording-status {
    text-align: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

#recording-timer {
    font-size: 24px;
    font-weight: bold;
    color: #d4af37;
    margin-bottom: 5px;
}

#recording-status {
    font-size: 12px;
    color: #ccc;
}

.level-meter {
    width: 100%;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.level-bar {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #d4af37);
    width: 0%;
    transition: width 0.1s ease;
}

.recording-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 12px;
}

.recording-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ccc;
}

.recording-options select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #d4af37;
    border-radius: 5px;
    color: white;
    padding: 4px 8px;
    font-size: 12px;
}

/* Randomization Slider Styles */
.randomization-control {
    background: rgba(42, 42, 42, 0.8);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #555;
    margin: 15px 0;
}

.randomization-control h4 {
    color: #d4af37;
    margin-bottom: 15px;
    text-align: center;
}

.randomization-slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

#randomization-intensity {
    flex: 1;
    height: 6px;
    background: #555;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

#randomization-intensity::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #d4af37;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #1a1a2e;
}

#randomization-intensity::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #d4af37;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #1a1a2e;
}

#randomization-value {
    color: #d4af37;
    font-weight: bold;
    min-width: 40px;
    text-align: center;
}

#apply-randomization {
    background: linear-gradient(135deg, #d4af37 0%, #b8941f 100%);
    color: #1a1a2e;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

#apply-randomization:hover {
    background: linear-gradient(135deg, #e6c158 0%, #c9a329 100%);
    transform: translateY(-2px);
}

.randomization-labels {
    display: flex;
    justify-content: space-between;
    color: #888;
    font-size: 0.9em;
}

/* Make sure the global controls container has proper styling */
.global-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

.sequence-builder {
    position: relative;
}

.sequence-item.selected {
    background: linear-gradient(135deg, #d4af37, #b8941f) !important;
    color: black !important;
    font-weight: bold;
    border: 2px solid #ffd700 !important;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

.batch-controls {
    margin: 10px 0;
    padding: 15px;
    background: rgba(212, 175, 55, 0.1);
    border-radius: 10px;
    border: 1px solid #d4af37;
    display: none;
}

.batch-controls.show {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.batch-control-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.batch-control-row label {
    color: #d4af37;
    font-weight: bold;
    min-width: 120px;
}

.batch-repeat-input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #d4af37;
    border-radius: 5px;
    color: white;
    padding: 8px 12px;
    width: 80px;
    text-align: center;
}

.batch-repeat-input:focus {
    outline: none;
    border-color: #ffd700;
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.5);
}

.batch-buttons {
    display: flex;
    gap: 10px;
}

.batch-btn {
    background: #d4af37;
    color: black;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.3s ease;
    flex: 1;
}

.batch-btn:hover {
    background: #e6c158;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.batch-btn.clear {
    background: #ff6b6b;
}

.batch-btn.clear:hover {
    background: #ff5252;
}

.selection-info {
    font-size: 12px;
    color: #d4af37;
    text-align: center;
    margin-top: 5px;
    font-style: italic;
}

.scale-validation-toggle {
    background: rgba(212, 175, 55, 0.2);
    border: 1px solid #d4af37;
    border-radius: 15px; /* Smaller border radius */
    padding: 4px 12px; /* 50% smaller padding */
    color: #d4af37;
    cursor: pointer;
    font-size: 10px; /* Smaller font */
    font-weight: bold;
    transition: all 0.3s ease;
    margin: 5px auto; /* Center with auto margins */
    display: block; /* Make it a block element for centering */
    width: fit-content; /* Only take needed width */
    min-width: 180px; /* Minimum width to prevent too small */
    text-align: center; /* Center text */
    line-height: 1.2; /* Better line height for smaller button */
}

.scale-validation-toggle:hover {
    background: rgba(212, 175, 55, 0.3);
    transform: translateY(-1px); /* Smaller hover lift */
}

.scale-validation-toggle.active {
    background: linear-gradient(135deg, #d4af37, #b8941f);
    color: black;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.4); /* Smaller shadow */
}

.scale-validation-toggle.inactive {
    background: rgba(255, 107, 107, 0.2);
    border-color: #ff6b6b;
    color: #ff6b6b;
}

/* Optional: Add tooltip style if you're using it */
.scale-validation-toggle {
    position: relative;
}

.scale-validation-toggle::after {
    content: "Right-click for manual validation";
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 3px 6px; /* Smaller tooltip padding */
    border-radius: 3px;
    font-size: 9px; /* Smaller tooltip font */
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1000;
}

.scale-validation-toggle:hover::after {
    opacity: 1;
}

.pause-curve-control {
    transform: scale(0.85); /* Scales entire control to 85% */
    transform-origin: top left;
    margin: 5px 0; /* Adjust margins to compensate for scaling */
}


.pause-curve-options {
    display: flex;
    gap: 10px;
    margin: 10px 0;
}

.pause-curve-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #555;
    border-radius: 8px;
    background: rgba(42, 42, 42, 0.8);
    color: #ccc;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 11px;
}

.pause-curve-btn.active {
    background: linear-gradient(135deg, #d4af37, #b8941f);
    color: black;
    border-color: #d4af37;
    font-weight: bold;
}

.pause-curve-btn:hover:not(.active) {
    border-color: #d4af37;
    background: rgba(212, 175, 55, 0.2);
}

.pause-duration-display {
    font-size: 12px;
    color: #d4af37;
    text-align: center;
    margin-top: 8px;
    font-weight: bold;
}

.curve-visual {
    width: 100%;
    height: 60px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    margin: 10px 0;
    position: relative;
    overflow: hidden;
}

.curve-path {
    fill: none;
    stroke: #d4af37;
    stroke-width: 2;
}

.curve-point {
    fill: #ff6b6b;
    r: 4;
}

.custom-range-controls {
    margin: 10px 0;
    padding: 10px;
    background: rgba(42, 42, 42, 0.8);
    border-radius: 8px;
    border: 1px solid #555;
}

.range-control-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    font-size: 11px;
}

.range-control-row label {
    min-width: 70px;
    color: #d4af37;
    font-weight: bold;
}

.range-slider {
    flex: 1;
    height: 6px;
}

.range-value {
    min-width: 40px;
    color: #d4af37;
    font-weight: bold;
    text-align: right;
}

/* Auto Randomize Button Styles */
.toggle-btn.auto-randomize-active {
    background: linear-gradient(135deg, #ff6b6b 0%, #d4af37 100%) !important;
    border-color: #ff6b6b !important;
    animation: pulse-auto-randomize 2s infinite;
}

@keyframes pulse-auto-randomize {
    0%, 100% { 
        box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    }
    50% { 
        box-shadow: 0 4px 25px rgba(255, 107, 107, 0.8);
    }
}

.auto-randomize-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 107, 107, 0.9);
    color: white;
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    z-index: 1000;
    animation: slide-in-right 0.3s ease-out;
}

@keyframes slide-in-right {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* MIDI Out Controls */
.midi-out-control {
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 8px;
    padding: 10px;
    margin: 8px 0;
}

.midi-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
    color: #d4af37;
    margin-bottom: 8px;
}

.midi-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.midi-settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 0.85em;
}

.midi-param {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.midi-param label {
    font-size: 0.8em;
    color: #ccc;
}

.midi-note-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: white;
    padding: 4px;
    font-size: 0.8em;
}

.midi-velocity-slider,
.midi-gate-slider {
    width: 100%;
}

.midi-value {
    font-size: 0.75em;
    color: #d4af37;
    text-align: center;
}

/* Active MIDI state */
.midi-out-control.active {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.5);
}

.midi-toggle.active {
    color: #4caf50;
}

/* MIDI Toggle Button Styles */
.toggle-btn.midi-active {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%) !important;
    border-color: #4caf50 !important;
    color: white !important;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.5);
}

/* MIDI toggle indicator */
.midi-toggle-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    padding: 10px 15px;
    border-radius: 20px;
    font-weight: bold;
    z-index: 10000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Audio I/O Section */
.audio-io-section {
    margin-bottom: 15px;
}

.audio-io-controls {
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.io-group {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}

.io-group label {
    min-width: 120px;
    color: #d4af37;
    font-size: 0.9em;
}

.io-group select {
    flex: 1;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: white;
    font-size: 0.9em;
}

.refresh-btn {
    padding: 6px 12px;
    background: rgba(212, 175, 55, 0.2);
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.refresh-btn:hover {
    background: rgba(212, 175, 55, 0.3);
}

/* Track Output Controls */
.track-output {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
}

.track-output label {
    font-size: 0.8em;
    color: #ccc;
    min-width: 50px;
}

.track-output-select {
    flex: 1;
    padding: 4px 6px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    color: white;
    font-size: 0.8em;
}

/* Record Track Button */
.record-track-btn {
    padding: 4px 8px;
    background: rgba(244, 67, 54, 0.2);
    border: 1px solid rgba(244, 67, 54, 0.4);
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.3s ease;
    margin-left: 8px;
}

.record-track-btn:hover {
    background: rgba(244, 67, 54, 0.3);
}

.record-track-btn.recording {
    background: rgba(244, 67, 54, 0.6);
    animation: pulse-record 1s infinite;
}

@keyframes pulse-record {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* Output Channel Indicators */
.track-controls[data-output="1"] { border-left: 3px solid #ff6b6b; }
.track-controls[data-output="2"] { border-left: 3px solid #4ecdc4; }
.track-controls[data-output="3"] { border-left: 3px solid #45b7d1; }
.track-controls[data-output="4"] { border-left: 3px solid #96ceb4; }
.track-controls[data-output="5"] { border-left: 3px solid #feca57; }
.track-controls[data-output="6"] { border-left: 3px solid #ff9ff3; }
.track-controls[data-output="7"] { border-left: 3px solid #54a0ff; }
.track-controls[data-output="8"] { border-left: 3px solid #5f27cd; }

.permission-hint {
    animation: pulse-gentle 2s infinite;
}

@keyframes pulse-gentle {
    0% { opacity: 0.8; }
    50% { opacity: 1; }
    100% { opacity: 0.8; }
}

.audio-status {
    font-size: 0.9em;
}

.audio-status.success {
    color: #4caf50;
}

.audio-status.error {
    color: #f44336;
}


.channel-preview {
    margin: 15px 0;
}

.channel-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.channel-preview-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 8px;
    border-left: 3px solid #d4af37;
}

.channel-number {
    font-weight: bold;
    color: #d4af37;
    font-size: 1.1em;
}

.channel-label {
    font-size: 0.8em;
    color: #ccc;
    margin: 4px 0;
}

.channel-level {
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin: 4px 0;
}

.level-bar {
    height: 100%;
    width: 100%;
    background: #4ecdc4;
    transform-origin: bottom;
    transition: height 0.1s ease;
}

.channel-tracks {
    font-size: 0.7em;
    color: #888;
    min-height: 16px;
}

/* Track output visual classes */
.track-controls.output-0 { border-left-color: #d4af37; }
.track-controls.output-1 { border-left-color: #ff6b6b; }
.track-controls.output-2 { border-left-color: #4ecdc4; }
.track-controls.output-3 { border-left-color: #45b7d1; }
.track-controls.output-4 { border-left-color: #96ceb4; }
.track-controls.output-5 { border-left-color: #feca57; }
.track-controls.output-6 { border-left-color: #ff9ff3; }
.track-controls.output-7 { border-left-color: #54a0ff; }
.track-controls.output-8 { border-left-color: #5f27cd; }

.output-channel-label {
    font-size: 0.8em;
    font-weight: bold;
    margin-left: 8px;
}

/* Audio & MIDI Control Panel */
.audio-midi-panel {
    margin-bottom: 15px;
}

.audio-midi-panel .dropdown-content {
    width: 400px;
    max-height: 70vh;
    overflow-y: auto;
}

.settings-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h3 {
    color: #d4af37;
    margin-bottom: 15px;
    font-size: 1em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* IO Groups */
.io-group {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}

.io-group label {
    min-width: 120px;
    color: #ccc;
    font-size: 0.9em;
}

.io-group select {
    flex: 1;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: white;
    font-size: 0.9em;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.action-buttons .refresh-btn {
    flex: 1;
    min-width: 120px;
    padding: 6px 8px;
    background: rgba(212, 175, 55, 0.2);
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.3s ease;
}

.action-buttons .refresh-btn:hover {
    background: rgba(212, 175, 55, 0.3);
}

/* MIDI Controls Grid */
.midi-controls-grid {
    display: grid;
    gap: 10px;
}

.midi-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

#midi-status {
    font-size: 0.85em;
    color: #ccc;
    flex: 1;
}

.midi-clock-control,
.midi-global-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.midi-clock-control label,
.midi-global-control label {
    color: #ccc;
    font-size: 0.9em;
}

/* Centered Audio & MIDI Control Panel */
.audio-midi-panel.centered-panel {
    display: flex;
    justify-content: center;
    margin: 15px auto;
    max-width: 400px;
}

.audio-midi-panel .dropdown {
    position: relative;
    width: 100%;
}

.audio-midi-panel .dropdown-toggle {
    width: 100%;
    padding: 10px 15px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.3) 0%, rgba(184, 148, 31, 0.3) 100%);
    border: 1px solid rgba(212, 175, 55, 0.5);
    border-radius: 8px;
    color: #d4af37;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.audio-midi-panel .dropdown-toggle:hover {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.4) 0%, rgba(184, 148, 31, 0.4) 100%);
    border-color: #d4af37;
}

.audio-midi-panel .dropdown-toggle.active {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.5) 0%, rgba(184, 148, 31, 0.5) 100%);
    border-color: #d4af37;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
}

.audio-midi-panel .dropdown-toggle.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-arrow {
    transition: transform 0.3s ease;
    font-size: 0.8em;
}

/* Dropdown Content - Fixed Positioning */
.audio-midi-panel .dropdown-content {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    max-height: 70vh;
    overflow-y: auto;
    background: rgba(42, 42, 42, 0.98);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 8px;
    padding: 15px;
    margin-top: 5px;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    
    /* Initially hidden */
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-10px);
    transition: all 0.3s ease;
}

.audio-midi-panel .dropdown-content.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Rest of your existing styles... */
.settings-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h3 {
    color: #d4af37;
    margin-bottom: 15px;
    font-size: 1em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.io-group {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}

.io-group label {
    min-width: 120px;
    color: #ccc;
    font-size: 0.9em;
}

.io-group select {
    flex: 1;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: white;
    font-size: 0.9em;
}

.action-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.action-buttons .refresh-btn {
    flex: 1;
    min-width: 120px;
    padding: 6px 8px;
    background: rgba(212, 175, 55, 0.2);
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.3s ease;
}

.action-buttons .refresh-btn:hover {
    background: rgba(212, 175, 55, 0.3);
}

.midi-controls-grid {
    display: grid;
    gap: 10px;
}

.midi-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

#midi-status {
    font-size: 0.85em;
    color: #ccc;
    flex: 1;
}

.midi-clock-control,
.midi-global-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.midi-clock-control label,
.midi-global-control label {
    color: #ccc;
    font-size: 0.9em;
}

.output-config-display {
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid #d4af37;
    border-radius: 4px;
    padding: 8px 12px;
    margin: 12px 0;
    font-size: 0.85em;
    text-align: center;
    color: #d4af37;
}

.channel-preview {
    margin-top: 10px;
}

.channel-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.channel-preview-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 6px;
    border-left: 3px solid #d4af37;
    text-align: center;
}

.channel-number {
    font-weight: bold;
    color: #d4af37;
    font-size: 0.9em;
}

.channel-label {
    font-size: 0.7em;
    color: #ccc;
    margin: 2px 0;
}

.channel-level {
    height: 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin: 3px 0;
}

.level-bar {
    height: 100%;
    width: 100%;
    background: #4ecdc4;
    transform-origin: bottom;
    transition: height 0.1s ease;
}

.channel-tracks {
    font-size: 0.6em;
    color: #888;
    min-height: 12px;
}

.toggle-btn {
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.3s ease;
    min-width: 50px;
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.toggle-btn.active {
    background: rgba(76, 175, 80, 0.3);
    border-color: #4caf50;
    color: white;
}

.toggle-btn.midi-active {
    background: rgba(76, 175, 80, 0.6);
    border-color: #4caf50;
}

/* Responsive Design */
@media (max-width: 768px) {
    .audio-midi-panel.centered-panel {
        max-width: 350px;
    }
    
    .audio-midi-panel .dropdown-content {
        width: 350px;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .channel-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .io-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .io-group label {
        min-width: auto;
        margin-bottom: 4px;
    }
}

@media (max-width: 480px) {
    .audio-midi-panel.centered-panel {
        max-width: 300px;
    }
    
    .audio-midi-panel .dropdown-content {
        width: 300px;
    }
}

@keyframes pulse-cycle {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.sample-randomize-active {
    background: linear-gradient(135deg, #ff6b6b 0%, #d4af37 100%) !important;
    color: white !important;
    border-color: #ff6b6b !important;
}

/* Enhanced tooltip styles */
[tooltip] {
    position: relative;
}

[tooltip]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    margin-bottom: 5px;
}

[tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.8);
    margin-bottom: -5px;
    z-index: 1000;
    pointer-events: none;
}

/* For buttons and interactive elements */
button[title], input[title], label[title] {
    cursor: help;
}

.reference {
    font-size: 0.8em;
    color: rgba(212, 175, 55, 0.7);
    margin-top: 5px;
    font-style: italic;
     margin-top: 15px;
}

.reference a {
    color: rgba(212, 175, 55, 0.9);
    text-decoration: none;
    transition: all 0.5s ease;
    position: relative;
    padding: 2px 8px;
    margin-top: 15px;
}

.reference a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(212, 175, 55, 0.4), 
        transparent);
    transition: left 0.8s ease;
    z-index: -1;
}

.reference a:hover::before {
    left: 100%;
}

.reference a:hover {
    color: #d4af37;
    text-shadow: 0 0 8px rgba(212, 175, 55, 0.6);
    box-shadow: 
        0 0 15px rgba(212, 175, 55, 0.4),
        inset 0 0 5px rgba(212, 175, 55, 0.2);
    background: rgba(212, 175, 55, 0.1);
    border-radius: 3px;
}

.time-stretch-control {
    margin: 8px 0;
    padding: 8px;
    background: rgba(212, 175, 55, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.time-stretch-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9em;
}

.time-stretch-toggle input[type="checkbox"] {
    margin: 0;
}

.time-stretch-info {
    font-size: 0.8em;
    color: #d4af37;
    margin-top: 4px;
    font-style: italic;
}

.time-stretch-control.disabled {
    background: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.3);
}

.time-stretch-control.disabled .time-stretch-info {
    color: #ff6b6b;
}

/* Enhanced Audio Controls */
.audio-midi-panel .dropdown-content {
    max-height: 70vh;
    overflow-y: auto;
}

.io-group {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
    flex-wrap: wrap;
}

.io-group label {
    min-width: 120px;
    color: #d4af37;
    font-weight: bold;
}

.io-group select {
    flex: 1;
    min-width: 200px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #555;
    color: white;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #d4af37;
}

.io-group select option {
    background: #2a2a2a;
    color: white;
    padding: 8px;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.refresh-btn {
    background: linear-gradient(135deg, #d4af37 0%, #b8941f 100%);
    border: none;
    color: black;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 120px;
}

.refresh-btn:hover {
    background: linear-gradient(135deg, #e6c158 0%, #d4af37 100%);
    transform: translateY(-2px);
}

.output-config-display {
    background: rgba(212, 175, 55, 0.1);
    border: 2px solid #d4af37;
    border-radius: 8px;
    padding: 12px;
    margin-top: 15px;
    font-weight: bold;
    color: #d4af37;
    text-align: center;
}

/* Track output styling */
.track.output-1 { border-left: 4px solid #ff6b6b; }
.track.output-2 { border-left: 4px solid #4ecdc4; }
.track.output-3 { border-left: 4px solid #45b7d1; }
.track.output-4 { border-left: 4px solid #96ceb4; }
.track.output-5 { border-left: 4px solid #feca57; }
.track.output-6 { border-left: 4px solid #ff9ff3; }
.track.output-7 { border-left: 4px solid #54a0ff; }
.track.output-8 { border-left: 4px solid #5f27cd; }

.output-channel-label {
    font-size: 0.8em;
    font-weight: bold;
    margin-left: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(0,0,0,0.3);
}

.keep-sample-control {
    margin: 10px 0;
    padding: 8px;
    background: rgba(212, 175, 55, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.keep-sample-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    color: #d4af37;
}

.keep-sample-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.keep-sample-info {
    font-size: 0.8em;
    color: #aaa;
    margin-top: 4px;
    font-style: italic;
}

.keep-sample-control.active {
    background: rgba(76, 175, 80, 0.1);
    border-color: rgba(76, 175, 80, 0.3);
}

.keep-sample-control.active .keep-sample-toggle {
    color: #4caf50;
}