/* === ELYWARE Video Mixer v4.1 - Performance Console Theme === */

:root {
    --bg: #0d0d0d;
    --surface: #1a1a1a;
    --surface2: #242424;
    --border: #333;
    --accent-a: #00ccff;
    --accent-b: #ff4488;
    --accent-mix: #aa44ff;
    --text: #e0e0e0;
    --text-dim: #888;
    --green: #44dd66;
    --orange: #ff9900;
    --red: #ff3333;
    --vu-bg: rgba(0,0,0,0.5);
    --shadow: rgba(0,0,0,0.5);
}

[data-theme="light"] {
    --bg: #e9e9ee;
    --surface: #f5f5f8;
    --surface2: #dfdfe6;
    --border: #bfbfca;
    --accent-a: #0090c0;
    --accent-b: #e02c68;
    --accent-mix: #8a2be2;
    --text: #1a1a2e;
    --text-dim: #5c5c74;
    --green: #1fa348;
    --orange: #d97b00;
    --red: #d92626;
    --vu-bg: rgba(255,255,255,0.5);
    --shadow: rgba(0,0,0,0.15);
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: 12px;
    overflow-x: hidden;
    user-select: none;
    transition: background 0.3s, color 0.3s;
}

body.dragging-h { cursor: col-resize; }
body.dragging-v { cursor: row-resize; }
body.dragging-h *, body.dragging-v * { pointer-events: none; }

/* Compact Toolbar */
#toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    height: 34px;
    flex-shrink: 0;
    transition: background 0.3s;
}

.brand-wordmark {
    color: #f4f7ff;
    font-size: 13px;
    font-weight: 850;
    letter-spacing: 3px;
    white-space: nowrap;
}

.version-tag {
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 1px;
    color: var(--text-dim);
    -webkit-text-fill-color: var(--text-dim);
    background: none;
    margin-left: 4px;
    opacity: 0.7;
}

#toolbar-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

#toolbar-controls select {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 11px;
}

#popout-btn, #shortcuts-btn, #fullscreen-btn, #save-session-btn,
#load-session-btn, #theme-toggle-btn, #reset-layout-btn {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
}
#popout-btn:hover, #shortcuts-btn:hover, #fullscreen-btn:hover,
#save-session-btn:hover, #load-session-btn:hover, #theme-toggle-btn:hover,
#reset-layout-btn:hover {
    background: var(--accent-mix);
    color: #fff;
}

#shortcuts-btn, #fullscreen-btn, #theme-toggle-btn, #reset-layout-btn {
    width: 26px;
    padding: 3px;
    text-align: center;
    font-weight: 700;
}

/* Output status indicator */
.output-connected {
    color: var(--green);
    font-size: 10px;
    font-weight: 700;
}
.output-disconnected {
    color: var(--text-dim);
    font-size: 10px;
}

/* Fullscreen decks layout */
body.fullscreen-decks {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Decks Row — fills all remaining space; resizable via splitters */
#decks-row {
    display: flex;
    gap: 0;
    flex: 1;
    min-height: 0;
    --grow-a: 1;
    --grow-b: 1;
    --center-w: 230px;
    --preview-h: 150px;
}

/* Splitters between panels */
.splitter {
    width: 6px;
    flex-shrink: 0;
    cursor: col-resize;
    background: var(--surface2);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    position: relative;
    transition: background 0.15s;
    z-index: 15;
}
.splitter:hover, .splitter.active {
    background: var(--accent-mix);
}
.splitter::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 26px;
    border-radius: 2px;
    background: var(--text-dim);
    opacity: 0.6;
}

/* Deck Panel */
.deck {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: background 0.3s;
    min-width: 260px;
    position: relative;
}

#deck-a { flex: var(--grow-a) 1 0; border-right: none; }
#deck-b { flex: var(--grow-b) 1 0; border-left: none; }

.deck-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
    transition: background 0.3s;
}

#deck-a .deck-label { color: var(--accent-a); font-weight: 700; letter-spacing: 2px; }
#deck-b .deck-label { color: var(--accent-b); font-weight: 700; letter-spacing: 2px; }

.deck-now-playing {
    color: var(--text-dim);
    font-size: 11px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    text-align: right;
    margin-right: 6px;
}

.deck-error {
    color: var(--orange);
    font-size: 14px;
    cursor: help;
    animation: blink 1s ease-in-out 3;
}
.deck-error.hidden { display: none; }

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Deck Preview — height adjustable via drag handle */
.deck-preview-wrap {
    position: relative;
    background: #000;
    height: var(--preview-h);
    flex-shrink: 0;
}

.deck-preview {
    width: 100%;
    height: 100%;
    display: block;
}

.deck video { display: none; }

.preview-resize-handle {
    height: 5px;
    flex-shrink: 0;
    cursor: row-resize;
    background: var(--surface2);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    position: relative;
    transition: background 0.15s;
}
.preview-resize-handle:hover, .preview-resize-handle.active { background: var(--accent-mix); }
.preview-resize-handle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 26px;
    height: 2px;
    border-radius: 2px;
    background: var(--text-dim);
    opacity: 0.6;
}

/* Drag & Drop Overlay — covers full deck */
.drop-overlay {
    position: absolute;
    inset: 0;
    background: rgba(170, 68, 255, 0.3);
    border: 3px dashed var(--accent-mix);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 2px;
    z-index: 20;
    pointer-events: none;
    backdrop-filter: blur(4px);
}
.drop-overlay.hidden { display: none; }

#deck-a .drop-overlay {
    background: rgba(0, 204, 255, 0.2);
    border-color: var(--accent-a);
}
#deck-b .drop-overlay {
    background: rgba(255, 68, 136, 0.2);
    border-color: var(--accent-b);
}

