/* BeatMaker Studio - Cyberpunk / Dark DAW Theme */

:root {
    --bg-main: #090b14;
    --bg-surface: #111422;
    --bg-surface-elevated: #181d33;
    --bg-panel: rgba(17, 20, 34, 0.85);
    
    --neon-cyan: #05d9e8;
    --neon-pink: #ff2a6d;
    --neon-purple: #9d4edd;
    --neon-green: #01ff70;
    --neon-yellow: #ffbc00;
    --neon-orange: #ff9900;
    
    --text-primary: #f0f3fa;
    --text-secondary: #8d96b0;
    --text-muted: #565f7c;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(5, 217, 232, 0.35);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SF Mono", Menlo, Monaco, Consolas, monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-stack);
    min-height: 100vh;
    overflow-x: hidden;
    user-select: none;
    touch-action: manipulation;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.15s ease;
}

body.beat-pulse {
    box-shadow: inset 0 0 50px rgba(5, 217, 232, 0.15);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--bg-surface-elevated);
    border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--neon-cyan);
}

/* TOP HEADER / TRANSPORT BAR */
.header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    background: var(--bg-panel);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 12px;
    flex-wrap: wrap;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--neon-pink), var(--neon-cyan));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    font-weight: 900;
    color: #fff;
    box-shadow: 0 0 16px rgba(255, 42, 109, 0.4);
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: linear-gradient(90deg, #fff, var(--neon-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-badge {
    font-size: 0.7rem;
    padding: 2px 7px;
    background: rgba(5, 217, 232, 0.15);
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    border-radius: 20px;
    text-transform: uppercase;
    font-weight: 700;
}

/* Transport Controls */
.transport-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-transport {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 15px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
    min-height: 42px;
}

.btn-transport:active {
    transform: scale(0.96);
}

.btn-transport.primary {
    background: linear-gradient(135deg, #05d9e8, #0099cc);
    color: #050b14;
    border: none;
    box-shadow: 0 0 16px rgba(5, 217, 232, 0.35);
}

.btn-transport.primary.playing {
    background: linear-gradient(135deg, #ff2a6d, #cc0044);
    color: #fff;
    box-shadow: 0 0 18px rgba(255, 42, 109, 0.5);
}

.btn-transport.record.recording {
    background: #ff0000;
    color: #fff;
    animation: pulse-red 1s infinite alternate;
}

@keyframes pulse-red {
    from { box-shadow: 0 0 8px #ff0000; }
    to { box-shadow: 0 0 22px #ff2a6d; }
}

.btn-transport.active {
    background: var(--neon-cyan);
    color: #000;
    border-color: var(--neon-cyan);
}

/* Tempo & Knobs in Header */
.tempo-section {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface);
    padding: 4px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.tempo-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.tempo-input {
    width: 58px;
    background: transparent;
    border: none;
    color: var(--neon-cyan);
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 800;
    text-align: center;
    outline: none;
}

.btn-tap {
    font-size: 0.75rem;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 700;
}

/* Presets & Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.preset-select {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    outline: none;
    min-height: 42px;
    cursor: pointer;
}

/* Visualizer Banner */
.visualizer-strip {
    width: 100%;
    height: 75px;
    background: #060810;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

#visualizer-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.visualizer-controls {
    position: absolute;
    right: 12px;
    top: 8px;
    display: flex;
    gap: 6px;
}

.vis-mode-btn {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.vis-mode-btn.active {
    color: var(--neon-cyan);
    border-color: var(--neon-cyan);
}

/* STUDIO NAVIGATION TABS */
.studio-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-height: 40px;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
    background: var(--bg-surface-elevated);
    color: var(--neon-cyan);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-glow);
}

/* MAIN STUDIO WORKSPACE */
.studio-workspace {
    flex: 1;
    padding: 16px 18px;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

.view-panel {
    display: none;
    animation: fadeIn 0.2s ease-in-out;
}

.view-panel.active {
    display: block;
}

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

/* --- 1. SEQUENCER VIEW --- */
.sequencer-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 10px;
}

.pattern-selector-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.pattern-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 800;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    min-height: 38px;
}

.pattern-btn.active {
    background: var(--neon-purple);
    color: #fff;
    border-color: var(--neon-purple);
    box-shadow: 0 0 12px rgba(157, 78, 221, 0.4);
}

.step-count-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.step-toggle-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
}

.step-toggle-btn.active {
    background: var(--neon-cyan);
    color: #000;
}

/* Sequencer Grid */
.sequencer-container {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 14px;
    overflow-x: auto;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.sequencer-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 780px;
}

.track-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.track-info {
    width: 145px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: var(--bg-surface-elevated);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--neon-cyan);
    flex-shrink: 0;
}

