:root {
    --bg-dark: #000000;
    --panel-bg: #111111;
    --accent-a: #00ff41; /* Neon green terminal */
    --accent-b: #00ff41; /* Same for both in this brutalist look */
    --text-main: #ffffff;
    --text-muted: #666666;
    --border-color: #333333;
    --glass-border: #333333; /* Renaming not strict, just repurposing to solid */
}

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

body {
    font-family: 'Space Mono', monospace;
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    /* subtle CRT noise pattern */
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.03'/%3E%3C/svg%3E");
}

/* Background gradient orb removed */
.background-glow {
    display: none;
}

/* Top Navigation */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
    gap: 2rem;
    position: relative;
    z-index: 1000;
}

header {
    text-align: left;
    margin: 0;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 0px;
}

header h1 .dot {
    color: var(--accent-a);
}

header p {
    color: var(--text-muted);
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    white-space: nowrap;
}

/* YouTube Search Module */
.search-module {
    width: 100%;
    margin: 0;
    padding: 0;
    position: relative;
    z-index: 1000;
    flex-grow: 1;
}

.search-bar {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    background: var(--bg-dark);
    padding: 0;
    border: 1px solid var(--border-color);
}

.search-bar input {
    flex: 1;
    font-size: 0.9rem;
    padding: 1rem 1.5rem;
    font-family: 'Space Mono', monospace;
    color: var(--text-main);
    background: transparent;
    border: none;
    border-right: 1px solid var(--border-color);
}

.search-bar input:focus {
    outline: none;
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: 350px;
    overflow-y: auto;
    padding: 0;
    position: absolute;
    top: calc(100% - 1rem);
    left: 0;
    right: 0;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-top: none;
    z-index: 100;
}

/* Hide when empty */
.search-results:empty {
    display: none;
}

/* Custom Scrollbar for results */
.search-results::-webkit-scrollbar {
    width: 6px;
}
.search-results::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
.search-results::-webkit-scrollbar-thumb {
    background: var(--border-color);
}

.search-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    padding: 1rem;
    font-size: 1rem;
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
    border: 1px dashed var(--glass-border);
}

.yt-result-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
    padding: 0.6rem 1rem;
    gap: 1.2rem;
    cursor: pointer;
}

.yt-result-card:hover {
    background: #222;
}

.yt-result-card.copied {
    background: var(--accent-a);
}
.yt-result-card.copied .yt-title {
    color: #000;
}

.yt-thumb {
    width: 77px;
    height: 43px;
    background-color: #111;
    object-fit: cover;
    flex-shrink: 0;
}

.yt-info {
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
    overflow: hidden;
}

.yt-title {
    font-size: 0.9rem;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-main);
}

.yt-id-badge {
    display: none;
}

.yt-card-actions {
    display: flex;
    align-items: center;
}

.dj-desk {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    justify-content: center;
    align-items: stretch;
    width: 100%;
    max-width: 1200px;
    padding: 0 2rem 4rem;
    position: relative;
    z-index: 1;
}

.deck {
    background: linear-gradient(135deg, #1c1c1c 0%, #0d0d0d 100%);
    box-shadow: inset 1px 1px 0px rgba(255,255,255,0.05), inset -1px -1px 0px rgba(0,0,0,0.8), 5px 5px 15px rgba(0,0,0,0.9);
    padding: 1.5rem;
    flex: 1;
    min-width: 320px;
    border: 1px solid #000;
    display: flex;
    flex-direction: column;
}

#deck-a { border-top: 4px solid var(--accent-a); }
#deck-b { border-top: 4px solid var(--accent-b); }

.deck-header {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.8);
}

.vol-meter {
    width: 6px;
    height: 24px;
    background: #000;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.vol-fill {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 100%;
    transition: height 0.05s linear;
}

#vol-indicator-a {
    background: var(--accent-a);
}

#vol-indicator-b {
    background: var(--accent-b);
}

