﻿:root {
    --app-font: 'Plus Jakarta Sans', sans-serif;
    --font-scale: 1;
    
    --bg-color: #0b071a;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    --accent-magenta: #ff00ff;
    --accent-cyan: #00ffff;
    --text-main: #ffffff;
    --text-muted: #a0a0b8;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; }
html { font-size: calc(16px * var(--font-scale)); scroll-behavior: smooth; }

body {
    font-family: var(--app-font); background-color: var(--bg-color);
    color: var(--text-main); height: 100vh; overflow: hidden;
    display: flex; flex-direction: column;
    background-image: radial-gradient(circle at 15% 15%, rgba(255, 0, 255, 0.15) 0%, transparent 40%), radial-gradient(circle at 85% 85%, rgba(0, 255, 255, 0.1) 0%, transparent 40%);
    background-attachment: fixed; transition: font-family 0.3s ease;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-cyan); }

.glass-panel {
    background: var(--glass-bg); backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px); border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* Top Bar */
.top-bar {
    height: 70px; background: rgba(11, 7, 26, 0.6); backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px); border-bottom: 1px solid var(--glass-border);
    display: flex; align-items: center; justify-content: space-between; padding: 0 40px;
    z-index: 20; flex-shrink: 0; position: relative; overflow: hidden;
}
.top-bar-viz {
    position: absolute; top:0; left:0; width:100%; height:100%;
    z-index: 0; pointer-events: none; opacity: 0; transition: opacity 0.5s ease;
}
.top-bar > .brand, .top-bar > .top-actions { position: relative; z-index: 2; }

/* Top bar dim overlay (sits behind brand + actions) */
.top-bar-dim { position: absolute; inset: 0; background: rgba(11, 7, 26, 0.7); z-index: 1; pointer-events: none; opacity: 0; transition: opacity 0.5s; }
.brand {
    font-size: 1.5rem; font-weight: 800; display: flex; align-items: center; gap: 12px;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-magenta));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.app-container { display: flex; flex: 1; overflow: hidden; padding: 20px; gap: 10px; position: relative; }

/* Left Sidebar */
.sidebar-left { width: 260px; display: flex; flex-direction: column; border-radius: var(--radius-lg); padding: 24px 16px; flex-shrink: 0; }
.nav-section { display: flex; flex-direction: column; gap: 4px; margin-bottom: 30px; }
.nav-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted); margin-bottom: 12px; padding: 0 12px; font-weight: 600; }
.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius-sm);
    color: var(--text-muted); cursor: pointer; transition: var(--transition); font-weight: 500; font-size: 1rem;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: var(--text-main); }
.nav-item.active { background: rgba(255, 255, 255, 0.08); color: var(--accent-cyan); }
.nav-item svg { width: 20px; height: 20px; fill: currentColor; }

/* Unified Premium Buttons */
.btn-primary, .btn-outline {
    background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255,255,255,0.1); color: white;
    padding: 10px 24px; border-radius: 30px; font-weight: 600; font-size: 0.95rem; cursor: pointer;
    transition: var(--transition); font-family: inherit; display: flex; align-items: center; justify-content: center; gap: 8px;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.btn-primary { background: rgba(255, 255, 255, 0.1); }
.btn-primary:hover, .btn-outline:hover {
    background: rgba(255, 255, 255, 0.15); border-color: var(--accent-cyan);
    transform: translateY(-2px); box-shadow: 0 4px 15px rgba(0, 255, 255, 0.15);
}

/* Header Action Buttons */
.header-btn {
    background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border);
    color: var(--text-main); height: 40px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 0 16px; cursor: pointer; transition: var(--transition);
    font-family: inherit; font-weight: 600; font-size: 0.85rem;
}
.header-btn:hover { background: rgba(255,255,255,0.1); border-color: var(--accent-cyan); color: var(--accent-cyan); }
.header-icon-btn { width: 40px; padding: 0; }
.header-icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
#btn-back { border-radius: 50%; }

/* Center Panel & Headers */
.center-panel { flex: 1; display: flex; flex-direction: column; border-radius: var(--radius-lg); overflow: hidden; position: relative; min-width: 300px; }
.view-header {
    padding: 30px 40px; background: linear-gradient(to bottom, rgba(255,255,255,0.05), transparent);
    border-bottom: 1px solid var(--glass-border); display: flex; align-items: center; justify-content: space-between;
}
.view-title { font-size: 1.5rem; font-weight: 700; }

.search-container { position: relative; width: 220px; transition: var(--transition); }
.search-container:focus-within { width: 300px; }
.search-input {
    width: 100%; height: 40px; background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border);
    border-radius: 20px; padding: 0 16px 0 40px; color: white; font-family: inherit; font-size: 0.9rem; outline: none; transition: var(--transition);
}
.search-input:focus { border-color: var(--accent-cyan); background: rgba(255,255,255,0.1); box-shadow: 0 0 15px rgba(0, 255, 255, 0.2); }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; fill: var(--text-muted); pointer-events: none; transition: fill 0.3s ease; }
.search-container:hover .search-input { border-color: var(--accent-cyan); }
.search-container:hover .search-icon { fill: var(--accent-cyan); }

