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

:root {
    /* Colors */
    --bg-primary: #0a0e27;
    --bg-secondary: #151937;
    --bg-tertiary: #1e2749;
    --accent-cyan: #00f0ff;
    --accent-magenta: #ff00aa;
    --accent-yellow: #ffeb3b;
    --text-primary: #e8eeff;
    --text-secondary: #a0b0d0;
    --text-muted: #8899bb;
    --text-muted-light: #99aacc;
    --text-white: #ffffff;
    --border-glow: rgba(0, 240, 255, 0.4);

    /* Spacing Scale */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Typography Scale */
    --text-xs: 0.7rem;
    --text-sm: 0.85rem;
    --text-base: 1rem;
    --text-lg: 1.3rem;
    --text-xl: 1.5rem;
    --text-2xl: 2.5rem;
    --text-3xl: 4rem;

    /* Font Families */
    --font-display: 'Orbitron', sans-serif;
    --font-mono: 'Share Tech Mono', monospace;
    --font-body: 'Inter', sans-serif;

    /* Animation */
    --transition-fast: 0.15s;
    --transition-base: 0.3s;
    --ease-out: cubic-bezier(0.4, 0, 0.2, 1);

    /* Border Radius */
    --radius-sm: 0;
    --radius-md: 0;
    --radius-lg: 0;
    --radius-xl: 0;

    /* Shadows & Glows */
    --glow-cyan-soft: 0 0 20px rgba(0, 240, 255, 0.2);
    --glow-cyan-medium: 0 0 40px rgba(0, 240, 255, 0.4);
    --glow-cyan-strong: 0 0 60px rgba(0, 240, 255, 0.6);
    --glow-magenta-soft: 0 0 20px rgba(255, 0, 170, 0.2);
    --glow-magenta-medium: 0 0 40px rgba(255, 0, 170, 0.4);
    --shadow-inset-panel: inset 0 0 60px rgba(0, 240, 255, 0.05);
}

body {
    font-family: var(--font-mono);
    background: #000;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;

}

/* CRT screen — curved glass container */
.crt-screen {
    background: linear-gradient(135deg, var(--bg-primary) 0%, #0d1428 50%, var(--bg-secondary) 100%);
    min-height: 100vh;
    border-radius: 0;
    overflow: hidden;
    position: relative;
    box-shadow:
        inset 0 0 120px rgba(0, 0, 0, 0.7),
        inset 0 0 40px rgba(0, 0, 0, 0.4),
        0 0 40px rgba(0, 240, 255, 0.08),
        0 0 80px rgba(0, 240, 255, 0.04);
}


/* CRT overlay — static snow */
#crtStatic {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.025;
}

/* CRT overlay — scanlines + RGB sub-pixels */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.15) 50%),
        linear-gradient(90deg, rgba(255, 0, 0, 0.04), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.04));
    background-size: 100% 3px, 3px 100%;
    pointer-events: none;
    z-index: 9998;
}

/* CRT overlay — vignette + flicker */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(
        ellipse at center,
        transparent 65%,
        rgba(0, 0, 0, 0.25) 90%,
        rgba(0, 0, 0, 0.5) 100%
    );
    pointer-events: none;
    z-index: 9998;
}