.video-container {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    flex-grow: 1;
}

.url-input-group {
    display: flex;
    gap: 0.8rem;
}

input[type="text"] {
    flex: 1;
    background: #000;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.8rem 1.2rem;
    font-size: 0.95rem;
    outline: none;
    font-family: inherit;
    border-radius: 0;
}

input[type="text"]:focus {
    border-color: var(--text-main);
}

.btn {
    background: #000;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 1px;
    font-family: inherit;
    text-transform: uppercase;
    border-radius: 0;
}

.paste-btn {
    padding: 0.8rem 1rem;
    background: #1a1a1a;
    color: var(--text-muted);
}

.btn:hover, .action-btn:hover, .paste-btn:hover {
    background: var(--text-main);
    color: #000;
    border-color: var(--text-main);
}

.btn:active {
    background: #555;
}

.playback-controls {
    display: flex;
    gap: 1rem;
    margin-top: auto;
}

.play-btn {
    flex: 1;
    color: var(--accent-a);
    border-color: var(--accent-a);
}
.play-btn:hover {
    background: var(--accent-a);
    color: #000;
}

.pause-btn {
    flex: 1;
    color: #ffaa00;
    border-color: #ffaa00;
}
.pause-btn:hover {
    background: #ffaa00;
    color: #000;
}

.mixer {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 1.5rem;
    background: linear-gradient(to bottom, #222 0%, #111 80%, #0a0a0a 100%);
    box-shadow: inset 1px 1px 0px rgba(255,255,255,0.1), inset -1px -1px 0px rgba(0,0,0,0.8), 5px 5px 15px rgba(0,0,0,0.9);
    border: 1px solid #000;
    min-width: 200px;
    border-radius: 0;
}

.mixer-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.mix-btn {
    width: 100%;
}

.crossfader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-top: 3rem;
}

.crossfader-container label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    letter-spacing: 3px;
    font-weight: 600;
}

/* Premium Crossfader */
input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: transparent;
    margin-bottom: 1rem;
}

input[type=range]:focus {
    outline: none;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 48px;
    width: 22px;
    background: linear-gradient(to right, #999 0%, #fff 20%, #ccc 50%, #fff 80%, #999 100%); /* Silver Metallic */
    cursor: grab;
    margin-top: -20px;
    border: 1px solid #333;
    position: relative;
    border-radius: 2px;
    box-shadow: 0 4px 5px rgba(0,0,0,0.8), inset 0 2px 1px rgba(255,255,255,0.9), inset 0 -2px 1px rgba(0,0,0,0.5);
}

/* Horizontal line physically etched onto the fader */
input[type=range]::-webkit-slider-thumb::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 20%;
    right: 20%;
    height: 2px;
    background: #000;
    box-shadow: 0 1px 0 rgba(255,255,255,0.8);
    transform: translateY(-50%);
}

input[type=range]::-webkit-slider-thumb:active {
    cursor: grabbing;
    background: var(--accent-a);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 0;
}

.fader-marks {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.center-mark {
    color: rgba(255,255,255,0.2);
}

/* Independent Deck Sliders */
.slider-group {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.8rem;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.slider-row label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    width: 25px;
}

.deck-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 0;
    margin: 0;
}

.deck-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 20px;
    width: 12px;
    border-radius: 2px;
    background: linear-gradient(to right, #444 0%, #888 50%, #444 100%); /* Dark Metal */
    cursor: pointer;
    border: 1px solid #111;
    box-shadow: 0 2px 4px rgba(0,0,0,0.8), inset 0 1px 1px rgba(255,255,255,0.5);
}

.deck-slider::-webkit-slider-thumb:hover {
    background: linear-gradient(to right, #666 0%, #aaa 50%, #666 100%);
}

.slider-val {
    font-size: 0.75rem;
    color: var(--text-main);
    width: 35px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* BPM Controls Layout */
.bpm-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--bg-dark);
    padding: 0.5rem 1rem;
    border-radius: 0;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.bpm-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #000;
    padding: 0.25rem 1rem;
    border-radius: 0;
    border: 1px solid #333;
    min-width: 80px;
}