/* Live Search Results */
.search-results {
    position: absolute; top: calc(100% + 12px); left: 0; right: 0; background: #1a1a2e;
    border: 1px solid var(--glass-border); border-radius: var(--radius-md); box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    z-index: 100; max-height: 350px; overflow-y: auto;
}
.search-result-item {
    padding: 12px 16px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex; flex-direction: column; gap: 4px; transition: background 0.2s;
}
.search-result-item:hover { background: rgba(0, 255, 255, 0.1); }
.sr-title { font-size: 0.9rem; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-meta { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-empty { padding: 16px; text-align: center; color: var(--text-muted); font-size: 0.9rem; }
.sr-section-title { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: var(--accent-cyan); padding: 12px 16px 4px; font-weight: 700; background: rgba(11, 7, 26, 0.95); position: sticky; top: 0; z-index: 2; }

/* Alpha Scrollbar */
.content-area-wrapper { position: relative; flex: 1; display: flex; overflow: hidden; }
.content-area { flex: 1; overflow-y: auto; padding: 20px 40px 20px 40px; scroll-behavior: smooth; }

.alpha-index {
    position: absolute; right: 8px; top: 20px; bottom: 20px; width: 24px;
    display: flex; flex-direction: column; align-items: center; justify-content: space-between;
    background: rgba(0,0,0,0.2); border-radius: 12px; padding: 10px 0; z-index: 10;
}
.alpha-index.select-hide { display: none; }
.alpha-index a {
    font-size: 0.65rem; font-weight: 700; color: var(--text-muted); text-decoration: none;
    transition: all 0.2s; width: 100%; text-align: center; padding: 1px 0;
}
.alpha-index a:hover { color: var(--accent-cyan); transform: scale(1.5); }
.alpha-header { grid-column: 1 / -1; font-size: 1.25rem; font-weight: 800; color: var(--text-main); border-bottom: 1px solid var(--glass-border); padding-bottom: 8px; margin-top: 16px; margin-bottom: 8px; scroll-margin-top: 20px;}

/* Disc Header */
.disc-header { grid-column: 1 / -1; font-size: 0.9rem; font-weight: 700; color: var(--accent-cyan); padding: 12px 16px 4px; border-bottom: 1px solid var(--glass-border); margin-top: 16px; margin-bottom: 8px; display: flex; align-items: center; gap: 12px; text-transform: uppercase; letter-spacing: 1px; }
.disc-header svg { width: 18px; height: 18px; fill: currentColor; }

/* View & Sort Toggles */
.view-toggles { display: flex; gap: 4px; background: rgba(255,255,255,0.05); border-radius: var(--radius-sm); padding: 4px; border: 1px solid var(--glass-border); height: 40px; align-items: center; }
.view-toggles.select-hide { display: none; }
.view-toggles .icon-btn { border-radius: calc(var(--radius-sm) - 2px); padding: 4px; width: 30px; height: 30px; transition: all 0.2s ease; }
.view-toggles .icon-btn:hover { color: var(--accent-cyan); }
.view-toggles .icon-btn.active { background: rgba(0, 255, 255, 0.15); color: var(--accent-cyan); }

.sort-btn { padding: 4px 12px; font-weight: 600; font-size: 0.85rem; border-radius: var(--radius-sm); font-family: inherit; }

/* General Track Styling & Buttons */
.icon-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 6px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.icon-btn:hover { background: rgba(255,255,255,0.1); color: var(--text-main); }
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }

.track-rating { display: flex; gap: 2px; }
.track-rating svg { width: 14px; height: 14px; fill: rgba(255,255,255,0.2); transition: transform 0.1s, fill 0.2s; }
.track-rating.interactive svg { cursor: pointer; pointer-events: auto; }
.track-rating.interactive svg:hover { transform: scale(1.2); opacity: 0.8; }
.track-rating svg.filled { fill: var(--accent-cyan); }

/* Grid Views (4 Columns) */
.grid-view-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
@media (max-width: 1200px) { .grid-view-4 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) { .grid-view-4 { grid-template-columns: repeat(2, 1fr); } }

.card {
    background: rgba(255,255,255,0.02); border: 1px solid var(--glass-border);
    border-radius: var(--radius-md); padding: 16px; text-align: center; cursor: pointer;
    transition: var(--transition); min-width: 0; position: relative;
}
.card.playing { border-color: var(--accent-cyan); box-shadow: 0 0 15px rgba(0, 255, 255, 0.2); }
.card:hover { background: rgba(255,255,255,0.06); transform: translateY(-4px); }

.card-icon {
    width: 100%; aspect-ratio: 1; background: linear-gradient(135deg, rgba(255,0,255,0.1), rgba(0,255,255,0.1));
    border-radius: var(--radius-sm); margin-bottom: 12px; display: flex; align-items: center; justify-content: center;
    color: var(--accent-cyan); overflow: hidden; position: relative;
}
.card-icon img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.card-icon svg { width: 40px; height: 40px; fill: currentColor; }
.card-icon .track-num-large { font-size: 3rem; font-weight: 800; color: rgba(255,255,255,0.15); }

.card-actions {
    position: absolute; top: 8px; right: 8px; z-index: 10;
    display: flex; gap: 4px; background: rgba(11, 7, 26, 0.6); backdrop-filter: blur(8px);
    padding: 4px 6px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.1);
    opacity: 0; transition: opacity 0.2s; pointer-events: none;
}
.card:hover .card-actions { opacity: 1; pointer-events: auto; }
.card-actions .icon-btn { width: 26px; height: 26px; padding: 0; background: transparent; }
.card-actions .icon-btn:hover { background: rgba(255,255,255,0.2); }
.card-actions .icon-btn svg { width: 14px; height: 14px; }

