/* ========== 基础重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.header-card-wrapper {
    flex-shrink: 0;
}
.music-wrapper {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 20px 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.player-card {
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02), 0 12px 28px rgba(0,0,0,0.08);
    border: 1px solid rgba(255,255,255,0.8);
    padding: 12px 20px;
    flex-shrink: 0;
    margin-bottom: 20px;
}
.player-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.song-info { min-width: 160px; }
.song-name {
    font-weight: 600;
    color: #1e293b;
    font-size: .95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* 歌名滚动样式 */
.song-name-marquee {
    color: #ef4444;                /* 红色 */
    display: inline-block;
    white-space: nowrap;
    animation: wiggle 2s ease-in-out infinite alternate;
}
@keyframes wiggle {
    0% { transform: translateX(-6px); }
    100% { transform: translateX(6px); }
}

.progress-wrapper {
    flex: 2;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
}
.progress-bar-container {
    flex: 1;
    height: 5px;
    background: #e2e8f0;
    border-radius: 3px;
    cursor: pointer;
}
.progress-bar-fill {
    height: 100%;
    background: #6366f1;
    border-radius: 3px;
    width: 0%;
}
.time-current, .time-total {
    font-size: .7rem;
    color: #475569;
    min-width: 36px;
    text-align: center;
}
.controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.ctrl-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: #475569;
    cursor: pointer;
    padding: 6px;
}
.ctrl-btn:hover { color: #6366f1; }
.play-pause {
    background: #6366f1;
    color: #fff;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
}
.volume-box, .mode-box, .search-box {
    display: flex;
    align-items: center;
    gap: 6px;
}
.volume-slider { width: 70px; height: 3px; cursor: pointer; }
.search-input {
    width: 120px;
    padding: 4px 8px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    font-size: .8rem;
}

/* 播放列表卡片：固定高度 77vh，内部滚动 */
.playlist-layout {
    display: flex;
    gap: 20px;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02), 0 12px 28px rgba(0,0,0,0.08);
    border: 1px solid rgba(255,255,255,0.8);
    overflow: hidden;
    height: 77vh;
    min-height: 300px;
}
.category-sidebar {
    width: 220px;
    background: #f8fafc;
    border-right: 1px solid #e2e8f0;
    padding: 16px;
    overflow-y: auto;
}
.category-sidebar h5 {
    margin-bottom: 12px;
    font-size: 1rem;
}
.category-sidebar h5 i { margin-right: 8px; color: #6366f1; }
.category-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.category-item {
    padding: 8px 12px;
    border-radius: 12px;
    cursor: pointer;
    font-size: .9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.category-item i { width: 24px; font-size: 1rem; }
.category-item .badge {
    background: #cbd5e1;
    color: #1e293b;
    border-radius: 30px;
    padding: 2px 8px;
    font-size: .7rem;
}
.category-item:hover { background: #eef2ff; }
.category-item.active {
    background: #e0e7ff;
    color: #4f46e5;
    font-weight: 500;
}
.category-item.active .badge {
    background: #a5b4fc;
    color: #fff;
}

/* 歌曲侧边栏：自身不滚动，内部容器滚动 */
.songs-sidebar {
    flex: 1;
    padding: 16px;
    overflow-y: visible;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.songs-sidebar h5 {
    margin-bottom: 12px;
    font-size: 1rem;
    display: flex;
    align-items: center;
}
.songs-sidebar h5 i { margin-right: 8px; color: #f59e0b; }
.songs-sidebar h5 span { flex: 1; }

/* 歌曲列表容器：将承载桌面端滚动条 */
.songs-list-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ========== 电脑端（宽度 > 768px） ========== */
@media (min-width: 769px) {
    .songs-list-container {
        overflow-y: auto;
    }
    .songs-header, .song-row {
        display: grid;
        grid-template-columns: 50px 1fr 80px 70px;
        padding: 8px 12px;
        min-width: 0;
    }
    .songs-header > div, .song-row > div {
        min-width: 0;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    .songs-header {
        background: #f1f5f9;
        border-radius: 12px;
        font-size: 0.8rem;
        font-weight: 600;
        color: #475569;
        margin-bottom: 8px;
        position: sticky;
        top: 0;
        z-index: 10;
    }
    .songs-header > div:nth-child(3) {
        text-align: center;
    }
    .songs-header > div:nth-child(4) {
        text-align: right;
    }
    .song-row {
        cursor: pointer;
        transition: background 0.15s;
        font-size: 0.9rem;
        border-radius: 12px;
    }
    .song-row:hover { background: #f8fafc; }
    .song-row.active { background: #eef2ff; color: #6366f1; font-weight: 500; }
    .song-index { color: #94a3b8; font-size: 0.8rem; }
    .song-title {
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
        width: 100%;
    }
    .song-title i { width: 24px; font-size: 1rem; flex-shrink: 0; }
    .song-title span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .song-quality {
        font-size: 0.7rem;
        padding: 2px 6px;
        border-radius: 20px;
        text-align: center;
        background-color: #e2e8f0;
        color: #475569;
    }
    .song-quality.lossless { background: #fef3c7; color: #b45309; }
    .song-quality.high { background: #dbeafe; color: #1e40af; }
    .song-quality.normal { background: #e2e8f0; color: #475569; }
    .song-duration {
        font-size: 0.8rem;
        color: #64748b;
        text-align: right;
    }
    .songs-list {
        flex: 1;
        overflow-y: visible;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
}

/* ========== 手机端适配 (≤768px) ========== */
@media (max-width: 768px) {
    body { overflow: auto; }
    .music-wrapper {
        padding: 10px;
        overflow-y: auto;
        height: auto;
    }
    .playlist-layout {
        flex-direction: column;
        height: auto;
        min-height: 300px;
        padding: 12px;
        gap: 12px;
    }
    .category-sidebar { display: none; }
    .mobile-category-toggle {
        display: inline-block !important;
        background: none;
        border: none;
        font-size: 1.2rem;
        color: #6366f1;
        margin-left: auto;
        cursor: pointer;
        padding: 0 8px;
    }
    .mobile-category-menu {
        display: none;
        background: #fff;
        border-radius: 16px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        padding: 8px 0;
        margin-bottom: 12px;
        z-index: 100;
    }
    .mobile-category-menu.show { display: block; }
    .mobile-category-item {
        padding: 10px 16px;
        cursor: pointer;
        text-align: left;
    }
    .mobile-category-item:hover,
    .mobile-category-item.active {
        background: #eef2ff;
        color: #4f46e5;
    }
    .search-box { display: none !important; }
    .songs-sidebar {
        padding: 12px;
        max-height: 70vh;
        overflow-y: auto;
    }
    .songs-list-container {
        overflow-y: visible;
    }
    .songs-header, .song-row {
        display: grid;
        grid-template-columns: 32px 1fr auto auto;
        gap: 8px;
        padding: 8px 6px;
    }
    .songs-header > div:nth-child(3),
    .songs-header > div:nth-child(4) {
        text-align: right;
    }
    .song-index { text-align: left; font-size: .75rem; }
    .song-title i { width: 18px; font-size: .75rem; }
    .song-title span { font-size: .8rem; }
    .song-quality, .song-duration { text-align: right; }
    .song-quality { font-size: .7rem; padding: 2px 6px; white-space: nowrap; width: auto; }
    .controls { justify-content: flex-start; }
    .player-row { flex-direction: column; align-items: stretch; }
    .progress-wrapper { width: 100%; }
}

/* 公用 Toast 提示 */
.mode-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    padding: 6px 16px;
    border-radius: 40px;
    font-size: .8rem;
    z-index: 10000;
    opacity: 0;
    transition: opacity .3s;
    pointer-events: none;
}
.mode-toast.show { opacity: .9; }
.footer-card-wrapper { flex-shrink: 0; }
.mobile-category-toggle,
.mobile-category-menu { display: none; }