/* ========== 基础变量（浅色模式默认） ========== */
:root {
    --bg-gradient-start: #f9f3e6;
    --bg-gradient-end: #e8e0d5;
    --container-bg: rgba(255, 255, 255, 0.75);
    --text-primary: #2d241e;
    --text-secondary: #6b4e3a;
    --card-bg: rgba(255, 255, 255, 0.5);
    --player-card-bg: rgba(30, 20, 15, 0.85);
    --lyrics-card-bg: rgba(255, 250, 240, 0.85);
    --lyrics-text: #6f4e36;
    --lyrics-active-bg: #fff0e4;
    --lyrics-active-color: #d44c2f;
    --border-color: #f0e2d4;
    --btn-bg: #2c2c2c;
    --btn-text: white;
    --progress-bg: #c0a084;
    --progress-thumb: #ffb085;
    --ctrl-btn-bg: #f0cfb6;
    --ctrl-btn-color: #4f2a18;
}

/* 暗色模式覆盖变量（优先级高） */
body.dark-mode {
    --bg-gradient-start: #1a1a2e;
    --bg-gradient-end: #16213e;
    --container-bg: rgba(0, 0, 0, 0.75);
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --card-bg: rgba(30, 30, 40, 0.6);
    --player-card-bg: rgba(10, 10, 15, 0.9);
    --lyrics-card-bg: rgba(25, 25, 35, 0.85);
    --lyrics-text: #c0c0c0;
    --lyrics-active-bg: #2a2a3a;
    --lyrics-active-color: #ea8c5c;
    --border-color: #3a3a4a;
    --btn-bg: #3a3a4a;
    --btn-text: #e0e0e0;
    --progress-bg: #5a5a6e;
    --progress-thumb: #ea8c5c;
    --ctrl-btn-bg: #3a3a4a;
    --ctrl-btn-color: #e0e0e0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, 'Segoe UI', 'PingFang SC', Roboto, 'Helvetica Neue', sans-serif;
    transition: background-color 0.3s ease, color 0.2s ease, border-color 0.2s ease;
}

body {
    min-height: 100vh;
    background: linear-gradient(145deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    padding: 24px 20px;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--container-bg);
    backdrop-filter: blur(12px);
    border-radius: 48px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.05);
    padding: 28px 32px;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

@media (max-width: 860px) {
    body { padding: 12px; }
    .app-container { padding: 20px 18px; border-radius: 32px; }
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}
.header-left h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #d44c2f, #ea8c5c);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}
.header-left p {
    color: var(--text-secondary);
    margin-top: 6px;
    font-weight: 500;
    font-size: 0.9rem;
}
.theme-toggle {
    background: var(--btn-bg);
    color: var(--btn-text);
    border: none;
    padding: 8px 18px;
    border-radius: 40px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: 0.2s;
}
.theme-toggle:hover {
    opacity: 0.85;
    transform: scale(1.02);
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 28px;
}
@media (max-width: 860px) {
    .main-grid { grid-template-columns: 1fr; gap: 28px; }
}