.card-title { font-weight: 600; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.85rem;}
.card-subtitle { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-subtitle .track-rating { justify-content: center; margin-top: 6px; }

/* List Views */
.list-view-item {
    display: flex; align-items: center; padding: 12px 16px; border-radius: var(--radius-sm);
    transition: var(--transition); cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.05); position: relative;
}
.list-view-item.playing { background: rgba(0, 255, 255, 0.1); border-left: 3px solid var(--accent-cyan); }
.list-view-item:hover { background: rgba(255, 255, 255, 0.05); }

.list-view-art {
    width: 48px; height: 48px; border-radius: var(--radius-sm); margin-right: 16px;
    background-size: cover; background-position: center; background-color: rgba(255,255,255,0.05);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.list-view-art.artist-avatar { border-radius: 50%; }
.list-view-art svg { width: 24px; height: 24px; fill: rgba(255,255,255,0.2); }
.list-view-info { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

.list-view-item.track-list-item .list-view-info { flex-direction: row; align-items: center; gap: 16px; }
.list-view-item.track-list-item .list-view-title { flex: 0 0 40%; margin-bottom: 0; }
.list-view-item.track-list-item .list-view-meta { flex: 1; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.list-view-title { font-weight: 500; font-size: 0.95rem; color: white; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-view-meta { font-size: 0.8rem; color: var(--text-muted); display:flex; align-items:center; gap: 8px;}

.track-rating-right { margin-left: auto; margin-right: 16px; }
.track-actions { opacity: 0; transition: opacity 0.2s; display: flex; gap: 10px; }
.list-view-item:hover .track-actions { opacity: 1; }

/* Resizer & Right Sidebar Base */
.resizer { width: 8px; border-radius: 4px; cursor: ew-resize; background: transparent; transition: background 0.2s; flex-shrink: 0; margin: 0 2px; z-index: 5; }
.resizer:hover, .resizer.active { background: rgba(255, 255, 255, 0.2); }

.sidebar-right { width: 320px; min-width: 250px; max-width: 600px; display: flex; flex-direction: column; border-radius: var(--radius-lg); padding: 24px; flex-shrink: 0; gap: 16px; position: relative; transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); }

.sidebar-right.overlay-mode {
    position: absolute; top: 20px; right: 20px; bottom: 20px; height: calc(100% - 40px);
    z-index: 50; background: rgba(11, 7, 26, 0.95); backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px); box-shadow: -10px 0 50px rgba(0,0,0,0.8); border: 1px solid var(--glass-border);
}

.sidebar-right-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; flex-shrink: 0;}
.sidebar-right-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted); font-weight: 600; }
.btn-collapse-art { background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); color: var(--text-muted); border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: var(--transition); }
.btn-collapse-art:hover { color: white; background: rgba(255,255,255,0.15); transform: scale(1.05); }
.btn-collapse-art svg { width: 18px; height: 18px; fill: currentColor; }