.bpm-label {
    font-size: 0.55rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.bpm-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--accent-a);
    font-family: 'Space Mono', monospace; /* Digital look */
    letter-spacing: 1px;
}

.tap-btn {
    background: #000;
    color: var(--text-main);
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 0;
}

.tap-btn:active {
    background: var(--text-main);
    color: #000;
}

.sync-btn {
    flex: 1;
    background: #000;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 0;
}

.sync-btn:hover {
    background: var(--text-main);
    color: #000;
}

/* Advanced Loop Timeline */
.loop-timeline {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: var(--bg-dark);
    padding: 0.8rem;
    border-radius: 0;
    border: 1px solid var(--border-color);
}

.loop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    gap: 0.5rem;
}

.loop-label {
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 1px;
}

.loop-zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: #000;
    border-radius: 0;
    padding: 0.1rem 0.3rem;
    border: 1px solid var(--border-color);
}

.zoom-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
    width: 20px;
    height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 0;
    font-family: 'Space Mono', monospace;
}

.zoom-btn:hover {
    background: var(--text-main);
    color: #000;
}

.zoom-level {
    font-size: 0.65rem;
    color: var(--accent-a);
    font-weight: 700;
    min-width: 1.5rem;
    text-align: center;
}

.loop-status {
    flex: 1;
    text-align: center;
    color: var(--text-main);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    font-size: 0.8rem;
    text-transform: uppercase;
    font-family: 'Space Mono', monospace;
    transition: color 0.2s, text-shadow 0.2s;
}
.loop-status.is-waiting {
    color: #ffaa00;
}
.loop-status.is-active {
    color: #00ff88;
    text-shadow: 0 0 5px rgba(0, 255, 136, 0.4);
}

.loop-btn-pro {
    background: #111;
    border: 1px solid #333;
    color: #aaa;
    padding: 3px 8px;
    font-size: 0.7rem;
    font-weight: 800;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}