.left-panel {
    background: var(--card-bg);
    border-radius: 32px;
    padding: 20px;
    backdrop-filter: blur(4px);
}
.search-card {
    margin-bottom: 24px;
}
.search-box {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.search-input {
    flex: 3;
    padding: 14px 18px;
    border: none;
    border-radius: 48px;
    background: white;
    font-size: 1rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
}
body.dark-mode .search-input {
    background: #2a2a3a;
    color: #e0e0e0;
    border-color: #4a4a5a;
}
.search-input:focus {
    border-color: #ea8c5c;
    outline: none;
    box-shadow: 0 0 0 3px rgba(234, 140, 92, 0.2);
}
.id-parse-group {
    display: flex;
    gap: 12px;
    background: var(--card-bg);
    padding: 10px 16px;
    border-radius: 60px;
}
.small-input {
    flex: 2;
    padding: 10px 16px;
    border-radius: 40px;
    border: 1px solid var(--border-color);
    background: white;
}
body.dark-mode .small-input {
    background: #2a2a3a;
    color: #e0e0e0;
    border-color: #4a4a5a;
}
.btn {
    border: none;
    background: var(--btn-bg);
    color: var(--btn-text);
    padding: 0 24px;
    border-radius: 48px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    font-size: 0.9rem;
}
.btn-primary {
    background: linear-gradient(100deg, #d44c2f, #f07c48);
}
.btn-primary:hover, .btn-outline:hover {
    transform: translateY(-2px);
    filter: brightness(1.02);
}
.btn-outline {
    background: rgba(255,255,240,0.9);
    color: #b45a3b;
    border: 1px solid #e2c7b5;
}
body.dark-mode .btn-outline {
    background: #3a3a4a;
    color: #ea8c5c;
    border-color: #ea8c5c;
}

.playlist-section {
    margin-bottom: 28px;
}
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-weight: 700;
    color: var(--text-primary);
    border-left: 4px solid #ea8c5c;
    padding-left: 12px;
    margin: 16px 0 12px 0;
}
.refresh-btn {
    font-size: 0.75rem;
    background: var(--card-bg);
    padding: 4px 12px;
    border-radius: 40px;
    cursor: pointer;
    color: #a16242;
}
body.dark-mode .refresh-btn {
    color: #ea8c5c;
}
.playlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 14px;
}
.playlist-item {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.playlist-item:hover {
    transform: translateY(-4px);
    background: var(--lyrics-active-bg);
}
.pl-cover {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 20px;
    object-fit: cover;
    background: #ecd9cb;
}
.pl-name {
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}
.pl-count {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.results-header {
    display: flex;
    justify-content: space-between;
    margin: 16px 0 12px 0;
    font-weight: 600;
    color: var(--text-primary);
    border-left: 4px solid #ea8c5c;
    padding-left: 12px;
}
.song-list {
    max-height: 420px;
    overflow-y: auto;
}
.song-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    margin-bottom: 10px;
    padding: 10px 14px;
    border-radius: 60px;
    cursor: pointer;
    transition: 0.2s;
    border: 1px solid var(--border-color);
}
body.dark-mode .song-item {
    background: #2a2a3a;
}
.song-item:hover {
    background: var(--lyrics-active-bg);
    transform: translateX(4px);
}
.song-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    overflow: hidden;
}
.song-cover {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    object-fit: cover;
}
.song-details {
    flex: 1;
}
.song-name {
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.song-artist {
    font-size: 0.7rem;
    color: var(--text-secondary);
}
.badge-free {
    background: #bde3c2;
    color: #2c6e2f;
    font-size: 0.65rem;
    border-radius: 40px;
    padding: 2px 8px;
    margin-left: 6px;
}
.badge-vip {
    background: #f3cfc3;
    color: #b64926;
    font-size: 0.65rem;
    border-radius: 40px;
    padding: 2px 8px;
    margin-left: 6px;
    font-weight: 500;
}
body.dark-mode .badge-free {
    background: #2a5a2a;
    color: #a0e0a0;
}
body.dark-mode .badge-vip {
    background: #5a2a2a;
    color: #f0a080;
}
.play-btn-small {
    background: #fae5d6;
    border: none;
    border-radius: 40px;
    padding: 6px 16px;
    font-weight: 600;
    color: #c1653e;
    cursor: pointer;
}
.play-btn-small:hover {
    background: #ea8c5c;
    color: white;
}
body.dark-mode .play-btn-small {
    background: #3a3a4a;
    color: #ea8c5c;
}
body.dark-mode .play-btn-small:hover {
    background: #ea8c5c;
    color: white;
}

.right-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.player-card {
    background: var(--player-card-bg);
    backdrop-filter: blur(12px);
    border-radius: 40px;
    padding: 20px;
    color: #fef2e6;
    box-shadow: 0 15px 30px rgba(0,0,0,0.2);
}
.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.fullscreen-btn {
    background: none;
    border: none;
    color: #fef2e6;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 8px;
    opacity: 0.7;
    transition: 0.2s;
}
.fullscreen-btn:hover {
    opacity: 1;
    transform: scale(1.05);
}
.cover-large {
    width: 160px;
    height: 160px;
    border-radius: 28px;
    margin: 0 auto 16px;
    display: block;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    object-fit: cover;
}
.track-title {
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.track-artist {
    text-align: center;
    opacity: 0.8;
    margin-bottom: 12px;
    font-size: 0.85rem;
}
.player-controls {
    margin: 12px 0;
}
.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.progress-bar {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    background: var(--progress-bg);
    border-radius: 5px;
    outline: none;
}
.progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--progress-thumb);
    border-radius: 50%;
    cursor: pointer;
}
.time-current, .time-duration {
    font-size: 0.7rem;
    min-width: 38px;
    color: #fef2e6;
}
.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
}
.volume-control input {
    width: 100px;
}
.audio-control-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 12px 0;
}
.ctrl-btn {
    background: var(--ctrl-btn-bg);
    border: none;
    padding: 8px 20px;
    border-radius: 60px;
    font-weight: bold;
    cursor: pointer;
    color: var(--ctrl-btn-color);
}
.ctrl-btn:hover {
    background: #ea8c5c;
    color: white;
}
.download-btn {
    background: #6c8b6e;
    color: white;
}
.download-btn:hover {
    background: #4a6b4c;
}