.art-collapse-wrapper { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.5s cubic-bezier(0.25, 0.8, 0.25, 1); flex-shrink: 0;}
.sidebar-right.art-collapsed .art-collapse-wrapper { grid-template-rows: 0fr; }
.art-scaler { 
    overflow: hidden; 
    min-height: 0; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    padding: 20px 0 40px 0; 
    margin: -20px 0 -30px 0; 
}
.art-container { max-width: 180px; margin: 0 auto; width: 100%; aspect-ratio: 1; border-radius: var(--radius-md); background: linear-gradient(135deg, #2a1b3d, #1a2a3d); box-shadow: 0 10px 30px rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; border: 1px solid var(--glass-border); flex-shrink: 0; background-size: cover; background-position: center; transition: opacity 0.3s; opacity: 1; }
.sidebar-right.art-collapsed .art-container { opacity: 0; }
.art-container::after { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: inherit; filter: blur(30px); opacity: 0.5; z-index: -1; }
.art-icon { width: 80px; height: 80px; fill: rgba(255,255,255,0.1); }

.now-playing-info { text-align: center; width: 100%; transition: all 0.3s ease; overflow: hidden; margin-top: 8px; flex-shrink: 0;}
.sidebar-right.art-collapsed .now-playing-info { text-align: left; }
.np-title-wrapper { width: 100%; overflow: hidden; white-space: nowrap; }
.np-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 4px; display: inline-block; will-change: transform; }
.np-title.marquee { animation: scroll-pause 10s ease-in-out infinite alternate; }
@keyframes scroll-pause { 0%, 15% { transform: translateX(0); } 85%, 100% { transform: translateX(calc(-1 * var(--scroll-dist))); } }
.np-artist { color: var(--text-muted); font-size: 0.9rem; }

/* Sidebar Tabs & Queue */
.sidebar-tabs { display: flex; gap: 4px; background: rgba(255,255,255,0.05); border-radius: var(--radius-sm); padding: 4px; margin-top: 8px; margin-bottom: 8px; flex-shrink: 0; border: 1px solid var(--glass-border); }
.sidebar-tab-btn { flex: 1; text-align: center; padding: 6px 12px; font-size: 0.85rem; font-weight: 600; border-radius: var(--radius-sm); color: var(--text-muted); cursor: pointer; transition: var(--transition); border: none; background: transparent; font-family: inherit; }
.sidebar-tab-btn.active { background: rgba(0, 255, 255, 0.15); color: var(--accent-cyan); }

.queue-container { flex: 1; border-radius: var(--radius-md); background: rgba(0,0,0,0.2); padding: 12px; overflow-y: auto; position: relative; scroll-behavior: smooth; }
.queue-container.select-hide { display: none; }
.queue-item { display: flex; align-items: center; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition); margin-bottom: 4px; border-bottom: 1px solid rgba(255,255,255,0.02); }
.queue-item:hover { background: rgba(255,255,255,0.05); }
.queue-item.playing { background: rgba(0, 255, 255, 0.1); border-left: 3px solid var(--accent-cyan); border-bottom-color: transparent;}
.queue-item-info { flex: 1; overflow: hidden; }
.queue-item-title { font-size: 0.85rem; color: white; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px;}
.queue-item-artist { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-item .remove-btn { width: 24px; height: 24px; padding: 4px; opacity: 0; transition: opacity 0.2s; }
.queue-item:hover .remove-btn { opacity: 1; }

.lyrics-container { flex: 1; border-radius: var(--radius-md); background: rgba(0,0,0,0.2); padding: 20px; overflow-y: auto; position: relative; scroll-behavior: smooth; }
.lyric-line { font-size: 0.95rem; color: rgba(255,255,255,0.4); margin-bottom: 16px; transition: all 0.3s ease; text-align: center; min-height: 20px; }
.lyric-line.active { color: var(--text-main); font-size: 1.15rem; font-weight: 700; transform: scale(1.05); text-shadow: 0 0 10px rgba(255, 255, 255, 0.5); }
.lyrics-not-found { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--text-muted); text-align: center; gap: 16px; font-size: 0.9rem; }
.lyrics-textarea { width: 100%; height: 150px; background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); border-radius: var(--radius-sm); color: white; padding: 12px; resize: none; font-family: inherit; font-size: 0.9rem; }

/* Custom Tooltip & Context Menu */
.custom-tooltip { position: fixed; background: rgba(11, 7, 26, 0.95); backdrop-filter: blur(8px); border: 1px solid var(--glass-border); color: white; padding: 6px 12px; border-radius: 6px; font-size: 0.8rem; font-weight: 500; pointer-events: none; z-index: 99999; opacity: 0; transition: opacity 0.2s, transform 0.2s; transform: translateY(5px); font-family: var(--app-font); white-space: nowrap; box-shadow: 0 4px 15px rgba(0,0,0,0.5); }
.custom-tooltip.visible { opacity: 1; transform: translateY(0); }
.context-menu { position: fixed; background: rgba(11, 7, 26, 0.95); backdrop-filter: blur(16px); border: 1px solid var(--glass-border); border-radius: var(--radius-sm); box-shadow: 0 10px 30px rgba(0,0,0,0.8); z-index: 999999; min-width: 200px; padding: 8px 0; opacity: 1; transition: opacity 0.2s; }
.context-menu.select-hide { display: none; opacity: 0; pointer-events: none; }
.context-menu-item { padding: 10px 16px; display: flex; align-items: center; gap: 12px; cursor: pointer; color: white; font-size: 0.95rem; transition: background 0.2s; }
.context-menu-item:hover { background: rgba(0, 255, 255, 0.15); }
.context-menu-item svg { width: 18px; height: 18px; fill: currentColor; }

/* Settings View Styles */
.settings-section { margin-bottom: 40px; background: rgba(255,255,255,0.02); padding: 24px; border-radius: var(--radius-md); border: 1px solid var(--glass-border); }
.settings-section h3 { font-size: 1.25rem; margin-bottom: 20px; color: var(--accent-cyan); border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 10px; }
.setting-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.setting-label { font-size: 1rem; font-weight: 500; }
.setting-desc { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

.custom-select { position: relative; width: 250px; font-family: inherit; }
.select-selected { background-color: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); color: white; padding: 12px 16px; border-radius: var(--radius-sm); cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-size: 0.95rem; }
.select-selected:after { content: ""; border: solid white; border-width: 0 2px 2px 0; display: inline-block; padding: 4px; transform: rotate(45deg); transition: transform 0.3s; }
.select-selected.select-arrow-active:after { transform: rotate(-135deg); }
.select-items { position: absolute; background-color: #1a1a2e; top: 110%; left: 0; right: 0; z-index: 99; border-radius: var(--radius-sm); border: 1px solid var(--glass-border); box-shadow: 0 10px 30px rgba(0,0,0,0.5); overflow: hidden; max-height: 250px; overflow-y: auto; }
.select-hide { display: none; }
.select-items div { padding: 12px 16px; cursor: pointer; transition: background 0.2s; font-size: 0.95rem; }
.select-items div:hover { background-color: rgba(0, 255, 255, 0.1); }

.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255,255,255,0.05); transition: .3s; border-radius: 24px; border: 1px solid var(--glass-border); }
.toggle-slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: var(--text-muted); transition: .3s cubic-bezier(0.25, 0.8, 0.25, 1); border-radius: 50%; }
input:checked + .toggle-slider { background: linear-gradient(135deg, var(--accent-magenta), var(--accent-cyan)); border-color: transparent; }
input:checked + .toggle-slider:before { transform: translateX(20px); background-color: white; box-shadow: 0 0 10px rgba(255,255,255,0.5); }

