/* ============================================================
   EZ-DJ — Professional DJ Interface
   Carbon fiber / brushed metal aesthetic
   ============================================================ */

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

:root {
    --bg: #08080c;
    --bg-deck: #0e0e14;
    --bg-mixer: #0b0b11;
    --bg-surface: #121219;
    --bg-inset: #060609;
    --accent-a: #00ccff;
    --accent-a-dim: rgba(0, 204, 255, 0.15);
    --accent-a-glow: rgba(0, 204, 255, 0.4);
    --accent-b: #ff3366;
    --accent-b-dim: rgba(255, 51, 102, 0.15);
    --accent-b-glow: rgba(255, 51, 102, 0.4);
    --text: #b0b0b8;
    --text-bright: #e8e8f0;
    --text-dim: #555566;
    --border: #1a1a28;
    --border-light: #252538;
    --knob-track: #13131e;
    --knob-thumb: #3a3a50;
    --knob-thumb-hover: #555570;
    --fx-active: #00ff88;
    --fx-active-dim: rgba(0, 255, 136, 0.12);
    --shadow-heavy: 0 4px 20px rgba(0,0,0,0.6);
    --shadow-inset: inset 0 1px 4px rgba(0,0,0,0.5);
    --shadow-button: 0 2px 6px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.04);
    --radius: 6px;
    --radius-lg: 10px;
    --carbon: repeating-linear-gradient(
        0deg,
        rgba(255,255,255,0.015) 0px,
        rgba(255,255,255,0.015) 1px,
        transparent 1px,
        transparent 2px
    );
    --brushed-metal: linear-gradient(
        135deg,
        rgba(255,255,255,0.02) 0%,
        rgba(255,255,255,0.005) 50%,
        rgba(255,255,255,0.02) 100%
    );
}

html {
    font-size: 14px;
}

body {
    background: var(--bg);
    background-image: var(--carbon);
    color: var(--text);
    font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow-x: hidden;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-inset); }
::-webkit-scrollbar-thumb { background: #2a2a3e; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a50; }

/* ============================================================
   APP CONTAINER
   ============================================================ */
#app {
    max-width: 1500px;
    margin: 0 auto;
    padding: 6px 10px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ============================================================
   HEADER — Equipment top panel
   ============================================================ */
#header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: linear-gradient(180deg, #111118 0%, #0c0c12 100%);
    background-image: var(--brushed-metal);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-heavy);
    position: relative;
}
#header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 20px;
    height: 1px;
    background: linear-gradient(90deg, var(--accent-a), transparent 30%, transparent 70%, var(--accent-b));
    opacity: 0.5;
}

#header h1 {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 3px;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--accent-a), #66e0ff, var(--accent-b));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    filter: drop-shadow(0 0 8px rgba(0, 204, 255, 0.3));
}

#master-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

#master-bpm {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-bright);
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
    padding: 4px 12px;
    background: var(--bg-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-inset);
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

#ai-mode-btn {
    background: linear-gradient(180deg, #1a1a2e, #141420);
    border: 1px solid var(--accent-a);
    color: var(--accent-a);
    padding: 8px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    transition: all 0.2s ease;
    box-shadow: 0 0 8px rgba(0, 204, 255, 0.1), var(--shadow-button);
}
#ai-mode-btn:hover {
    background: linear-gradient(180deg, #1e1e36, #18182a);
    box-shadow: 0 0 16px rgba(0, 204, 255, 0.25), var(--shadow-button);
}
#ai-mode-btn:active {
    transform: scale(0.97);
}
#ai-mode-btn.active {
    background: linear-gradient(135deg, var(--accent-a), #0099cc);
    color: #000;
    border-color: var(--accent-a);
    box-shadow: 0 0 20px rgba(0, 204, 255, 0.4);
    text-shadow: 0 1px 0 rgba(255,255,255,0.2);
}

/* ============================================================
   DECKS CONTAINER — CSS Grid main layout
   ============================================================ */
