/* 音乐下载器 Web UI — 沉浸式深色主题 */

:root {
    color-scheme: dark;
    --accent: #79d69c;
    --accent-rgb: 121, 214, 156;
    --accent-hover: #5ecf87;
    --accent-pressed: #48b872;
    --accent-soft: rgba(121, 214, 156, 0.12);
    --surface: #0d0f0e;
    --surface-elevated: rgba(18, 22, 20, 0.82);
    --surface-card: rgba(22, 26, 24, 0.68);
    --text: #f0f0ec;
    --text-secondary: rgba(240, 240, 236, 0.58);
    --text-placeholder: rgba(240, 240, 236, 0.32);
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.14);
    --danger: #f87171;
    --danger-border: rgba(248, 113, 113, 0.3);
    --on-accent: #0a0f0c;
    --row-hover: rgba(255, 255, 255, 0.04);
    --font-ui: 'Inter', 'Microsoft YaHei UI', 'PingFang SC', system-ui, sans-serif;
    --font-display: 'Noto Serif SC', Georgia, 'Songti SC', serif;
    --font-num: 'SF Mono', 'Cascadia Code', Menlo, monospace;
    --radius: 8px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
    --shadow-md: 0 8px 32px rgba(0,0,0,0.3);
    --shadow-lg: 0 16px 64px rgba(0,0,0,0.4);
    --glass-blur: blur(24px) saturate(1.3);
    --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    color-scheme: light;
    --accent: #10B981;
    --accent-rgb: 16, 185, 129;
    --accent-hover: #0EA372;
    --accent-pressed: #0C9A6B;
    --accent-soft: rgba(16, 185, 129, 0.08);
    --surface: #f8f9fa;
    --surface-elevated: rgba(255, 255, 255, 0.88);
    --surface-card: rgba(255, 255, 255, 0.72);
    --text: #111111;
    --text-secondary: rgba(17, 17, 17, 0.58);
    --text-placeholder: rgba(17, 17, 17, 0.32);
    --line: rgba(0, 0, 0, 0.06);
    --line-strong: rgba(0, 0, 0, 0.12);
    --danger: #EF4444;
    --danger-border: rgba(239, 68, 68, 0.25);
    --on-accent: #FFFFFF;
    --row-hover: rgba(0, 0, 0, 0.03);
    --glass-blur: blur(20px) saturate(1.1);
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--text);
    background: var(--surface);
    line-height: 1.6;
    transition: background-color 600ms ease;
}

/* ===== 氛围背景层 ===== */
.ambient {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.ambient-layer {
    position: absolute;
    inset: -60px;
    background: radial-gradient(ellipse at 30% 20%, rgba(var(--accent-rgb), 0.08) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 80%, rgba(var(--accent-rgb), 0.05) 0%, transparent 50%);
    filter: blur(40px) saturate(0.8);
    opacity: 1;
    transition: opacity 800ms ease;
}

.ambient::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.3) 100%);
}

[data-theme="light"] .ambient::after {
    background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, rgba(248,249,250,0.6) 100%);
}

/* ===== App 容器 ===== */
#app {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ===== 顶栏 ===== */
.top-bar {
    display: flex;
    align-items: center;
    height: 60px;
    padding: 0 24px;
    background: var(--surface-elevated);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
    gap: 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.brand-mark {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    color: var(--accent);
}

.brand-text {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text);
}

/* ===== 导航标签 ===== */
.nav-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: none;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.nav-tab svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.nav-tab:hover {
    background: var(--row-hover);
    color: var(--text);
}

.nav-tab.active {
    background: var(--accent-soft);
    color: var(--accent);
}

.nav-tab-login {
    margin-left: 4px;
    border: 1px solid var(--line-strong);
}

.nav-tab-login:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ===== 顶栏右侧 ===== */
.top-bar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--surface-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0 12px;
    width: 240px;
    height: 34px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 12px;
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-placeholder);
}

.search-box .search-icon {
    margin-right: 8px;
    color: var(--text-placeholder);
    flex-shrink: 0;
}

.icon-btn {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.icon-btn:hover {
    background: var(--row-hover);
    color: var(--text);
    border-color: var(--line-strong);
}

/* ===== 主体布局 ===== */
.body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ===== 主内容 ===== */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
    scroll-behavior: smooth;
}