.about-section { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.about-logo { width: 64px; height: 64px; margin: 0 auto 16px; background: linear-gradient(135deg, var(--accent-magenta), var(--accent-cyan)); border-radius: 16px; display: flex; align-items: center; justify-content: center; color: white; }
.about-logo svg { width: 36px; height: 36px; fill: currentColor; }
.about-title { font-size: 1.5rem; font-weight: 800; color: white; margin-bottom: 4px; }
.about-version { font-size: 0.9rem; margin-bottom: 16px; }
.about-copy { font-size: 0.8rem; opacity: 0.7; }

/* Bottom Bar */
.bottom-bar { height: 96px; background: rgba(11, 7, 26, 0.8); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-top: 1px solid var(--glass-border); display: flex; align-items: center; justify-content: space-between; padding: 0 40px; z-index: 10; flex-shrink: 0; position: relative; overflow: hidden; }
#viz-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; opacity: 0; transition: opacity 0.5s; pointer-events: none; }
.bottom-bar-dim { position: absolute; inset: 0; background: rgba(11, 7, 26, 0.7); z-index: 1; pointer-events: none; opacity: 0; transition: opacity 0.5s; }
.bottom-bar > .player-info, .bottom-bar > .player-controls, .bottom-bar > .player-volume { position: relative; z-index: 2; }
.player-info { width: 30%; display: flex; align-items: center; gap: 16px; }
.player-art-mini { width: 56px; height: 56px; border-radius: 8px; background: #1a1a2e; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.player-art-mini svg { width: 24px; height: 24px; fill: rgba(255,255,255,0.2); }
.player-text { display: flex; flex-direction: column; overflow: hidden; }
.player-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-artist { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}
.player-controls { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.control-buttons { display: flex; align-items: center; gap: 24px; }
.ctrl-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; transition: var(--transition); display: flex; align-items: center; justify-content: center; padding: 4px; }
.ctrl-btn:hover { color: var(--text-main); }
.ctrl-btn.active { color: var(--accent-cyan); }
.ctrl-btn svg { width: 20px; height: 20px; fill: currentColor; }
.play-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--text-main); color: var(--bg-color); }
.play-btn:hover { transform: scale(1.05); background: var(--accent-cyan); box-shadow: 0 0 15px rgba(0, 255, 255, 0.4); }
.play-btn svg { width: 24px; height: 24px; }
.progress-container { width: 100%; max-width: 600px; display: flex; align-items: center; gap: 12px; font-size: 0.8rem; color: var(--text-muted); }

/* Premium Custom Range Sliders */
input[type=range] { -webkit-appearance: none; width: 100%; background: transparent; height: 4px; border-radius: 2px; cursor: pointer; position: relative; background-image: linear-gradient(var(--accent-cyan), var(--accent-cyan)); background-size: var(--progress, 0%) 100%; background-repeat: no-repeat; }
input[type=range]:focus { outline: none; }
input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 4px; background: transparent; border-radius: 2px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; height: 12px; width: 12px; border-radius: 50%; background: var(--text-main); margin-top: -4px; box-shadow: 0 0 10px rgba(255,255,255,0.5); transition: transform 0.1s; }
input[type=range]:hover::-webkit-slider-thumb { transform: scale(1.3); background: var(--accent-cyan); }

.player-volume { width: 30%; display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.player-volume input[type=range] { width: 100px; }
.player-volume .icon-btn { padding: 4px; width: 28px; height: 28px; }
.player-volume .icon-btn svg { width: 20px; height: 20px; fill: var(--text-muted); }

/* Modals & Loader */
.overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; z-index: 100; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.overlay.active { opacity: 1; pointer-events: auto; }
.modal { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius-md); padding: 32px; width: 400px; box-shadow: var(--glass-shadow); text-align: center; }
.modal h2 { margin-bottom: 16px; font-size: 1.5rem;}
.modal p { color: var(--text-muted); margin-bottom: 24px; line-height: 1.5; font-size: 0.95rem; }
.playlist-input { width: 100%; padding: 12px 16px; border-radius: var(--radius-sm); background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); color: white; margin-bottom: 16px; outline: none; font-family: inherit;}
.playlist-input:focus { border-color: var(--accent-cyan); }
.playlist-select-list { max-height: 200px; overflow-y: auto; text-align: left; margin-bottom: 16px; border: 1px solid var(--glass-border); border-radius: var(--radius-sm); }
.playlist-select-item { padding: 12px; border-bottom: 1px solid var(--glass-border); cursor: pointer; font-size: 0.95rem; }
.playlist-select-item:hover { background: rgba(255,255,255,0.05); }
.modal-actions { display: flex; gap: 12px; justify-content: center; }
.btn-outline { background: transparent; border: 1px solid var(--glass-border); color: white; padding: 10px 20px; border-radius: 20px; cursor: pointer; transition: var(--transition); font-family: inherit; font-size: 0.95rem;}
.btn-outline:hover { background: rgba(255,255,255,0.1); }
.loader { display: inline-block; width: 40px; height: 40px; border: 4px solid rgba(255,255,255,0.1); border-radius: 50%; border-top-color: var(--accent-cyan); animation: spin 1s ease-in-out infinite; margin-bottom: 16px; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-muted); text-align: center; }
.empty-state svg { width: 64px; height: 64px; margin-bottom: 16px; opacity: 0.5; }

