@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@300;400;500;600&display=swap');

:root {
    /* Enhanced Dark Aesthetic Palette */
    --bg-primary: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --bg-tertiary: #333333;
    --bg-panel: #252525;
    
    --metal-dark: #0f0f0f;
    --metal-medium: #1f1f1f;
    --metal-light: #2f2f2f;
    --metal-accent: #3f3f3f;
    
    --border-dark: #111111;
    --border-medium: #333333;
    --border-light: #444444;
    
    /* Chalky White Text */
    --text-primary: #f0f0f0;
    --text-secondary: #d0d0d0;
    --text-tertiary: #b0b0b0;
    --text-accent: #c0c0c0;
    
    --accent-primary: #4a9eff;
    --accent-secondary: #357abd;
    --accent-warning: #ffab40;
    --accent-danger: #f44336;
    --accent-success: #4caf50;
    
    /* Deep Teal Highlights */
    --teal-primary: #008080;
    --teal-secondary: #006666;
    --teal-glow: rgba(0, 128, 128, 0.6);
    
    /* CRT Display Colors - Deep Teal */
    --crt-green: #008080;
    --crt-amber: #ffb000;
    --crt-screen: #050f0f;
    --crt-glass: rgba(0, 128, 128, 0.1);
    
    /* Enhanced: Darker playhead color */
    --playhead-green: #004040;
    
    /* Blood Red Grain Color */
    --grain-red: #ff0000;
    --grain-glow: rgba(255, 0, 0, 0.8);
    
    /* CHANGED: New active button color as requested */
    --loop-active-teal: #80BA86;
    
    --shadow-light: 0 2px 4px rgba(0,0,0,0.5);
    --shadow-medium: 0 4px 12px rgba(0,0,0,0.6);
    --shadow-heavy: 0 8px 24px rgba(0,0,0,0.8);
    --shadow-deep: 0 12px 32px rgba(0,0,0,0.9);
    --shadow-inset: inset 0 2px 4px rgba(0,0,0,0.5);
}

/* iPhone Notch/Dynamic Island Styling */
@supports (padding: max(0px)) {
    html {
        background-color: var(--bg-primary);
        padding-top: env(safe-area-inset-top);
    }
    
    body {
        background: linear-gradient(135deg, var(--bg-primary) 0%, var(--metal-dark) 100%);
        padding-top: 0;
    }
    
    .container {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
}

/* SVG Noise Filters */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Global Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'IBM Plex Mono', 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--metal-dark) 100%);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    filter: url(#noise-filter);
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255,255,255,0.02) 1px, transparent 1px),
        radial-gradient(circle at 80% 50%, rgba(0,0,0,0.02) 1px, transparent 1px),
        radial-gradient(circle at 40% 20%, rgba(255,255,255,0.01) 1px, transparent 1px),
        radial-gradient(circle at 60% 80%, rgba(0,0,0,0.01) 1px, transparent 1px);
    background-size: 3px 3px, 4px 4px, 2px 2px, 5px 5px;
    pointer-events: none;
    z-index: -1;
    opacity: 0.3;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px;
    position: relative;
}
/* Enhanced Header with NEW Text Logo and Particle Effects */
.main-header {
    text-align: center;
    margin-bottom: 12px;
    padding: 20px 0;
    border-bottom: 2px solid var(--border-medium);
    background: linear-gradient(135deg, var(--metal-medium) 0%, var(--metal-dark) 100%);
    border-radius: 8px;
    box-shadow: var(--shadow-deep);
    position: relative;
    overflow: hidden;
    filter: url(#noise-filter-strong);
}

/* NEW: Text-based GRAINS logo */
.grains-text-logo {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(18px, 4vw, 29px);
    font-weight: 600;
    color: #c0c0c0;
    text-shadow: 
        0 0 14px var(--teal-glow),
        0 0 40px var(--teal-glow),
        0 2px 8px rgba(0,0,0,0.8);
    letter-spacing: clamp(2px, 0.5vw, 4px);
    margin-bottom: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
    user-select: none;
    word-break: break-word;
    overflow-wrap: break-word;
}

.grains-text-logo:hover {
    color: var(--teal-primary);
    text-shadow: 
        0 0 15px var(--teal-glow),
        0 0 30px var(--teal-glow),
        0 0 45px rgba(0,128,128,0.4),
        0 2px 12px rgba(0,0,0,0.9);
    transform: scale(1.02);
    cursor:crosshair;
}

/* ASCII-style grain texture overlay for logo */
.grains-text-logo::before {
    content: '▓▓▓▓▓░░▓▓▓▓▓░░▓▓▓▓▓░░▓▓▓▓▓░░▓▓▓▓▓░░▓▓▓▓▓';
    position: absolute;
    top: -5px;
    left: 0;
    width: 100%;
    height: 100%;
    font-size: 8px;
    opacity: 0.3;
    color: var(--teal-primary);
    letter-spacing: 1px;
    pointer-events: none;
    animation: grain-flicker 2s ease-in-out infinite alternate;
}

@keyframes grain-flicker {
    0% { opacity: 0.2; }
    100% { opacity: 0.4; }
}

/* Hide the old image logo */
#grainsIMG {
    display: none;
}

.logo-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: var(--teal-primary);
    border-radius: 50%;
    opacity: 0.4;
    animation: swirl 8s infinite linear;
    box-shadow: 0 0 5px var(--teal-glow);
}

.particle:nth-child(1) { animation-delay: 0s; top: 15%; left: 10%; }
.particle:nth-child(2) { animation-delay: 1s; top: 25%; left: 85%; }
.particle:nth-child(3) { animation-delay: 2s; top: 75%; left: 15%; }
.particle:nth-child(4) { animation-delay: 3s; top: 45%; left: 75%; }
.particle:nth-child(5) { animation-delay: 4s; top: 85%; left: 50%; }
.particle:nth-child(6) { animation-delay: 2.5s; top: 35%; left: 40%; }
.particle:nth-child(7) { animation-delay: 1.5s; top: 65%; left: 80%; }
.particle:nth-child(8) { animation-delay: 3.5s; top: 10%; left: 60%; }
.particle:nth-child(9) { animation-delay: 0.5s; top: 55%; left: 25%; }

@keyframes swirl {
    0% {
        transform: rotate(0deg) translateX(30px) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.4;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: rotate(360deg) translateX(30px) rotate(-360deg);
        opacity: 0;
    }
}

.main-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: 2px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
    position: relative;
    z-index: 2;
}

.subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: 1px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

/* Enhanced Drop Zone with Falling Dust */
.drop-zone {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--metal-medium) 100%);
    border: 2px dashed var(--border-medium);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    margin-bottom: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-deep);
    position: relative;
    overflow: hidden;
    filter: url(#noise-filter);
}

.drop-zone:hover,
.drop-zone.dragover {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--metal-light) 100%);
    border-color: var(--teal-primary);
    box-shadow: 0 0 25px var(--teal-glow);
}

.drop-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 2;
}

.drop-icon {
    font-size: 20px;
    opacity: 0.7;
    color: var(--text-secondary);
}

.drop-text {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.falling-dust {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.dust-particle {
    position: absolute;
    width: 1px;
    height: 1px;
    background: var(--text-tertiary);
    opacity: 0.4;
    animation: fall linear infinite;
}

.dust-particle:nth-child(odd) {
    animation-duration: 3s;
    animation-delay: 0s;
}

.dust-particle:nth-child(even) {
    animation-duration: 4s;
    animation-delay: 1s;
}

@keyframes fall {
    0% {
        transform: translateY(-10px) translateX(0px);
        opacity: 0;
    }
    10% {
        opacity: 0.4;
    }
    90% {
        opacity: 0.2;
    }
    100% {
        transform: translateY(100px) translateX(10px);
        opacity: 0;
    }
}
/* Status Bar */
.status-bar {
    margin-bottom: 16px;
}

.status {
    background: linear-gradient(135deg, var(--metal-medium) 0%, var(--metal-dark) 100%);
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    padding: 12px 16px;
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    box-shadow: var(--shadow-deep);
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    line-height: 1.4;
}

/* Mobile alert styling within status */
.status .mobile-alert {
    color: var(--accent-warning);
    font-weight: 600;
    text-shadow: 0 0 4px rgba(255, 171, 64, 0.4);
    display: inline-block;
    margin-left: 8px;
    animation: gentle-pulse 2s ease-in-out infinite;
}

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

/* Enhanced Oscilloscope with Glass Effects */
.oscilloscope-container {
    margin-bottom: 24px;
    position: relative;
}

.scope-frame {
    background: linear-gradient(145deg, var(--metal-dark), var(--metal-medium));
    border-radius: 16px;
    padding: 24px;
    box-shadow: 
        var(--shadow-deep),
        inset 0 2px 0 rgba(255,255,255,0.1),
        inset 0 -2px 0 rgba(0,0,0,0.5);
    position: relative;
    border: 2px solid var(--border-dark);
}

.scope-frame::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--metal-accent), var(--metal-light), var(--metal-accent));
    border-radius: 18px;
    z-index: -1;
}

.scope-bezel {
    background: radial-gradient(ellipse at center, var(--metal-medium) 0%, var(--metal-dark) 70%);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 
        inset 0 0 25px rgba(0,0,0,0.9),
        inset 0 0 50px rgba(0,0,0,0.7);
}

.scope-screen {
    background: 
        radial-gradient(ellipse at center, 
            var(--crt-screen) 0%, 
            #001010 70%,
            #001a1a 100%);
    border-radius: 10px;
    padding: 10px;
    position: relative;
    height: 180px;
    box-shadow: 
        inset 0 0 35px rgba(0,0,0,0.95),
        inset 0 0 70px rgba(0,0,0,0.8),
        0 0 20px rgba(0,0,0,0.6);
    background-image: 
        radial-gradient(ellipse at 25% 25%, rgba(0,128,128,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 75% 75%, rgba(0,128,128,0.03) 0%, transparent 40%);
    overflow: hidden;
    border: 2px solid var(--border-dark);
}

.scope-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(135deg, 
            rgba(255,255,255,0.12) 0%, 
            transparent 25%,
            transparent 75%,
            rgba(0,128,128,0.05) 100%);
    border-radius: 8px;
    pointer-events: none;
}

.scope-screen::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent 0px,
            transparent 1px,
            rgba(0,128,128,0.03) 1px,
            rgba(0,128,128,0.03) 2px
        );
    pointer-events: none;
    border-radius: 8px;
}

.scope-glass-effects {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    border-radius: 8px;
    overflow: hidden;
}

.droplet {
    position: absolute;
    width: 2px;
    height: 6px;
    background: linear-gradient(to bottom, 
        rgba(0,128,128,0.6) 0%, 
        rgba(0,128,128,0.3) 50%, 
        rgba(0,128,128,0.1) 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: drip 4s ease-in infinite;
    opacity: 0;
}

@keyframes drip {
    0% {
        top: 0;
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        top: 100%;
        opacity: 0;
    }
}

.glass-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 30%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255,255,255,0.1) 50%, 
        transparent 100%);
    animation: shine 45s ease-in-out infinite;
    transform: skewX(-20deg);
}

@keyframes shine {
    0%, 95% {
        left: -100%;
        opacity: 0;
    }
    96% {
        opacity: 1;
    }
    100% {
        left: 100%;
        opacity: 0;
    }
}

.scope-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(90deg, rgba(0,128,128,0.15) 1px, transparent 1px),
        linear-gradient(0deg, rgba(0,128,128,0.15) 1px, transparent 1px);
    background-size: 24px 24px;
    opacity: 0.4;
    pointer-events: none;
}

#waveform {
    width: 100%;
    height: 160px;
    border-radius: 8px;
    background: transparent;
    display: block;
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    filter: drop-shadow(0 0 6px var(--teal-glow));
}

.scan-line {
    position: absolute;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background: linear-gradient(to bottom, 
        var(--playhead-green) 0%, 
        #002020 50%, 
        var(--playhead-green) 100%);
    left: 0%;
    z-index: 10;
    box-shadow: 
        0 0 8px var(--playhead-green),
        0 0 16px rgba(0,64,64,0.4);
    border-radius: 1px;
}

#grainCanvas {
    width: 100%;
    height: 160px;
    border-radius: 8px;
    background: transparent;
    display: block;
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    pointer-events: none;
}

.scope-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--metal-dark) 0%, var(--metal-medium) 100%);
    border-radius: 8px;
    border: 1px solid var(--border-dark);
    box-shadow: var(--shadow-medium);
}

.scope-label {
    font-size: 10px;
    color: var(--text-tertiary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.scope-indicators {
    display: flex;
    gap: 10px;
}

.indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--metal-dark);
    border: 1px solid var(--border-medium);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.6);
}