/* VU Meter */
.vu-meter {
    position: absolute;
    bottom: 4px;
    left: 4px;
    right: 4px;
    height: 4px;
    z-index: 5;
}
.vu-bar {
    width: 100%;
    height: 100%;
    background: var(--vu-bg);
    border-radius: 2px;
    overflow: hidden;
}
.vu-fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    transition: width 0.08s linear;
}
#deck-a .vu-fill {
    background: linear-gradient(90deg, var(--accent-a), var(--green));
}
#deck-b .vu-fill {
    background: linear-gradient(90deg, var(--accent-b), var(--green));
}
.vu-fill.hot {
    background: linear-gradient(90deg, var(--orange), var(--red)) !important;
}

/* Transport Controls */
.deck-transport {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 6px;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
    transition: background 0.3s;
}

.transport-btn {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    width: 36px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.transport-btn:hover {
    background: var(--surface2);
    border-color: var(--text-dim);
}

.transport-btn.active {
    background: var(--accent-mix);
    color: #fff;
    border-color: var(--accent-mix);
}

#deck-a .play-btn.active {
    background: var(--accent-a);
    border-color: var(--accent-a);
    color: #000;
}

#deck-b .play-btn.active {
    background: var(--accent-b);
    border-color: var(--accent-b);
    color: #fff;
}

/* Sliders */
.deck-sliders {
    padding: 4px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.deck-sliders label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    color: var(--text-dim);
}

.deck-sliders input[type="range"] { flex: 1; height: 4px; }

.speed-val, .slide-dur-val, .vol-val {
    min-width: 30px;
    text-align: right;
    font-size: 10px;
}

/* Progress bar */
.deck-progress-wrap {
    padding: 2px 10px 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-slider { flex: 1; height: 6px; }

.time-display {
    font-size: 10px;
    color: var(--text-dim);
    min-width: 80px;
    text-align: right;
}

/* Image slideshow progress */
.time-display .slide-progress {
    display: inline-block;
    width: 40px;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    vertical-align: middle;
    margin-left: 4px;
    overflow: hidden;
}
.time-display .slide-progress-fill {
    display: block;
    height: 100%;
    background: var(--accent-mix);
    border-radius: 2px;
    transition: width 0.25s linear;
}

/* Per-Deck FX */
.deck-fx {
    border-top: 1px solid var(--border);
    background: var(--surface2);
    transition: background 0.3s;
}

.deck-fx-toggle {
    width: 100%;
    background: none;
    border: none;
    color: var(--text-dim);
    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    cursor: pointer;
    text-align: left;
    letter-spacing: 1px;
}
.deck-fx-toggle:hover { color: var(--text); }

.deck-fx-controls {
    padding: 4px 10px 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.deck-fx-controls.hidden { display: none; }

.deck-fx-controls label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-dim);
}
.deck-fx-controls input[type="range"] { flex: 1; height: 4px; }

.deck-fx-reset {
    background: var(--surface);
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 3px;
    cursor: pointer;
    font-family: inherit;
    font-size: 9px;
    margin-top: 2px;
}
.deck-fx-reset:hover { color: var(--text); border-color: var(--text-dim); }

/* ============================================================
   Deck Tabs: Browse | Playlist | Stock
   ============================================================ */