/* Album Play Overlay */
.list-view-art { position: relative; overflow: hidden; } /* Ensure list view art acts as a container */

.album-play-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: inherit;
}

.card-icon:hover .album-play-overlay,
.list-view-art:hover .album-play-overlay {
    opacity: 1;
}

.btn-play-overlay {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent-cyan);
    color: var(--bg-color);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transform: scale(0.8);
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 4px 15px rgba(0, 255, 255, 0.4);
}

.list-view-art .btn-play-overlay {
    width: 32px;
    height: 32px;
}

.card-icon:hover .btn-play-overlay,
.list-view-art:hover .btn-play-overlay {
    transform: scale(1);
}

.btn-play-overlay:hover {
    background: var(--text-main);
    transform: scale(1.1) !important;
}

.btn-play-overlay svg { 
    width: 50%; 
    height: 50%; 
    fill: currentColor; 
}

/* ============================================
   Mobile Overrides (appended) 
   ============================================ */
/* ============================================
   Neon Stream Mobile Styles
   Overrides and additions for mobile layout
   ============================================ */

:root {
    --mobile-top-bar: 48px;
    --mobile-mini-player: 64px;
    --mobile-bottom-tabs: 56px;
    --mobile-header: 44px;
}

/* --- Touch Detection --- */
html.touch .card-actions,
html.touch .track-actions,
html.touch .queue-item .remove-btn {
    opacity: 1;
    pointer-events: auto;
}

html.touch .card:hover {
    transform: none;
}

html.touch .album-play-overlay {
    opacity: 1;
    background: rgba(0, 0, 0, 0.4);
}

html.touch .btn-play-overlay {
    transform: scale(0.9);
}

html.touch .nav-item:hover,
html.touch .header-btn:hover,
html.touch .icon-btn:hover,
html.touch .ctrl-btn:hover,
html.touch .list-view-item:hover,
html.touch .context-menu-item:hover,
html.touch .select-items div:hover,
html.touch .playlist-select-item:hover,
html.touch .btn-outline:hover,
html.touch .search-result-item:hover,
html.touch .queue-item:hover,
html.touch .tab-btn:hover {
    background: inherit !important;
    color: inherit !important;
    border-color: inherit !important;
    transform: none !important;
}
html.touch .tab-btn.active {
    background: rgba(0, 255, 255, 0.12) !important;
    color: var(--accent-cyan) !important;
}

/* --- Fix: select-hide must override display:flex from mobile CSS --- */
.np-overlay.select-hide,
.mini-player.select-hide,
.lib-search.select-hide,
.lib-subnav.select-hide {
    display: none !important;
}

/* --- NP Overlay Art Collapse --- */
.np-overlay.art-collapsed .np-overlay-art-wrapper {
    display: none;
}

/* --- Top Bar Mobile --- */
.top-bar-mobile {
    height: var(--mobile-top-bar);
    padding: 0 12px;
    position: relative;
    z-index: 20;
    flex-shrink: 0;
}

.top-bar-mobile .brand {
    font-size: 1.1rem;
    gap: 8px;
}

.top-bar-mobile .brand svg {
    width: 22px;
    height: 22px;
}

.top-bar-mobile .header-icon-btn {
    width: 36px;
    height: 36px;
}

/* --- App Container Mobile --- */
.app-container-mobile {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    padding-bottom: calc(var(--mobile-mini-player) + var(--mobile-bottom-tabs) + 28px);
}

/* --- View Header Mobile --- */
.view-header-mobile {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    min-height: var(--mobile-header);
}