#decks-container {
    display: grid;
    grid-template-columns: 1fr 220px 1fr;
    gap: 6px;
}

/* ============================================================
   DECK — Individual deck panel
   ============================================================ */
.deck {
    background: var(--bg-deck);
    background-image: var(--brushed-metal);
    border-radius: var(--radius-lg);
    padding: 12px 14px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-heavy);
    position: relative;
    overflow: hidden;
}

/* Deck accent glow line at top */
#deck-a { border-top: 2px solid var(--accent-a); }
#deck-b { border-top: 2px solid var(--accent-b); }
#deck-a::before, #deck-b::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    pointer-events: none;
}
#deck-a::before {
    background: linear-gradient(180deg, rgba(0,204,255,0.06) 0%, transparent 100%);
}
#deck-b::before {
    background: linear-gradient(180deg, rgba(255,51,102,0.06) 0%, transparent 100%);
}

/* Deck Header */
.deck-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}
.btn-load-deck {
    background: none;
    border: 1px solid var(--border);
    color: #666;
    font-size: 1.1em;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-load-deck:hover {
    border-color: var(--accent-a);
    color: var(--accent-a);
}
#deck-b .btn-load-deck:hover {
    border-color: var(--accent-b);
    color: var(--accent-b);
}

.deck-label {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--accent-a);
    min-width: 28px;
    text-align: center;
    letter-spacing: 2px;
    text-shadow: 0 0 12px var(--accent-a-glow);
}
.deck-label-b {
    color: var(--accent-b);
    text-shadow: 0 0 12px var(--accent-b-glow);
}

.track-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    letter-spacing: 0.3px;
}

.track-info {
    font-size: 0.7rem;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   WAVEFORM
   ============================================================ */
.waveform-container {
    position: relative;
    background: var(--bg-inset);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-inset);
}

#waveform-a, #waveform-b {
    height: 90px;
}

.time-display {
    display: flex;
    justify-content: space-between;
    padding: 3px 10px 4px;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    background: rgba(0,0,0,0.4);
    border-top: 1px solid rgba(255,255,255,0.03);
}

#deck-a .time-display span, #deck-a-time, #deck-a-remaining {
    color: var(--accent-a);
    text-shadow: 0 0 6px rgba(0,204,255,0.3);
}
#deck-b .time-display span, #deck-b-time, #deck-b-remaining {
    color: var(--accent-b);
    text-shadow: 0 0 6px rgba(255,51,102,0.3);
}

/* Spectrum Canvas */
.spectrum-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.45;
    z-index: 1;
}