.deck-tabs {
    display: flex;
    background: var(--surface2);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.deck-tab {
    flex: 1;
    background: none;
    border: none;
    border-right: 1px solid var(--border);
    color: var(--text-dim);
    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 6px 4px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}
.deck-tab:last-child { border-right: none; }
.deck-tab:hover { color: var(--text); background: var(--surface); }

.deck-tab.active {
    color: var(--text);
    background: var(--surface);
    box-shadow: inset 0 -2px 0 var(--accent-mix);
}
#deck-a .deck-tab.active { box-shadow: inset 0 -2px 0 var(--accent-a); }
#deck-b .deck-tab.active { box-shadow: inset 0 -2px 0 var(--accent-b); }

.tab-badge {
    display: inline-block;
    background: var(--border);
    color: var(--text);
    font-size: 9px;
    border-radius: 8px;
    padding: 0 5px;
    margin-left: 2px;
    min-width: 15px;
}
.deck-tab.active .tab-badge { background: var(--accent-mix); color: #fff; }
#deck-a .deck-tab.active .tab-badge { background: var(--accent-a); color: #000; }
#deck-b .deck-tab.active .tab-badge { background: var(--accent-b); color: #fff; }

.deck-panels {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.deck-panel { display: none; }
.deck-panel.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* File Browser */
.file-browser {
    overflow: hidden;
}

.browser-nav {
    display: flex;
    gap: 4px;
    padding: 4px 6px;
    background: var(--surface2);
    transition: background 0.3s;
    position: relative;
}

.nav-btn {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 3px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    font-family: inherit;
    white-space: nowrap;
    transition: background 0.15s;
}
.nav-btn:hover { background: var(--border); }

.path-input {
    flex: 1;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 3px 6px;
    border-radius: 3px;
    font-family: inherit;
    font-size: 11px;
    min-width: 0;
    transition: background 0.3s;
}

/* Recent folders dropdown */
.recent-menu {
    position: absolute;
    top: 100%;
    left: 6px;
    right: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 6px 18px var(--shadow);
    z-index: 40;
    max-height: 220px;
    overflow-y: auto;
}
.recent-menu.hidden { display: none; }
.recent-menu .recent-item {
    padding: 6px 10px;
    font-size: 10px;
    cursor: pointer;
    border-bottom: 1px solid var(--surface2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    direction: rtl;
    text-align: left;
}
.recent-menu .recent-item:last-child { border-bottom: none; }
.recent-menu .recent-item:hover { background: var(--surface2); color: var(--accent-mix); }
.recent-menu .recent-empty {
    padding: 8px 10px;
    font-size: 10px;
    color: var(--text-dim);
    font-style: italic;
}

/* Search bar */
.browser-search {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    background: var(--surface2);
    border-top: 1px solid var(--border);
}

.search-icon {
    color: var(--text-dim);
    font-size: 13px;
    width: 16px;
    text-align: center;
}

.search-input {
    flex: 1;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 4px 8px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 11px;
    min-width: 0;
    transition: border-color 0.15s, background 0.3s;
}
.search-input:focus {
    outline: none;
    border-color: var(--accent-mix);
}
#deck-a .search-input:focus { border-color: var(--accent-a); }
#deck-b .search-input:focus { border-color: var(--accent-b); }

.search-clear {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 11px;
    padding: 2px 4px;
    border-radius: 3px;
}
.search-clear:hover { color: var(--text); background: var(--border); }
.search-clear.hidden { display: none; }

.search-status {
    padding: 3px 10px;
    font-size: 10px;
    color: var(--accent-mix);
    background: var(--bg);
    border-top: 1px solid var(--surface);
}
.search-status.hidden { display: none; }

/* Breadcrumb path */
.browser-path {
    padding: 3px 8px;
    font-size: 10px;
    color: var(--text-dim);
    background: var(--bg);
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    transition: background 0.3s;
    scrollbar-width: none;
    flex-shrink: 0;
}
.browser-path::-webkit-scrollbar { display: none; }

.breadcrumb .crumb {
    cursor: pointer;
    padding: 1px 2px;
    border-radius: 2px;
}
.breadcrumb .crumb:hover { color: var(--accent-mix); background: var(--surface2); }
.breadcrumb .crumb:last-child { color: var(--text); font-weight: 700; }
.breadcrumb .crumb-sep { color: var(--text-dim); opacity: 0.5; margin: 0 1px; }

.file-list {
    flex: 1;
    overflow-y: auto;
    list-style: none;
    background: var(--bg);
    transition: background 0.3s;
    min-height: 0;
}

.file-list li {
    padding: 4px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid var(--surface);
    font-size: 11px;
    transition: background 0.1s;
    position: relative;
}
.file-list li:hover { background: var(--surface2); }

.file-list li.active {
    background: var(--surface2);
    border-left: 3px solid var(--accent-mix);
}
#deck-a .file-list li.active { border-left-color: var(--accent-a); }
#deck-b .file-list li.active { border-left-color: var(--accent-b); }

.file-list .file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-list .file-rel {
    font-size: 9px;
    color: var(--text-dim);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Queue [+] button on file rows */
.file-add-btn {
    background: var(--surface);
    color: var(--text-dim);
    border: 1px solid var(--border);
    width: 18px;
    height: 18px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    display: none;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: inherit;
}
.file-list li:hover .file-add-btn { display: flex; }
.file-add-btn:hover { color: #fff; background: var(--accent-mix); border-color: var(--accent-mix); }

/* Drag reorder styling */
.file-list li.dragging, .playlist-list li.dragging {
    opacity: 0.4;
}
.file-list li.drag-over, .playlist-list li.drag-over {
    border-top: 2px solid var(--accent-mix);
}

.file-list .icon, .playlist-list .icon { font-size: 13px; width: 18px; text-align: center; flex-shrink: 0; }
.dir-icon { color: var(--orange); }
.vid-icon { color: var(--accent-a); }
.img-icon { color: var(--green); }
.vis-icon { color: var(--accent-mix); }

.browser-actions {
    padding: 4px 6px;
    background: var(--surface2);
    transition: background 0.3s;
    flex-shrink: 0;
}

.load-folder-btn {
    width: 100%;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    transition: all 0.15s;
}
#deck-a .load-folder-btn:hover { background: var(--accent-a); color: #000; border-color: var(--accent-a); }
#deck-b .load-folder-btn:hover { background: var(--accent-b); color: #fff; border-color: var(--accent-b); }

/* ============================================================
   Playlist Panel
   ============================================================ */

.playlist-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    background: var(--surface2);
    flex-shrink: 0;
}

.playlist-count { font-size: 10px; color: var(--text-dim); }

.playlist-clear {
    background: var(--surface);
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-family: inherit;
    font-size: 10px;
}
.playlist-clear:hover { color: var(--red); border-color: var(--red); }

.playlist-list {
    flex: 1;
    overflow-y: auto;
    list-style: none;
    background: var(--bg);
    min-height: 0;
}

.playlist-list li {
    padding: 4px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid var(--surface);
    font-size: 11px;
    transition: background 0.1s;
}
.playlist-list li:hover { background: var(--surface2); }

.playlist-list li.active {
    background: var(--surface2);
    border-left: 3px solid var(--accent-mix);
}
#deck-a .playlist-list li.active { border-left-color: var(--accent-a); }
#deck-b .playlist-list li.active { border-left-color: var(--accent-b); }

.playlist-list .pl-index {
    font-size: 9px;
    color: var(--text-dim);
    min-width: 18px;
    text-align: right;
}

.playlist-list .pl-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pl-remove {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 11px;
    padding: 1px 4px;
    border-radius: 3px;
    opacity: 0;
    flex-shrink: 0;
    font-family: inherit;
}
.playlist-list li:hover .pl-remove { opacity: 1; }
.pl-remove:hover { color: var(--red); background: var(--surface); }

.playlist-empty {
    flex: 1;
    display: none;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-dim);
    font-size: 11px;
    line-height: 1.8;
    background: var(--bg);
}
.playlist-empty.visible { display: flex; }

/* ============================================================
   Legacy Visuals Panel (hidden in v4; retained for old sessions)
   ============================================================ */

.visuals-hint {
    padding: 4px 8px;
    font-size: 10px;
    color: var(--text-dim);
    background: var(--surface2);
    flex-shrink: 0;
}
.visuals-hint b { color: var(--accent-mix); }

.visuals-scroll {
    flex: 1;
    overflow-y: auto;
    background: var(--bg);
    padding: 6px;
    min-height: 0;
}

.visuals-cat-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 6px 2px 4px;
}

.visuals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 6px;
}

.visual-tile {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 5px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 16 / 9;
    background-size: cover;
    background-position: center;
    background-color: #000;
    transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.visual-tile:hover {
    transform: scale(1.03);
    border-color: var(--accent-mix);
    box-shadow: 0 2px 10px var(--shadow);
    z-index: 2;
}
.visual-tile.playing {
    border-color: var(--green);
    box-shadow: 0 0 0 1px var(--green);
}

.visual-tile .visual-name {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 3px 5px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #fff;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    text-shadow: 0 1px 2px #000;
    pointer-events: none;
}

.visual-add-btn {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 18px;
    height: 18px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    display: none;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}
.visual-tile:hover .visual-add-btn { display: flex; }
.visual-add-btn:hover { background: var(--accent-mix); border-color: var(--accent-mix); }

/* ============================================================
   Center Panel / Crossfader
   ============================================================ */

#center-panel {
    width: var(--center-w);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 10px;
    gap: 10px;
    overflow-y: auto;
    transition: background 0.3s;
    min-width: 190px;
}

#crossfader-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cf-label { font-weight: 700; font-size: 14px; }
#crossfader-section .cf-label:first-child { color: var(--accent-a); }
#crossfader-section .cf-label:last-child { color: var(--accent-b); }
#crossfader { flex: 1; height: 8px; }

/* Mini mix preview */
#mini-preview-wrap { text-align: center; }
#mini-preview {
    width: 100%;
    height: 100px;
    background: #000;
    border-radius: 4px;
    display: block;
    border: 1px solid var(--border);
}
.mini-label {
    font-size: 8px;
    letter-spacing: 1.5px;
    color: var(--text-dim);
    margin-top: 2px;
    display: block;
}

/* Transition Search */
.trans-search { margin-bottom: 4px; }
.trans-search input {
    width: 100%;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 3px 8px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 10px;
    transition: border-color 0.15s;
}
.trans-search input:focus {
    outline: none;
    border-color: var(--accent-mix);
}

/* Transition Picker */
#transition-picker {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    transition: background 0.3s;
}