.view-title-mobile {
    font-size: 1.1rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.view-header-mobile .header-btn {
    height: 34px;
    padding: 0 10px;
    font-size: 0.8rem;
}

.view-header-mobile .header-icon-btn {
    width: 34px;
    padding: 0;
}

/* --- Content Area Mobile --- */
.content-area-mobile {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px 12px;
    -webkit-overflow-scrolling: touch;
}

.content-area-mobile .empty-state {
    padding-top: 60px;
}

/* --- Mini Player --- */
.mini-player {
    position: fixed;
    bottom: calc(var(--mobile-bottom-tabs) + 20px);
    left: 0;
    right: 0;
    height: var(--mobile-mini-player);
    background: rgba(11, 7, 26, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    padding: 0 12px;
    z-index: 30;
    gap: 12px;
}

.mini-player-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    overflow: hidden;
    cursor: pointer;
}

.mini-player-art {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    background: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.mini-player-art svg {
    width: 20px;
    height: 20px;
    fill: rgba(255, 255, 255, 0.2);
}

.mini-player-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mini-player-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.mini-player-title {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-player-artist {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-player-play {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--text-main);
    color: var(--bg-color);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

.mini-player-play svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* --- Bottom Tabs: Floating + Transparent --- */
.bottom-tabs {
    position: fixed;
    bottom: 12px;
    left: 16px;
    right: 16px;
    height: var(--mobile-bottom-tabs);
    background: rgba(11, 7, 26, 0.45);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 35;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    padding: 0 4px;
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    padding: 8px 0;
    font-family: inherit;
    border-radius: 14px;
    height: 40px;
    -webkit-tap-highlight-color: transparent;
}

.tab-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.tab-btn.active {
    color: var(--accent-cyan);
    background: rgba(0, 255, 255, 0.12);
}

/* --- Now Playing Overlay --- */
.np-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 7, 26, 0.98);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.np-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.np-overlay-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.np-overlay-close svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.np-overlay-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 0 16px 40px;
    position: relative;
    z-index: 2;
    -webkit-overflow-scrolling: touch;
}

.np-overlay-art-wrapper {
    display: flex;
    justify-content: center;
    padding: 20px 0 16px;
}

.np-overlay-art {
    width: 100%;
    max-width: 280px;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #2a1b3d, #1a2a3d);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    background-size: cover;
    background-position: center;
}

.np-overlay-art svg {
    width: 72px;
    height: 72px;
    fill: rgba(255, 255, 255, 0.1);
}

.np-overlay-info {
    text-align: center;
    padding: 4px 0 16px;
}

.np-overlay-info .np-title {
    font-size: 1.15rem;
}

.np-overlay-info .np-artist {
    font-size: 0.85rem;
}

.np-overlay-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 8px 0 16px;
}

.progress-container-mobile {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.progress-container-mobile input[type=range] {
    flex: 1;
}

.control-buttons-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
}

.ctrl-btn-lg svg {
    width: 28px;
    height: 28px;
}

.play-btn-mobile {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--text-main);
    color: var(--bg-color);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s, background 0.2s;
}

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

.play-btn-mobile svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.np-overlay-volume {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0 16px;
    justify-content: center;
}

/* --- Now Playing Tabs --- */
.np-overlay-tabs {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-top: 4px;
    flex-shrink: 0;
    border: 1px solid var(--glass-border);
}

/* --- Lyrics/Queue in Overlay --- */
.np-overlay-body .lyrics-container,
.np-overlay-body .queue-container {
    flex: none;
    height: 240px;
    min-height: 240px;
    margin-top: 8px;
}

/* --- Search Overlay --- */
.search-results-mobile {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

/* --- Hide Desktop Elements --- */
.sidebar-left,
.sidebar-right,
.resizer,
#playlist-nav-container,
.btn-primary[onclick*="rescanLibrary"] {
    display: none !important;
}

/* --- Override Modals for Mobile --- */
.modal {
    width: 92vw !important;
    max-width: 400px;
    padding: 24px 20px;
}

/* --- Override Grid for Mobile --- */
.grid-view-4 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
}

/* --- Cards Compact --- */
.card {
    padding: 10px;
}

.card-icon svg {
    width: 32px;
    height: 32px;
}

.card-title {
    font-size: 0.78rem;
}

.card-subtitle {
    font-size: 0.7rem;
}

/* --- List Items Compact --- */
.list-view-item {
    padding: 10px 12px;
}

.list-view-art {
    width: 40px;
    height: 40px;
    margin-right: 12px;
}

.list-view-title {
    font-size: 0.85rem;
}

.list-view-meta {
    font-size: 0.72rem;
}

/* --- Track Actions Always Visible --- */
.track-actions {
    opacity: 1;
}

/* --- Override Range Slider for Touch --- */
input[type=range] {
    height: 4px;
    border-radius: 2px;
}

input[type=range]::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 2px;
}

input[type=range]::-webkit-slider-thumb {
    height: 16px;
    width: 16px;
    margin-top: -5px;
    box-shadow: 0 0 8px rgba(255,255,255,0.5);
}

input[type=range]::-moz-range-thumb {
    height: 16px;
    width: 16px;
    border: none;
    border-radius: 50%;
    background: var(--text-main);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(255,255,255,0.5);
    margin-top: -5px;
}

input[type=range]::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.1);
}

input[type=range]:hover::-webkit-slider-thumb {
    transform: scale(1.15);
}

/* --- Context Menu as Bottom Sheet on Mobile --- */
html.touch .context-menu {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    max-height: 50vh;
    overflow-y: auto;
    z-index: 999999;
    background: rgba(11, 7, 26, 0.98);
    border: 1px solid var(--glass-border);
    border-bottom: none;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6);
    transform: translateY(0);
    min-width: auto;
}

html.touch .context-menu.select-hide {
    display: none;
}

html.touch .context-menu-item {
    padding: 14px 16px;
    font-size: 1rem;
}

/* --- Now Playing Wrapper for Marquee --- */
#np-title-wrapper {
    max-width: 100%;
}