/* Section Regions (on waveform) */
.section-region {
    position: absolute;
    top: 0;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
}
.section-label {
    position: absolute;
    top: 2px;
    left: 3px;
    font-size: 0.5em;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Mix Point Markers */
.mix-marker {
    position: absolute;
    top: 0;
    height: 100%;
    width: 2px;
    z-index: 3;
    pointer-events: none;
}
.mix-marker-in { background: rgba(0, 200, 100, 0.7); }
.mix-marker-out { background: rgba(255, 50, 50, 0.7); }
.mix-marker-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7em;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1;
}
.mix-marker-in .mix-marker-arrow { left: 4px; color: #00cc66; }
.mix-marker-out .mix-marker-arrow { right: 4px; color: #ff3355; }

/* ============================================================
   DECK CONTROLS — Transport buttons
   ============================================================ */
.deck-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Hardware button base */
.btn-cue, .btn-play, .btn-sync {
    border: none;
    border-radius: var(--radius);
    font-weight: 800;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.12s ease;
    letter-spacing: 1px;
    text-transform: uppercase;
    min-height: 44px;
    min-width: 44px;
    position: relative;
    overflow: hidden;
}

/* CUE Button */
.btn-cue {
    background: linear-gradient(180deg, #3a3020, #2a2218);
    color: #ffa500;
    padding: 10px 18px;
    border: 1px solid #4a3a1e;
    box-shadow: 0 3px 8px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,200,100,0.08);
}
.btn-cue:hover {
    background: linear-gradient(180deg, #ffa500, #cc8400);
    color: #000;
    box-shadow: 0 0 16px rgba(255,165,0,0.4), 0 3px 8px rgba(0,0,0,0.5);
}
.btn-cue:active {
    transform: translateY(1px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.5), inset 0 2px 4px rgba(0,0,0,0.3);
}

/* PLAY Button */
.btn-play {
    background: linear-gradient(180deg, #1e1e30, #141422);
    color: var(--text-bright);
    font-size: 1.3rem;
    padding: 10px 22px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-button);
}
.btn-play:hover {
    border-color: var(--fx-active);
    box-shadow: 0 0 12px rgba(0,255,136,0.15), var(--shadow-button);
}
.btn-play:active {
    transform: translateY(1px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.5), inset 0 2px 4px rgba(0,0,0,0.3);
}
.btn-play.playing {
    background: linear-gradient(180deg, var(--fx-active), #00cc6a);
    color: #000;
    border-color: var(--fx-active);
    box-shadow: 0 0 20px rgba(0,255,136,0.35), 0 3px 8px rgba(0,0,0,0.4);
    text-shadow: 0 1px 0 rgba(255,255,255,0.15);
}

/* SYNC Button */
#deck-a .btn-sync {
    background: linear-gradient(180deg, #152030, #0e1822);
    color: var(--accent-a);
    padding: 10px 18px;
    border: 1px solid rgba(0,204,255,0.2);
    box-shadow: var(--shadow-button);
}
#deck-a .btn-sync:hover {
    background: linear-gradient(180deg, var(--accent-a), #0099cc);
    color: #000;
    box-shadow: 0 0 16px var(--accent-a-glow), 0 3px 8px rgba(0,0,0,0.5);
}
#deck-b .btn-sync {
    background: linear-gradient(180deg, #2a1520, #1e0e16);
    color: var(--accent-b);
    padding: 10px 18px;
    border: 1px solid rgba(255,51,102,0.2);
    box-shadow: var(--shadow-button);
}
#deck-b .btn-sync:hover {
    background: linear-gradient(180deg, var(--accent-b), #cc2952);
    color: #000;
    box-shadow: 0 0 16px var(--accent-b-glow), 0 3px 8px rgba(0,0,0,0.5);
}
.btn-sync:active {
    transform: translateY(1px);
}

/* BPM Display */
.bpm-display {
    margin-left: auto;
    font-size: 1.1rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--text-bright);
    letter-spacing: 0.5px;
    padding: 6px 14px;
    background: var(--bg-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-inset);
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* ============================================================
   MIXER — Center column
   ============================================================ */
#mixer {
    display: flex;
    gap: 6px;
    padding: 12px 8px;
    background: var(--bg-mixer);
    background-image: var(--brushed-metal);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-heavy);
    min-width: 210px;
    position: relative;
}

/* EQ Column */
.eq-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex: 1;
}
.eq-column label {
    font-size: 0.6rem;
    font-weight: 800;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* ============================================================
   VERTICAL SLIDERS — EQ knobs and volume faders
   ============================================================ */
.eq-knob, .vol-fader {
    writing-mode: vertical-lr;
    direction: rtl;
    -webkit-appearance: none;
    appearance: none;
    width: 32px;
    height: 70px;
    background: var(--knob-track);
    border-radius: var(--radius);
    outline: none;
    cursor: pointer;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-inset);
    transition: border-color 0.2s;
}
.vol-fader {
    height: 95px;
    margin-top: 4px;
}
.eq-knob:hover, .vol-fader:hover {
    border-color: var(--border-light);
}

/* WebKit thumb — EQ */
.eq-knob::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 30px;
    height: 14px;
    background: linear-gradient(180deg, #555568, #3a3a4e);
    border: 1px solid #666;
    border-radius: 3px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
    transition: background 0.15s;
}
.eq-knob::-webkit-slider-thumb:hover {
    background: linear-gradient(180deg, #6a6a80, #505066);
}
.eq-knob:active::-webkit-slider-thumb {
    background: linear-gradient(180deg, #7a7a90, #606076);
    box-shadow: 0 1px 3px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
}

/* WebKit thumb — Volume fader */
.vol-fader::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 30px;
    height: 18px;
    background: linear-gradient(180deg, #606074, #44445a);
    border: 1px solid #777;
    border-radius: 3px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.12);
    transition: background 0.15s;
    /* Grip lines */
    background-image:
        linear-gradient(180deg, #606074, #44445a),
        repeating-linear-gradient(
            0deg,
            transparent 0px,
            transparent 3px,
            rgba(255,255,255,0.1) 3px,
            rgba(255,255,255,0.1) 4px
        );
}
.vol-fader::-webkit-slider-thumb:hover {
    background: linear-gradient(180deg, #7a7a90, #58586e);
    border-color: #999;
}

/* Firefox support */
.eq-knob::-moz-range-thumb, .vol-fader::-moz-range-thumb {
    width: 28px;
    height: 14px;
    background: linear-gradient(180deg, #555568, #3a3a4e);
    border: 1px solid #666;
    border-radius: 3px;
    cursor: pointer;
}
.eq-knob::-moz-range-track, .vol-fader::-moz-range-track {
    background: var(--knob-track);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

/* ============================================================
   CROSSFADER SECTION
   ============================================================ */
#crossfader-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    padding: 0 4px;
}
#crossfader-section label {
    font-size: 0.55rem;
    font-weight: 800;
    color: var(--text-dim);
    letter-spacing: 2px;
    text-transform: uppercase;
}

#crossfader {
    -webkit-appearance: none;
    appearance: none;
    width: 130px;
    height: 10px;
    background: var(--knob-track);
    border-radius: 5px;
    outline: none;
    cursor: pointer;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-inset);
}
#crossfader::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 30px;
    background: linear-gradient(180deg, #666680, #444460);
    border: 1px solid #888;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.15);
    /* Grip texture */
    background-image: repeating-linear-gradient(
        90deg,
        transparent 0px, transparent 4px,
        rgba(255,255,255,0.08) 4px, rgba(255,255,255,0.08) 5px
    );
}
#crossfader::-webkit-slider-thumb:hover {
    background-color: #7a7a90;
    border-color: #aaa;
}
#crossfader::-moz-range-thumb {
    width: 24px;
    height: 30px;
    background: linear-gradient(180deg, #666680, #444460);
    border: 1px solid #888;
    border-radius: 4px;
    cursor: pointer;
}

.crossfader-labels {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 1px;
}
.crossfader-labels span:first-child { color: var(--accent-a); }
.crossfader-labels span:last-child { color: var(--accent-b); }

/* ============================================================
   VU METERS — LED bar style
   ============================================================ */
.vu-meter {
    width: 12px;
    height: 90px;
    background: #080808;
    border-radius: 3px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-inset);
    /* LED segments look */
    background-image: repeating-linear-gradient(
        to top,
        transparent 0px,
        transparent 4px,
        rgba(0,0,0,0.8) 4px,
        rgba(0,0,0,0.8) 5px
    );
}
.vu-fill {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(
        to top,
        var(--fx-active) 0%,
        var(--fx-active) 50%,
        #ffcc00 70%,
        #ff6600 85%,
        #ff2222 100%
    );
    transition: height 0.08s linear;
    border-radius: 2px;
}