.trans-category { border-bottom: 1px solid var(--border); }
.trans-category:last-child { border-bottom: none; }
.trans-category.hidden { display: none; }

.trans-cat-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 4px 6px 2px;
    background: var(--surface2);
    transition: background 0.3s;
}

.trans-cat-items { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; }

.trans-btn {
    background: var(--surface);
    color: var(--text-dim);
    border: 1px solid transparent;
    padding: 2px 5px;
    border-radius: 3px;
    cursor: pointer;
    font-family: inherit;
    font-size: 9px;
    transition: all 0.1s;
    white-space: nowrap;
}
.trans-btn:hover { color: var(--text); border-color: var(--border); }
.trans-btn.active { background: var(--accent-mix); color: #fff; border-color: var(--accent-mix); }
.trans-btn.hidden { display: none; }

#transition-current { text-align: center; padding: 3px 0; }
#transition-current-name { font-size: 11px; font-weight: 700; color: var(--accent-mix); }

#auto-mix-section { margin-top: 8px; }

#auto-mix-btn {
    width: 100%;
    background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
    color: #fff;
    border: none;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 6px;
    transition: opacity 0.15s;
}
#auto-mix-btn:hover { opacity: 0.85; }
#auto-mix-btn.mixing { animation: pulse 1s ease-in-out infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

#auto-mix-section label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-dim);
}
#auto-mix-section input[type="range"] { flex: 1; height: 4px; }
#auto-mix-dur-val { min-width: 28px; text-align: right; }

/* BPM Section */
#bpm-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#bpm-display {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-mix);
    letter-spacing: 1px;
    padding: 4px 0;
}

#tap-tempo-btn {
    width: 100%;
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    transition: all 0.1s;
}
#tap-tempo-btn:hover { border-color: var(--accent-mix); color: var(--accent-mix); }
#tap-tempo-btn:active, #tap-tempo-btn.flash {
    background: var(--accent-mix);
    color: #fff;
    border-color: var(--accent-mix);
}

#beat-sync-btn {
    width: 100%;
    background: var(--surface2);
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 5px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    transition: all 0.2s;
}
#beat-sync-btn:hover { border-color: var(--green); color: var(--green); }
#beat-sync-btn.active {
    background: var(--green);
    color: #000;
    border-color: var(--green);
}

/* FX Section */
#fx-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-mix);
    letter-spacing: 2px;
    margin-bottom: 2px;
}

#fx-section label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-dim);
}
#fx-section input[type="range"] { flex: 1; height: 4px; }

#fx-reset {
    background: var(--surface2);
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 4px;
    border-radius: 3px;
    cursor: pointer;
    font-family: inherit;
    font-size: 10px;
    margin-top: 4px;
    transition: color 0.15s;
}
#fx-reset:hover { color: var(--text); border-color: var(--text-dim); }

/* Slider Theming */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    transition: background 0.3s;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--text);
    border: 2px solid var(--surface);
    cursor: pointer;
}

#crossfader::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
    border: 2px solid #fff;
}

#deck-a input[type="range"]::-webkit-slider-thumb { background: var(--accent-a); }
#deck-b input[type="range"]::-webkit-slider-thumb { background: var(--accent-b); }

.progress-slider { height: 6px !important; }
.progress-slider::-webkit-slider-thumb { width: 10px; height: 16px; border-radius: 2px; }

/* Shortcuts overlay */
#shortcuts-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
#shortcuts-overlay.hidden { display: none; }