.page-section {
    max-width: 960px;
    margin: 0 auto;
}

.page-title {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text);
    letter-spacing: -0.02em;
}

/* ===== 右栏 ===== */
.right-rail {
    width: 260px;
    padding: 24px 20px;
    flex-shrink: 0;
    overflow-y: auto;
    border-left: 1px solid var(--line);
}

.now-playing-title {
    color: var(--accent);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    margin-bottom: 16px;
}

.cover-frame {
    width: 100%;
    aspect-ratio: 1;
    background: var(--surface-card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: var(--text-placeholder);
    box-shadow: var(--shadow-md);
}

.cover-frame svg {
    width: 56px;
    height: 56px;
}

.cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-lg);
}

.np-album {
    color: var(--text-secondary);
    font-size: 11px;
    margin-bottom: 6px;
    font-style: italic;
}

/* 歌词展示 */
.lrc-container {
    margin-top: 14px;
    max-height: 200px;
    overflow-y: auto;
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

.lrc-scroll {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lrc-line {
    font-size: 11px;
    color: var(--text-placeholder);
    line-height: 1.6;
    transition: color 0.3s ease, transform 0.3s ease;
    padding: 1px 0;
}

.lrc-line.lrc-active {
    color: var(--accent);
    font-weight: 600;
    transform: scale(1.02);
}

.lrc-empty {
    margin-top: 14px;
    font-size: 11px;
    color: var(--text-placeholder);
    font-style: italic;
}

/* 播放错误提示 */
.play-error-toast {
    position: fixed;
    bottom: 84px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(248, 113, 113, 0.95);
    color: #fff;
    padding: 8px 20px;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
    z-index: 800;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    animation: toast-in 0.3s ease;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.np-track {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.np-artist {
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 8px;
}

/* ===== 播放栏 ===== */
.player-bar {
    display: flex;
    align-items: center;
    height: 72px;
    padding: 0 24px;
    background: var(--surface-elevated);
    backdrop-filter: var(--glass-blur);
    border-top: 1px solid var(--line);
    flex-shrink: 0;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 220px;
    flex-shrink: 0;
}

.player-cover {
    width: 42px;
    height: 42px;
    background: var(--surface-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-placeholder);
    overflow: hidden;
}

.player-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-meta {
    min-width: 0;
}

.player-track {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-artist {
    color: var(--text-secondary);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ctrl-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.ctrl-btn:hover:not(:disabled) {
    background: var(--row-hover);
    color: var(--text);
}

.ctrl-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.play-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: var(--on-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(var(--accent-rgb), 0.3);
    transition: all var(--transition);
}

.play-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 24px rgba(var(--accent-rgb), 0.4);
}

.play-btn:active {
    transform: scale(0.96);
}

.progress-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 480px;
}

.time-text {
    font-family: var(--font-num);
    color: var(--text-secondary);
    font-size: 10px;
    min-width: 36px;
    text-align: center;
}

.progress-slider,
.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 3px;
    background: var(--line-strong);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    transition: height var(--transition);
}

.progress-slider {
    flex: 1;
}

.progress-slider:hover,
.volume-slider:hover {
    height: 5px;
}

.progress-slider::-webkit-slider-thumb,
.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--text);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition);
}

.progress-slider:hover::-webkit-slider-thumb,
.volume-slider:hover::-webkit-slider-thumb {
    opacity: 1;
}

.progress-slider::-moz-range-thumb,
.volume-slider::-moz-range-thumb {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--text);
    cursor: pointer;
}

.player-volume {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 140px;
    justify-content: flex-end;
    color: var(--text-secondary);
}

.volume-slider {
    width: 80px;
}

