:root {
    --bg: #080808;
    --bg-card: rgba(255,255,255,0.03);
    --bg-hover: rgba(255,255,255,0.06);
    --bg-active: rgba(255,255,255,0.1);
    --border: rgba(255,255,255,0.06);
    --border-light: rgba(255,255,255,0.1);
    --text: #fff;
    --text-sub: #888;
    --text-muted: #555;
    --radius: 12px;
    --radius-lg: 18px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* ===== 动画 ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes glowPulse { 0%,100%{ text-shadow:0 0 20px rgba(255,255,255,0.06); } 50%{ text-shadow:0 0 40px rgba(255,255,255,0.15); } }
@keyframes shimmer { 0%{ background-position:-200% center; } 100%{ background-position:200% center; } }
@keyframes pulseRing { 0%{box-shadow:0 0 0 0 rgba(255,255,255,0.2);} 70%{box-shadow:0 0 0 14px rgba(255,255,255,0);} 100%{box-shadow:0 0 0 0 rgba(255,255,255,0);} }
@keyframes waveBar { 0%,100%{transform:scaleY(0.1);opacity:0.1;} 50%{transform:scaleY(1);opacity:1;} }
@keyframes qbar { 0%,100%{transform:scaleY(0.3);} 50%{transform:scaleY(1);} }

/* ===== 视图系统 ===== */
.view { display: none; min-height: 100vh; }
.view.active { display: flex; flex-direction: column; animation: fadeIn 0.3s ease; }

/* ===== 搜索页 ===== */
.view-search {
    max-width: 680px;
    margin: 0 auto;
    padding: 20px 16px;
}

.view-search header {
    text-align: center;
    padding: 20px 0 14px;
}

.view-search h1 {
    font-size: 2em;
    font-weight: 100;
    letter-spacing: 12px;
    animation: glowPulse 4s ease-in-out infinite;
    user-select: none;
}

.header-line {
    width: 36px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    margin: 10px auto 0;
    animation: shimmer 3s linear infinite;
    background-size: 200% 100%;
}

.search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    animation: slideDown 0.4s ease;
}

#searchInput {
    flex: 1;
    padding: 12px 16px;
    font-size: 15px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: #fff;
    outline: none;
    transition: border-color 0.2s;
}

#searchInput:focus { border-color: var(--border-light); }
#searchInput::placeholder { color: #444; }

#searchBtn {
    padding: 12px 24px;
    font-size: 14px;
    background: #fff;
    color: #000;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-weight: 500;
    transition: transform 0.15s;
}

#searchBtn:active { transform: scale(0.96); }