.track-name {
    font-size: 0.84rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-preview-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 2px 4px;
}

.track-preview-btn:hover {
    color: var(--neon-cyan);
}

.steps-container {
    display: flex;
    gap: 4px;
    flex: 1;
}

/* Individual Step Button */
.step-btn {
    flex: 1;
    min-width: 36px;
    height: 48px;
    background: #141828;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    cursor: pointer;
    position: relative;
    transition: background 0.1s, transform 0.05s, border-color 0.1s;
    touch-action: manipulation;
}

/* Bar separator visual cues (every 4 steps) */
.step-btn:nth-child(4n + 1) {
    border-left: 2px solid rgba(255, 255, 255, 0.18);
}

.step-btn:hover {
    background: #1d233a;
}

.step-btn:active {
    transform: scale(0.92);
}

.step-btn.active {
    background: var(--neon-cyan);
    box-shadow: 0 0 12px var(--neon-cyan);
    border-color: #fff;
}

/* Active track-specific step colors */
.track-row[data-track="kick"] .step-btn.active { background: var(--neon-pink); box-shadow: 0 0 12px var(--neon-pink); }
.track-row[data-track="808"] .step-btn.active { background: #00f0ff; box-shadow: 0 0 12px #00f0ff; }
.track-row[data-track="snare"] .step-btn.active { background: var(--neon-yellow); box-shadow: 0 0 12px var(--neon-yellow); }
.track-row[data-track="clap"] .step-btn.active { background: var(--neon-orange); box-shadow: 0 0 12px var(--neon-orange); }
.track-row[data-track="hat-closed"] .step-btn.active { background: var(--neon-green); box-shadow: 0 0 12px var(--neon-green); }
.track-row[data-track="hat-open"] .step-btn.active { background: #2ecc40; box-shadow: 0 0 12px #2ecc40; }
.track-row[data-track="perc"] .step-btn.active { background: var(--neon-purple); box-shadow: 0 0 12px var(--neon-purple); }
.track-row[data-track="crash"] .step-btn.active { background: #f012be; box-shadow: 0 0 12px #f012be; }
.track-row[data-track="synth"] .step-btn.active { background: #7928ca; box-shadow: 0 0 12px #7928ca; }

/* Playhead highlighted step */
.step-btn.playhead {
    border: 2px solid #ffffff !important;
    transform: scale(1.05);
    z-index: 2;
}

/* Step Roll badge */
.step-roll-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 0.6rem;
    font-weight: 900;
    color: #000;
    background: rgba(255, 255, 255, 0.85);
    padding: 1px 3px;
    border-radius: 3px;
    pointer-events: none;
}

/* --- 2. MPC DRUM PADS VIEW --- */
.dj-fx-strip {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
    background: var(--bg-surface);
    padding: 10px 14px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.dj-fx-btn {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 800;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
    user-select: none;
    touch-action: manipulation;
}

.dj-fx-btn:active, .dj-fx-btn.active {
    transform: scale(0.95);
    background: var(--neon-cyan);
    color: #000;
    border-color: var(--neon-cyan);
    box-shadow: 0 0 14px var(--neon-cyan);
}

.dj-fx-btn.danger:active, .dj-fx-btn.danger.active {
    background: var(--neon-pink);
    color: #fff;
    border-color: var(--neon-pink);
    box-shadow: 0 0 14px var(--neon-pink);
}

.pads-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    max-width: 860px;
    margin: 0 auto;
    padding: 10px;
}

.drum-pad {
    aspect-ratio: 1 / 1;
    background: linear-gradient(145deg, #181c2f, #121524);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    cursor: pointer;
    transition: transform 0.08s, box-shadow 0.08s, background 0.08s, opacity 0.15s;
    position: relative;
    touch-action: manipulation;
    overflow: hidden;
}

.drum-pad:active, .drum-pad.hit {
    transform: scale(0.95);
    background: #252d4a;
    border-color: var(--neon-cyan);
    box-shadow: 0 0 25px var(--neon-cyan), inset 0 0 15px var(--neon-cyan);
}

.drum-pad.muted {
    opacity: 0.45;
    border-color: #ff2a6d !important;
    box-shadow: inset 0 0 15px rgba(255, 42, 109, 0.4);
}

.drum-pad.soloed {
    border-color: var(--neon-yellow) !important;
    box-shadow: 0 0 20px rgba(255, 188, 0, 0.5), inset 0 0 12px rgba(255, 188, 0, 0.3);
}

/* Direct Pad Mute & Solo Header */
.pad-header-controls {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 5;
}

.pad-btn-mute, .pad-btn-solo {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 900;
    width: 26px;
    height: 22px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s;
}

.pad-btn-mute:hover {
    color: #ff2a6d;
    border-color: #ff2a6d;
}

.pad-btn-mute.active {
    background: #ff2a6d;
    color: #fff;
    border-color: #ff2a6d;
    box-shadow: 0 0 10px #ff2a6d;
}

.pad-btn-solo:hover {
    color: var(--neon-yellow);
    border-color: var(--neon-yellow);
}

.pad-btn-solo.active {
    background: var(--neon-yellow);
    color: #000;
    border-color: var(--neon-yellow);
    box-shadow: 0 0 10px var(--neon-yellow);
}

.pad-center-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.pad-title {
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 4px;
    color: #fff;
    pointer-events: none;
}

.pad-key-hint {
    font-size: 0.72rem;
    color: var(--neon-cyan);
    font-family: var(--font-mono);
    background: rgba(5, 217, 232, 0.12);
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid rgba(5, 217, 232, 0.25);
    pointer-events: none;
}

/* Pad Bottom VU LED Meter */
.pad-vu-meter {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
    pointer-events: none;
}

.pad-vu-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #01ff70, #ffbc00, #ff2a6d);
    transition: width 0.08s ease-out;
}

/* Individual Pad Accents */
.drum-pad[data-track="kick"] { border-bottom: 4px solid var(--neon-pink); }
.drum-pad[data-track="808"] { border-bottom: 4px solid #00f0ff; }
.drum-pad[data-track="snare"] { border-bottom: 4px solid var(--neon-yellow); }
.drum-pad[data-track="clap"] { border-bottom: 4px solid var(--neon-orange); }
.drum-pad[data-track="hat-closed"] { border-bottom: 4px solid var(--neon-green); }
.drum-pad[data-track="hat-open"] { border-bottom: 4px solid #2ecc40; }
.drum-pad[data-track="cowbell"] { border-bottom: 4px solid #e056fd; }
.drum-pad[data-track="shaker"] { border-bottom: 4px solid #f9ca24; }
.drum-pad[data-track="rimshot"] { border-bottom: 4px solid #686de0; }
.drum-pad[data-track="ride"] { border-bottom: 4px solid #48dbfb; }
.drum-pad[data-track="perc"] { border-bottom: 4px solid var(--neon-purple); }
.drum-pad[data-track="crash"] { border-bottom: 4px solid #f012be; }
.drum-pad[data-track="vocal"] { border-bottom: 4px solid #ff6b6b; }
.drum-pad[data-track="synth"] { border-bottom: 4px solid #7928ca; }

/* --- 3. PIANO ROLL & MELODY VIEW --- */
.piano-roll-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 10px;
}

.piano-control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.select-control {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    outline: none;
    min-height: 38px;
}

/* Piano Studio Stage (Wheels + Keyboard) */
.piano-studio-stage {
    display: flex;
    gap: 14px;
    background: #070912;
    padding: 16px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.5), inset 0 0 40px rgba(0, 0, 0, 0.7);
    align-items: stretch;
}

/* Wheels (Pitch Bend & Mod) */
.wheels-container {
    display: flex;
    gap: 10px;
    padding: 6px;
    background: #101322;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    align-items: center;
}

.wheel-strip {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    width: 38px;
    height: 100%;
}

.wheel-label {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.pitch-wheel {
    -webkit-appearance: slider-vertical;
    appearance: slider-vertical;
    width: 24px;
    height: 130px;
    cursor: pointer;
    accent-color: var(--neon-cyan);
}

/* Virtual Piano Keyboard: 3D Ivory & Ebony */
.virtual-keyboard-wrapper {
    flex: 1;
    overflow-x: auto;
    position: relative;
}

.virtual-keyboard {
    display: flex;
    position: relative;
    height: 205px;
    background: #111422;
    border-radius: var(--radius-md);
    padding: 0 6px 6px 6px;
    min-width: 720px;
}

/* 3D Realistic Ivory White Key */
.white-key {
    flex: 1;
    min-width: 46px;
    height: 195px;
    background: linear-gradient(to bottom, #fcfdff 0%, #e6e9f2 85%, #cfd5e3 100%);
    border: 1px solid #99a2b8;
    border-top: none;
    border-radius: 0 0 6px 6px;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 12px;
    color: #1a2035;
    font-weight: 800;
    font-size: 0.85rem;
    z-index: 1;
    box-shadow: 0 5px 8px rgba(0, 0, 0, 0.4), inset 0 -3px 4px rgba(0, 0, 0, 0.15);
    transition: transform 0.05s, background 0.05s;
    touch-action: manipulation;
}

.white-key:active, .white-key.pressed {
    background: linear-gradient(to bottom, #a0f0ff 0%, #05d9e8 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4), 0 0 20px var(--neon-cyan);
    transform: translateY(3px);
    color: #000;
}

.white-key.out-of-scale {
    opacity: 0.4;
    background: #b0b8cb;
}

.key-note-badge {
    font-size: 0.82rem;
    font-weight: 900;
    pointer-events: none;
}

.key-shortcut-hint {
    font-size: 0.65rem;
    color: #636e88;
    font-family: var(--font-mono);
    margin-top: 2px;
    pointer-events: none;
}

/* 3D Realistic Ebony Black Key */
.black-key {
    width: 30px;
    height: 125px;
    background: linear-gradient(to bottom, #2b3044 0%, #151824 65%, #080a10 100%);
    border: 1px solid #05060a;
    border-radius: 0 0 5px 5px;
    position: absolute;
    z-index: 3;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 10px;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    box-shadow: 2px 5px 10px rgba(0, 0, 0, 0.8), inset 0 1px 2px rgba(255, 255, 255, 0.25);
    transition: transform 0.05s, background 0.05s;
    touch-action: manipulation;
}

.black-key:active, .black-key.pressed {
    background: linear-gradient(to bottom, #bd68f8 0%, #7928ca 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6), 0 0 18px var(--neon-purple);
    transform: translateY(2px);
}

.black-key.out-of-scale {
    opacity: 0.35;
}

/* Interactive Melody Step Matrix (Piano Roll Step Grid) */
.melody-grid-section {
    margin-top: 18px;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 16px;
}

.melody-grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.melody-matrix {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-x: auto;
}

.melody-pitch-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pitch-row-label {
    width: 60px;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--neon-cyan);
    font-family: var(--font-mono);
    text-align: right;
    padding-right: 8px;
    flex-shrink: 0;
}

.melody-step-cell {
    flex: 1;
    min-width: 36px;
    height: 28px;
    background: #141828;
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.1s;
}

.melody-step-cell:nth-child(4n + 2) {
    border-left: 2px solid rgba(255, 255, 255, 0.15);
}

.melody-step-cell:hover {
    background: #202742;
}

.melody-step-cell.active {
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    box-shadow: 0 0 10px var(--neon-cyan);
    border-color: #fff;
}

.melody-step-cell.playhead {
    border: 2px solid #fff !important;
}

/* Keybind Customizer Modal Styles */
.keybind-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 6px;
}

@media (max-width: 650px) {
    .keybind-grid {
        grid-template-columns: 1fr;
    }
}

.keybind-row {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.keybind-name {
    font-size: 0.85rem;
    font-weight: 700;
}

.keybind-key-btn {
    background: rgba(5, 217, 232, 0.15);
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    font-family: var(--font-mono);
    font-weight: 800;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    min-width: 60px;
    text-align: center;
    font-size: 0.85rem;
    transition: all 0.15s;
}

.keybind-key-btn.listening {
    background: #ff2a6d;
    border-color: #ff2a6d;
    color: #fff;
    animation: pulse-red 0.8s infinite alternate;
}

/* --- 4. MIXER & FX VIEW --- */
.mixer-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
}

@media (max-width: 900px) {
    .mixer-container {
        grid-template-columns: 1fr;
    }
}

.mixer-channels-strip {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 14px;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.channel-strip {
    width: 80px;
    background: var(--bg-surface-elevated);
    border-radius: var(--radius-md);
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
}

.channel-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.channel-fader-container {
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vertical-fader {
    -webkit-appearance: slider-vertical;
    appearance: slider-vertical;
    width: 24px;
    height: 130px;
    cursor: pointer;
}

.channel-buttons {
    display: flex;
    gap: 4px;
    width: 100%;
}

.btn-mute, .btn-solo {
    flex: 1;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 4px 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
}

.btn-mute.active {
    background: #ff2a6d;
    color: #fff;
    border-color: #ff2a6d;
}

.btn-solo.active {
    background: var(--neon-yellow);
    color: #000;
    border-color: var(--neon-yellow);
}

/* Master FX Rack Panel */
.fx-rack-panel {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.fx-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--neon-cyan);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.fx-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.fx-card {
    background: var(--bg-surface-elevated);
    border-radius: var(--radius-md);
    padding: 10px;
    border: 1px solid var(--border-color);
}

.fx-card-title {
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 6px;
}

.slider-group label {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.slider-control {
    width: 100%;
    accent-color: var(--neon-cyan);
    cursor: pointer;
}

/* --- 5. SAMPLER & MIC RECORDER VIEW --- */
.sampler-panel {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 18px;
    max-width: 900px;
    margin: 0 auto;
}

.sample-drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 16px;
}

.sample-drop-zone:hover, .sample-drop-zone.dragover {
    border-color: var(--neon-cyan);
    background: rgba(5, 217, 232, 0.05);
}

.waveform-display-area {
    margin: 14px 0;
}

#sample-waveform-canvas {
    width: 100%;
    height: 120px;
    background: #080a14;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    display: block;
}

.trim-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

/* --- MODAL DIALOGS --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 580px;
    padding: 24px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    animation: modalIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalIn {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--neon-cyan);
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.4rem;
    cursor: pointer;
}

.export-option-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.export-item {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.15s;
}

.export-item:hover {
    border-color: var(--neon-cyan);
    background: rgba(5, 217, 232, 0.08);
}

.export-item-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.export-item-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* Tablet & Mobile Responsiveness */
@media (max-width: 768px) {
    .header-bar {
        padding: 8px 10px;
    }
    .brand-title {
        font-size: 1rem;
    }
    .pads-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    .drum-pad {
        height: 85px;
    }
    .step-btn {
        min-width: 30px;
        height: 42px;
    }
    .track-info {
        width: 110px;
    }
    .white-key {
        min-width: 36px;
    }
}