/* ===== 玻璃面板 ===== */
.glass-panel {
    background: var(--surface-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.glass-panel-side {
    background: var(--surface-card);
    backdrop-filter: var(--glass-blur);
}

.glass-modal {
    background: var(--surface-elevated);
    backdrop-filter: blur(32px) saturate(1.4);
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow-lg);
}

/* ===== 按钮 ===== */
.btn {
    background: var(--surface-card);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn:hover {
    background: var(--row-hover);
    border-color: var(--line-strong);
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    color: var(--text-placeholder);
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-accent {
    background: var(--accent);
    color: var(--on-accent);
    border: none;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.25);
}

.btn-accent:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 16px rgba(var(--accent-rgb), 0.35);
}

.btn-danger {
    color: var(--danger);
    border: 1px solid var(--danger-border);
    background: transparent;
}

.btn-danger:hover {
    background: rgba(248, 113, 113, 0.08);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 11px;
}

/* 播放按钮（搜索结果在线播放） */
.btn-play {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-play:hover {
    background: var(--accent-soft);
    border-color: var(--accent-hover);
    color: var(--accent-hover);
}

.btn-play:active {
    transform: scale(0.97);
}

/* ===== 表格 ===== */
.table-wrapper {
    overflow-x: auto;
    padding: 4px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

thead th {
    color: var(--text-secondary);
    border-bottom: 1px solid var(--line);
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-card);
}

tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    color: var(--text);
}

tbody tr {
    transition: background var(--transition);
}

tbody tr:hover {
    background: var(--row-hover);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ===== 卡片 ===== */
.card {
    padding: 18px 20px;
    margin-bottom: 14px;
}

.card-title {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text);
}

/* ===== 标签 ===== */
.tag {
    display: inline-block;
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 11px;
    background: var(--surface-card);
    color: var(--text-secondary);
    border: 1px solid var(--line);
}

.tag-accent {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: rgba(var(--accent-rgb), 0.2);
}

/* ===== 进度条 ===== */
.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--line-strong);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
    box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.4);
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    padding: 12px 0;
}

.page-info {
    color: var(--text-secondary);
    font-size: 12px;
}

/* ===== 表单 ===== */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-input {
    width: 100%;
    background: var(--surface-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 9px 12px;
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1);
}

.form-input::placeholder {
    color: var(--text-placeholder);
}

textarea.form-input {
    min-height: 80px;
    resize: vertical;
}

/* ===== 分段控件 ===== */
.segmented {
    display: inline-flex;
    background: var(--surface-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 3px;
}

.segmented button {
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition);
}

.segmented button:hover {
    color: var(--text);
}

.segmented button.active {
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.3);
}

/* ===== 状态标签 ===== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
}

.status-pending {
    background: var(--surface-card);
    color: var(--text-secondary);
}

.status-downloading {
    background: var(--accent-soft);
    color: var(--accent);
}

.status-completed {
    background: var(--accent-soft);
    color: var(--accent);
}

.status-failed {
    background: rgba(248, 113, 113, 0.1);
    color: var(--danger);
}

/* ===== 筛选栏 ===== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.filter-bar label {
    color: var(--text-secondary);
    font-size: 12px;
}

.filter-bar select {
    background: var(--surface-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 6px 10px;
    color: var(--text);
    font-size: 12px;
    outline: none;
    transition: border-color var(--transition);
}

.filter-bar select:focus {
    border-color: var(--accent);
}

/* ===== 统计条 ===== */
.stat-bar {
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 12px;
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-placeholder);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 13px;
}

/* ===== 加载状态 ===== */
.loading {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== 登录对话框 ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    border-radius: var(--radius-xl);
    padding: 28px;
    width: 520px;
    max-width: 92vw;
    max-height: 82vh;
    overflow-y: auto;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 18px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

/* ===== Tab 切换 ===== */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--line);
    margin-bottom: 18px;
    gap: 2px;
}

.tab {
    padding: 8px 14px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    border-radius: 6px 6px 0 0;
}

.tab:hover {
    color: var(--text);
    background: var(--row-hover);
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ===== 二维码区域 ===== */
.qrcode-area {
    text-align: center;
    padding: 20px;
}

.qrcode-area img {
    max-width: 180px;
    margin: 12px 0;
    border-radius: var(--radius);
    border: 1px solid var(--line);
}

/* ===== 设置项 ===== */
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-label {
    font-size: 13px;
    color: var(--text);
}

/* ===== 帮助链接 ===== */
.help-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-placeholder);
}

/* ===== Toggle Switch ===== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    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: var(--line-strong);
    border-radius: 22px;
    transition: 0.2s;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: var(--text);
    border-radius: 50%;
    transition: 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
    background: var(--on-accent);
}

/* ===== 工具类 ===== */
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.ml-8 { margin-left: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.hidden { display: none !important; }

/* ===== kbd / code ===== */
kbd {
    background: var(--surface-card);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-num);
    font-size: 11px;
    border: 1px solid var(--line);
}