/* ============================================================
   FX SECTION
   ============================================================ */
#fx-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.fx-rack {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-deck);
    background-image: var(--brushed-metal);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-heavy);
    flex-wrap: wrap;
}

.fx-label {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-dim);
    min-width: 34px;
    letter-spacing: 1px;
    text-transform: uppercase;
}
#fx-a .fx-label { color: var(--accent-a); opacity: 0.6; }
#fx-b .fx-label { color: var(--accent-b); opacity: 0.6; }

/* FX Toggle Buttons */
.fx-btn {
    background: linear-gradient(180deg, #1a1a2e, #12121e);
    border: 1px solid var(--border-light);
    color: var(--text-dim);
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 0.65rem;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.15s ease;
    min-height: 32px;
    box-shadow: var(--shadow-button);
}
.fx-btn:hover {
    border-color: var(--fx-active);
    color: var(--fx-active);
    box-shadow: 0 0 8px rgba(0,255,136,0.15), var(--shadow-button);
}
.fx-btn:active {
    transform: translateY(1px);
}
.fx-btn.active {
    background: linear-gradient(180deg, var(--fx-active), #00cc6a);
    color: #000;
    border-color: var(--fx-active);
    box-shadow: 0 0 14px rgba(0,255,136,0.35), 0 2px 4px rgba(0,0,0,0.4);
    text-shadow: 0 1px 0 rgba(255,255,255,0.15);
}

/* FX Knobs (horizontal) */
.fx-knob {
    -webkit-appearance: none;
    appearance: none;
    width: 60px;
    height: 6px;
    background: var(--knob-track);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    border: 1px solid var(--border);
}
.fx-knob::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: linear-gradient(180deg, #555568, #3a3a4e);
    border: 1px solid #666;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
    transition: background 0.15s;
}
.fx-knob::-webkit-slider-thumb:hover {
    background: linear-gradient(180deg, #6e6e84, #505068);
    border-color: #888;
}
.fx-knob::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: linear-gradient(180deg, #555568, #3a3a4e);
    border: 1px solid #666;
    border-radius: 50%;
    cursor: pointer;
}

/* ============================================================
   AI PANEL — Collapsible with gradient accents
   ============================================================ */
.ai-panel {
    display: none;
    background: var(--bg-deck);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    animation: aiPanelSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-heavy);
    position: relative;
}
.ai-panel.visible {
    display: block;
}
.ai-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
}

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

.ai-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.2);
}
.ai-panel-header h2 {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* AI Status Bar */
.ai-status-bar {
    font-size: 0.72rem;
    color: #666;
    font-variant-numeric: tabular-nums;
    padding: 5px 14px;
    background: var(--bg-inset);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-inset);
}