/* CRT animated chromatic aberration — text */
@keyframes crt-chromatic-text {
    0% { text-shadow: 0.05px 0 1px rgba(0,30,255,0.5), -0.05px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    2% { text-shadow: 0.05px 0 1px rgba(0,30,255,0.5), -0.05px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    3% { text-shadow: 2.8px 0 1px rgba(0,30,255,0.5), -2.8px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    4% { text-shadow: 0.05px 0 1px rgba(0,30,255,0.5), -0.05px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    20% { text-shadow: 0.05px 0 1px rgba(0,30,255,0.5), -0.05px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    21% { text-shadow: 3.5px 0 1px rgba(0,30,255,0.5), -3.5px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    22% { text-shadow: 0.1px 0 1px rgba(0,30,255,0.5), -0.1px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    23% { text-shadow: 1.9px 0 1px rgba(0,30,255,0.5), -1.9px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    24% { text-shadow: 0.05px 0 1px rgba(0,30,255,0.5), -0.05px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    55% { text-shadow: 0.05px 0 1px rgba(0,30,255,0.5), -0.05px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    55.5% { text-shadow: 2.2px 0 1px rgba(0,30,255,0.5), -2.2px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    56% { text-shadow: 0.05px 0 1px rgba(0,30,255,0.5), -0.05px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    78% { text-shadow: 0.05px 0 1px rgba(0,30,255,0.5), -0.05px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    78.5% { text-shadow: 4.1px 0 1px rgba(0,30,255,0.5), -4.1px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    79% { text-shadow: 0.3px 0 1px rgba(0,30,255,0.5), -0.3px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    79.5% { text-shadow: 2.6px 0 1px rgba(0,30,255,0.5), -2.6px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    80% { text-shadow: 0.05px 0 1px rgba(0,30,255,0.5), -0.05px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
    100% { text-shadow: 0.05px 0 1px rgba(0,30,255,0.5), -0.05px 0 1px rgba(255,0,80,0.3), 0 0 3px; }
}

/* CRT animated chromatic aberration — borders */
@keyframes crt-chromatic-box {
    0% { box-shadow: 0.05px 0 1px rgba(0,30,255,0.4), -0.05px 0 1px rgba(255,0,80,0.25); }
    2% { box-shadow: 0.05px 0 1px rgba(0,30,255,0.4), -0.05px 0 1px rgba(255,0,80,0.25); }
    3% { box-shadow: 2.8px 0 2px rgba(0,30,255,0.4), -2.8px 0 2px rgba(255,0,80,0.25); }
    4% { box-shadow: 0.05px 0 1px rgba(0,30,255,0.4), -0.05px 0 1px rgba(255,0,80,0.25); }
    20% { box-shadow: 0.05px 0 1px rgba(0,30,255,0.4), -0.05px 0 1px rgba(255,0,80,0.25); }
    21% { box-shadow: 3.5px 0 2px rgba(0,30,255,0.4), -3.5px 0 2px rgba(255,0,80,0.25); }
    22% { box-shadow: 0.1px 0 1px rgba(0,30,255,0.4), -0.1px 0 1px rgba(255,0,80,0.25); }
    23% { box-shadow: 1.9px 0 2px rgba(0,30,255,0.4), -1.9px 0 2px rgba(255,0,80,0.25); }
    24% { box-shadow: 0.05px 0 1px rgba(0,30,255,0.4), -0.05px 0 1px rgba(255,0,80,0.25); }
    55% { box-shadow: 0.05px 0 1px rgba(0,30,255,0.4), -0.05px 0 1px rgba(255,0,80,0.25); }
    55.5% { box-shadow: 2.2px 0 2px rgba(0,30,255,0.4), -2.2px 0 2px rgba(255,0,80,0.25); }
    56% { box-shadow: 0.05px 0 1px rgba(0,30,255,0.4), -0.05px 0 1px rgba(255,0,80,0.25); }
    78% { box-shadow: 0.05px 0 1px rgba(0,30,255,0.4), -0.05px 0 1px rgba(255,0,80,0.25); }
    78.5% { box-shadow: 4.1px 0 2px rgba(0,30,255,0.4), -4.1px 0 2px rgba(255,0,80,0.25); }
    79% { box-shadow: 0.3px 0 1px rgba(0,30,255,0.4), -0.3px 0 1px rgba(255,0,80,0.25); }
    79.5% { box-shadow: 2.6px 0 2px rgba(0,30,255,0.4), -2.6px 0 2px rgba(255,0,80,0.25); }
    80% { box-shadow: 0.05px 0 1px rgba(0,30,255,0.4), -0.05px 0 1px rgba(255,0,80,0.25); }
    100% { box-shadow: 0.05px 0 1px rgba(0,30,255,0.4), -0.05px 0 1px rgba(255,0,80,0.25); }
}

/* CRT animated chromatic aberration — knobs (SVG via drop-shadow) */
@keyframes crt-chromatic-knob {
    0% { filter: drop-shadow(0.05px 0 0.5px rgba(0,30,255,0.4)) drop-shadow(-0.05px 0 0.5px rgba(255,0,80,0.25)); }
    2% { filter: drop-shadow(0.05px 0 0.5px rgba(0,30,255,0.4)) drop-shadow(-0.05px 0 0.5px rgba(255,0,80,0.25)); }
    3% { filter: drop-shadow(2.8px 0 1px rgba(0,30,255,0.4)) drop-shadow(-2.8px 0 1px rgba(255,0,80,0.25)); }
    4% { filter: drop-shadow(0.05px 0 0.5px rgba(0,30,255,0.4)) drop-shadow(-0.05px 0 0.5px rgba(255,0,80,0.25)); }
    20% { filter: drop-shadow(0.05px 0 0.5px rgba(0,30,255,0.4)) drop-shadow(-0.05px 0 0.5px rgba(255,0,80,0.25)); }
    21% { filter: drop-shadow(3.5px 0 1px rgba(0,30,255,0.4)) drop-shadow(-3.5px 0 1px rgba(255,0,80,0.25)); }
    22% { filter: drop-shadow(0.1px 0 0.5px rgba(0,30,255,0.4)) drop-shadow(-0.1px 0 0.5px rgba(255,0,80,0.25)); }
    23% { filter: drop-shadow(1.9px 0 1px rgba(0,30,255,0.4)) drop-shadow(-1.9px 0 1px rgba(255,0,80,0.25)); }
    24% { filter: drop-shadow(0.05px 0 0.5px rgba(0,30,255,0.4)) drop-shadow(-0.05px 0 0.5px rgba(255,0,80,0.25)); }
    55% { filter: drop-shadow(0.05px 0 0.5px rgba(0,30,255,0.4)) drop-shadow(-0.05px 0 0.5px rgba(255,0,80,0.25)); }
    55.5% { filter: drop-shadow(2.2px 0 1px rgba(0,30,255,0.4)) drop-shadow(-2.2px 0 1px rgba(255,0,80,0.25)); }
    56% { filter: drop-shadow(0.05px 0 0.5px rgba(0,30,255,0.4)) drop-shadow(-0.05px 0 0.5px rgba(255,0,80,0.25)); }
    78% { filter: drop-shadow(0.05px 0 0.5px rgba(0,30,255,0.4)) drop-shadow(-0.05px 0 0.5px rgba(255,0,80,0.25)); }
    78.5% { filter: drop-shadow(4.1px 0 1px rgba(0,30,255,0.4)) drop-shadow(-4.1px 0 1px rgba(255,0,80,0.25)); }
    79% { filter: drop-shadow(0.3px 0 0.5px rgba(0,30,255,0.4)) drop-shadow(-0.3px 0 0.5px rgba(255,0,80,0.25)); }
    79.5% { filter: drop-shadow(2.6px 0 1px rgba(0,30,255,0.4)) drop-shadow(-2.6px 0 1px rgba(255,0,80,0.25)); }
    80% { filter: drop-shadow(0.05px 0 0.5px rgba(0,30,255,0.4)) drop-shadow(-0.05px 0 0.5px rgba(255,0,80,0.25)); }
    100% { filter: drop-shadow(0.05px 0 0.5px rgba(0,30,255,0.4)) drop-shadow(-0.05px 0 0.5px rgba(255,0,80,0.25)); }
}



/* Skip link */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-cyan);
    color: var(--bg-primary);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-family: var(--font-display);
    font-weight: 700;
    text-decoration: none;
    z-index: 10000;
    transition: top 0.2s;
}

.skip-link:focus {
    top: var(--space-sm);
}

/* Audio activation overlay */
.audio-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(10, 14, 39, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.4s ease-out;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.audio-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.audio-overlay-content {
    text-align: center;
    color: var(--text-primary);
}

.audio-overlay-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-transform: uppercase;
    letter-spacing: 0.2rem;
    margin-bottom: var(--space-lg);
}

.audio-overlay-content p {
    font-family: var(--font-mono);
    font-size: clamp(1rem, 2vw, 1.3rem);
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
    letter-spacing: 0.1rem;
    text-transform: uppercase;
}

.audio-overlay-icon {
    color: var(--accent-cyan);
    animation: pulse-overlay 2s ease-in-out infinite;
}

@keyframes pulse-overlay {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.95); }
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    padding: clamp(1rem, 4vw, 2rem);
    position: relative;
    z-index: 2;
}

h1, h2, p, span, label, button, select, option,
.control-value, .control-hint, .control-label,
.note-label, .keyboard-key-label, .preset-btn, .preset-label,
.octave-display, .octave-btn, .info-display, .subtitle,
.synth-description, .audio-overlay-content, .audio-overlay-title {
    animation: crt-chromatic-text 8s infinite;
}

/* Stagger chromatic aberration so elements glitch at different times */
h2, .panel-title { animation-delay: -1.2s; }
.control-label, .control-value { animation-delay: -3.5s; }
.control-hint { animation-delay: -5.8s; }
.preset-btn, .preset-label { animation-delay: -2.3s; }
.note-label, .keyboard-key-label { animation-delay: -6.1s; }
.octave-display, .octave-btn { animation-delay: -4.7s; }
.info-display { animation-delay: -7.2s; }
.synth-description { animation-delay: -0.8s; }
select, .wave-select { animation-delay: -5.1s; }
.subtitle { animation-delay: -3.9s; }
.knob-container { animation-delay: -4.2s; }

.synth-panel,
.control-group,
.keyboard,
.key,
.key.black,
select,
.wave-select,
.preset-btn,
.octave-btn,
.keyboard-key-label,
.info-display {
    animation: crt-chromatic-box 8s infinite;
}

header {
    text-align: center;
    margin-bottom: clamp(1.25rem, 4vw, 2rem);
    position: relative;
}

h1 {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 4vw + 0.75rem, 3rem);
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-transform: uppercase;
    letter-spacing: clamp(0.2rem, 1vw, 0.5rem);
    margin-bottom: 0.35rem;
}

.subtitle {
    font-size: clamp(0.65rem, 1.2vw + 0.3rem, 0.8rem);
    color: var(--text-muted);
    letter-spacing: clamp(0.15rem, 0.6vw, 0.3rem);
    text-transform: uppercase;
}

.synth-panel {
    background: linear-gradient(135deg, rgba(21, 25, 55, 0.9), rgba(30, 39, 73, 0.9));
    border: 1px solid rgba(0, 240, 255, 0.25);
    border-radius: var(--radius-xl);
    padding: clamp(1.25rem, 3vw, 2rem);
    margin-bottom: clamp(1rem, 3vw, 1.5rem);
    box-shadow:
        0 4px 30px rgba(0, 0, 0, 0.3),
        inset 0 0 60px rgba(0, 240, 255, 0.03);
    position: relative;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.panel-header {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: clamp(1rem, 2.5vw, 1.5rem);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid rgba(0, 240, 255, 0.15);
}

.panel-title {
    font-family: var(--font-display);
    font-size: clamp(0.8rem, 1.5vw + 0.3rem, 1.1rem);
    font-weight: 700;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: clamp(0.15rem, 0.6vw, 0.3rem);
}

.synth-description {
    font-family: var(--font-body);
    font-size: clamp(0.7rem, 1.2vw, 0.8rem);
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: clamp(0.75rem, 2vw, 1.25rem);
    padding: var(--space-sm) var(--space-md);
    border-left: 2px solid rgba(0, 240, 255, 0.3);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.synth-description:empty {
    display: none;
}

.preset-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: clamp(0.75rem, 2vw, 1.25rem);
}

.preset-bar:empty {
    display: none;
}

.preset-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    font-family: var(--font-mono);
    margin-right: var(--space-xs);
}

.preset-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid rgba(0, 240, 255, 0.15);
    border-radius: var(--radius-sm);
    padding: 0.3rem 0.7rem;
    font-family: var(--font-mono);
    font-size: clamp(0.65rem, 1.1vw, 0.75rem);
    cursor: pointer;
    transition: all var(--transition-fast) var(--ease-out);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.03rem;
}

.preset-btn:hover {
    border-color: rgba(0, 240, 255, 0.5);
    color: var(--accent-cyan);
    background: rgba(0, 240, 255, 0.05);
}

.preset-btn.active {
    background: rgba(0, 240, 255, 0.1);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.instrument-select {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    align-items: stretch;
}

label {
    font-size: clamp(0.75rem, 1.5vw, 0.85rem);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1rem;
}

select {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid rgba(0, 240, 255, 0.4);
    border-radius: var(--radius-md);
    padding: clamp(0.4rem, 1.5vw, 0.6rem) clamp(0.75rem, 2vw, 1rem);
    font-family: var(--font-mono);
    font-size: clamp(0.8rem, 1.3vw, 0.9rem);
    cursor: pointer;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

select:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.2);
}

select:focus {
    outline: 2px solid var(--accent-magenta);
    outline-offset: 2px;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--space-md);
    margin-top: clamp(1rem, 3vw, 2rem);
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: rgba(30, 39, 73, 0.5);
    padding: clamp(0.75rem, 2vw, 1.25rem);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0, 240, 255, 0.15);
    transition: border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
}

.control-group:hover {
    border-color: rgba(0, 240, 255, 0.4);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.15);
    transform: translateY(-2px);
}

.control-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin-bottom: var(--space-sm);
    font-size: clamp(0.7rem, 1.3vw, 0.8rem);
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 0.08rem;
}

.control-value {
    color: var(--accent-magenta);
    font-weight: bold;
    font-size: clamp(0.85rem, 1.4vw, 0.95rem);
}

.control-hint {
    font-family: var(--font-body);
    font-size: clamp(0.6rem, 1.1vw, 0.7rem);
    color: var(--text-muted);
    line-height: 1.4;
    margin-top: var(--space-xs);
    margin-bottom: 0;
    order: 10;
}

input[type="range"] {
    display: none;
}

.knob-container {
    display: block;
    position: relative;
    width: 64px;
    animation: crt-chromatic-knob 8s infinite;
    height: 64px;
    cursor: grab;
    touch-action: none;
    user-select: none;
    margin: var(--space-xs) 0;
}

.knob-container:active {
    cursor: grabbing;
}

.knob-svg {
    width: 100%;
    height: 100%;
}

.knob-track {
    fill: none;
    stroke: rgba(30, 39, 73, 0.8);
    stroke-width: 5;
    stroke-linecap: round;
}

.knob-fill {
    fill: none;
    stroke: var(--accent-cyan);
    stroke-width: 5;
    stroke-linecap: round;
    filter: drop-shadow(0 0 3px rgba(0, 240, 255, 0.5));
}

.knob-body {
    fill: linear-gradient(135deg, #1a2040, #252d54);
    fill: var(--bg-tertiary);
    stroke: rgba(0, 240, 255, 0.2);
    stroke-width: 1;
    transition: stroke var(--transition-fast);
}

.knob-container:hover .knob-body {
    stroke: rgba(0, 240, 255, 0.5);
    filter: drop-shadow(0 0 6px rgba(0, 240, 255, 0.15));
}

.knob-indicator {
    stroke: var(--accent-magenta);
    stroke-width: 2;
    stroke-linecap: round;
    filter: drop-shadow(0 0 4px rgba(255, 0, 170, 0.5));
}

.knob-notch {
    stroke: rgba(0, 240, 255, 0.1);
    stroke-width: 0.8;
}

.keyboard {
    display: flex;
    justify-content: center;
    gap: 2px;
    margin: clamp(0.75rem, 2vw, 1.5rem) 0;
    padding: clamp(1.5rem, 3vw, 2rem) clamp(1rem, 2.5vw, 1.5rem) clamp(1rem, 2.5vw, 1.5rem);
    background: linear-gradient(180deg, rgba(10, 14, 39, 0.95), rgba(15, 18, 40, 0.98));
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0, 240, 255, 0.2);
    box-shadow:
        0 8px 30px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(0, 240, 255, 0.1);
    position: relative;
    overflow-x: auto;
}

/* Hide scroll indicators on desktop by default */
.keyboard-scroll-indicator {
    display: none;
}

.key {
    position: relative;
    width: 40px;
    height: 160px;
    background: linear-gradient(180deg, rgba(55, 65, 110, 0.95), rgba(40, 48, 85, 0.98));
    border: 1px solid rgba(0, 240, 255, 0.4);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast) var(--ease-out), border-color var(--transition-fast) var(--ease-out), transform var(--transition-fast) var(--ease-out), box-shadow var(--transition-fast) var(--ease-out);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.4),
        inset 0 -20px 30px rgba(0, 240, 255, 0.05);
}

.key:hover {
    background: linear-gradient(180deg, rgba(40, 49, 93, 0.95), rgba(31, 35, 75, 1));
    border-color: var(--accent-cyan);
    transform: translateY(-3px);
    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(0, 240, 255, 0.3);
}

.key:active {
    background: linear-gradient(180deg, rgba(0, 240, 255, 0.7), rgba(0, 200, 220, 0.6));
    border-color: var(--accent-cyan);
    transform: translateY(2px);
    box-shadow:
        0 1px 4px rgba(0, 0, 0, 0.3),
        0 0 25px rgba(0, 240, 255, 0.4);
}

.key:focus-visible {
    outline: 2px solid var(--accent-yellow);
    outline-offset: 2px;
    z-index: 20;
}

.key.black {
    width: 28px;
    height: 100px;
    background: linear-gradient(180deg, rgba(20, 22, 50, 0.98), rgba(10, 12, 30, 1));
    margin: 0 -15px;
    z-index: 10;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    border-color: rgba(255, 0, 170, 0.4);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.6),
        inset 0 -15px 25px rgba(255, 0, 170, 0.05);
}

.key.black:hover {
    background: linear-gradient(180deg, rgba(25, 15, 40, 1), rgba(15, 8, 30, 1));
    border-color: var(--accent-magenta);
    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.6),
        0 0 15px rgba(255, 0, 170, 0.3);
}

.key.black:active {
    background: linear-gradient(180deg, rgba(255, 0, 170, 0.7), rgba(200, 0, 130, 0.5));
    border-color: var(--accent-magenta);
    transform: translateY(2px);
    box-shadow:
        0 1px 4px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(255, 0, 170, 0.3);
}

.note-label {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.02rem;
    opacity: 0.9;
}

.key.black .note-label {
    color: var(--text-secondary);
    font-size: 0.6rem;
    bottom: 6px;
}

.keyboard-key-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-mono);
    font-size: clamp(0.6rem, 1.2vw, 0.75rem);
    font-weight: 400;
    color: var(--accent-cyan);
    background: rgba(0, 240, 255, 0.08);
    padding: 2px 5px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(0, 240, 255, 0.35);
    text-transform: uppercase;
    letter-spacing: 0.03rem;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

.key:hover .keyboard-key-label {
    color: var(--text-white);
    border-color: rgba(0, 240, 255, 0.7);
}

.key.black .keyboard-key-label {
    color: var(--accent-magenta);
    background: rgba(255, 0, 170, 0.08);
    border-color: rgba(255, 0, 170, 0.35);
}

.key.black:hover .keyboard-key-label {
    color: var(--text-white);
    border-color: rgba(255, 0, 170, 0.7);
}

.key.pressed {
    background: linear-gradient(180deg, rgba(0, 240, 255, 0.8), rgba(0, 200, 220, 0.6));
    border-color: var(--accent-cyan);
    transform: translateY(2px);
    box-shadow:
        0 1px 4px rgba(0, 0, 0, 0.3),
        0 0 25px rgba(0, 240, 255, 0.4);
}

.key.pressed .keyboard-key-label {
    color: var(--bg-primary);
    background: rgba(255, 255, 255, 0.15);
    border-color: transparent;
}

.key.black.pressed {
    background: linear-gradient(180deg, rgba(255, 0, 170, 0.8), rgba(200, 0, 130, 0.6));
    border-color: var(--accent-magenta);
    box-shadow:
        0 1px 4px rgba(0, 0, 0, 0.3),
        0 0 25px rgba(255, 0, 170, 0.4);
}

.effect-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--space-md);
}