code {
    background: var(--surface-card);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-num);
    font-size: 11px;
    border: 1px solid var(--line);
    color: var(--accent);
}

/* ===== 响应式 ===== */
@media (max-width: 900px) {
    .right-rail {
        display: none;
    }
    .nav-tab span {
        display: none;
    }
    .nav-tab {
        padding: 8px;
    }
    .search-box {
        width: 160px;
    }
}

@media (max-width: 640px) {
    .top-bar {
        padding: 0 12px;
        gap: 8px;
    }
    .brand-text {
        display: none;
    }
    .main-content {
        padding: 16px;
    }
    .player-info {
        width: auto;
    }
    .player-volume {
        display: none;
    }
}

/* ===== 动画减弱偏好 ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   沉浸式播放层
   ========================================================================== */

.immersive-player {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    transform: translateY(100%);
    transition: transform 480ms cubic-bezier(0.32, 0.72, 0, 1);
    overflow: hidden;
    isolation: isolate;
}

.immersive-player.is-open {
    transform: translateY(0);
}

/* 氛围背景 */
.imm-ambient {
    position: absolute;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.imm-ambient-layer {
    position: absolute;
    inset: -80px;
    background: radial-gradient(ellipse at 40% 30%, rgba(var(--accent-rgb), 0.12) 0%, transparent 55%),
                radial-gradient(ellipse at 65% 75%, rgba(var(--accent-rgb), 0.08) 0%, transparent 50%);
    filter: blur(50px) saturate(0.7);
    opacity: 0.6;
}

.imm-ambient::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.4) 60%, rgba(0,0,0,0.7) 100%);
}

/* 顶栏 */
.imm-topbar {
    position: relative;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    padding: 0 28px;
    flex-shrink: 0;
}

.imm-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: rgba(255,255,255,0.7);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
}

.imm-brand svg { color: var(--accent); }

.imm-close-btn {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    transition: all 200ms ease;
}

.imm-close-btn:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

/* 中间舞台 */
.imm-stage {
    flex: 1;
    display: grid;
    grid-template-rows: 1fr auto;
    min-height: 0;
    overflow: hidden;
}

/* 轮播 */
.imm-carousel {
    position: relative;
    min-height: 0;
    cursor: grab;
    touch-action: pan-y;
    overflow: hidden;
}

.imm-carousel.is-dragging {
    cursor: grabbing;
}

.imm-carousel.is-dragging .imm-card {
    transition: none;
}

.imm-card {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(34vw, 340px);
    aspect-ratio: 1;
    border-radius: 8px;
    background: rgba(30,34,32,0.8);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
    cursor: pointer;
    will-change: transform, opacity;
    transition: transform 520ms cubic-bezier(0.2, 0.82, 0.2, 1), opacity 420ms ease, box-shadow 420ms ease;
    overflow: hidden;
}

.imm-card.is-current {
    box-shadow: 0 20px 60px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.1), 0 0 48px rgba(var(--accent-rgb), 0.15);
}

.imm-card-art {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(var(--accent-rgb),0.08) 0%, rgba(30,34,32,0.9) 100%);
}

.imm-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.imm-card-placeholder {
    color: rgba(255,255,255,0.15);
}

.imm-card-title {
    position: absolute;
    bottom: 14px;
    left: 16px;
    right: 16px;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 500;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0,0,0,0.6);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.imm-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.3);
    font-size: 14px;
}

.imm-empty-hint {
    margin-top: 8px;
    font-size: 12px;
    color: rgba(255,255,255,0.2);
}

/* 歌曲详情 */
.imm-track-detail {
    text-align: center;
    padding: 16px 24px 20px;
}

.imm-kicker {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--accent);
    margin-bottom: 8px;
}

.imm-title {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 500;
    color: #fff;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.imm-subtitle {
    margin-top: 8px;
    font-size: 13px;
    color: rgba(255,255,255,0.5);
}

/* 底部控制栏 */
.imm-footer {
    position: relative;
    z-index: 30;
    flex-shrink: 0;
    padding: 0 28px 16px;
    background: rgba(10, 12, 11, 0.7);
    backdrop-filter: blur(24px) saturate(1.2);
    border-top: 1px solid rgba(255,255,255,0.06);
}