.results {
    flex: 1;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.results::-webkit-scrollbar { width: 3px; }
.results::-webkit-scrollbar-track { background: transparent; }
.results::-webkit-scrollbar-thumb { background: #222; border-radius: 2px; }

.song-item {
    display: flex;
    align-items: center;
    padding: 11px 14px;
    cursor: pointer;
    transition: background 0.15s;
    border-radius: var(--radius);
    animation: slideUp 0.3s ease both;
    min-height: 50px;
}

.song-item:active { background: var(--bg-hover); }

.song-item-info { flex: 1; min-width: 0; }

.song-item-title {
    font-size: 14px;
    color: #ddd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 1px;
}

.song-item-artist { font-size: 11px; color: #555; }
.song-item-duration { font-size: 11px; color: #444; margin-left: 12px; flex-shrink: 0; }

.search-status { text-align: center; color: #444; padding: 20px; font-size: 13px; }

/* ===== 播放页 ===== */
.view-player {
    background: var(--bg);
}

.player-top-bar {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(8,8,8,0.9);
    backdrop-filter: blur(12px);
}

.back-btn {
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s;
    flex-shrink: 0;
}

.back-btn:active { background: var(--bg-hover); }
.back-btn svg { width: 22px; height: 22px; }

.player-top-title {
    flex: 1;
    text-align: center;
    font-size: 15px;
    font-weight: 500;
}

.player-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 30px;
    scroll-behavior: smooth;
}

.player-disc-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0 12px;
}

.disc-container { width: 160px; height: 160px; }

.disc {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, #2a2a2a 0%, #181818 20%, #0f0f0f 40%, #080808 60%, #000 100%);
    animation: spin 10s linear infinite;
    animation-play-state: paused;
    box-shadow: 0 0 40px rgba(255,255,255,0.02);
    transition: box-shadow 0.3s;
    position: relative;
}

.disc.playing { animation-play-state: running; }

.disc-ring {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.06);
    background: radial-gradient(circle, #222 0%, #1a1a1a 40%, transparent 70%);
}

.disc-hole {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #000;
    border: 1px solid #333;
}

.song-info { text-align: center; margin-top: 12px; width: 100%; }

.song-title {
    display: block;
    font-size: 17px;
    font-weight: 500;
    color: #fff;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 20px;
}

.song-artist { display: block; font-size: 12px; color: #555; }

/* ===== 声浪 ===== */
.wave-wrap {
    width: 100%;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 16px;
}

.wave-bar {
    width: 3px;
    height: 70%;
    background: linear-gradient(to top, rgba(255,255,255,0.15), #fff);
    border-radius: 2px;
    transform: scaleY(0.08);
    transform-origin: center;
    opacity: 0.06;
    transition: opacity 0.3s;
}

.wave-wrap.active .wave-bar {
    animation: waveBar 0.9s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.03s);
    opacity: 1;
}

/* ===== 控制按钮 ===== */
.player-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 8px 0;
}

.control-btn {
    width: 42px; height: 42px;
    background: none;
    border: 1px solid var(--border-light);
    border-radius: 50%;
    color: #ccc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.control-btn svg { width: 16px; height: 16px; }
.control-btn:active { background: var(--bg-hover); transform: scale(0.93); }

.play-btn { width: 52px; height: 52px; border-width: 2px; }
.play-btn svg { width: 20px; height: 20px; }
.play-btn.playing { animation: pulseRing 2.5s ease-in-out infinite; }

.play-mode-row {
    display: flex;
    justify-content: center;
    padding: 2px 0 4px;
}

.play-mode-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.play-mode-toggle:active {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.play-mode-toggle .mode-icon {
    width: 14px;
    height: 14px;
}

.play-mode-toggle.mode-one {
    color: #fff;
    border-color: rgba(255,255,255,0.2);
}

/* ===== 进度条 ===== */
.progress-container {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}

.time { font-size: 11px; color: #555; font-variant-numeric: tabular-nums; min-width: 32px; }

.progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
}

.progress-bar::before {
    content: '';
    position: absolute;
    top: -10px;
    bottom: -10px;
    left: 0;
    right: 0;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, #888, #fff);
    width: 0%;
    border-radius: 4px;
    transition: width 0.1s linear;
    position: relative;
}

/* ===== 音量/下载 ===== */
.player-extras {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0 8px;
}

.volume-control { display: flex; align-items: center; gap: 6px; flex: 1; }
.vol-icon { width: 14px; height: 14px; color: #444; flex-shrink: 0; }

#volumeSlider {
    flex: 1; max-width: 100px; height: 3px;
    -webkit-appearance: none; appearance: none;
    background: rgba(255,255,255,0.06);
    border-radius: 3px; outline: none;
}

#volumeSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px; height: 12px;
    background: #fff; border-radius: 50%; cursor: pointer;
}

#downloadBtn {
    padding: 7px 14px;
    background: rgba(255,255,255,0.04);
    color: #666;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

#downloadBtn:active { background: var(--bg-hover); color: #ccc; }

/* ===== 标签页 ===== */
.player-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin: 8px 0;
}

.tab {
    flex: 1;
    padding: 10px 0;
    background: none;
    border: none;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    transition: color 0.2s;
    position: relative;
}

.tab.active { color: #fff; font-weight: 500; }

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px; left: 20%; right: 20%;
    height: 2px;
    background: #fff;
    border-radius: 1px;
}

.tab span { font-size: 11px; margin-left: 3px; opacity: 0.6; }

/* ===== 队列面板 ===== */
.tab-panel { display: none; max-height: 300px; overflow-y: auto; }
.tab-panel.active { display: block; }
.tab-panel::-webkit-scrollbar { width: 3px; }
.tab-panel::-webkit-scrollbar-track { background: transparent; }
.tab-panel::-webkit-scrollbar-thumb { background: #222; border-radius: 2px; }

.queue-item {
    display: flex;
    align-items: center;
    padding: 9px 10px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s;
    min-height: 44px;
}

.queue-item:active { background: var(--bg-hover); }

.queue-item.current {
    background: var(--bg-active);
}

.queue-idx {
    font-size: 12px;
    color: #444;
    width: 26px;
    text-align: center;
    flex-shrink: 0;
}

.queue-item.current .queue-idx {
    color: transparent;
}

.queue-playing-bars {
    display: none;
    align-items: flex-end;
    gap: 2px;
    height: 14px;
    width: 26px;
    justify-content: center;
}

.queue-item.current .queue-playing-bars { display: flex; }

.queue-playing-bars span {
    width: 3px;
    background: #fff;
    border-radius: 1px;
    display: block;
}

.queue-playing-bars span:nth-child(1) { height: 60%; animation: qbar 0.8s ease-in-out infinite; }
.queue-playing-bars span:nth-child(2) { height: 100%; animation: qbar 0.8s ease-in-out 0.15s infinite; }
.queue-playing-bars span:nth-child(3) { height: 40%; animation: qbar 0.8s ease-in-out 0.3s infinite; }

.queue-item-info { flex: 1; min-width: 0; margin-left: 6px; }

.queue-item-title {
    font-size: 13px;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.queue-item.current .queue-item-title { color: #fff; font-weight: 500; }
.queue-item-artist { font-size: 11px; color: #555; margin-top: 1px; }

.queue-item-close {
    width: 28px; height: 28px;
    background: none;
    border: none;
    color: #444;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    font-size: 14px;
    transition: all 0.15s;
}

.queue-item-close:active { background: rgba(255,255,255,0.1); color: #fff; }

.queue-empty {
    text-align: center;
    color: #333;
    padding: 24px;
    font-size: 13px;
}

/* ===== 歌词 ===== */
.lyrics-container {
    margin: 10px 0;
    padding: 10px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.lyrics {
    max-height: 160px;
    overflow-y: auto;
    text-align: center;
    font-size: 13px;
    color: #444;
    line-height: 2.4;
    scroll-behavior: smooth;
}

.lyrics::-webkit-scrollbar { width: 2px; }
.lyrics::-webkit-scrollbar-track { background: transparent; }
.lyrics::-webkit-scrollbar-thumb { background: #1a1a1a; border-radius: 2px; }

.lyric-line { padding: 2px 0; transition: all 0.4s; }
.lyric-line.active { color: #fff; font-size: 14px; }

/* ===== PC 适配 ===== */
@media (min-width: 700px) {
    .view-search { max-width: 720px; }

    .player-scroll {
        max-width: 640px;
        margin: 0 auto;
        padding: 0 24px 40px;
    }

    .disc-container { width: 180px; height: 180px; }
    .song-title { font-size: 19px; }

    .tab-panel { max-height: 360px; }

    .wave-wrap { height: 52px; }

    .queue-item:hover { background: var(--bg-hover); }
    .song-item:hover { background: var(--bg-hover); }
}

/* ===== 手机端 ===== */
@media (max-width: 699px) {
    .view-search { padding: 12px 10px; }
    .view-search header { padding: 14px 0 10px; }
    .view-search h1 { font-size: 1.5em; letter-spacing: 8px; }
    .header-line { width: 28px; }
    .search-box { margin-bottom: 10px; }
    #searchInput { padding: 10px 14px; font-size: 14px; }
    #searchBtn { padding: 10px 16px; font-size: 13px; }

    .player-scroll { padding: 0 14px 24px; }

    .disc-container { width: 120px; height: 120px; }
    .disc-ring { width: 34px; height: 34px; }
    .disc-hole { width: 6px; height: 6px; }
    .song-title { font-size: 15px; }
    .song-artist { font-size: 11px; }

    .wave-wrap { height: 36px; }

    .player-controls { gap: 16px; }
    .control-btn { width: 38px; height: 38px; }
    .play-btn { width: 46px; height: 46px; }

    .player-extras { gap: 8px; }
    #volumeSlider { max-width: 80px; }

    .tab-panel { max-height: 220px; }

    .lyrics { max-height: 120px; }

    .queue-item { min-height: 40px; padding: 8px 8px; }
    .queue-item-title { font-size: 12px; }
}

@media (max-width: 380px) {
    .disc-container { width: 90px; height: 90px; }
    .disc-ring { width: 26px; height: 26px; }
    .disc-hole { width: 5px; height: 5px; }
    .player-controls { gap: 14px; }
    .play-btn { width: 42px; height: 42px; }
    .control-btn { width: 34px; height: 34px; }
    .player-extras { flex-direction: column; }
    #volumeSlider { max-width: none; }
}