.lyrics-card, .history-card {
    background: var(--lyrics-card-bg);
    backdrop-filter: blur(8px);
    border-radius: 32px;
    padding: 16px 18px;
    color: var(--text-primary);
}
.lyrics-container {
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.85rem;
    line-height: 1.5;
}
.lyric-line {
    padding: 4px 8px;
    transition: 0.1s;
    color: var(--lyrics-text);
}
.lyric-line.active {
    color: var(--lyrics-active-color);
    font-weight: bold;
    background: var(--lyrics-active-bg);
    border-radius: 40px;
}
.empty-lyrics {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
}
.history-item {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
}
.history-item:hover {
    background: var(--lyrics-active-bg);
    padding-left: 8px;
}
.history-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-artist {
    color: var(--text-secondary);
    font-size: 0.75rem;
}
.footer-note {
    margin-top: 28px;
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
    border-top: 1px solid rgba(0,0,0,0.1);
    padding-top: 18px;
}
.empty-tip {
    text-align: center;
    color: var(--text-secondary);
    padding: 32px 20px;
}
.loading-tip {
    font-size: 0.75rem;
    text-align: center;
    margin-top: 12px;
    padding: 6px;
    border-radius: 60px;
    background: rgba(0,0,0,0.3);
}

/* VIP 弹窗样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-content {
    background: #fff9f2;
    border-radius: 32px;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 20px 35px rgba(0,0,0,0.3);
    overflow: hidden;
    animation: modalFadeIn 0.2s ease;
}
@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    background: #f5e6d8;
    font-weight: bold;
    font-size: 1.2rem;
    color: #b64926;
}
.modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #9b6a4a;
    line-height: 1;
}
.modal-close:hover {
    color: #d44c2f;
}
.modal-body {
    padding: 24px 20px;
    text-align: center;
    color: #4f3524;
    line-height: 1.5;
}
.modal-body p {
    margin: 8px 0;
}
.modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 20px 24px;
    justify-content: center;
}
.modal-btn {
    padding: 10px 24px;
    border-radius: 60px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: 0.2s;
}
.modal-btn.cancel {
    background: #e8ddd0;
    color: #6b4e3a;
}
.modal-btn.cancel:hover {
    background: #d6c6b5;
}
.modal-btn.confirm {
    background: #d44c2f;
    color: white;
}
.modal-btn.confirm:hover {
    background: #b83b1f;
    transform: translateY(-1px);
}

/* 全屏播放器样式 */
.fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.fullscreen-container {
    width: 90%;
    max-width: 1300px;
    height: 85%;
    background: rgba(30, 20, 15, 0.9);
    border-radius: 48px;
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 24px 32px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}
.close-fullscreen {
    position: absolute;
    top: 20px;
    right: 28px;
    background: none;
    border: none;
    font-size: 2rem;
    color: #fef2e6;
    cursor: pointer;
    z-index: 10;
    opacity: 0.7;
}
.close-fullscreen:hover {
    opacity: 1;
}
.fullscreen-content {
    display: flex;
    flex: 1;
    gap: 48px;
    overflow: hidden;
    margin-top: 20px;
}
.fullscreen-cover {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.fullscreen-cover img {
    width: 100%;
    max-width: 400px;
    border-radius: 32px;
    box-shadow: 0 20px 35px rgba(0,0,0,0.4);
    object-fit: cover;
    aspect-ratio: 1;
}
.fullscreen-lyrics {
    flex: 1.5;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.fullscreen-lyrics-header {
    margin-bottom: 20px;
    text-align: center;
}
.fullscreen-song {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fef2e6;
}
.fullscreen-artist {
    font-size: 1rem;
    color: #d4bca8;
    margin-top: 6px;
}
.fullscreen-lyrics-scroll {
    flex: 1;
    overflow-y: auto;
    padding-right: 12px;
}
.fullscreen-lyric-line {
    padding: 8px 16px;
    font-size: 1rem;
    color: #c0b0a0;
    transition: 0.2s;
    text-align: center;
}
.fullscreen-lyric-line.active {
    color: #ea8c5c;
    font-weight: bold;
    font-size: 1.1rem;
    background: rgba(234, 140, 92, 0.2);
    border-radius: 40px;
}
.fullscreen-controls {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,215,190,0.3);
}
.fullscreen-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.fullscreen-progress .progress-bar {
    flex: 1;
}
.fullscreen-volume {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
}
.fullscreen-volume input {
    width: 150px;
}
.fullscreen-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
}
@media (max-width: 768px) {
    .fullscreen-content {
        flex-direction: column;
    }
    .fullscreen-cover img {
        max-width: 200px;
    }
    .fullscreen-song {
        font-size: 1.2rem;
    }
    .fullscreen-lyric-line {
        font-size: 0.85rem;
    }
    .fullscreen-volume input {
        width: 100px;
    }
}