/* AI Prompt Section */
.ai-prompt-section {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
}
.ai-prompt-input {
    flex: 1;
    background: var(--bg-inset);
    border: 1px solid var(--border);
    color: var(--text-bright);
    padding: 10px 16px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow-inset);
}
.ai-prompt-input:focus {
    border-color: var(--accent-a);
    box-shadow: var(--shadow-inset), 0 0 12px rgba(0,204,255,0.15);
}
.ai-prompt-input::placeholder {
    color: #444;
}

.ai-generate-btn {
    background: linear-gradient(135deg, var(--accent-a), #0099cc);
    color: #000;
    border: none;
    padding: 10px 24px;
    border-radius: var(--radius);
    font-weight: 800;
    font-size: 0.82rem;
    cursor: pointer;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.2s;
    box-shadow: 0 0 12px rgba(0,204,255,0.2), 0 3px 8px rgba(0,0,0,0.4);
    min-height: 44px;
}
.ai-generate-btn:hover {
    box-shadow: 0 0 20px rgba(0,204,255,0.35), 0 3px 8px rgba(0,0,0,0.4);
    transform: translateY(-1px);
}
.ai-generate-btn:active { transform: translateY(1px); }
.ai-generate-btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }

/* AI Spinner */
.ai-spinner {
    display: none;
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-top-color: var(--accent-a);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.ai-spinner.visible { display: block; }
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* AI Example Buttons */
.ai-examples {
    display: flex;
    gap: 8px;
    padding: 0 18px 14px;
    flex-wrap: wrap;
}
.ai-example-btn {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-light);
    color: var(--text-dim);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 32px;
}
.ai-example-btn:hover {
    border-color: var(--accent-a);
    color: var(--accent-a);
    background: var(--accent-a-dim);
    box-shadow: 0 0 8px rgba(0,204,255,0.1);
}