button {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid rgba(0, 240, 255, 0.3);
    padding: clamp(0.5rem, 1.5vw, 0.75rem) clamp(1rem, 2.5vw, 1.5rem);
    font-family: var(--font-mono);
    font-size: clamp(0.75rem, 1.3vw, 0.85rem);
    text-transform: uppercase;
    letter-spacing: 0.08rem;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

button:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.2);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

button:focus-visible {
    outline: 2px solid var(--accent-magenta);
    outline-offset: 2px;
}

.wave-select {
    width: 100%;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--accent-cyan);
    border-radius: var(--radius-md);
    padding: clamp(0.5rem, 2vw, 0.75rem) clamp(0.75rem, 2vw, 1rem);
    font-family: var(--font-mono);
    font-size: clamp(0.8rem, 1.5vw, 0.9rem);
    cursor: pointer;
    transition: box-shadow var(--transition-base), transform var(--transition-base), border-color var(--transition-base);
    box-shadow: var(--glow-cyan-soft);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2300f0ff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right clamp(0.75rem, 2vw, 1rem) center;
    padding-right: 2.5rem;
}

.wave-select:hover {
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.4);
    transform: translateY(-2px);
}

.wave-select:focus {
    outline: 2px solid var(--accent-magenta);
    outline-offset: 2px;
    box-shadow: 0 0 40px rgba(0, 240, 255, 0.6);
    border-color: var(--accent-magenta);
}