.imm-seek {
    position: absolute;
    top: -6px;
    left: 0;
    right: 0;
    width: 100%;
    height: 12px;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
}

.imm-seek::-webkit-slider-runnable-track {
    height: 2px;
    border-radius: 2px;
    background: rgba(255,255,255,0.12);
}

.imm-seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    margin-top: -4px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 160ms ease;
}

.imm-seek:hover::-webkit-slider-thumb { opacity: 1; }

.imm-seek::-moz-range-track {
    height: 2px;
    border: 0;
    border-radius: 2px;
    background: rgba(255,255,255,0.12);
}

.imm-seek::-moz-range-thumb {
    width: 8px;
    height: 8px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--accent);
}

.imm-footer-content {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
    align-items: center;
    height: 72px;
    gap: 20px;
}

.imm-footer-track {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.imm-footer-meta { min-width: 0; }

.imm-footer-title {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.imm-footer-artist {
    margin-top: 3px;
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.imm-transport {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.imm-play-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: var(--on-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(var(--accent-rgb), 0.3);
    transition: all 180ms ease;
}

.imm-play-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 28px rgba(var(--accent-rgb), 0.4);
}

.imm-play-btn:active { transform: scale(0.95); }

.imm-icon-btn {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: rgba(255,255,255,0.55);
    cursor: pointer;
    transition: all 160ms ease;
}

.imm-icon-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.imm-icon-btn:active:not(:disabled) { transform: scale(0.92); }
.imm-icon-btn:disabled { opacity: 0.25; cursor: not-allowed; }
.imm-icon-btn.is-active { color: var(--accent); }

.imm-footer-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    color: rgba(255,255,255,0.45);
}

.imm-time {
    font-family: var(--font-num);
    font-size: 10px;
    min-width: 80px;
    text-align: right;
}

.imm-volume {
    width: 72px;
    height: 20px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
}

.imm-volume::-webkit-slider-runnable-track {
    height: 2px;
    border-radius: 2px;
    background: rgba(255,255,255,0.15);
}

.imm-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    margin-top: -4px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    opacity: 1;
}

.imm-volume::-moz-range-track {
    height: 2px;
    border: 0;
    border-radius: 2px;
    background: rgba(255,255,255,0.15);
}

.imm-volume::-moz-range-thumb {
    width: 8px;
    height: 8px;
    border: none;
    border-radius: 50%;
    background: var(--accent);
}

/* 队列抽屉 */
.imm-drawer-scrim {
    position: absolute;
    z-index: 40;
    inset: 0;
    background: rgba(0,0,0,0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 320ms ease;
}

.imm-drawer-scrim.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.imm-queue-drawer {
    position: absolute;
    z-index: 50;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(360px, 85vw);
    padding: 20px;
    background: rgba(12, 14, 13, 0.94);
    backdrop-filter: blur(28px);
    border-left: 1px solid rgba(255,255,255,0.08);
    box-shadow: -20px 0 50px rgba(0,0,0,0.3);
    transform: translateX(104%);
    transition: transform 400ms cubic-bezier(0.2, 0.82, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.imm-queue-drawer.is-open { transform: translateX(0); }

.imm-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    flex-shrink: 0;
}

.imm-drawer-title {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

.imm-drawer-count {
    margin-left: 8px;
    font-size: 11px;
    font-weight: 400;
    color: rgba(255,255,255,0.4);
}

.imm-queue-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.imm-queue-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: rgba(255,255,255,0.55);
    text-align: left;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease;
}

.imm-queue-item:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.imm-queue-item.is-current {
    background: rgba(var(--accent-rgb), 0.1);
    color: #fff;
}

.imm-queue-name {
    font-size: 12px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.imm-queue-artist {
    font-size: 10px;
    color: rgba(255,255,255,0.35);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.imm-queue-empty {
    text-align: center;
    padding: 32px;
    color: rgba(255,255,255,0.25);
    font-size: 12px;
}

/* 沉浸式响应式 */
@media (max-width: 700px) {
    .imm-footer-content {
        grid-template-columns: 1fr auto;
        gap: 12px;
    }
    .imm-footer-tools { display: none; }
    .imm-title { font-size: 22px; }
    .imm-card { width: min(55vw, 280px); }
}