/* --- Library Sub-Navigation --- */
.lib-subnav {
    display: flex;
    gap: 6px;
    padding: 6px 12px;
    overflow-x: auto;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.lib-subnav::-webkit-scrollbar { display: none; }

.lib-subnav-btn {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.lib-subnav-btn.active {
    background: rgba(0, 255, 255, 0.15);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

/* --- Library Search Bar --- */
.lib-search {
    position: relative;
    display: flex;
    align-items: center;
    padding: 6px 12px;
    flex-shrink: 0;
}

.lib-search .search-icon {
    position: absolute;
    left: 22px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    fill: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}

.lib-search .search-input-mobile {
    width: 100%;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 0 36px 0 34px;
    color: white;
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
}

.lib-search .search-results-mobile {
    position: absolute;
    top: 100%;
    left: 12px;
    right: 12px;
    background: #1a1a2e;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    z-index: 50;
    max-height: 300px;
    overflow-y: auto;
}

/* --- Safe Area Support --- */
@supports (padding-top: env(safe-area-inset-top)) {
    .bottom-tabs {
        bottom: env(safe-area-inset-bottom, 12px);
        height: calc(var(--mobile-bottom-tabs));
    }
    .mini-player {
        bottom: calc(var(--mobile-bottom-tabs) + 24px + env(safe-area-inset-bottom, 0px));
    }
    .app-container-mobile {
        padding-bottom: calc(var(--mobile-mini-player) + var(--mobile-bottom-tabs) + 36px + env(safe-area-inset-bottom, 0px));
    }
    .mini-player {
        bottom: calc(var(--mobile-bottom-tabs) + 24px + env(safe-area-inset-bottom, 0px));
    }
    .np-overlay {
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .loading-toast {
        bottom: calc(var(--mobile-bottom-tabs) + 28px + env(safe-area-inset-bottom, 0px));
    }
}

/* ============================================
   Tablet Layout (768px - 1024px)
   ============================================ */
@media (min-width: 768px) {
    .top-bar-mobile {
        height: 56px;
        padding: 0 20px;
    }

    .view-title-mobile {
        font-size: 1.3rem;
    }

    .content-area-mobile {
        padding: 16px 24px;
    }

    .grid-view-4 {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 16px;
    }

    .card {
        padding: 14px;
    }

    .mini-player {
        height: 72px;
        padding: 0 20px;
    }

    .mini-player-art {
        width: 52px;
        height: 52px;
    }

    .mini-player-title {
        font-size: 0.95rem;
    }

    .np-overlay-art {
        max-width: 360px;
    }

    .np-overlay-body {
        padding: 0 32px 40px;
    }

    .np-overlay .lyrics-container,
    .np-overlay .queue-container {
        height: 320px;
        min-height: 320px;
    }

    .control-buttons-mobile {
        gap: 36px;
    }

    .play-btn-mobile {
        width: 64px;
        height: 64px;
    }

    .play-btn-mobile svg {
        width: 32px;
        height: 32px;
    }

    .tab-btn svg {
        width: 24px;
        height: 24px;
    }

    .settings-section {
        padding: 28px;
    }

    .search-input-mobile {
        font-size: 1rem;
        height: 44px;
    }
}

@media (min-width: 1024px) {
    .grid-view-4 {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 20px;
    }

    .np-overlay-art {
        max-width: 400px;
    }
}

/* ============================================
   Welcome Overlay Tap-to-Dismiss
   ============================================ */
#welcome-overlay .overlay-backdrop {
    position: absolute;
    inset: 0;
    z-index: 1;
}

#welcome-overlay .modal {
    position: relative;
    z-index: 2;
}

/* ============================================
   Circular Progress & Loading Overlay
   ============================================ */
.loading-modal {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 40px 32px;
    box-shadow: var(--glass-shadow);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: 320px;
    width: 85vw;
}

.circular-progress {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.circular-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.circular-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 8;
}

.circular-fill {
    fill: none;
    stroke: url(#progressGradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 326.73;
    stroke-dashoffset: 326.73;
    transition: stroke-dashoffset 0.4s ease;
}

.circular-text {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.circular-pct {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent-cyan);
    line-height: 1;
}

.circular-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.loading-detail {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

.loading-minimize-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.loading-minimize-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.loading-minimize-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* ============================================
   Loading Toast (Minimized)
   ============================================ */
.loading-toast {
    position: fixed;
    bottom: calc(var(--mobile-bottom-tabs) + 24px);
    left: 16px;
    right: 16px;
    height: 48px;
    background: rgba(11, 7, 26, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    z-index: 90;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.loading-toast-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-magenta));
    border-radius: 0 2px 2px 0;
    transition: width 0.4s ease;
    width: 0%;
}

.loading-toast-text {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.loading-toast-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

.loading-toast-pct {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent-cyan);
}

.loading-toast-expand {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    transition: color 0.2s;
}

.loading-toast-expand svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.loading-toast-expand:hover {
    color: white;
}

/* --- Fix: Loading toast hidden by default --- */
.loading-toast.select-hide {
    display: none !important;
}

/* --- Fix: Load Music button sizing --- */
.mobile-load-btn {
    font-size: 0.85rem !important;
    padding: 8px 20px !important;
    height: 40px !important;
    width: auto !important;
    min-width: 160px;
}

/* --- Fix: Settings layout on mobile --- */
@media (max-width: 480px) {
    .setting-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .setting-row > div:first-child {
        width: 100%;
    }
    .setting-row input[type="range"] {
        width: 100% !important;
    }
    .setting-row .custom-select {
        width: 100% !important;
    }
    .setting-row > div:last-child {
        width: 100%;
    }
    .settings-section {
        padding: 16px !important;
    }
}