.wave-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0.5rem;
}

.octave-controls {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(1rem, 2.5vw, 1.5rem);
    align-items: center;
}

.octave-btn {
    padding: clamp(0.5rem, 1.5vw, 0.75rem) clamp(1rem, 2.5vw, 1.5rem);
    font-size: clamp(0.8rem, 1.5vw, 0.9rem);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--accent-cyan);
    cursor: pointer;
    transition: background var(--transition-base), color var(--transition-base), transform var(--transition-base), box-shadow var(--transition-base);
    box-shadow: var(--glow-cyan-soft);
}

.octave-btn:hover {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta));
    color: var(--bg-primary);
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(0, 240, 255, 0.4);
}

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

.octave-display {
    font-size: clamp(0.875rem, 1.5vw, 1rem);
    color: var(--text-secondary);
    letter-spacing: 0.1rem;
    text-transform: uppercase;
}

.octave-display #currentOctave {
    color: var(--accent-cyan);
    font-size: clamp(1.1rem, 2vw, 1.3rem);
    font-weight: bold;
    margin-left: var(--space-sm);
}

.info-display {
    text-align: center;
    padding: clamp(0.6rem, 1.5vw, 0.8rem);
    background: rgba(0, 240, 255, 0.03);
    border-radius: var(--radius-md);
    margin-top: clamp(0.75rem, 2vw, 1.25rem);
    border: 1px solid rgba(0, 240, 255, 0.12);
}