.indicator.active {
    background: var(--teal-primary);
    box-shadow: 
        0 0 8px var(--teal-glow),
        inset 0 2px 4px rgba(255,255,255,0.3);
}

/* Transport Bar - IMPROVED Mobile Layout */
.transport-bar-container {
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    background: var(--metal-dark);
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: var(--shadow-deep);
    flex-wrap: wrap;
}

.transport-section {
    display: flex;
    flex-direction: row;
    gap: 6px;
    align-items: center;
    background: none;
    border: none;
    padding: 0;
    box-shadow: none;
    min-width: 0;
}

.transport-controls {
    display: flex;
    flex-direction: row;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.preset-controls {
    display: flex;
    flex-direction: row;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.volume-controls {
    display: flex;
    flex-direction: row;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.master-volume-control {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-secondary);
}

.master-volume-control input[type="range"] {
    width: 80px;
}

#presetSelect {
    width: auto;
    min-width: 120px;
    margin-bottom: 0;
}

.preset-btn {
    padding: 6px 12px;
    font-size: 10px;
    min-width: 60px;
}

#presetSelect {
    min-width: 140px;
}

.master-volume-control label {
    font-weight: 500;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.master-volume-control input[type="range"] {
    width: 120px;
}
/* UPDATED Signal Path Diagram - Removed modules */
.signal-path-diagram {
    background: linear-gradient(135deg, var(--metal-dark) 0%, var(--bg-tertiary) 100%);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    padding: 12px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-deep);
}

.signal-flow {
    font-size: 9px;
    color: var(--teal-primary);
    text-align: center;
    letter-spacing: 1px;
    font-weight: 600;
    text-shadow: 0 0 6px var(--teal-glow);
}

.process-module {
    animation: phosphor-pulse 4s ease-in-out infinite;
    display: inline-block;
}

.process-module:nth-child(2n) {
    animation-delay: 0.4s;
}

.process-module:nth-child(3n) {
    animation-delay: 0.8s;
}

.process-module:nth-child(4n) {
    animation-delay: 1.2s;
}

.process-module:nth-child(5n) {
    animation-delay: 1.6s;
}

@keyframes phosphor-pulse {
    0%, 100% {
        text-shadow: 
            0 0 6px var(--teal-primary),
            0 0 12px var(--teal-primary),
            0 0 18px var(--teal-glow);
        opacity: 0.9;
    }
    50% {
        text-shadow: 
            0 0 8px var(--teal-primary),
            0 0 16px var(--teal-primary),
            0 0 24px var(--teal-glow),
            0 0 32px rgba(0,128,128,0.3);
        opacity: 1;
    }
}

/* Controls Grid */
.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

/* Enhanced Control Panel with Deeper Shadows */
.control-panel {
    background: linear-gradient(135deg, var(--bg-panel) 0%, var(--metal-medium) 100%);
    border: 2px solid var(--border-medium);
    border-radius: 12px;
    padding: 18px;
    box-shadow: 
        var(--shadow-deep),
        inset 0 2px 0 rgba(255,255,255,0.08);
    position: relative;
    filter: url(#noise-filter);
}

.control-panel::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    border-radius: 1px;
}

.panel-icon {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 18px;
    height: 18px;
    color: var(--text-tertiary);
    opacity: 0.8;
    z-index: 2;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

.panel-icon svg {
    width: 100%;
    height: 100%;
}

.panel-screws {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.screw {
    position: absolute;
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, var(--metal-dark) 0%, var(--border-dark) 100%);
    border: 1px solid var(--border-medium);
    border-radius: 0;
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
    box-shadow: 
        inset 0 2px 2px rgba(255,255,255,0.15),
        0 2px 4px rgba(0,0,0,0.4);
}

.screw::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3px;
    height: 1px;
    background: var(--border-light);
    transform: translate(-50%, -50%);
    box-shadow: 0 1px 1px rgba(0,0,0,0.3);
}

.screw.top-left {
    top: 10px;
    left: 10px;
}

.screw.top-right {
    top: 10px;
    right: 10px;
}

.screw.bottom-left {
    bottom: 10px;
    left: 10px;
}

.screw.bottom-right {
    bottom: 10px;
    right: 10px;
}

.control-panel h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-accent);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-medium);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding-right: 28px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

.playback-panel {
    grid-column: 1 / -1;
}

.status-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    padding: 10px;
    background: var(--metal-dark);
    border-radius: 6px;
    border: 1px solid var(--border-dark);
    box-shadow: var(--shadow-inset);
}

.status-display.compact {
    padding: 8px;
    gap: 8px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
}

.status-item label {
    color: var(--text-tertiary);
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.status-item span {
    color: var(--text-primary);
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Enhanced Slider Styles with Wider Caps */
.slider-group {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.slider-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}

.slider-item.compact {
    gap: 4px;
}

.slider-item label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.slider-item label span {
    font-weight: 600;
    color: var(--teal-primary);
    font-size: 10px;
}

/* NEW: Slider indicator lights */
.slider-indicator {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--metal-dark);
    border: 1px solid var(--border-medium);
    transition: all 0.3s ease;
    z-index: 10;
}

.slider-indicator.active {
    background: var(--teal-primary);
    box-shadow: 0 0 8px var(--teal-glow);
}

/* Vocoder band indicators */
.vocoder-band {
    position: relative;
}

.vocoder-band::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--metal-dark);
    border: 1px solid var(--border-medium);
    transition: all 0.3s ease;
}

.vocoder-band.changed::after {
    background: #4caf50;
    box-shadow: 0 0 8px #4caf50, 0 0 16px rgba(76, 175, 80, 0.6);
    opacity: 1;
}

/* Sequencer step indicators */
.seq-step {
    position: relative;
}

.seq-step::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--metal-dark);
    border: 1px solid var(--border-medium);
    transition: all 0.3s ease;
}

.seq-step.changed::after {
    background: #4caf50;
    box-shadow: 0 0 8px #4caf50, 0 0 16px rgba(76, 175, 80, 0.6);
    opacity: 1;
}

/* Isolator band indicators */
.isolator-band {
    position: relative;
}

.isolator-band::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--metal-dark);
    border: 1px solid var(--border-medium);
    transition: all 0.3s ease;
}

.isolator-band.changed::after {
    background: #4caf50;
    box-shadow: 0 0 8px #4caf50, 0 0 16px rgba(76, 175, 80, 0.6);
    opacity: 1;
}