.loop-btn-pro:hover:not(:disabled) {
    background: #222;
    color: #fff;
    border-color: #555;
}
.loop-btn-pro.loop-toggle-btn { border-bottom: 2px solid #aaa; width: 60px; }
.loop-btn-pro.loop-toggle-btn.out-mode { border-bottom: 2px solid #ffaa00; color: #ffaa00; width: 60px; }
.loop-btn-pro.loop-toggle-btn.out-mode:active { background: #ffaa00; color: #000; }
.loop-btn-pro.loop-toggle-btn.active-state { background: #00ff88; border-color: #00ff88; color: #000; width: 60px; }

.loop-btn-pro.exit-btn { border-bottom: 2px solid #ff2a5f; }
.loop-btn-pro.exit-btn:hover:not(:disabled) { background: #ff2a5f; color: #fff; }

.loop-btn-pro:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: transparent;
    color: var(--text-muted);
    background: transparent;
}

/* Scroll Wrapper */
.loop-track-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 0; /* Room for handle box shadows */
    border-radius: 0;
    scroll-behavior: auto;
}

.loop-track-wrapper::-webkit-scrollbar {
    height: 4px;
}
.loop-track-wrapper::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
.loop-track-wrapper::-webkit-scrollbar-thumb {
    background: var(--border-color);
}

/* The interactive scrub area */
.loop-track {
    position: relative;
    width: 100%; /* Will be dynamically widened by JS on zoom */
    height: 12px;
    background: var(--bg-dark);
    border-radius: 0;
    border: 1px solid var(--border-color);
    cursor: crosshair;
    touch-action: pan-x; /* Allow native horizontal scroll */
    min-width: 100%;
}

/* Independent Progress Track */
.progress-wrapper {
    width: 100%;
    margin-bottom: 5px;
}

.progress-track {
    width: 100%;
    height: 10px;
    background: var(--bg-dark);
    border-radius: 0;
    border: 1px solid var(--border-color);
    cursor: pointer;
    position: relative;
}

.progress-fill {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 0%;
    background: rgba(255, 255, 255, 0.8);
    pointer-events: none;
}

/* Shows current video playback time weakly */
.loop-progress {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 0%;
    background: rgba(255,255,255,0.2);
    pointer-events: none;
}

/* Fills the area between IN and OUT */
.loop-fill {
    position: absolute;
    top: 0; bottom: 0;
    background: rgba(0, 255, 65, 0.4); /* Neon green tint */
    border-top: 1px solid var(--accent-a);
    border-bottom: 1px solid var(--accent-a);
    pointer-events: none;
}

/* The draggable knobs */
.loop-handle {
    position: absolute;
    top: 50%;
    width: 10px;
    height: 24px;
    background: #fff;
    border-radius: 0;
    transform: translate(-50%, -50%);
    cursor: grab;
    z-index: 10;
    border: 1px solid #000;
}

.loop-handle:active {
    cursor: grabbing;
    background: var(--accent-a);
    transform: translate(-50%, -50%);
}

.loop-in-handle {
    border-left: 3px solid #ffaa00;
}

.loop-out-handle {
    border-right: 3px solid #00ff88;
}

@media (max-width: 1024px) {
    .dj-desk {
        flex-direction: column;
    }
    .mixer {
        order: -1;
        flex-direction: row;
        gap: 2rem;
    }
    .crossfader-container {
        margin-top: 0;
    }
    .mixer-controls {
        width: 40%;
    }
}

@media (max-width: 768px) {
    .top-nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

@media (max-width: 600px) {
    .mixer {
        flex-direction: column;
    }
    .mixer-controls {
        width: 100%;
    }
}

/* ==================================
   V2 Layout Redesign
   ================================== */

.absolute-branding {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 2000;
    pointer-events: none;
}
.absolute-branding h1 {
    font-size: 2rem;
    text-shadow: 2px 2px 10px #000;
}

.dj-desk-v2 {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* VJ Main Screen (Takes up center stage) */
.vj-main-screen {
    position: relative;
    flex-grow: 1; /* Takes most of the height */
    width: 100%;
    background: #000;
    overflow: hidden;
}

.video-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto; /* Allow clicking on YT wrapper if needed */
}

.video-wrapper iframe {
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: none; /* Disable YT overlay interactions so they don't block clicks */
}

.yt-shadow-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* No transition to keep cuts ultra sharp, or use very fast one */
}

#layer-a-1, #layer-b-1 { z-index: 2; opacity: 1; }
#layer-a-2, #layer-b-2 { z-index: 1; opacity: 0; }

#video-wrapper-a {
    transform: scale(var(--crop, 1.2)); /* hides YouTube's overlays at the edges */
    opacity: 1; /* Controlled by crossfader */
    z-index: 1;
}

#video-wrapper-b {
    transform: scale(var(--crop, 1.2));
    opacity: 0; /* Controlled by crossfader */
    z-index: 2;
}

.vj-label {
    position: absolute;
    bottom: 20px;
    right: 30px;
    font-size: 4rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.05); /* Ghost text */
    pointer-events: none;
    letter-spacing: 5px;
    z-index: 5;
}

/* Floating Search */
.floating-search {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.search-bar-floating {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.9); /* Darker background */
    border: 1px solid var(--border-color);
    border-radius: 0; /* Square edges */
    overflow: hidden;
    transition: width 0.3s ease;
}

.floating-input {
    width: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-family: 'Space Mono', monospace;
    transition: width 0.3s ease, padding 0.3s ease;
    outline: none;
}

.search-bar-floating:hover .floating-input,
.search-bar-floating:focus-within .floating-input {
    width: 450px;
    padding: 10px 15px;
}

.search-icon-btn {
    background: transparent;
    border: none;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-main);
}
.search-icon-btn:hover {
    color: var(--accent-a);
}
.search-icon-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    pointer-events: none;
}