#shortcuts-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    transition: background 0.3s;
}
#shortcuts-box h3 { margin-bottom: 12px; color: var(--accent-mix); letter-spacing: 1px; }
#shortcuts-box table { width: 100%; margin-bottom: 12px; }
#shortcuts-box td { padding: 3px 8px; }
#shortcuts-box kbd {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 2px 6px;
    font-family: inherit;
    font-size: 11px;
}
.shortcuts-tip {
    font-size: 10px;
    color: var(--text-dim);
    margin-bottom: 12px;
}
#close-shortcuts {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* Autopilot section */
#autopilot-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#autopilot-btn {
    width: 100%;
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    transition: all 0.2s;
}
#autopilot-btn:hover { border-color: var(--green); color: var(--green); }
#autopilot-btn.active {
    background: var(--green);
    color: #000;
    border-color: var(--green);
    animation: pulse 2s ease-in-out infinite;
}

#autopilot-section label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-dim);
}
#autopilot-section input[type="range"] { flex: 1; height: 4px; }
#autopilot-hold-val, #autopilot-trans-val { min-width: 24px; text-align: right; font-size: 10px; }

/* Custom transitions section */
#custom-transitions-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#load-custom-btn {
    width: 100%;
    background: var(--surface2);
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 4px;
    border-radius: 3px;
    cursor: pointer;
    font-family: inherit;
    font-size: 10px;
}
#load-custom-btn:hover { color: var(--text); border-color: var(--text-dim); }

#custom-list { display: flex; flex-wrap: wrap; gap: 3px; }
.custom-tag {
    background: var(--surface2);
    color: var(--green);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 9px;
}
.no-custom { font-size: 9px; color: var(--text-dim); font-style: italic; }

/* ============================================================
   v4.1 Performance Console — visual hierarchy + show controls
   ============================================================ */

:root {
    --bg: #07090d;
    --surface: #0e1219;
    --surface2: #151b24;
    --surface3: #1b2330;
    --border: #273142;
    --border-hi: #3b4a60;
    --accent-a: #31d7ff;
    --accent-b: #ff4f91;
    --accent-mix: #9a6bff;
    --text: #edf3fb;
    --text-dim: #8390a3;
    --green: #4ee6a3;
    --orange: #ffb44f;
    --red: #ff5e67;
    --shadow: rgba(0, 0, 0, 0.62);
    --glow-a: rgba(49, 215, 255, 0.18);
    --glow-b: rgba(255, 79, 145, 0.16);
    --glow-mix: rgba(154, 107, 255, 0.2);
}

[data-theme="light"] {
    --bg: #e9edf4;
    --surface: #f8faff;
    --surface2: #eef2f8;
    --surface3: #e1e7f0;
    --border: #cbd3df;
    --border-hi: #aeb9c8;
    --text: #101722;
    --text-dim: #657184;
    --shadow: rgba(23, 34, 51, 0.16);
    --glow-a: rgba(0, 144, 192, 0.1);
    --glow-b: rgba(224, 44, 104, 0.09);
    --glow-mix: rgba(138, 43, 226, 0.1);
}

body {
    font-family: Inter, "SF Pro Text", "Segoe UI", Arial, sans-serif;
    font-size: 12px;
    letter-spacing: 0.01em;
    background:
        radial-gradient(circle at 50% -20%, rgba(89, 101, 255, 0.08), transparent 35%),
        var(--bg);
}

button, input, select { font-family: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible {
    outline: 2px solid var(--accent-mix);
    outline-offset: 1px;
}

#toolbar {
    height: 48px;
    padding: 6px 12px;
    background: rgba(14, 18, 25, 0.96);
    border-bottom-color: var(--border);
    box-shadow: 0 8px 30px rgba(0,0,0,0.18);
    backdrop-filter: blur(18px);
    position: relative;
    z-index: 30;
}

.brand-lockup, .brand-copy { display: flex; align-items: center; }
.brand-lockup { gap: 10px; min-width: max-content; }
.brand-copy { flex-direction: column; align-items: flex-start; line-height: 1; gap: 3px; }
.brand-mark {
    width: 30px;
    height: 30px;
    display: block;
    flex: 0 0 30px;
    filter: drop-shadow(0 7px 11px rgba(0,0,0,.36));
}
.brand-wordmark { color: #f4f7ff; font-size: 12px; font-weight: 850; letter-spacing: 3.1px; }
.brand-product {
    display: flex;
    align-items: center;
    gap: 5px;
    color: rgba(199, 207, 222, .62);
    font-size: 7px;
    font-weight: 750;
    letter-spacing: 1.8px;
    white-space: nowrap;
}
.version-tag {
    margin-left: 0;
    padding: 1px 4px;
    border: 1px solid rgba(154,107,255,.42);
    border-radius: 4px;
    color: #c8b5ff;
    -webkit-text-fill-color: currentColor;
    background: rgba(154,107,255,.1);
    font-size: 7px;
    font-weight: 800;
    letter-spacing: .7px;
    opacity: 1;
}

#toolbar-controls { gap: 6px; }
#toolbar-controls > label { color: var(--text-dim); font-size: 9px; font-weight: 800; letter-spacing: 1px; }
#toolbar-controls select { height: 28px; padding: 3px 24px 3px 8px; border-radius: 6px; background: var(--surface2); }
#popout-btn, #shortcuts-btn, #fullscreen-btn, #save-session-btn,
#load-session-btn, #theme-toggle-btn, #reset-layout-btn {
    height: 29px;
    background: linear-gradient(180deg, var(--surface3), var(--surface2));
    border-color: var(--border);
    border-radius: 6px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
#popout-btn { border-color: rgba(154,107,255,0.45); color: #e8ddff; }

#output-status { display: inline-flex; align-items: center; gap: 6px; padding: 0 5px; font-size: 9px; letter-spacing: .7px; }
#output-status i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; opacity: .8; }

#decks-row { --center-w: 242px; --preview-h: 164px; }
.deck { border-top: none; box-shadow: inset 0 1px 0 rgba(255,255,255,0.02); }
#deck-a { background: linear-gradient(180deg, var(--glow-a), transparent 120px), var(--surface); }
#deck-b { background: linear-gradient(180deg, var(--glow-b), transparent 120px), var(--surface); }
.deck-header { min-height: 34px; padding: 7px 11px; background: rgba(21,27,36,0.82); }
.deck-label { font-size: 10px; }
.deck-now-playing { font-weight: 600; letter-spacing: .02em; }

.deck-preview-wrap { background: #030507; }
.deck-preview { opacity: .98; }
.deck-preview-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border: 1px solid rgba(255,255,255,0.045);
    box-shadow: inset 0 0 38px rgba(0,0,0,0.36);
}

.deck-transport { padding: 7px; gap: 7px; background: rgba(21,27,36,0.9); }
.transport-btn { width: 38px; height: 31px; border-radius: 7px; background: linear-gradient(180deg, var(--surface3), var(--surface)); box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 2px 4px rgba(0,0,0,.18); }
.transport-btn:hover { transform: translateY(-1px); border-color: var(--border-hi); }

.deck-tabs { background: var(--surface2); }
.deck-tab { padding: 8px 4px; font-size: 9px; letter-spacing: 1.25px; }
.deck-panel.active { border-left: none; border-right: none; border-bottom: none; }

#center-panel {
    padding: 10px;
    gap: 11px;
    background: linear-gradient(180deg, var(--glow-mix), transparent 180px), var(--surface);
}
#crossfader-section, #mini-preview-wrap, #transition-section, #auto-mix-section {
    position: relative;
}
#mini-preview { height: 112px; border-radius: 7px; box-shadow: 0 8px 26px rgba(0,0,0,.28); }
.section-title { font-size: 9px; letter-spacing: 1.8px; }
#transition-picker { border-radius: 7px; }
.trans-btn { border-radius: 5px; padding: 3px 6px; }
#auto-mix-btn { border-radius: 7px; padding: 9px; box-shadow: 0 8px 22px rgba(128,68,255,.2); }