/* NEW: LFO Indicators */
.lfo-indicator {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--loop-active-teal);
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 0 6px var(--loop-active-teal);
    z-index: 10;
}

.lfo-indicator.active {
    opacity: 1;
    animation: lfo-pulse 2s ease-in-out infinite;
}

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

/* Green indicator lights for adjusted sliders */
.slider-value-indicator {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4caf50;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 0 4px #4caf50;
    z-index: 10;
}

.slider-value-indicator.active {
    opacity: 1;
}

/* Enhanced Industrial Slider Design with Wider Caps */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 10px;
    border-radius: 3px;
    background: linear-gradient(135deg, var(--metal-dark) 0%, var(--bg-tertiary) 100%);
    border: 1px solid var(--border-dark);
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-inset);
}

input[type="range"]:hover {
    background: linear-gradient(135deg, var(--metal-medium) 0%, var(--bg-tertiary) 100%);
    border-color: var(--teal-primary);
    box-shadow: 
        var(--shadow-inset),
        0 0 8px var(--teal-glow);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 18px;
    border-radius: 3px;
    background: linear-gradient(135deg, var(--teal-primary) 0%, var(--teal-secondary) 100%);
    border: 1px solid var(--border-light);
    cursor: pointer;
    box-shadow: 
        var(--shadow-light),
        inset 0 2px 0 rgba(255,255,255,0.25);
    transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: linear-gradient(135deg, #00a0a0 0%, var(--teal-primary) 100%);
    transform: scale(1.05);
    box-shadow: 
        var(--shadow-medium),
        0 0 12px var(--teal-glow);
}

input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(0.98);
}

/* Enhanced Select Styles with Dark Background */
.select-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.select-item label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

select, .dark-select {
    padding: 8px 12px;
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    background: linear-gradient(135deg, var(--metal-dark) 0%, var(--bg-primary) 100%);
    font-size: 11px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-inset);
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

select option, .dark-select option {
    background: var(--metal-dark);
    color: var(--text-primary);
    border: none;
    padding: 4px 8px;
}

select:hover, .dark-select:hover {
    border-color: var(--teal-primary);
    background: linear-gradient(135deg, var(--metal-medium) 0%, var(--bg-secondary) 100%);
    box-shadow: 
        var(--shadow-inset),
        0 0 8px var(--teal-glow);
}

select:focus, .dark-select:focus {
    outline: none;
    border-color: var(--teal-primary);
    box-shadow: 0 0 0 2px rgba(0, 128, 128, 0.3);
}

/* Enhanced Button Styles with 3D Effects */
button {
    padding: 10px 16px;
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    background: linear-gradient(135deg, var(--metal-light) 0%, var(--metal-medium) 100%);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    box-shadow: 
        0 4px 8px rgba(0,0,0,0.4),
        inset 0 2px 0 rgba(255,255,255,0.15),
        inset 0 -2px 0 rgba(0,0,0,0.4);
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

button::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    border-radius: 5px 5px 0 0;
}

button:hover {
    background: linear-gradient(135deg, var(--metal-accent) 0%, var(--metal-light) 100%);
    border-color: var(--teal-primary);
    color: var(--text-primary);
    box-shadow: 
        0 4px 12px rgba(0,0,0,0.5),
        inset 0 2px 0 rgba(255,255,255,0.2),
        0 0 10px var(--teal-glow);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(1px);
    box-shadow: var(--shadow-inset);
}

.play-button {
    background: linear-gradient(135deg, var(--teal-primary) 0%, var(--teal-secondary) 100%);
    color: white;
    border-color: var(--teal-primary);
    box-shadow: 
        0 4px 8px rgba(0,0,0,0.4),
        inset 0 2px 0 rgba(255,255,255,0.15),
        inset 0 -2px 0 rgba(0,0,0,0.4);
    position: relative;
}

.play-button::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    border-radius: 5px 5px 0 0;
}