/* AI Playlist Table */
.ai-playlist-container {
    max-height: 220px;
    overflow-y: auto;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.ai-playlist-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}
.ai-playlist-table thead {
    background: rgba(0, 0, 0, 0.4);
    position: sticky;
    top: 0;
    z-index: 1;
}
.ai-playlist-table th {
    padding: 8px 12px;
    text-align: left;
    font-weight: 700;
    color: var(--text-dim);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border);
}
.ai-playlist-table td {
    padding: 7px 12px;
    color: var(--text);
    border-bottom: 1px solid rgba(26, 26, 40, 0.6);
    transition: background 0.15s;
}
.ai-playlist-row:hover {
    background: rgba(0, 204, 255, 0.04);
}
.ai-playlist-row.active {
    background: rgba(0, 204, 255, 0.1);
    border-left: 3px solid var(--accent-a);
}
.ai-playlist-row.active td {
    color: var(--text-bright);
}
.ai-playlist-row.next {
    background: rgba(255, 51, 102, 0.06);
}

/* Transition type badges */
.trans-type {
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 3px;
}
.trans-smooth {
    color: var(--accent-a);
    background: var(--accent-a-dim);
}
.trans-energy {
    color: #ffa500;
    background: rgba(255,165,0,0.1);
}
.trans-drop {
    color: var(--accent-b);
    background: var(--accent-b-dim);
}

/* AI Controls */
.ai-controls {
    display: flex;
    gap: 10px;
    padding: 12px 18px;
    align-items: center;
    background: rgba(0,0,0,0.15);
    border-top: 1px solid var(--border);
}
.ai-start-btn {
    background: linear-gradient(135deg, var(--accent-a), #0088cc);
    color: #000;
    border: none;
    padding: 10px 26px;
    border-radius: var(--radius);
    font-weight: 800;
    font-size: 0.82rem;
    cursor: pointer;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.2s;
    box-shadow: 0 0 12px rgba(0,204,255,0.2), 0 3px 8px rgba(0,0,0,0.4);
    min-height: 44px;
}
.ai-start-btn:hover {
    box-shadow: 0 0 20px rgba(0,204,255,0.4), 0 3px 8px rgba(0,0,0,0.4);
    transform: translateY(-1px);
}
.ai-start-btn:active { transform: translateY(1px); }

.ai-takeover-btn {
    background: linear-gradient(180deg, #2a2010, #1e1808);
    border: 1px solid rgba(255,165,0,0.3);
    color: #ffa500;
    padding: 8px 20px;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 0.78rem;
    cursor: pointer;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.2s;
    box-shadow: var(--shadow-button);
    min-height: 44px;
}
.ai-takeover-btn:hover {
    background: linear-gradient(180deg, #ffa500, #cc8800);
    color: #000;
    box-shadow: 0 0 16px rgba(255,165,0,0.3);
}

.ai-resume-btn {
    background: linear-gradient(180deg, #102018, #0a1610);
    border: 1px solid rgba(0,255,136,0.25);
    color: var(--fx-active);
    padding: 8px 20px;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 0.78rem;
    cursor: pointer;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.2s;
    box-shadow: var(--shadow-button);
    min-height: 44px;
}
.ai-resume-btn:hover {
    background: linear-gradient(180deg, var(--fx-active), #00cc6a);
    color: #000;
    box-shadow: 0 0 16px rgba(0,255,136,0.3);
}

/* ============================================================
   LIBRARY — Track browser
   ============================================================ */
#library {
    background: var(--bg-deck);
    background-image: var(--brushed-metal);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    max-height: 280px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-heavy);
}

#library-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.2);
}
#library-header h2 {
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-dim);
}