/* Playlist workspace */
.playlist-head { min-height: 39px; padding: 5px 7px; gap: 8px; border-bottom: 1px solid var(--border); }
.playlist-summary { display: flex; flex-direction: column; gap: 2px; min-width: 52px; }
.playlist-count { font-size: 10px; color: var(--text); font-weight: 750; }
.playlist-position { font-size: 8px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .8px; }
.playlist-actions { display: flex; justify-content: flex-end; align-items: center; gap: 3px; flex: 1; }
.playlist-actions button, .pl-tool {
    background: var(--surface);
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: 5px;
    cursor: pointer;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    transition: all .12s;
}
.playlist-actions button { height: 24px; padding: 0 7px; }
.playlist-actions button:hover, .pl-tool:hover { color: var(--text); border-color: var(--border-hi); background: var(--surface3); }
.playlist-actions .playlist-clear:hover { color: var(--red); border-color: var(--red); }

.playlist-filter { display: flex; align-items: center; gap: 5px; padding: 5px 7px; border-bottom: 1px solid var(--border); background: var(--surface); }
.playlist-filter .search-icon { color: var(--text-dim); }
.playlist-search {
    min-width: 0;
    flex: 1;
    height: 26px;
    color: var(--text);
    background: transparent;
    border: none;
    font-size: 10px;
}
.playlist-search:focus { outline: none; }
.playlist-search-clear { color: var(--text-dim); background: transparent; border: none; cursor: pointer; }
.playlist-search-clear.hidden { display: none; }

.playlist-list { padding: 4px; }
.playlist-list li {
    min-height: 37px;
    margin-bottom: 2px;
    padding: 5px 6px;
    gap: 7px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: rgba(255,255,255,.012);
}
.playlist-list li:hover { border-color: var(--border); background: var(--surface2); }
.playlist-list li.active { border: 1px solid var(--border-hi); border-left: 3px solid var(--accent-mix); background: linear-gradient(90deg, var(--glow-mix), var(--surface2)); }
.playlist-list li.is-next .pl-index { color: var(--green); }
.playlist-list li.filtered-out { display: none; }
.playlist-list .pl-index { min-width: 22px; font-variant-numeric: tabular-nums; font-family: "SF Mono", Consolas, monospace; }
.playlist-list .pl-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.playlist-list .pl-name { flex: none; font-size: 10px; font-weight: 650; }
.playlist-list .pl-meta { color: var(--text-dim); font-size: 8px; letter-spacing: .6px; text-transform: uppercase; }
.playlist-list .pl-tools { display: flex; gap: 2px; opacity: .45; transition: opacity .12s; }
.playlist-list li:hover .pl-tools, .playlist-list li.active .pl-tools { opacity: 1; }
.pl-tool { width: 23px; height: 23px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.pl-tool:disabled { opacity: .22; cursor: default; }
.pl-tool.play { color: var(--green); }
.pl-tool.remove:hover { color: var(--red); border-color: var(--red); }
.playlist-list li.drag-after { border-bottom: 2px solid var(--accent-mix); }
.playlist-foot { flex-shrink: 0; padding: 5px 8px; color: var(--text-dim); background: var(--surface2); border-top: 1px solid var(--border); font-size: 8px; text-align: center; letter-spacing: .2px; }
.playlist-empty { background: radial-gradient(circle at 50% 42%, var(--glow-mix), transparent 45%), var(--bg); }

/* v4.1 Pixabay stock-video browser */
.stock-panel { position: relative; background: var(--bg); }
.stock-toolbar { flex: 0 0 auto; padding: 7px; border-bottom: 1px solid var(--border); background: var(--surface2); }
.stock-search-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px; }
.stock-search-input {
    min-width: 0;
    height: 29px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    outline: none;
    color: var(--text);
    background: var(--bg);
    font-family: inherit;
    font-size: 10px;
    user-select: text;
}
.stock-search-input:focus { border-color: var(--accent-mix); box-shadow: 0 0 0 1px var(--glow-mix); }
.stock-search-input:disabled { opacity: .48; cursor: not-allowed; }
.stock-search-btn,
.stock-action-btn,
.stock-key-form button,
.stock-card-actions button,
.stock-preview-actions button,
.stock-pager button {
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text);
    background: var(--surface3);
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
}
.stock-search-btn { height: 29px; padding: 0 9px; font-size: 9px; }
.stock-search-btn:hover,
.stock-action-btn:hover,
.stock-key-form button:hover,
.stock-card-actions button:hover,
.stock-preview-actions button:hover,
.stock-pager button:hover { border-color: var(--border-hi); background: var(--surface); }
.stock-search-btn:disabled,
.stock-key-form button:disabled,
.stock-card-actions button:disabled,
.stock-pager button:disabled { opacity: .4; cursor: not-allowed; }