.play-button:hover {
    background: linear-gradient(135deg, #00a0a0 0%, var(--teal-primary) 100%);
    color: white;
    box-shadow: 
        0 4px 12px rgba(0,0,0,0.5),
        inset 0 2px 0 rgba(255,255,255,0.2),
        0 0 12px var(--teal-glow);
    transform: translateY(-1px);
}

.play-button.playing {
    background: linear-gradient(135deg, rgba(112, 30, 43, 0.986) 0%, #5a1e2b 100%);
    color: white;
    border-color: rgba(112, 30, 43, 0.986);
}

/* CHANGED: Loop button active state - new color */
.loop-button.active {
    background: linear-gradient(135deg, var(--loop-active-teal) 0%, #6b9d71 100%);
    color: white;
    border-color: var(--loop-active-teal);
    box-shadow: 
        var(--shadow-medium),
        0 0 15px rgba(128, 186, 134, 0.5);
}

.record-button {
    background: linear-gradient(135deg, var(--accent-danger) 0%, #922323 100%);
    color: white;
    border-color: var(--accent-danger);
    font-weight: 600;
    box-shadow: 
        0 4px 8px rgba(0,0,0,0.4),
        inset 0 2px 0 rgba(255,255,255,0.15),
        inset 0 -2px 0 rgba(0,0,0,0.4);
    position: relative;
}

.record-button::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    border-radius: 5px 5px 0 0;
}

.record-button:hover {
    background: linear-gradient(135deg, #f55555 0%, var(--accent-danger) 100%);
    color: white;
    box-shadow: 
        0 4px 12px rgba(0,0,0,0.5),
        inset 0 2px 0 rgba(255,255,255,0.2),
        0 0 12px rgba(244, 67, 54, 0.5);
    transform: translateY(-1px);
}

.record-button.recording {
    animation: recording-pulse 1s ease-in-out infinite alternate;
}

@keyframes recording-pulse {
    0% { 
        opacity: 1; 
        box-shadow: var(--shadow-medium), 0 0 15px rgba(244, 67, 54, 0.5); 
    }
    100% { 
        opacity: 0.8; 
        box-shadow: var(--shadow-medium), 0 0 25px rgba(244, 67, 54, 0.8); 
    }
}

/* Enhanced Button Groups */
.button-group {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.mod-source-btn, .grain-shape-btn {
    flex: 1;
    padding: 6px 8px;
    font-size: 9px;
    min-width: 0;
    box-shadow: 
        0 3px 6px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.15),
        inset 0 -1px 0 rgba(0,0,0,0.4);
    position: relative;
}

.mod-source-btn::before, .grain-shape-btn::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    border-radius: 5px 5px 0 0;
}

.mod-source-btn.active, .grain-shape-btn.active {
    background: linear-gradient(135deg, var(--teal-primary) 0%, var(--teal-secondary) 100%);
    color: white;
    border-color: var(--teal-primary);
    box-shadow: 
        var(--shadow-medium),
        0 0 10px var(--teal-glow);
}

.section-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Vocoder Styles */
.vocoder-bands {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.vocoder-band {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
}

.vocoder-band label {
    font-size: 9px;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.vocoder-band label span {
    font-weight: 600;
    color: var(--teal-primary);
    font-size: 8px;
    display: block;
}

.vocoder-slider {
    writing-mode: bt-lr;
    -webkit-appearance: slider-vertical;
    width: 24px;
    height: 70px;
    background: linear-gradient(to top, var(--metal-dark) 0%, var(--bg-tertiary) 100%);
    outline: none;
    border: 1px solid var(--border-dark);
    border-radius: 3px;
    box-shadow: var(--shadow-inset);
}

.vocoder-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 10px;
    border-radius: 3px;
    background: linear-gradient(135deg, var(--teal-primary) 0%, var(--teal-secondary) 100%);
    border: 1px solid var(--border-light);
    cursor: pointer;
    box-shadow: var(--shadow-light);
}

.vocoder-slider::-webkit-slider-thumb:hover {
    background: linear-gradient(135deg, #00a0a0 0%, var(--teal-primary) 100%);
    box-shadow: 
        var(--shadow-medium),
        0 0 10px var(--teal-glow);
}

/* NEW: WARP Module Styles with LFO controls */
.warp-display-container {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.warp-display {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--crt-screen) 0%, #001010 70%, #001a1a 100%);
    border: 2px solid var(--border-dark);
    box-shadow: 
        inset 0 0 20px rgba(0,0,0,0.9),
        0 0 15px rgba(0,128,128,0.3);
}

#warpCanvas {
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.warp-inner-dial {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    border: 2px solid var(--teal-primary);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 128, 128, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.warp-inner-dial:hover {
    background: rgba(0, 128, 128, 0.2);
    box-shadow: 0 0 10px var(--teal-glow);
}

.warp-outer-dial {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid var(--teal-secondary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.warp-outer-dial:hover {
    border-color: var(--teal-primary);
    box-shadow: 0 0 15px var(--teal-glow);
}

/* NEW: WARP LFO Controls */
.warp-lfo-section {
    border-top: 1px solid var(--border-medium);
    padding-top: 12px;
    margin-top: 12px;
}

.warp-lfo-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
/* String Sequencer Styles */
.string-seq-toggle {
    margin-bottom: 12px;
    text-align: center;
}

.seq-toggle-btn {
    padding: 10px 18px;
    background: linear-gradient(135deg, var(--teal-primary) 0%, var(--teal-secondary) 100%);
    color: white;
    border: 1px solid var(--teal-primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 8px rgba(0,0,0,0.4),
        inset 0 2px 0 rgba(255,255,255,0.15),
        inset 0 -2px 0 rgba(0,0,0,0.4);
    position: relative;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.seq-toggle-btn::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    border-radius: 5px 5px 0 0;
}

.seq-toggle-btn:hover {
    background: linear-gradient(135deg, var(--metal-accent) 0%, var(--metal-light) 100%);
    border-color: var(--teal-primary);
    box-shadow: 
        0 4px 12px rgba(0,0,0,0.5),
        inset 0 2px 0 rgba(255,255,255,0.2);
}

.seq-toggle-btn.active {
    background: linear-gradient(135deg, var(--loop-active-teal) 0%, #6b9d71 100%);
    color: white;
    border-color: var(--loop-active-teal);
    box-shadow: 
        var(--shadow-medium),
        0 0 15px rgba(128, 186, 134, 0.5);
}

.string-seq-wave {
    margin-bottom: 12px;
    border: 1px solid var(--border-dark);
    border-radius: 6px;
    background: var(--crt-screen);
    padding: 6px;
    box-shadow: var(--shadow-inset);
}

#stringSeqWave {
    width: 100%;
    height: 45px;
    background: transparent;
    border-radius: 3px;
}

.seq-steps {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.seq-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: relative;
}

.seq-step label {
    font-size: 9px;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.seq-step label span {
    font-weight: 600;
    color: var(--teal-primary);
    font-size: 8px;
    display: block;
}

.seq-step-slider {
    writing-mode: bt-lr;
    -webkit-appearance: slider-vertical;
    width: 18px;
    height: 60px;
    background: linear-gradient(to top, var(--metal-dark) 0%, var(--bg-tertiary) 100%);
    outline: none;
    border: 1px solid var(--border-dark);
    border-radius: 3px;
    box-shadow: var(--shadow-inset);
}

.seq-step-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 8px;
    border-radius: 3px;
    background: linear-gradient(135deg, var(--teal-primary) 0%, #00a0a0 100%);
    border: 1px solid var(--border-light);
    cursor: pointer;
    box-shadow: var(--shadow-light);
}

.seq-step-slider::-webkit-slider-thumb:hover {
    background: linear-gradient(135deg, #00c0c0 0%, var(--teal-primary) 100%);
    box-shadow: 
        var(--shadow-medium),
        0 0 10px var(--teal-glow);
}

/* NEW: Chromatic Envelope Styles */
.envelope-canvas-container {
    margin-bottom: 16px;
    border: 1px solid var(--border-dark);
    border-radius: 6px;
    background: var(--crt-screen);
    padding: 8px;
    box-shadow: var(--shadow-inset);
}

#envelopeCanvas {
    width: 100%;
    height: 120px;
    background: transparent;
    border-radius: 3px;
    cursor: crosshair;
}

.envelope-btn {
    flex: 1;
    padding: 6px 12px;
    font-size: 10px;
    margin: 0 2px;
}

.envelope-btn.active {
    background: linear-gradient(135deg, var(--loop-active-teal) 0%, #6b9d71 100%);
    color: white;
    border-color: var(--loop-active-teal);
}

/* NEW: 3-Band Frequency Isolator Styles */
.isolator-bands {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 12px;
}

.isolator-band {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
}

.isolator-band label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.isolator-band label span {
    font-weight: 600;
    color: var(--teal-primary);
    font-size: 10px;
    display: block;
}

.isolator-slider {
    writing-mode: bt-lr;
    -webkit-appearance: slider-vertical;
    width: 30px;
    height: 100px;
    background: linear-gradient(to top, var(--metal-dark) 0%, var(--bg-tertiary) 100%);
    outline: none;
    border: 1px solid var(--border-dark);
    border-radius: 4px;
    box-shadow: var(--shadow-inset);
}

.isolator-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 26px;
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(135deg, var(--teal-primary) 0%, var(--teal-secondary) 100%);
    border: 1px solid var(--border-light);
    cursor: pointer;
    box-shadow: var(--shadow-light);
}

.isolator-slider::-webkit-slider-thumb:hover {
    background: linear-gradient(135deg, #00a0a0 0%, var(--teal-primary) 100%);
    box-shadow: 
        var(--shadow-medium),
        0 0 12px var(--teal-glow);
}

/* REMOVED: PT2399, Liquefier, T-Resonator display containers are removed */

/* Mobile Keyboard */
.mobile-keyboard {
    background: linear-gradient(135deg, var(--bg-panel) 0%, var(--metal-medium) 100%);
    border: 2px solid var(--border-medium);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 16px;
    display: none;
    box-shadow: var(--shadow-deep);
    filter: url(#noise-filter);
}

.keyboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 18px;
}

.keyboard-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.keyboard-section h4 {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-accent);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
    text-align: center;
}

.keyboard-row {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

.key-btn {
    padding: 6px 8px;
    min-width: 28px;
    font-size: 9px;
    font-weight: 600;
    border-radius: 4px;
    background: linear-gradient(135deg, var(--metal-light) 0%, var(--metal-medium) 100%);
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    box-shadow: var(--shadow-light);
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.key-btn:active,
.key-btn.active {
    background: linear-gradient(135deg, var(--teal-primary) 0%, var(--teal-secondary) 100%);
    color: white;
    border-color: var(--teal-primary);
    transform: scale(0.95);
    box-shadow: 
        var(--shadow-inset),
        0 0 10px var(--teal-glow);
}

.key-btn.scan-key:active,
.key-btn.scan-key.active {
    background: linear-gradient(135deg, var(--accent-warning) 0%, #f57c00 100%);
    color: white;
    border-color: var(--accent-warning);
    box-shadow: 
        var(--shadow-inset),
        0 0 10px rgba(255, 171, 64, 0.5);
}

.key-btn.fine-key:active,
.key-btn.fine-key.active {
    background: linear-gradient(135deg, var(--teal-primary) 0%, #00a0a0 100%);
    color: white;
    border-color: var(--teal-primary);
    box-shadow: 
        var(--shadow-inset),
        0 0 10px var(--teal-glow);
}

.key-btn.space-key {
    min-width: 120px;
    background: linear-gradient(135deg, var(--teal-primary) 0%, var(--teal-secondary) 100%);
    color: white;
    border-color: var(--teal-primary);
    font-size: 10px;
}

/* Enhanced Grain Animation Effects - 2x bigger particles */
.grain-particle-enhanced {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--grain-red);
    border-radius: 50%;
    opacity: 0.9;
    animation: grain-spray 2s ease-out forwards;
    box-shadow: 
        0 0 4px var(--grain-red),
        0 0 8px var(--grain-glow),
        0 0 12px rgba(255, 0, 0, 0.4);
}

@keyframes grain-spray {
    0% {
        transform: scale(1) translate(0, 0);
        opacity: 0.9;
    }
    50% {
        transform: scale(1.5) translate(var(--spray-x, 0), var(--spray-y, 0));
        opacity: 0.7;
    }
    100% {
        transform: scale(0.5) translate(calc(var(--spray-x, 0) * 2), calc(var(--spray-y, 0) * 2));
        opacity: 0;
    }
}

/* Waveform Green Variants Animation */
.waveform-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    border-radius: 8px;
    background: radial-gradient(circle at var(--glow-x, 50%) var(--glow-y, 50%), 
        rgba(0, 128, 128, 0.2) 0%, 
        rgba(0, 128, 128, 0.1) 30%, 
        transparent 60%);
    animation: electrical-pulse 3s ease-in-out infinite;
}

@keyframes electrical-pulse {
    0%, 100% {
        opacity: 0.3;
        filter: hue-rotate(0deg);
    }
    25% {
        opacity: 0.6;
        filter: hue-rotate(10deg);
    }
    50% {
        opacity: 0.8;
        filter: hue-rotate(-10deg);
    }
    75% {
        opacity: 0.5;
        filter: hue-rotate(5deg);
    }
}

/* Instructions */
.instructions {
    background: linear-gradient(135deg, var(--bg-panel) 0%, var(--metal-medium) 100%);
    border: 2px solid var(--border-medium);
    border-radius: 12px;
    padding: 18px;
    margin-top: 16px;
    box-shadow: var(--shadow-deep);
    filter: url(#noise-filter);
}

.instruction-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.instruction-column h4 {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-accent);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

.instruction-column ul {
    list-style: none;
    font-size: 11px;
    line-height: 1.5;
}

.instruction-column li {
    margin-bottom: 4px;
    color: var(--text-secondary);
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.instruction-column strong {
    color: var(--teal-primary);
    font-weight: 600;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.active-grains {
    color: var(--teal-primary) !important;
    font-weight: 700;
    text-shadow: 0 0 6px var(--teal-glow);
}

@keyframes grain-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.active-grains.pulsing {
    animation: grain-pulse 0.3s ease-in-out;
}

/* Enhanced phosphor button hover effects */
button:hover:not(.active):not(.recording):not(.play-button):not(.record-button):not(.reset-button):not(.mute-button) {
    color: var(--teal-primary);
    text-shadow: 0 0 8px var(--teal-glow);
}

input[type="range"]:hover::-webkit-slider-thumb {
    box-shadow: 
        var(--shadow-medium),
        0 0 10px var(--teal-glow);
}

/* Volume boost indicator */
.volume-boost-indicator {
    position: relative;
}

.volume-boost-indicator::after {
    content: '⚡';
    position: absolute;
    right: -18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--accent-warning);
    opacity: 0;
    transition: opacity 0.3s ease;
    text-shadow: 0 0 4px rgba(255, 171, 64, 0.6);
}

.volume-boost-indicator.boosted::after {
    opacity: 1;
    animation: boost-pulse 1.2s ease-in-out infinite alternate;
}

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

/* Speed Controller Styles */
.speed-controller {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.speed-circle {
    position: relative;
    width: 100px;
    height: 100px;
    border: 2px solid var(--teal-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--metal-dark);
    user-select: none;
}

.speed-circle:hover {
    border-color: var(--teal-glow);
    box-shadow: 0 0 15px var(--teal-glow);
}

.speed-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0%;
    height: 0%;
    background: radial-gradient(circle, var(--teal-primary) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.speed-circle.active .speed-glow {
    opacity: 0.6;
}

.speed-value {
    position: relative;
    z-index: 2;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.speed-circle.active .speed-value {
    color: white;
    text-shadow: 0 0 8px var(--teal-glow);
}

/* Arpeggiator Styles */
.arp-grid-container {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.arp-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 2px;
    width: 120px;
    height: 120px;
    background: transparent;
    border: none;
}

.arp-step {
    background: var(--metal-dark);
    border: 1px solid var(--teal-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.arp-step:hover {
    background: var(--metal-medium);
    box-shadow: 0 0 8px var(--teal-glow);
}

.arp-step.active {
    background: var(--teal-primary);
    box-shadow: 0 0 12px var(--teal-glow);
}

.arp-step.playing {
    background: var(--accent-warning);
    box-shadow: 0 0 15px rgba(255, 171, 64, 0.8);
    animation: arp-pulse 0.2s ease-in-out;
}

@keyframes arp-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.arp-toggle-btn {
    padding: 10px 18px;
    background: linear-gradient(135deg, var(--teal-primary) 0%, var(--teal-secondary) 100%);
    color: white;
    border: 1px solid var(--teal-primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-medium);
}

.arp-toggle-btn.active {
    background: linear-gradient(135deg, var(--accent-danger) 0%, #922323 100%);
    border-color: var(--accent-danger);
    box-shadow: 0 0 15px rgba(244, 67, 54, 0.5);
}

/* WARP LFO text teal color */
#warpStartLfoSpeedValue,
#warpStartLfoDepthValue,
#warpLengthLfoSpeedValue,
#warpLengthLfoDepthValue {
    color: var(--teal-primary) !important;
}

.warp-lfo-label {
    color: var(--teal-primary);
    text-transform: none !important;
}

/* TOP Button */
.top-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 60px;
    background: linear-gradient(135deg, var(--metal-medium) 0%, var(--metal-dark) 100%);
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-medium);
    z-index: 1000;
    user-select: none;
}

.top-button:hover {
    background: linear-gradient(135deg, var(--metal-light) 0%, var(--metal-medium) 100%);
    border-color: var(--teal-primary);
    box-shadow: 
        var(--shadow-deep),
        0 0 10px var(--teal-glow);
    transform: translateY(-2px);
}

.top-arrow {
    font-size: 20px;
    color: var(--text-secondary);
    font-weight: bold;
    line-height: 1;
    margin-bottom: 2px;
}

.top-text {
    font-size: 9px;
    color: var(--text-tertiary);
    font-weight: 600;
    letter-spacing: 0.5px;
    font-family: 'IBM Plex Mono', monospace;
}

.top-button:hover .top-arrow {
    color: var(--teal-primary);
}

.top-button:hover .top-text {
    color: var(--text-secondary);
}

.top-button:active {
    transform: translateY(0px);
    box-shadow: var(--shadow-light);
}

/* Navigation Dots - Enhanced Fixed Positioning */
.nav-dots {
    position: fixed !important;
    left: 8px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 99999 !important;
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(10px) !important;
    border-radius: 20px !important;
    padding: 12px 6px !important;
    width: 16px !important;
    height: auto !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    margin: 0 !important;
    /* Force fixed positioning */
    isolation: isolate !important;
    pointer-events: auto !important;
    visibility: visible !important;
}

.nav-dot {
    position: relative !important;
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
    background: rgba(0, 128, 128, 0.6) !important;
    margin: 8px auto !important;
    margin-left: -3px !important;  /* Keep your centering */
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    opacity: 0.7 !important;
    display: block !important;
    pointer-events: auto !important;
}

.nav-dot:hover {
    opacity: 1 !important;
    transform: scale(1.3) !important;
    background: rgba(0, 128, 128, 0.9) !important;
    box-shadow: 0 0 8px rgba(0, 128, 128, 0.4) !important;
}

.nav-dot.active {
    opacity: 1 !important;
    background: #008080 !important;
    box-shadow: 0 0 6px rgba(0, 128, 128, 0.6) !important;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .nav-dots {
        left: 4px !important;
        top: 50% !important;
        width: 12px !important;
        padding: 10px 4px !important;
    }
    
    .nav-dot {
        width: 6px !important;
        height: 6px !important;
        margin: 6px auto !important;
        margin-left: -2.4px !important;  /* Keep your mobile centering */
    }
}

/* Special highlighting for new features */
.new-feature {
    position: relative;
}

.new-feature::before {
    content: 'NEW';
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--accent-warning);
    color: var(--metal-dark);
    font-size: 8px;
    font-weight: 600;
    padding: 3px 6px;
    border-radius: 3px;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Enhanced Loading States */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(0, 128, 128, 0.2) 50%, 
        transparent 100%);
    animation: loading-sweep 2s ease-in-out infinite;
}

@keyframes loading-sweep {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Enhanced Error States */
.error {
    border-color: var(--accent-danger) !important;
    box-shadow: 0 0 10px rgba(244, 67, 54, 0.4) !important;
    animation: error-pulse 0.5s ease-in-out 3;
}

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

/* Success States */
.success {
    border-color: var(--accent-success) !important;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.4) !important;
    animation: success-glow 2s ease-out;
}

@keyframes success-glow {
    0% { 
        box-shadow: 0 0 20px rgba(76, 175, 80, 0.8);
    }
    100% { 
        box-shadow: 0 0 10px rgba(76, 175, 80, 0.4);
    }
}

/* Enhanced Focus States */
input:focus, select:focus, button:focus {
    outline: none;
    border-color: var(--teal-primary);
    box-shadow: 
        0 0 0 3px rgba(0, 128, 128, 0.3),
        var(--shadow-medium);
}

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

::-webkit-scrollbar-track {
    background: var(--metal-dark);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--teal-primary) 0%, var(--teal-secondary) 100%);
    border-radius: 4px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #00a0a0 0%, var(--teal-primary) 100%);
}

/* Selection Styles */
::selection {
    background: var(--teal-glow);
    color: white;
}

::-moz-selection {
    background: var(--teal-glow);
    color: white;
}

/* ENHANCED RESPONSIVE DESIGN - FIXED Mobile Transport Buttons */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
        filter: url(#noise-filter);
    }
    
    .container {
        padding: 8px;
        max-width: 100vw;
        box-sizing: border-box;
    }
    
    /* FIXED: Transport bar mobile layout - keeps buttons in rows */
    .transport-bar-container {
        flex-direction: column;
        gap: 8px;
        padding: 8px;
        margin-bottom: 12px;
    }
    
    /* Row 1: Play/Rec/Loop/Reset */
    .transport-section:first-child {
        width: 100%;
        justify-content: center;
    }
    
    .transport-controls {
        width: 100%;
        justify-content: space-between;
        flex-wrap: nowrap;
        gap: 4px;
    }
    
    .transport-controls button {
        flex: 1;
        min-width: 60px;
        max-width: 80px;
        padding: 8px 4px;
        font-size: 10px;
        min-height: 36px;
    }
    
    /* Row 2: Preset controls */
    .transport-section:nth-child(2) {
        width: 100%;
        justify-content: center;
    }
    
    .preset-controls {
        width: 100%;
        justify-content: space-between;
        flex-wrap: nowrap;
        gap: 4px;
    }
    
    #presetSelect {
        flex: 2;
        min-width: 120px;
        font-size: 10px;
        min-height: 36px;
    }
    
    .preset-btn {
        flex: 1;
        padding: 8px 6px;
        font-size: 10px;
        min-width: 50px;
        min-height: 36px;
    }
    
    /* Row 3: Mute and Volume */
    .transport-section:last-child {
        width: 100%;
        justify-content: center;
    }
    
    .volume-controls {
        width: 100%;
        justify-content: space-between;
        align-items: center;
        flex-wrap: nowrap;
        gap: 8px;
    }
    
    .volume-controls button {
        flex: 0 0 auto;
        padding: 8px 12px;
        font-size: 10px;
        min-height: 36px;
    }
    
    .master-volume-control {
        flex: 1;
        min-width: 120px;
        gap: 6px;
    }
    
    .master-volume-control input[type="range"] {
        width: 100%;
        min-width: 80px;
        min-height: 36px;
    }
    
    input[type="range"]::-webkit-slider-thumb {
        width: 20px;
        height: 20px;
    }
    
    .master-volume-control label {
        font-size: 10px;
        white-space: nowrap;
    }
    
    /* Other mobile optimizations */
    .controls-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    
    .control-panel {
        padding: 14px;
    }
    
    .scope-frame {
        padding: 18px;
    }
    
    .scope-screen {
        height: 150px;
    }
    
    #waveform, #grainCanvas {
        height: 130px;
    }
    
    .mobile-keyboard {
        display: block !important;
    }
    
    .keyboard-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .vocoder-bands {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
    
    .vocoder-slider {
        height: 50px;
        width: 20px;
    }
    
    .seq-steps {
        grid-template-columns: repeat(5, 1fr);
        gap: 6px;
    }
    
    .seq-step-slider {
        height: 45px;
        width: 14px;
    }
    
    .signal-flow {
        font-size: 8px;
        line-height: 1.3;
    }
    
    .signal-path-diagram {
        padding: 8px 12px;
        margin-bottom: 12px;
    }
    
    .instruction-grid {
        grid-template-columns: 1fr;
    }
}


/* CRITICAL FIX: Transport buttons below 480px - KEEP IN ROWS */
@media (max-width: 480px) {
    .container {
        padding: 6px;
    }
    
    .transport-bar-container {
        gap: 6px;
        padding: 6px;
    }
    
    /* FORCE buttons to stay in rows, not stack vertically */
    .transport-controls {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
    }
    
    .preset-controls {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
    }
    
    .volume-controls {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
    }
    
    .transport-controls button {
        font-size: 9px;
        padding: 6px 2px;
        min-height: 32px;
        min-width: 45px;
    }
    
    .preset-btn {
        font-size: 8px;
        padding: 6px 4px;
        min-width: 40px;
        min-height: 32px;
    }
    
    #presetSelect {
        font-size: 9px;
        min-height: 32px;
        min-width: 100px;
    }
    
    .volume-controls button {
        font-size: 9px;
        padding: 6px 8px;
        min-height: 32px;
    }
    
    .master-volume-control {
        min-width: 100px;
        gap: 4px;
    }
    
    .master-volume-control label {
        font-size: 9px;
    }
    
    .master-volume-control input[type="range"] {
        min-width: 70px;
        min-height: 32px;
    }
    
    .signal-flow {
        font-size: 7px;
    }
    
    .main-header .grains-text-logo {
        font-size: 28px;
    }
    
    .subtitle {
        font-size: 12px;
    }
    
    .drop-zone {
        padding: 24px 16px;
    }
    
    .vocoder-bands {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .seq-steps {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
}

/* SVG Filter Definitions */
.svg-filters-container {
    position: absolute;
    width: 0;
    height: 0;
    pointer-events: none;
    opacity: 0;
}

.noise-filter {
    filter: url(#noise-filter);
}

.noise-filter-strong {
    filter: url(#noise-filter-strong);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #0f0f0f;
        --bg-secondary: #1a1a1a;
        --text-primary: #f5f5f5;
    }
}

/* Animation Performance Optimizations */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
}

/* High DPI Display Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .grains-text-logo {
        text-rendering: optimizeLegibility;
    }
}

/* Accessibility Improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--teal-primary);
    outline-offset: 2px;
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    button, input[type="range"], select {
        min-height: 44px;
        min-width: 44px;
    }
    
    .key-btn {
        min-height: 40px;
        min-width: 40px;
    }
    
    .vocoder-slider, .seq-step-slider {
        width: 28px;
    }
}

@container (max-width: 600px) {
    .controls-grid {
        grid-template-columns: 1fr;
    }
}

@supports (backdrop-filter: blur(10px)) {
    .scope-screen::before {
        backdrop-filter: blur(0.5px);
    }
}

@supports (color: color(display-p3 1 0 0)) {
    :root {
        --teal-primary: color(display-p3 0 0.5 0.5);
        --grain-red: color(display-p3 1 0 0);
    }
}

.paused * {
    animation-play-state: paused !important;
}

.force-gpu {
    transform: translate3d(0, 0, 0);
}

/* Performance indicator */
.performance-indicator {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 1000;
    display: none;
}

.performance-indicator.visible {
    display: block;
}

.performance-indicator.excellent { color: #4caf50; }
.performance-indicator.good { color: #2196f3; }
.performance-indicator.fair { color: #ff9800; }
.performance-indicator.poor { color: #f44336; }