.floating-search .search-results {
    top: calc(100% + 5px);
    border-radius: 0; /* Square edges */
    width: 450px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
}

/* Decks Container (Bottom) */
.dj-decks-container {
    display: flex;
    height: auto; 
    min-height: 120px;
    width: 100%;
    background: linear-gradient(to top, #000, #0a0a0a);
    border-top: 2px solid #333;
    z-index: 100;
}

.dj-decks-container .deck {
    flex: 1;
    border: none;
    border-top: 4px solid var(--accent-a);
    padding: 0.5rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
#deck-b { border-left: 1px solid #1a1a1a; border-top: 4px solid var(--accent-b); }

.deck-top-row {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.deck-main-controls {
    display: flex;
    align-items: center;
    gap: 2rem;
    width: 100%;
    justify-content: space-between; /* Space out the 3 main blocks */
}

/* Thumbnail Paste */
.thumbnail-paste {
    width: 60px;
    height: 60px;
    background: #111;
    border: 2px dashed #444;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    background-size: cover;
    background-position: center;
    border-radius: 5px;
    flex-shrink: 0;
}
.thumbnail-paste:hover {
    border-color: var(--accent-a);
    background-color: rgba(0, 255, 65, 0.05);
}
#deck-b .thumbnail-paste:hover {
    border-color: var(--accent-b);
}
.thumbnail-paste .paste-icon { font-size: 1rem; margin-bottom: 2px; text-shadow: 2px 2px 4px #000; }
.thumbnail-paste .paste-text { font-size: 1rem; font-weight: 800; text-shadow: 2px 2px 4px #000; color: #fff;}

/* Unified Play/Pause Button */
.play-pause-btn {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    border-radius: 50%; /* Make it circular like a DJ deck */
    background: linear-gradient(135deg, #222, #000);
    border: 2px solid #333;
    box-shadow: 0 4px 10px rgba(0,0,0,0.8), inset 0 2px 2px rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.play-pause-btn.playing {
    border-color: var(--accent-a);
    color: var(--accent-a);
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.3);
}

/* Compact Sliders */
.slider-group-compact {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

/* Compact Mixer */
.compact-mixer {
    flex: 0 0 300px;
    padding: 0.5rem 2rem;
    border: none;
    border-top: 4px solid #444;
    background: linear-gradient(to bottom, #151515, #000);
}

.mixer-btn-row {
    display: flex;
    gap: 0.5rem;
    width: 100%;
    margin-bottom: 0.6rem;
}
.mixer-btn-row .mix-btn { flex: 1; width: auto; min-width: 0; }

.sync-play-pause-btn {
    padding: 0.5rem 0.6rem;
    font-size: 1rem;
    margin-bottom: 0;
    border-radius: 5px;
    white-space: nowrap;
}

/* Responsive V2 */
@media (max-width: 900px) {
    .dj-decks-container {
        flex-direction: column;
        height: auto;
        min-height: 50vh;
    }
    .dj-desk-v2 {
        overflow-y: auto;
    }
    .compact-mixer {
        order: -1;
        flex: auto;
        border-left: none;
        border-right: none;
    }
    .deck-main-controls {
        gap: 1rem;
    }
}

/* ─────────────────────────────────────────────────────────────────────────
   iOS / iPadOS overrides — only applied when <body> has class "is-ios".
   Bigger touch targets and touch-action rules so iOS doesn't steal gestures.
   Desktop is unaffected.
   ───────────────────────────────────────────────────────────────────────── */
body.is-ios .btn,
body.is-ios input[type="range"],
body.is-ios .deck-slider {
    touch-action: manipulation;
}

body.is-ios .deck-slider::-webkit-slider-thumb {
    height: 28px;
    width: 18px;
}

body.is-ios .loop-track,
body.is-ios .progress-track {
    touch-action: none;
}

body.is-ios .loop-track {
    height: 18px;
}

body.is-ios .progress-track {
    height: 14px;
}

body.is-ios .loop-handle {
    width: 14px;
    height: 32px;
    touch-action: none;
}

/* ===== v3 LOOP EDITOR ===== */
.loop-btn-pro.edit-btn { border-bottom: 2px solid #00ff88; color: #00ff88; }
.loop-btn-pro.edit-btn:hover { background: #00ff88; color: #000; }

.le-backdrop {
    position: fixed; inset: 0; z-index: 5000;
    background: rgba(0,0,0,0.72);
    display: flex; align-items: center; justify-content: center;
    padding: 12px;
}
.le-backdrop[hidden] { display: none; }
.le-modal {
    width: 100%; max-width: 1040px; max-height: 100%; overflow-y: auto;
    background: #0d0d0d; border: 1px solid #444;
    box-shadow: 0 0 0 1px #000, 0 20px 60px rgba(0,0,0,0.8);
    padding: 14px; display: flex; flex-direction: column; gap: 12px;
    font-family: 'Space Mono', monospace; color: #fff;
}
.le-head { display: flex; align-items: center; gap: 16px; }
.le-title { font-weight: 700; font-style: italic; letter-spacing: 1px; flex: 1; }
.le-title b { color: #00ff41; }
.le-auto { font-size: 0.65rem; color: #888; display: flex; gap: 6px; align-items: center; cursor: pointer; }
.le-close { background: transparent; border: 1px solid #444; color: #aaa; width: 28px; height: 28px; cursor: pointer; font-family: inherit; }
.le-close:hover { background: #ff2a5f; color: #fff; border-color: #ff2a5f; }

.le-overview, .le-strip { width: 100%; display: block; border: 1px solid #333; cursor: pointer; }
.le-strip { cursor: ew-resize; touch-action: none; height: 96px; }
.le-overview { height: 54px; }

.le-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.le-panel { border: 1px solid #2a2a2a; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.le-panel.is-sel { border-color: #00ff41; }
.le-panel-head { display: flex; align-items: center; gap: 10px; }
.le-tag { font-weight: 700; font-size: 0.75rem; padding: 2px 8px; color: #000; }
.le-tag-in { background: #ffaa00; }
.le-tag-out { background: #ff2a5f; color: #fff; }
.le-time { flex: 1; font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.le-win { display: flex; align-items: center; gap: 4px; font-size: 0.65rem; color: #00ff41; }
.le-win button { background: #000; border: 1px solid #333; color: #aaa; width: 22px; height: 22px; cursor: pointer; font-family: inherit; }
.le-win button:hover { background: #fff; color: #000; }
.le-win span { min-width: 34px; text-align: center; }

.le-nudges { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; }
.le-nudges button, .le-btn {
    background: #111; border: 1px solid #333; color: #bbb; padding: 6px 4px;
    font-size: 0.68rem; font-weight: 700; cursor: pointer; font-family: inherit;
}
.le-nudges button:hover, .le-btn:hover { background: #222; color: #fff; border-color: #666; }
.le-nudges button:active, .le-btn:active { background: #00ff41; color: #000; }
.le-row { display: flex; gap: 6px; }
.le-row .le-btn { flex: 1; padding: 8px 4px; }

.le-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; border-top: 1px solid #222; padding-top: 10px; }
.le-len { font-size: 0.85rem; color: #888; }
.le-len b { color: #00ff41; font-size: 1.1rem; }
.le-grid { display: flex; align-items: center; gap: 6px; flex: 1; flex-wrap: wrap; }
.le-lbl { font-size: 0.65rem; color: #666; }
.le-grid input { width: 72px; background: #000; border: 1px solid #333; color: #fff; padding: 6px; font-family: inherit; font-size: 0.8rem; }
.le-len-ops { display: flex; gap: 6px; }
.le-play { background: #00ff41; color: #000; border-color: #00ff41; }
.le-play:hover { background: #00ff88; color: #000; }
.le-hint { font-size: 0.6rem; color: #555; line-height: 1.4; }

@media (max-width: 720px) {
    .le-panels { grid-template-columns: 1fr; }
    .le-time { font-size: 1.05rem; }
}

/* ===== v3 VISUALS SIDEBAR ===== */
:root { --fxs-w: 400px; --crop: 1.2; }
.fx-open-btn { margin-bottom: 0; padding: 0.5rem 0.4rem; font-size: 0.75rem; }
.fx-open-btn.is-on { background: #00ff41; color: #000; border-color: #00ff41; }

body.fxs-open .dj-desk-v2 { width: calc(100vw - var(--fxs-w)); align-self: flex-start; }

.fxs {
    position: fixed; top: 0; right: 0; bottom: 0; width: var(--fxs-w); z-index: 4000;
    background: #0d0d0d; border-left: 1px solid #444;
    font-family: 'Space Mono', monospace; color: #fff;
    display: flex; flex-direction: column;
}
.fxs[hidden] { display: none; }
.fxs-resize { position: absolute; left: -4px; top: 0; bottom: 0; width: 8px; cursor: ew-resize; z-index: 2; touch-action: none; }
.fxs-resize:hover { background: rgba(0,255,65,0.35); }
.fxs-head { display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: #161616; border-bottom: 1px solid #333; }
.fxs-title { font-weight: 700; font-style: italic; letter-spacing: 1px; font-size: 0.8rem; color: #00ff41; }
.fxs-spacer { flex: 1; }
.fxs-btn { background: transparent; border: 1px solid #444; color: #aaa; width: 24px; height: 24px; cursor: pointer; font-family: inherit; font-size: 0.8rem; }
.fxs-btn:hover { background: #fff; color: #000; }

.fxs-screen { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; flex: 0 0 auto; }
.fxs-stage { position: absolute; inset: 0; overflow: hidden; }
.fxs-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.fxs-msg { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; color: #555; font-size: 0.7rem; letter-spacing: 3px; text-align: center; }
.fxs-msg button { background: #111; border: 1px solid #444; color: #00ff41; padding: 6px 12px; font-family: inherit; font-size: 0.65rem; font-weight: 700; cursor: pointer; letter-spacing: 1px; }
.fxs-msg button:hover { background: #00ff41; color: #000; }

/* YouTube-style view-mode control, bottom right */
.fxs-viewctl { position: absolute; right: 10px; bottom: 10px; z-index: 5; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; opacity: 0; transition: opacity 0.15s; }
.fxs-screen:hover .fxs-viewctl, .fxs-viewctl.is-open, .fxs-viewctl:focus-within { opacity: 1; }
@media (hover: none) { .fxs-viewctl { opacity: 0.85; } }
.fxs-viewbtn { width: 34px; height: 30px; display: flex; align-items: center; justify-content: center; background: rgba(20,20,20,0.85); border: 0; border-radius: 6px; color: #fff; cursor: pointer; }
.fxs-viewbtn:hover { background: rgba(60,60,60,0.95); }
.fxs-viewbtn svg { width: 20px; height: 20px; }
.fxs-menu { background: rgba(24,24,24,0.96); border-radius: 8px; padding: 6px 0; min-width: 190px; box-shadow: 0 6px 24px rgba(0,0,0,0.7); }
.fxs-menu[hidden] { display: none; }
.fxs-menu button { display: flex; align-items: center; gap: 14px; width: 100%; background: transparent; border: 0; color: #fff; padding: 9px 16px; font-family: 'Inter', system-ui, sans-serif; font-size: 0.85rem; cursor: pointer; text-align: left; }
.fxs-menu button:hover:not(:disabled) { background: rgba(255,255,255,0.12); }
.fxs-menu button svg { width: 22px; height: 22px; flex: 0 0 auto; }
.fxs-menu button.is-active span::after { content: ' ✓'; color: #00ff41; }
.fxs-menu button:disabled { opacity: 0.35; cursor: not-allowed; }

/* In-window: video fills the browser window */
.fxs-screen.is-inwindow { position: fixed; inset: 0; z-index: 6000; width: auto; aspect-ratio: auto; }
.fxs-screen:fullscreen { aspect-ratio: auto; width: 100%; height: 100%; }
.fxs-screen.is-inwindow .fxs-viewctl, .fxs-screen:fullscreen .fxs-viewctl { right: 20px; bottom: 20px; }

.fxs-controls { padding: 10px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; flex: 1 1 auto; }
.fxs-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.fxs-cell { display: flex; flex-direction: column; gap: 4px; }
.fxs-noamt { height: 16px; }
.fxs-fx { background: #111; border: 1px solid #333; color: #aaa; padding: 9px 4px; font-size: 0.7rem; font-weight: 700; cursor: pointer; font-family: inherit; }
.fxs-fx:hover { border-color: #666; color: #fff; }
.fxs-fx.is-on { background: #00ff41; border-color: #00ff41; color: #000; }
.fxs-cell input[type=range], .fxs-rate input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 16px; background: transparent; margin: 0; padding: 0; }
.fxs input[type=range]::-webkit-slider-runnable-track { height: 4px; background: #333; border: 0; }
.fxs input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 10px; height: 14px; margin-top: -5px; background: #00ff41; border: 0; border-radius: 0; box-shadow: none; }
.fxs input[type=range]::-webkit-slider-thumb::after { display: none; }
.fxs input[type=range]::-moz-range-track { height: 4px; background: #333; }
.fxs input[type=range]::-moz-range-thumb { width: 10px; height: 14px; background: #00ff41; border: 0; border-radius: 0; }
.fxs-foot { display: flex; align-items: center; gap: 10px; border-top: 1px solid #222; padding-top: 10px; }
.fxs-rate { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 0.65rem; color: #888; }
.fxs-rate input { flex: 1; }
.fxs-rate b { color: #00ff41; min-width: 60px; text-align: right; }
.fxs-reset { background: #111; border: 1px solid #333; color: #ff2a5f; padding: 6px 10px; font-size: 0.65rem; font-weight: 700; cursor: pointer; font-family: inherit; }
.fxs-reset:hover { background: #ff2a5f; color: #fff; }

/* Narrow screens: sidebar becomes a full overlay */
@media (max-width: 900px) {
    body.fxs-open .dj-desk-v2 { width: 100vw; }
    .fxs { width: 100vw; border-left: 0; }
    .fxs-resize { display: none; }
}


/* ===== v3 SESSION RECORDER ===== */
.rec-btn { background: #1a0006; border: 1px solid #ff2a5f; color: #ff2a5f; margin-bottom: 0; padding: 0.5rem 0.4rem; font-size: 0.75rem; }
.rec-btn:hover { background: #ff2a5f; color: #fff; }
.rec-btn.is-rec { background: #ff2a5f; color: #fff; animation: rec-pulse 1.2s ease-in-out infinite; }
.rec-btn:disabled { opacity: 0.35; cursor: not-allowed; animation: none; }
@keyframes rec-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,42,95,0.55); } 50% { box-shadow: 0 0 0 8px rgba(255,42,95,0); } }

.rec-badge[hidden] { display: none; }
.rec-badge {
    position: absolute; top: 16px; left: 16px; z-index: 30;
    display: flex; align-items: center; gap: 8px;
    background: rgba(10,0,4,0.75); border: 1px solid #ff2a5f; color: #fff;
    padding: 6px 12px; font-family: 'Space Mono', monospace; font-size: 0.75rem; font-weight: 700; letter-spacing: 1px;
    border-radius: 3px; pointer-events: none;
}
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: #ff2a5f; animation: rec-pulse 1.2s ease-in-out infinite; }