.stock-subnav { display: flex; align-items: center; justify-content: space-between; gap: 7px; margin-top: 6px; }
.stock-modes { display: inline-flex; padding: 2px; border: 1px solid var(--border); border-radius: 5px; background: var(--bg); }
.stock-mode { min-width: 58px; height: 21px; padding: 0 7px; border: none; border-radius: 3px; color: var(--text-dim); background: transparent; font-family: inherit; font-size: 8px; font-weight: 700; letter-spacing: .3px; cursor: pointer; }
.stock-mode.active { color: #fff; background: var(--accent-mix); }
.stock-cache-summary { flex: 1; min-width: 0; overflow: hidden; color: var(--text-dim); font-size: 8px; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.stock-config-btn { flex: 0 0 auto; height: 21px; padding: 0 6px; border: 1px solid var(--border); border-radius: 4px; color: var(--text-dim); background: var(--bg); font-family: inherit; font-size: 8px; cursor: pointer; }
.stock-config-btn:hover { color: var(--text); border-color: var(--border-hi); }
.stock-config-btn.hidden { display: none; }

.stock-status { flex: 0 0 auto; min-height: 24px; padding: 6px 8px; border-bottom: 1px solid var(--border); color: var(--text-dim); background: var(--surface); font-size: 8px; font-weight: 800; letter-spacing: .75px; text-transform: uppercase; }
.stock-status.online { color: var(--green); }
.stock-status.warning { color: var(--orange); }
.stock-status.error { color: var(--red); }
.stock-status.loading::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border: 1px solid var(--text-dim); border-top-color: transparent; border-radius: 50%; animation: stock-spin .7s linear infinite; }
.stock-content { flex: 1; min-height: 0; overflow-y: auto; padding: 8px; background: var(--bg); }
.stock-hint { flex: 0 0 auto; padding: 5px 7px; border-top: 1px solid var(--border); color: var(--text-dim); background: var(--surface2); font-size: 8px; text-align: center; }

.stock-setup,
.stock-welcome,
.stock-empty { min-height: 190px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; max-width: 430px; margin: 0 auto; padding: 18px; color: var(--text-dim); text-align: center; }
.stock-setup strong,
.stock-welcome strong,
.stock-empty strong { color: var(--text); font-size: 12px; }
.stock-setup p,
.stock-welcome p,
.stock-empty p { max-width: 360px; margin: 0; font-size: 9px; line-height: 1.5; }
.stock-setup-mark,
.stock-welcome-mark { display: grid; place-items: center; min-width: 50px; height: 24px; padding: 0 8px; border: 1px solid var(--accent-mix); border-radius: 4px; color: var(--accent-mix); background: var(--glow-mix); font-size: 8px; font-weight: 900; letter-spacing: 1.4px; }
.stock-key-form { width: min(100%, 360px); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px; }
.stock-key-form input { min-width: 0; height: 30px; padding: 0 9px; border: 1px solid var(--border); border-radius: 5px; outline: none; color: var(--text); background: var(--surface); font-family: inherit; font-size: 9px; user-select: text; }
.stock-key-form input:focus { border-color: var(--accent-mix); }
.stock-key-form button { padding: 0 9px; font-size: 8px; }
.stock-privacy { color: var(--green); }
.stock-config-error { width: min(100%, 360px); padding: 5px 7px; border: 1px solid rgba(255,51,51,.35); border-radius: 4px; color: #ffb3b3; background: rgba(255,51,51,.1); font-size: 8px; line-height: 1.4; }
.stock-config-alt code { padding: 2px 4px; border-radius: 3px; color: var(--text); background: var(--surface2); user-select: text; }
.stock-setup-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.stock-setup-links button { border: none; padding: 0; color: var(--text-dim); background: transparent; font-family: inherit; font-size: 8px; text-decoration: underline; cursor: pointer; }
.stock-setup a,
.stock-welcome a,
.stock-links a { color: var(--accent-a); text-decoration: none; }
.stock-setup a:hover,
.stock-welcome a:hover,
.stock-links a:hover { text-decoration: underline; }
.stock-starters { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.stock-starters button { height: 25px; padding: 0 9px; border: 1px solid var(--border); border-radius: 13px; color: var(--text); background: var(--surface2); font-family: inherit; font-size: 8px; font-weight: 700; cursor: pointer; }
.stock-starters button:hover { border-color: var(--accent-mix); background: var(--glow-mix); }
.stock-legal { color: var(--text-dim); font-size: 8px; }

.stock-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 8px; }
.stock-card { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); box-shadow: 0 5px 14px rgba(0,0,0,.2); }
.stock-card:hover { border-color: var(--border-hi); box-shadow: 0 8px 20px var(--shadow); }
.stock-card.is-cached { border-color: var(--green); }
.stock-card.is-busy { pointer-events: none; }
.stock-thumb { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; padding: 0; border: none; color: var(--text-dim); background: #050608; cursor: pointer; }
.stock-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .18s, opacity .18s; }
.stock-card:hover .stock-thumb img { transform: scale(1.025); }
.stock-thumb-fallback { position: absolute; inset: 0; display: grid; place-items: center; font-size: 8px; font-weight: 900; letter-spacing: 2px; }
.stock-badges { position: absolute; left: 5px; bottom: 5px; display: flex; gap: 3px; }
.stock-badges b,
.stock-cached-badge { padding: 2px 4px; border-radius: 3px; color: #fff; background: rgba(0,0,0,.74); font-size: 7px; font-weight: 800; }
.stock-cached-badge { position: absolute; top: 5px; left: 5px; color: #031209; background: var(--green); letter-spacing: .45px; }
.stock-card-body { display: flex; flex-direction: column; gap: 5px; padding: 7px; }
.stock-card-body > strong { overflow: hidden; color: var(--text); font-size: 9px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.stock-links { display: flex; align-items: center; gap: 3px; min-width: 0; overflow: hidden; color: var(--text-dim); font-size: 7px; white-space: nowrap; }
.stock-links a { max-width: 42%; overflow: hidden; text-overflow: ellipsis; }
.stock-card-actions { display: flex; gap: 3px; }
.stock-card-actions button { flex: 1; min-width: 0; height: 23px; padding: 0 4px; overflow: hidden; font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.stock-card-actions button.primary,
.stock-preview-actions button.primary { color: #fff; border-color: var(--accent-mix); background: var(--accent-mix); }
.stock-progress { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.stock-progress::before { content: ''; height: 3px; overflow: hidden; border-radius: 2px; background: var(--border); }
.stock-progress span { position: relative; height: 3px; margin-top: -7px; overflow: hidden; border-radius: 2px; }
.stock-progress span::after { content: ''; position: absolute; inset: 0; width: 42%; background: var(--accent-mix); animation: stock-progress 1s ease-in-out infinite; }
.stock-progress em { overflow: hidden; color: var(--accent-mix); font-size: 7px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.stock-card-error { padding: 4px 5px; border-radius: 3px; color: #ffb3b3; background: rgba(255,51,51,.12); font-size: 7px; line-height: 1.35; }
.stock-pager { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 10px 0 2px; color: var(--text-dim); font-size: 8px; }
.stock-pager button,
.stock-action-btn { min-height: 25px; padding: 0 9px; font-size: 8px; }
.stock-empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }

.stock-preview { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; padding: 10px; background: rgba(3,5,9,.82); backdrop-filter: blur(7px); }
.stock-preview.hidden { display: none; }
.stock-preview-card { position: relative; width: min(100%, 440px); max-height: 100%; overflow-y: auto; border: 1px solid var(--border-hi); border-radius: 9px; background: var(--surface); box-shadow: 0 20px 55px rgba(0,0,0,.6); }
.stock-preview-close { position: absolute; top: 6px; right: 6px; z-index: 2; width: 25px; height: 25px; border: 1px solid rgba(255,255,255,.28); border-radius: 50%; color: #fff; background: rgba(0,0,0,.7); font-size: 16px; cursor: pointer; }
.stock-preview-media { aspect-ratio: 16 / 9; overflow: hidden; background: #000; }
.stock-preview-media img,
.stock-preview-media video { display: block; width: 100%; height: 100%; object-fit: contain; }
.stock-preview-fallback { width: 100%; height: 100%; display: grid; place-items: center; color: var(--text-dim); font-size: 9px; letter-spacing: 2px; }
.stock-preview-copy { display: flex; flex-direction: column; gap: 6px; padding: 10px; }
.stock-preview-kicker { color: var(--accent-mix); font-size: 7px; font-weight: 900; letter-spacing: 1px; }
.stock-preview-copy > strong { font-size: 11px; }
.stock-preview-copy > p { color: var(--text-dim); font-size: 8px; }
.stock-preview-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 3px; }
.stock-preview-actions button { flex: 1; min-width: 75px; min-height: 27px; padding: 0 8px; font-size: 8px; }

.stock-skeleton { min-height: 145px; padding: 0 0 8px; }
.stock-skeleton i { display: block; aspect-ratio: 16 / 9; background: var(--surface2); }
.stock-skeleton span { display: block; width: 72%; height: 7px; margin: 8px 7px 0; border-radius: 4px; background: var(--surface2); }
.stock-skeleton span:last-child { width: 46%; }
.stock-skeleton i,
.stock-skeleton span { background-image: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.05) 45%, transparent 70%); background-size: 220% 100%; animation: stock-shimmer 1.15s linear infinite; }

@keyframes stock-spin { to { transform: rotate(360deg); } }
@keyframes stock-progress { 0% { transform: translateX(-120%); } 100% { transform: translateX(300%); } }
@keyframes stock-shimmer { to { background-position-x: -220%; } }

#app-toast {
    position: fixed;
    left: 50%;
    bottom: 22px;
    z-index: 200;
    transform: translate(-50%, 14px);
    opacity: 0;
    pointer-events: none;
    min-width: 190px;
    max-width: 480px;
    padding: 9px 13px;
    border: 1px solid var(--border-hi);
    border-radius: 8px;
    color: var(--text);
    background: rgba(14,18,25,.96);
    box-shadow: 0 16px 44px rgba(0,0,0,.42);
    text-align: center;
    font-size: 10px;
    font-weight: 650;
    transition: opacity .18s, transform .18s;
}
#app-toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1180px) {
    .brand-product, .resolution-control { display: none; }
    #toolbar-controls { gap: 4px; }
    #save-session-btn, #load-session-btn { width: 28px; overflow: hidden; color: transparent; position: relative; }
    #save-session-btn::first-letter, #load-session-btn::first-letter { color: var(--text); }
    #decks-row { --center-w: 214px; }
    .playlist-actions .playlist-export, .playlist-actions .playlist-import { font-size: 0; width: 25px; padding: 0; }
    .playlist-actions .playlist-export::after { content: '↓'; font-size: 12px; }
    .playlist-actions .playlist-import::after { content: '↑'; font-size: 12px; }
}