#library-search {
    background: var(--bg-inset);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 0.8rem;
    width: 220px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow-inset);
}
#library-search:focus {
    border-color: var(--accent-a);
    box-shadow: var(--shadow-inset), 0 0 10px rgba(0,204,255,0.12);
}
#library-search::placeholder {
    color: #444;
}

#library-list {
    overflow-y: auto;
    flex: 1;
}

.library-track {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    border-bottom: 1px solid rgba(20,20,30,0.8);
    font-size: 0.8rem;
    cursor: pointer;
    gap: 14px;
    transition: background 0.12s;
}
.library-track:hover {
    background: rgba(255,255,255,0.03);
}
.library-track .title {
    flex: 1;
    color: var(--text-bright);
    font-weight: 500;
}
.library-track .artist {
    flex: 1;
    color: var(--text-dim);
}
.library-track .meta {
    color: #444;
    font-variant-numeric: tabular-nums;
    min-width: 60px;
    text-align: right;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.75rem;
}
.library-track .load-btns {
    display: flex;
    gap: 5px;
}

.load-btn {
    background: linear-gradient(180deg, #1a1a2e, #12121e);
    border: 1px solid var(--border-light);
    color: var(--text-dim);
    padding: 5px 12px;
    border-radius: var(--radius);
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: all 0.15s;
    box-shadow: var(--shadow-button);
    min-height: 30px;
}
.load-btn:hover {
    border-color: var(--accent-a);
    color: var(--accent-a);
    box-shadow: 0 0 8px rgba(0,204,255,0.15), var(--shadow-button);
}
.load-btn.load-b:hover {
    border-color: var(--accent-b);
    color: var(--accent-b);
    box-shadow: 0 0 8px rgba(255,51,102,0.15), var(--shadow-button);
}

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */
@media (max-width: 960px) {
    html { font-size: 13px; }

    #app { padding: 4px 6px 16px; gap: 5px; }

    #decks-container {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    /* Reorder: Deck A, Deck B, Mixer */
    #deck-a { order: 1; }
    #deck-b { order: 2; }
    #mixer  { order: 3; }

    #mixer {
        flex-direction: row;
        min-width: auto;
        justify-content: center;
        padding: 14px 16px;
    }

    .eq-knob, .vol-fader {
        height: 55px;
    }
    .vol-fader { height: 70px; }

    #crossfader { width: 100px; }

    #fx-section {
        grid-template-columns: 1fr;
    }

    /* Touch-friendly buttons */
    .btn-cue, .btn-play, .btn-sync {
        min-height: 48px;
        min-width: 48px;
        padding: 12px 20px;
    }

    .fx-btn {
        min-height: 40px;
        padding: 8px 14px;
    }

    .load-btn {
        min-height: 36px;
        padding: 8px 14px;
    }

    .ai-panel-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    .ai-prompt-section {
        flex-wrap: wrap;
    }
    .ai-prompt-input {
        min-width: 100%;
    }

    .ai-playlist-table th:nth-child(5),
    .ai-playlist-table td:nth-child(5),
    .ai-playlist-table th:nth-child(7),
    .ai-playlist-table td:nth-child(7) {
        display: none;
    }

    #library-search {
        width: 160px;
    }

    .library-track .artist {
        display: none;
    }
}

@media (max-width: 480px) {
    html { font-size: 12px; }

    #header h1 { font-size: 1.2rem; letter-spacing: 2px; }

    .deck { padding: 10px; }
    #waveform-a, #waveform-b { height: 70px; }

    .bpm-display { font-size: 0.9rem; padding: 4px 10px; }

    .ai-example-btn {
        min-height: 36px;
        padding: 8px 14px;
    }

    .ai-controls {
        flex-wrap: wrap;
    }

    #library-search {
        width: 120px;
    }
}