.info-display p {
    font-size: clamp(0.7rem, 1.3vw, 0.8rem);
    color: var(--text-muted);
}

.info-display p + p {
    margin-top: 0.25rem;
}

/* ============================================
   RESPONSIVE BREAKPOINTS - MOBILE FIRST
   ============================================ */

/* Small tablets and larger phones - 480px+ */
@media (min-width: 480px) {
    .panel-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .instrument-select {
        flex-direction: row;
        align-items: center;
    }

    .key {
        width: 45px;
        height: 180px;
    }

    .key.black {
        width: 30px;
        height: 110px;
        margin: 0 -16px;
    }
}

/* Tablets and desktop - 769px+ */
@media (min-width: 769px) {
    .controls-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }

    .effect-controls {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }

    .keyboard {
        overflow-x: visible;
    }

    .key {
        width: 50px;
        height: 200px;
    }

    .key.black {
        width: 32px;
        height: 120px;
        margin: 0 -17px;
    }
}

/* Large desktop - 1200px+ */
@media (min-width: 1200px) {
    .container {
        padding: 2rem;
    }

    header {
        margin-bottom: 3rem;
    }
}

/* ============================================
   MOBILE STICKY KEYBOARD LAYOUT
   ============================================ */

/* Mobile devices - sticky keyboard at bottom */
@media (max-width: 768px) {
    body {
        padding-bottom: 0;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    /* Prevent body scroll when touching keyboard */
    body.keyboard-active {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }

    .keyboard-section {
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        margin-bottom: 0;
        padding-bottom: env(safe-area-inset-bottom, 0);
        background: linear-gradient(135deg, var(--bg-primary) 0%, #0d1428 50%, var(--bg-secondary) 100%);
        width: 100vw;
        margin-left: calc(-50vw + 50%);
    }

    .keyboard-panel {
        margin-bottom: 0;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        border-bottom: none;
        padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom, 0));
        padding-left: 0;
        padding-right: 0;
    }

    .keyboard-panel .panel-header {
        flex-direction: column;
        gap: var(--space-sm);
        padding: 0 var(--space-md) var(--space-sm) var(--space-md);
        margin-bottom: var(--space-md);
    }

    .keyboard-controls {
        display: flex;
        flex-direction: column;
        gap: var(--space-sm);
        width: 100%;
        padding: 0 var(--space-md);
    }

    .keyboard-controls .instrument-select {
        display: none;
    }

    .keyboard-controls .octave-controls {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        gap: var(--space-sm);
    }

    .keyboard-controls .octave-btn {
        flex: 0 1 auto;
        padding: var(--space-sm) var(--space-sm);
        font-size: var(--text-xs);
        white-space: nowrap;
        min-width: 44px;
        min-height: 44px;
        max-width: 100px;
    }

    .keyboard-controls .octave-btn:disabled {
        opacity: 0.4;
        cursor: not-allowed;
        background: var(--bg-tertiary);
        color: var(--text-muted);
        border-color: rgba(0, 240, 255, 0.2);
        box-shadow: none;
    }

    .keyboard-controls .octave-display {
        flex: 1;
        font-size: var(--text-sm);
        text-align: center;
        min-width: 60px;
    }

    .keyboard {
        overflow-x: auto;
        overflow-y: hidden;
        padding: var(--space-sm) 0 var(--space-sm) 0;
        margin: 0;
        position: relative;
        gap: 2px;
        width: 100%;
        justify-content: flex-start;
        scroll-behavior: smooth;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .keyboard::-webkit-scrollbar {
        display: none;
    }

    .keyboard > .key:first-child {
        margin-left: var(--space-md);
    }

    .keyboard > .key:last-child {
        margin-right: var(--space-md);
    }

    .key {
        flex: 0 0 auto;
        width: 52px;
        min-width: 52px;
        height: 140px;
        border-radius: 0 0 var(--radius-md) var(--radius-md);
        scroll-snap-align: start;
        touch-action: none;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        -webkit-user-select: none;
        transition: transform 50ms var(--ease-out),
                    background 50ms var(--ease-out),
                    box-shadow 50ms var(--ease-out);
    }

    .key.black {
        flex: 0 0 auto;
        width: 36px;
        min-width: 36px;
        height: 100px;
        margin: 0 -16px;
        border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    }

    .key.pressed {
        transform: translateY(3px) scale(0.98);
        transition: transform 20ms linear,
                    background 20ms linear,
                    box-shadow 20ms linear;
    }

    .key:active {
        transition: transform 20ms linear,
                    background 20ms linear,
                    box-shadow 20ms linear;
    }

    .keyboard-key-label {
        font-size: var(--text-xs);
        padding: 2px 4px;
    }

    /* Scroll indicators */
    .keyboard-wrapper {
        position: relative;
        width: 100%;
    }

    .keyboard-scroll-indicator {
        display: flex;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 40px;
        height: 80px;
        pointer-events: none;
        align-items: center;
        justify-content: center;
        opacity: 0.9;
        transition: opacity 0.3s ease-out;
        z-index: 5;
        animation: pulse-hint 2s ease-in-out infinite;
        will-change: opacity;
    }

    .keyboard-scroll-indicator.left {
        left: 0;
        background: linear-gradient(to right, rgba(10, 14, 39, 0.9), transparent);
    }

    .keyboard-scroll-indicator.right {
        right: 0;
        background: linear-gradient(to left, rgba(10, 14, 39, 0.9), transparent);
    }

    .keyboard-scroll-indicator.hidden {
        opacity: 0;
        animation: none;
    }

    .keyboard-scroll-indicator svg {
        width: 24px;
        height: 24px;
        fill: var(--accent-cyan);
        filter: drop-shadow(0 0 8px var(--accent-cyan));
        animation: bounce-hint 1.5s ease-in-out infinite;
    }

    .keyboard-scroll-indicator.left svg {
        animation: bounce-left 1.5s ease-in-out infinite;
    }

    @keyframes pulse-hint {
        0%, 100% { opacity: 0.9; }
        50% { opacity: 0.5; }
    }

    @keyframes bounce-hint {
        0%, 100% { transform: translateX(0); }
        50% { transform: translateX(4px); }
    }

    @keyframes bounce-left {
        0%, 100% { transform: translateX(0); }
        50% { transform: translateX(-4px); }
    }

    /* Info display adjustments */
    .info-display {
        margin-bottom: var(--space-md);
    }
}

/* Desktop - normal layout (no sticky behavior) */
@media (min-width: 769px) {
    .keyboard-section {
        position: static;
    }

    .keyboard-panel {
        border-radius: var(--radius-xl);
    }

    .keyboard-controls {
        display: flex;
        flex-direction: row;
        gap: var(--space-xl);
        align-items: center;
    }
}

/* Tablet portrait - larger keys (must come after mobile styles) */
@media (min-width: 481px) and (max-width: 768px) {
    .key {
        width: 56px;
        min-width: 56px;
        height: 160px;
    }

    .key.black {
        width: 40px;
        min-width: 40px;
        height: 110px;
        margin: 0 -18px;
    }
}

/* Accessibility: Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    /* Disable all decorative animations */
    h1 {
        animation: none !important;
    }

    .synth-panel::before,
    .synth-panel:hover::before {
        transition: none !important;
    }

    .keyboard-scroll-indicator {
        animation: none !important;
    }

    .keyboard-scroll-indicator svg {
        animation: none !important;
    }

    .audio-overlay-icon {
        animation: none !important;
    }

    /* Disable hover transforms */
    .control-group:hover,
    select:hover,
    .wave-select:hover,
    .octave-btn:hover,
    button:hover,
    .key:hover {
        transform: none !important;
    }

    /* Preserve essential interactive feedback with faster timing */
    .key,
    .key.pressed,
    button,
    select,
    .control-group,
    input[type="range"]::-webkit-slider-thumb,
    input[type="range"]::-moz-range-thumb {
        transition-duration: 50ms !important;
    }

    .key.pressed {
        transition: transform 50ms linear !important;
    }

    * {
        scroll-behavior: auto !important;
    }
}
