:root {
    --bg: #0c0f14;
    --panel: rgba(19, 22, 29, 0.72);
    --panel-strong: rgba(29, 33, 43, 0.95);
    --accent: #1ed760;
    --accent-shadow: rgba(30, 215, 96, 0.18);
    --hero-glow: rgba(30, 215, 96, 0.18);
    --text: #f5f7fb;
    --muted: #9aa4b5;
    --border: rgba(255, 255, 255, 0.06);
    --card: linear-gradient(135deg, #1f2634 0%, #121822 100%);
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
body[data-theme="ruby"] {
    --bg: #100c10;
    --panel: rgba(24, 18, 24, 0.78);
    --panel-strong: rgba(38, 28, 38, 0.95);
    --accent: #ff2a6d;
    --accent-shadow: rgba(255, 42, 109, 0.18);
    --hero-glow: rgba(255, 42, 109, 0.18);
    --text: #f6f0f5;
    --muted: #b9a9b9;
    --border: rgba(255, 255, 255, 0.08);
    --card: linear-gradient(135deg, #2a1c2a 0%, #16101a 100%);
}
body[data-theme="ocean"] {
    --bg: #08131d;
    --panel: rgba(12, 26, 38, 0.78);
    --panel-strong: rgba(16, 32, 46, 0.95);
    --accent: #2dd4ff;
    --accent-shadow: rgba(45, 212, 255, 0.2);
    --hero-glow: rgba(45, 212, 255, 0.2);
    --text: #eaf4ff;
    --muted: #8ea6bd;
    --border: rgba(255, 255, 255, 0.08);
    --card: linear-gradient(135deg, #13283b 0%, #0a141f 100%);
}
body[data-theme="amber"] {
    --bg: #140f08;
    --panel: rgba(28, 20, 10, 0.78);
    --panel-strong: rgba(42, 30, 16, 0.95);
    --accent: #ff9f1c;
    --accent-shadow: rgba(255, 159, 28, 0.2);
    --hero-glow: rgba(255, 159, 28, 0.2);
    --text: #fff3e4;
    --muted: #c6a98b;
    --border: rgba(255, 255, 255, 0.08);
    --card: linear-gradient(135deg, #2b1f13 0%, #17110b 100%);
}
body[data-theme="aurora"] {
    --bg: #0b1010;
    --panel: rgba(16, 24, 24, 0.78);
    --panel-strong: rgba(20, 32, 32, 0.95);
    --accent: #7cf7c7;
    --accent-shadow: rgba(124, 247, 199, 0.2);
    --hero-glow: rgba(124, 247, 199, 0.2);
    --text: #eefaf5;
    --muted: #92b8a7;
    --border: rgba(255, 255, 255, 0.08);
    --card: linear-gradient(135deg, #17302b 0%, #0c1714 100%);
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Manrope", "Space Grotesk", system-ui, -apple-system, sans-serif;
    background: radial-gradient(circle at 10% 10%, rgba(72, 239, 128, 0.12), transparent 25%),
                radial-gradient(circle at 90% 30%, rgba(64, 187, 255, 0.1), transparent 25%),
                var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow: hidden;
    overscroll-behavior-x: contain;
}
a { color: inherit; text-decoration: none; }
.app {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: 100vh;
    position: relative;
}
.sidebar {
    padding: 24px 20px 90px;
    background: linear-gradient(180deg, rgba(17, 20, 28, 0.98), rgba(12, 15, 20, 0.94));
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    font-size: 18px;
}
.logo .mark {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
}
.logo .mark svg { width: 30px; height: 30px; display: block; }
.nav {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.nav button {
    border: none;
    background: transparent;
    color: var(--muted);
    padding: 12px 14px;
    border-radius: 10px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.18s ease;
}
.nav button .icon {
    width: 18px; height: 18px;
    display: inline-flex;
    align-items: center; justify-content: center;
}
.nav button.active, .nav button:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
}
.sidebar .footer {
    margin-top: auto;
    font-size: 12px;
    color: var(--muted);
    opacity: 0.8;
}
.main {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: linear-gradient(180deg, rgba(30, 215, 96, 0.06), transparent 25%),
                radial-gradient(circle at 70% 15%, rgba(68, 95, 255, 0.12), transparent 28%),
                var(--bg);
}
.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    backdrop-filter: blur(14px);
    background: rgba(12, 15, 20, 0.75);
    border-bottom: 1px solid var(--border);
}
.menu-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.12s ease;
}
.menu-btn:hover { background: rgba(255, 255, 255, 0.08); transform: translateY(-1px); }
.search-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: 18px;
}
.back-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.12s ease, opacity 0.15s ease;
}
.back-btn:hover { background: rgba(255, 255, 255, 0.08); transform: translateY(-1px); }
.back-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }
.search {
    flex: 1;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    padding: 10px 14px;
    border-radius: 12px;
    gap: 10px;
    border: 1px solid transparent;
    transition: border 0.2s ease;
}
.search .icon.clickable {
    cursor: pointer;
    transition: opacity 0.15s ease;
}
.search .icon.clickable:hover { opacity: 0.8; }
.search:focus-within {
    border: 1px solid var(--accent);
}
.search input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    width: 100%;
    font-size: 14px;
}
@media (max-width: 768px) {
    input,
    select,
    textarea {
        font-size: 16px;
    }
}
.user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 18px;
}
.lang-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12px;
    outline: none;
}
.lang-select option {
    background: #11151c;
}
.theme-btn {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12px;
    cursor: pointer;
}
.user .pill {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--muted);
}
.avatar {
    width: 38px; height: 38px;
    border-radius: 12px;
    background: linear-gradient(145deg, var(--accent), rgba(0, 0, 0, 0.2));
    display: grid;
    place-items: center;
    color: var(--bg);
    font-weight: 800;
    border: 1px solid var(--accent-shadow);
}
.auth-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.auth-actions .btn {
    padding: 8px 12px;
    font-size: 12px;
}
.only-desktop { display: inline-flex; }
.mobile-only { display: none; }
.dropdown {
    position: relative;
}
.dropdown-btn {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.dropdown-btn .arrow {
    opacity: 0.6;
    font-size: 11px;
}
.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 180px;
    background: rgba(32, 32, 32, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
    z-index: 50;
}
.dropdown-menu button {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text);
    padding: 10px 12px;
    border-radius: 10px;
    text-align: left;
    cursor: pointer;
    font-size: 13px;
}
.dropdown-menu button:hover {
    background: rgba(255, 255, 255, 0.06);
}
.dropdown-menu button.active {
    background: rgba(255, 255, 255, 0.12);
}
.user-menu .dropdown {
    width: 100%;
}
.user-menu .dropdown-btn {
    width: 100%;
    justify-content: space-between;
}
.user-menu .dropdown-menu {
    position: static;
    margin-top: 8px;
}
.menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 6px 0;
}
.pwa-gate .modal {
    width: min(420px, 92vw);
    text-align: left;
}
.pwa-gate .modal h3 {
    margin: 0 0 8px;
    font-size: 18px;
}
.pwa-gate .modal p {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}
.pwa-gate .actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.pwa-guide {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    font-size: 13px;
    color: var(--text);
}
.pwa-guide h4 {
    margin: 0 0 8px;
    font-size: 14px;
}
.pwa-guide ol {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
}
.pwa-guide li { margin: 6px 0; }
.turnstile-wrap {
    margin-top: 12px;
    display: flex;
    justify-content: center;
}
.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, var(--accent), rgba(0, 0, 0, 0.2));
    color: var(--bg);
    border: 1px solid var(--accent-shadow);
    cursor: pointer;
    overflow: hidden;
}
.user-avatar span {
    font-weight: 700;
    font-size: 14px;
}
.user-menu {
    position: absolute;
    top: 64px;
    right: 24px;
    width: 260px;
    background: rgba(28, 28, 28, 0.98);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 12px;
    z-index: 10;
    max-height: min(70vh, 520px);
    overflow-y: auto;
}
.user-menu .header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.user-menu .header .avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
}
.user-menu .header .name {
    font-size: 16px;
    font-weight: 700;
}
.user-menu .header .email {
    font-size: 13px;
    color: var(--muted);
}
.user-menu .menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 10px;
}
.user-menu .menu button {
    background: transparent;
    border: none;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
}
.user-menu .menu button:hover {
    background: rgba(255, 255, 255, 0.06);
}
.main-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 10px 22px 120px;
}
.hero {
    background: linear-gradient(135deg, var(--hero-glow), rgba(68, 95, 255, 0.18)),
                linear-gradient(180deg, rgba(18, 22, 30, 0.85), rgba(12, 15, 20, 0.9));
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 24px;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 18px;
    box-shadow: var(--shadow);
}
.hero h1 {
    margin: 0 0 10px;
    font-size: clamp(24px, 3vw, 34px);
    letter-spacing: -0.3px;
}
.hero p { color: var(--muted); margin: 0 0 16px; max-width: 640px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.search-history {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 18px;
}
.search-history .title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
}
.search-history .list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.search-history .item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    cursor: pointer;
}
.search-history .item:hover { background: rgba(255, 255, 255, 0.08); }
.search-history .item .dot {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 12px;
}
.search-history .actions {
    margin-top: 12px;
}
.btn {
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn.primary {
    background: var(--accent);
    color: #06200f;
    box-shadow: 0 12px 30px rgba(30, 215, 96, 0.35);
}
.btn.secondary {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border);
    color: var(--text);
}
.btn:hover { transform: translateY(-1px); }
.glow-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
}
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 22px 0 12px;
}
.section-title h2 { margin: 0; font-size: 18px; letter-spacing: -0.2px; }
.section-title span { color: var(--muted); font-size: 13px; }
.fav-section { margin-top: 18px; }
.fav-section:first-of-type { margin-top: 0; }
.fav-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.2px;
    margin: 0 0 10px;
}
.fav-count {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
}
.fav-grid {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}
.fav-card {
    min-width: 180px;
    width: 180px;
}
.fav-card.track {
    min-width: 160px;
    width: 160px;
}
.fav-card .playlist-cover img {
    border-radius: 14px;
}
.fav-card.playlist .playlist-cover img {
    border-radius: 12px;
}
.fav-card.album .playlist-cover img {
    border-radius: 18px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}
.fav-card.track .playlist-cover img {
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.fav-card.artist .playlist-cover img {
    border-radius: 999px;
}
.grid {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}
.search-section {
    margin-top: 16px;
}
.search-section h3 {
    margin: 0 0 10px;
    font-size: 15px;
    letter-spacing: -0.2px;
}
.playlist-card {
    background: transparent;
    border-radius: 0;
    padding: 0;
    border: none;
    position: relative;
    overflow: visible;
    cursor: pointer;
    min-height: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 0 0 200px;
}
.playlist-card .playlist-meta .title,
.playlist-card .playlist-meta .desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.artist-card .playlist-cover {
    border-radius: 999px;
}
.artist-card .playlist-cover img {
    border-radius: 999px;
}
.artist-card .playlist-meta {
    text-align: center;
}
.playlist-card::after {
    display: none;
}
.playlist-cover {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    height: 150px;
    border: none;
    background: #0f131b;
}
.playlist-cover img {
    width: 100%; height: 100%; object-fit: cover;
    display: block;
}
.playlist-meta {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    backdrop-filter: blur(4px);
}
.muted { color: var(--muted); }
.trending {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}
.track-tile {
    background: var(--panel);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 12px;
    display: flex;
    gap: 12px;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}
.track-tile:hover { background: rgba(255, 255, 255, 0.04); transform: translateY(-1px); }
.track-tile img {
    width: 56px; height: 56px;
    border-radius: 10px;
    object-fit: cover;
}
.track-info { flex: 1; }
.track-info h4 { margin: 0 0 4px; font-size: 15px; }
.track-info span { color: var(--muted); font-size: 13px; }
.time {
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    font-size: 12px;
}
.hidden { display: none !important; }
/* Detail */
.detail {
    background: rgba(12, 15, 20, 0.75);
    border-radius: 18px;
    /* border: 1px solid var(--border); */
    box-shadow: var(--shadow);
    padding: 22px;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
}
.detail-yt {
    display: grid;
    grid-template-columns: minmax(280px, 520px) 1fr;
    gap: 6px;
    align-items: start;
    max-width: 100%;
    min-width: 0;
}
.detail-hero {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}
.detail-hero .cover {
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #0c0f14;
    aspect-ratio: 1 / 1;
    width: 100%;
}
.detail-hero .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-hero h2 { font-size: 26px; letter-spacing: -0.2px; }
.detail-hero .meta { color: var(--muted); margin-bottom: 12px; }
.detail-hero .tags { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.detail-head .btn { padding: 6px 12px; border-radius: 999px; font-size: 12px; }
.meta-label {
    color: var(--muted);
    font-size: 12px;
}
#detailHeadExtra {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.album-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-size: 12px;
    cursor: pointer;
    max-width: 180px;
}
.album-link svg { width: 14px; height: 14px; }
.album-link .label {
    display: inline-block;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#detailDesc.rich {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.detail-popularity {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 2px 12px 2px 2px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
    font-size: 12px;
    color: var(--text);
}
.detail-popularity .ring {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: conic-gradient(var(--accent) 0deg, rgba(255, 255, 255, 0.12) 0deg);
    display: grid;
    place-items: center;
    position: relative;
}
.detail-popularity .ring::after {
    content: "";
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bg);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.detail-popularity .ring span {
    position: absolute;
    font-size: 10px;
    font-weight: 700;
    color: var(--text);
}
.fav-type {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--muted);
    font-size: 12px;
}
.fav-type svg { width: 14px; height: 14px; }
.fav-btn {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 12px;
    transition: transform 0.12s ease, color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.fav-btn svg { width: 14px; height: 14px; }
.fav-btn:hover { transform: translateY(-1px); }
.fav-btn.favored {
    color: var(--accent);
    border-color: var(--accent-shadow);
    background: var(--accent-shadow);
}
.detail-queue {
    background: var(--panel);
    border-radius: 14px;
    border: 1px solid var(--border);
    padding: 0px 6px;
    max-width: 100%;
    min-width: 0;
    max-height: calc(100vh - 260px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}
.detail-queue .section-title {
    margin: 0 0 12px;
}
.detail-list {
    background: transparent;
    border-radius: 12px;
    overflow-y: auto;
    min-height: 0;
    overscroll-behavior-x: contain;
}
.row {
    display: grid;
    grid-template-columns: 40px 1fr 120px 140px;
    gap: 10px;
    padding: 12px 14px 12px 0px;
    align-items: center;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    max-height: 64px;
}
.row.playing {
    background: rgba(30, 215, 96, 0.12);
    border-left: 3px solid var(--accent);
}
.row.playing .name {
    color: var(--accent);
}
.row:last-child { border-bottom: none; }
.row:hover { background: rgba(255, 255, 255, 0.04); }
.row .title {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.row .title.with-cover {
    flex-direction: row;
    align-items: center;
    gap: 10px;
}
.row .title-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 100px;
}
.row .cover {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: #0f131b;
}
.row .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .artist { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .album { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.row .time { white-space: nowrap; text-align: right; }
/* Player */
.player {
    z-index: 999;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 86px;
    padding: 10px 18px 12px;
    background: linear-gradient(180deg, #1b1b1c, #121214);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    grid-template-columns: 320px 1fr 200px;
    gap: 18px;
    align-items: center;
}
.player-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 12px;
    z-index: 9999;
}
.player-loading .spinner {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.player-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: height 0.2s ease;
}
.player-progress .bar {
    position: absolute;
    inset: 0;
    background: transparent;
}
.player-progress .fill {
    height: 100%;
    width: var(--player-progress, 0%);
    background: var(--accent);
}
.player-progress .thumb {
    display: none;
    position: absolute;
    top: 50%;
    left: var(--player-progress, 0%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 6px var(--accent-shadow);
    pointer-events: none;
}
.player-progress .time-marker {
    font-size: 11px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.player-progress:hover,
.player-progress.dragging {
    height: 6px;
}
.player-progress:hover .bar,
.player-progress.dragging .bar {
    height: 6px;
}
.player-progress.dragging .thumb,
.player-progress:hover .thumb {
    transform: translate(-50%, -50%) scale(1.05);
}
.now {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    cursor: pointer;
    grid-column: 2;
    justify-self: center;
    width: 100%;
    max-width: 520px;
}
.now img {
    width: 48px; height: 48px; border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.now > div {
    min-width: 0;
}
#playerTitle,
#playerArtist,
#playerMeta {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.now .meta {
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px;
}
.controls {
    display: flex;
    gap: 16px;
    align-items: center;
    grid-column: 1;
}
.controls .buttons {
    display: flex;
    gap: 14px;
    align-items: center;
}
.circle-btn {
    width: 40px; height: 40px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.12s ease;
    color: var(--text);
}
.circle-btn:hover { background: rgba(255, 255, 255, 0.12); transform: translateY(-1px); }
.progress {
    display: flex;
    gap: 6px;
    align-items: center;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    justify-content: center;
}
.progress .slash {
    opacity: 0.6;
}
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 0 6px var(--accent-shadow);
}
input[type="range"]::-moz-range-thumb {
    width: 12px; height: 12px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 0 6px var(--accent-shadow);
}
input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
}
.player-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
    position: relative;
    grid-column: 3;
    justify-self: end;
}
.mode {
    position: relative;
}
.mode-pop {
    position: absolute;
    bottom: 54px;
    right: 0;
    background: rgba(16, 20, 28, 0.96);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 6px;
    min-width: 140px;
}
.mode-pop button {
    background: transparent;
    border: none;
    color: var(--text);
    text-align: left;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
}
.mode-pop button.active {
    color: var(--accent);
    background: rgba(30, 215, 96, 0.12);
}
.volume {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}
.icon-btn {
    width: 36px; height: 36px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: grid;
    place-items: center;
    cursor: pointer;
    color: var(--text);
}
.icon-btn.small {
    width: 28px;
    height: 28px;
}
.volume-pop {
    position: absolute;
    bottom: 54px;
    right: 46px;
    background: rgba(16, 20, 28, 0.96);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    box-shadow: var(--shadow);
}
.volume-pop input[type="range"] {
    width: 140px;
    height: 5px;
}
.pill.small { padding: 6px 10px; font-weight: 600; }
/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: grid;
    place-items: center;
    z-index: 20;
}
.modal {
    background: #0f131b;
    padding: 20px;
    border-radius: 14px;
    width: min(420px, 92vw);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 10px; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs button {
    flex: 1;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    cursor: pointer;
}
.tabs button.active { border-color: var(--accent); }
.field {
    display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px;
}
.field label { color: var(--muted); font-size: 13px; }
.field input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    color: var(--text);
    outline: none;
}
.helper { color: var(--muted); font-size: 12px; margin-top: 6px; }
.toast {
    position: fixed;
    bottom: 110px;
    right: 20px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow);
    z-index: 15;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.context-menu {
    position: fixed;
    min-width: 240px;
    background: rgba(32, 32, 32, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
    z-index: 1000;
}
.context-submenu {
    position: fixed;
    min-width: 240px;
    background: rgba(32, 32, 32, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
    z-index: 1001;
}
.context-submenu .search {
    padding: 8px 10px;
    border-radius: 10px;
}
.context-submenu .search input {
    font-size: 13px;
}
.context-submenu .list {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
    text-align: left;
}
.context-submenu .item {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    text-align: left;
}
.context-submenu .item:hover { background: rgba(255, 255, 255, 0.08); }
.context-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text);
    font-size: 14px;
}
.context-item:hover { background: rgba(255, 255, 255, 0.06); }
.context-item .icon {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.6);
}
.context-item .icon svg { width: 18px; height: 18px; }
.context-item .arrow {
    margin-left: auto;
    opacity: 0.5;
}
.context-sep {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 6px 4px;
}
.mobile-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(78vw, 280px);
    background: rgba(15, 18, 24, 0.98);
    border-right: 1px solid var(--border);
    padding: 18px 16px 24px;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    z-index: 12;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.mobile-drawer.open { transform: translateX(0); }
.mobile-drawer .nav { gap: 6px; }
.mobile-drawer .nav button span {
    display: inline;
}
.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 11;
}
.mobile-overlay.show {
    opacity: 1;
    pointer-events: auto;
}
.mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    padding: 10px 12px calc(env(safe-area-inset-bottom) + 12px);
    background: rgba(12, 15, 20, 0.92);
    border-top: 1px solid var(--border);
    z-index: 9;
    backdrop-filter: blur(10px);
}
.mobile-nav button {
    border: none;
    background: transparent;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    padding: 8px 6px;
    border-radius: 12px;
}
.mobile-nav button.active,
.mobile-nav button:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}
.mobile-nav .icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.playlist-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.playlist-toolbar .btn { padding: 8px 14px; }
.playlist-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.playlist-card .count {
    font-size: 12px;
    color: var(--muted);
}
.playlist-modal {
    width: min(520px, 92vw);
}
.playlist-modal .list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    max-height: 320px;
    overflow-y: auto;
}
.playlist-modal .list button {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    padding: 10px 12px;
    border-radius: 10px;
    text-align: left;
    cursor: pointer;
}
.queue-modal {
    width: min(520px, 92vw);
}
.queue-modal .head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.queue-modal .sub {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 12px;
}
.queue-modal .detail-list {
    max-height: min(60vh, 480px);
    overflow-y: auto;
}
@media (max-width: 1100px) {
    .app { grid-template-columns: 78px 1fr; }
    .sidebar { padding: 18px 12px 96px; }
    .nav button span { display: none; }
    .mobile-drawer .nav button span { display: inline; }
    .logo span { display: none; }
    .hero { grid-template-columns: 1fr; }
    .detail-yt { grid-template-columns: 1fr; }
    .detail-queue { max-height: none; }
    .player { grid-template-columns: 1fr; height: auto; grid-template-rows: auto auto auto; }
    .now { justify-content: flex-start; grid-column: 1; width: auto; justify-self: stretch; }
    .controls { grid-column: 1; }
    .player-actions { justify-content: flex-start; grid-column: 1; justify-self: stretch; }
}
@media (max-width: 720px) {
    body { overflow: hidden; }
    .app { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .topbar { position: sticky; }
    .topbar { padding: 12px 14px; }
    .main-scroll { overflow-y: auto; }
    .menu-btn { display: inline-flex; }
    .search-wrap { margin-right: 0; }
    .search { padding: 8px 12px; }
    .only-desktop { display: none; }
    .mobile-only { display: block; }
    .queue-open-btn { display: inline-flex; }
    .auth-actions { display: none; }
    .hero { gap: 16px; }
    .hero h1 { font-size: 22px; }
    .hero p { font-size: 13px; }
    .hero .glow-card { display: none; }
    .hero-actions { flex-direction: column; align-items: stretch; }
    .main-scroll { 
        /* padding-bottom: calc(220px + env(safe-area-inset-bottom));  */
    }
    .player { grid-template-columns: 1fr; gap: 8px; }
    .player {
        display: grid;
        grid-template-columns: auto 1fr auto;
        grid-template-rows: auto auto;
        align-items: center;
        height: 120px;
    }
    .player-actions { display: flex; justify-content: flex-end; }
    .volume { display: none; }
    .player-progress {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        height: 24px;
        background: transparent;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 0 12px;
        margin-bottom: 6px;
        width: 100%;
        grid-column: 1 / -1;
        grid-row: 1;
    }
    .now {
        display: flex;
        grid-column: 1;
        grid-row: 2;
        max-width: 48vw;
    }
    .now img {
        width: 40px;
        height: 40px;
    }
    #playerTitle,
    #playerArtist,
    #playerMeta {
        max-width: 42vw;
    }
    #playerMeta { display: none; }
    .controls { grid-column: 2; grid-row: 2; justify-content: center; }
    .player-actions { grid-column: 3; grid-row: 2; justify-content: center; }
    .player-progress:hover,
    .player-progress.dragging {
        height: 24px;
    }
    .player-progress .bar {
        position: relative;
        flex: 1;
        height: 6px;
        background: rgba(255, 255, 255, 0.08);
        border-radius: 999px;
    }
    .player-progress .fill { height: 100%; border-radius: 999px; }
    .player-progress .thumb { top: 50%; }
    .player-progress .thumb { display: block; }
    .player-progress .thumb { width: 12px; height: 12px; }
    .progress { display: none; }
    .controls .buttons { gap: 8px; }
    .circle-btn { width: 36px; height: 36px; }
    .icon-btn { width: 32px; height: 32px; }
    .controls .queue-open-btn { width: 34px; height: 34px; }
    .detail { padding: 2px; }
    .detail-yt {
        grid-template-columns: 1fr;
        height: calc(100svh - 220px);
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }
    .detail-hero .cover { width: min(100%, 320px); margin: 0 auto; }
    .detail-queue {
        max-height: none;
        overflow: hidden;
        flex: 1;
        display: block;
        width: 100%;
    }
    .detail-queue .detail-list {
        display: block;
        overflow-y: auto;
        overscroll-behavior: contain;
        height: 100%;
        padding: 0 4px 8px;
        width: 100%;
    }
    .detail-queue .row {
        grid-template-columns: 1fr 56px;
        align-items: flex-start;
        /* padding: 6px 6px; */
        gap: 8px;
    }
    .detail-queue .row .title.with-cover {
        min-width: 0;
    }
    .detail-queue .row .title.with-cover .title-text {
        min-width: 0;
    }
    .detail-list.releases .row .title.with-cover {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }
    .detail-list.releases .row .title.with-cover .name {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .detail-queue .row .cover {
        width: 44px;
        height: 44px;
        border-radius: 8px;
        object-fit: cover;
        border: 1px solid rgba(255, 255, 255, 0.12);
        background: #0f131b;
    }
    .detail-queue .row .artist { display: none; }
    .detail-queue .row .index,
    .detail-queue .row .album,
    .detail-queue .row .time { display: none; }
    .detail-list.tracks .row .time,
    .detail-list.releases .row .time {
        display: block;
        text-align: right;
        color: var(--muted);
        font-size: 12px;
        white-space: nowrap;
        align-self: flex-start;
        padding-top: 2px;
    }
    .detail-list.releases .row .album { display: none; }
    .queue-modal .detail-list .row {
        grid-template-columns:1fr 56px;
        align-items: flex-start;
        padding: 6px 6px;
        gap: 8px;
    }
    .queue-modal .detail-list .row .artist { display: none; }
    .queue-modal .detail-list .row .index,
    .queue-modal .detail-list .row .album { display: none; }
    .queue-modal .detail-list .row .time {
        display: block;
        text-align: right;
        color: var(--muted);
        font-size: 12px;
        white-space: nowrap;
        align-self: flex-start;
        padding-top: 2px;
    }
    .row { grid-template-columns: 1fr; gap: 6px; }
    .row .index,
    .row .album,
    .row .time { display: none; }
    .row .title.with-cover { gap: 12px; }
    .search-history { padding: 14px; }
    .section-title { display: none; }
    .mobile-nav { display: grid; }
    .detail-queue { display: none; }
}

@media (max-width: 720px) {
    body.detail-open .main-scroll { overflow: hidden; }
}

@media (max-width: 720px) {
    .context-menu,
    .context-submenu {
        left: 10px !important;
        right: 10px !important;
        top: 20% !important;
        max-width: calc(100vw - 20px);
    }
    .context-submenu .list {
        max-height: 50vh;
    }
}
    
    .detail-head .fav-btn span,
    #favoriteTypeLabel span {
        display: none;
    }
    .detail-head .fav-btn,
    .detail-head .album-link,
    #favoriteTypeLabel {
        padding: 6px 8px;
    }
