/* ==================== 主题变量 ==================== */
:root { --accent: #e94560; }

/* ==================== 基础重置 ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
    overscroll-behavior: none;
}
body {
    font-family: 'Microsoft YaHei', 'Segoe UI', sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==================== 背景动效 ==================== */
.bg-animation {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 0; overflow: hidden; pointer-events: none;
}
.bubble {
    position: absolute; border-radius: 50%;
    filter: blur(80px); opacity: 0.15;
    animation: float 20s infinite ease-in-out;
}
.b1 { width: 400px; height: 400px; background: var(--accent); top: -100px; left: -100px; }
.b2 { width: 500px; height: 500px; background: #0f3460; bottom: -150px; right: -150px; animation-delay: -7s; }
.b3 { width: 300px; height: 300px; background: #533483; top: 50%; left: 50%; animation-delay: -14s; }
@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(50px, -50px) scale(1.1); }
    50% { transform: translate(-30px, 30px) scale(0.9); }
    75% { transform: translate(40px, 40px) scale(1.05); }
}

/* ==================== 应用容器 ==================== */
.app-container {
    position: relative; z-index: 1;
    max-width: 1200px; margin: 0 auto;
    min-height: 100vh; display: flex; flex-direction: column;
}

/* ==================== 顶部栏 ==================== */
.top-bar {
    display: flex; justify-content: space-between; align-items: center;
    position: relative;
    padding: 16px 24px;
    background: rgba(22, 33, 62, 0.6);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-icon { font-size: 24px; color: var(--accent); }
.site-name { font-size: 18px; font-weight: bold; color: #eee; }
/* 中间文字说明（相对顶栏真正居中，过长自动省略） */
.site-desc {
    position: absolute; left: 50%; transform: translateX(-50%);
    color: #888; font-size: 13px;
    max-width: 34%;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    pointer-events: none;
}
/* 顶栏全局搜索：输入框 + 按钮 */
.top-search-wrap { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.top-search-box { position: relative; display: flex; align-items: center; width: 330px; }
.top-search-ico {
    position: absolute; left: 12px; color: #777; pointer-events: none;
    transition: color 0.3s;
}
.top-search-box:focus-within .top-search-ico { color: var(--accent); }
.top-search-box input {
    width: 100%; padding: 8px 14px 8px 34px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 20px; color: #e0e0e0;
    font-size: 13px; outline: none;
    transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
}
.top-search-box input:focus {
    border-color: var(--accent);
    background: rgba(255,255,255,0.09);
    box-shadow: 0 0 0 3px rgba(233,69,96,0.18);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.top-search-box input::placeholder { color: #666; }
.top-search-btn {
    display: flex; align-items: center; flex-shrink: 0;
    padding: 8px 18px; border: none; border-radius: 20px;
    background: var(--accent); color: #fff;
    font-size: 13px; cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: filter 0.2s, transform 0.2s;
}
.top-search-btn:hover { filter: brightness(1.12); transform: translateY(-1px); }

/* ==================== 全局搜索页 ==================== */
.search-page {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 2000;
    background: rgba(16, 18, 34, 0.97);
    backdrop-filter: blur(14px);
    overflow-y: auto;
}
.search-page.show { display: block; }
.search-page-inner { max-width: 720px; margin: 0 auto; padding: 28px 20px 80px; }
.search-page-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 22px;
}
.search-page-back {
    background: none; border: none; color: #aaa;
    font-size: 18px; cursor: pointer;
    padding: 8px 14px; border-radius: 10px;
    transition: all 0.2s;
}
.search-page-back:hover { color: #fff; background: rgba(255,255,255,0.08); }
.search-page-title { color: #eee; font-size: 16px; font-weight: bold; }
.search-page-bar { display: flex; gap: 10px; }
.search-page-bar input {
    flex: 1; padding: 12px 20px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 24px; color: #e0e0e0;
    font-size: 15px; outline: none;
    transition: border-color 0.3s;
}
.search-page-bar input:focus { border-color: var(--accent); }
.search-page-bar input::placeholder { color: #666; }
.search-page-go {
    padding: 0 30px; border: none; border-radius: 24px;
    background: var(--accent); color: #fff;
    font-size: 15px; cursor: pointer; flex-shrink: 0;
    transition: filter 0.2s;
}
.search-page-go:hover { filter: brightness(1.12); }
.search-page-tip { color: #888; font-size: 13px; margin: 18px 4px 12px; }
.search-page-results { display: flex; flex-direction: column; gap: 8px; }
.sp-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px; cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.sp-item:hover { background: rgba(255,255,255,0.09); border-color: var(--accent); }
.sp-num { color: var(--accent); font-size: 13px; min-width: 22px; text-align: center; }
.sp-info { flex: 1; overflow: hidden; }
.sp-title {
    font-size: 14px; color: #e0e0e0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sp-artist {
    font-size: 12px; color: #888; margin-top: 3px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sp-list {
    flex-shrink: 0; font-size: 11px; color: #9ab;
    background: rgba(255,255,255,0.06);
    padding: 3px 10px; border-radius: 10px;
    max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ==================== 主内容 ==================== */
.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
    padding: 24px;
    align-items: start;
}

/* 左列：播放器 + 随机推荐 */
.left-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: 0;
}

/* ==================== 播放器区域 ==================== */
.player-section {
    background: rgba(22, 33, 62, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 30px;
    border: 1px solid rgba(255,255,255,0.05);
    display: flex; flex-direction: column; align-items: center;
}

/* 封面 */
.cover-wrapper { margin-bottom: 24px; }
.cover-disc { width: 220px; height: 220px; }
.disc-outer {
    width: 100%; height: 100%;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #1a1a2e, #16213e, #0f3460, #16213e, #1a1a2e);
    padding: 15px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    animation: none;
}
.disc-outer.spinning { animation: spin 8s linear infinite; }
.disc-outer.spinning.paused { animation-play-state: paused; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.disc-inner {
    width: 100%; height: 100%;
    border-radius: 50%;
    background: #1a1a2e;
    display: flex; justify-content: center; align-items: center;
    overflow: hidden;
    position: relative;
}
.cover-img {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: none;
}
.cover-img.show { display: block; }
.no-cover {
    font-size: 48px; color: var(--accent);
    position: absolute;
}
.no-cover.hide { display: none; }

/* 歌曲信息 */
.song-info { text-align: center; margin-bottom: 24px; width: 100%; min-width: 0; overflow: hidden; }
.song-title {
    font-size: 18px; color: #eee;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 100%;
}
.song-artist { color: #888; font-size: 14px; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* 歌词显示 */
.lyrics-container {
    width: 100%; text-align: center;
    margin-bottom: 20px; min-height: 72px;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    gap: 4px;
}
.lyrics-line {
    font-size: 13px; color: #555;
    transition: all 0.3s ease;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 100%; line-height: 1.6;
    height: 22px;
}
.lyrics-line.lyrics-active {
    font-size: 15px; color: var(--accent);
    font-weight: bold;
    text-shadow: 0 0 12px rgba(233,69,96,0.4);
}

/* 进度条 */
.progress-section {
    width: 100%; display: flex; align-items: center; gap: 10px;
    margin-bottom: 20px;
}
.time-current, .time-total { color: #888; font-size: 12px; min-width: 36px; }
.time-total { text-align: right; }
.progress-bar {
    flex: 1; height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    position: relative; cursor: pointer;
}
.progress-fill {
    height: 100%; width: 0%;
    background: var(--accent); border-radius: 2px;
    transition: width 0.1s linear;
}
.progress-handle {
    width: 12px; height: 12px;
    background: var(--accent); border-radius: 50%;
    position: absolute; top: 50%; transform: translate(-50%, -50%);
    left: 0%; opacity: 0;
    transition: opacity 0.2s;
    box-shadow: 0 0 6px rgba(233,69,96,0.5);
}
.progress-bar:hover .progress-handle { opacity: 1; }

/* 控制按钮 */
.controls {
    display: flex; align-items: center; gap: 16px;
    margin-bottom: 20px;
}
.ctrl-btn {
    background: none; border: none; color: #aaa;
    cursor: pointer; padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.ctrl-btn:hover { color: #eee; background: rgba(255,255,255,0.05); }
.ctrl-btn.active {
    color: var(--accent);
    background: rgba(233,69,96,0.15);
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    box-shadow: inset 0 0 0 1.5px var(--accent);
}
/* 当前播放模式文字提示 */
.mode-tip {
    text-align: center; font-size: 12px; color: #888;
    margin: -8px 0 14px;
    letter-spacing: 1px;
}
.mode-tip .mode-name { color: var(--accent); font-weight: bold; }
.ctrl-play {
    width: 56px; height: 56px;
    background: var(--accent); color: #fff;
    box-shadow: 0 4px 16px rgba(233,69,96,0.4);
}
.ctrl-play:hover { background: #d63851; transform: scale(1.05); }

/* 音量 */
.volume-section {
    display: flex; align-items: center; gap: 8px; width: 100%;
}
.vol-icon { color: #888; flex-shrink: 0; }
.volume-bar {
    flex: 1; height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px; cursor: pointer;
    position: relative;
}
.volume-fill {
    height: 100%; width: 70%;
    background: var(--accent); border-radius: 2px;
}

/* 随机推荐（独立卡片） */
.recommend-section {
    background: rgba(22, 33, 62, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(255,255,255,0.05);
}
.recommend-head {
    color: #eee; font-size: 15px; margin-bottom: 12px;
    font-weight: bold;
}
.recommend-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; border-radius: 8px;
    cursor: pointer; transition: background 0.2s;
}
.recommend-item:hover { background: rgba(255,255,255,0.05); }
.recommend-num { color: var(--accent); font-size: 13px; min-width: 18px; text-align: center; }
.recommend-info { flex: 1; overflow: hidden; }
.recommend-name {
    font-size: 13px; color: #e0e0e0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.recommend-artist {
    font-size: 11px; color: #888; margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.recommend-empty { color: #666; font-size: 13px; text-align: center; padding: 12px 0; }

/* 页脚（与顶部栏镜像对称） */
.footer {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 24px;
    background: rgba(22, 33, 62, 0.6);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255,255,255,0.05);
}

/* ==================== 广告位 ==================== */
.ad-banner {
    padding: 0 24px 16px;
}
.ad-banner a {
    display: block;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(22, 33, 62, 0.7);
    border: 1px solid rgba(255,255,255,0.05);
    line-height: 0;
}
.ad-banner img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 150px;
    object-fit: cover;
}

/* ==================== 播放列表 ==================== */
.playlist-section {
    background: rgba(22, 33, 62, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 400px;
}
.playlist-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
}
.playlist-header h3 { color: #eee; font-size: 16px; margin-bottom: 12px; }
.song-count { color: #888; font-weight: normal; font-size: 14px; }
.playlist-select {
    padding: 6px 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px; color: #e0e0e0;
    font-size: 13px; outline: none;
    cursor: pointer; max-width: 160px;
    transition: border-color 0.3s;
}
.playlist-select:focus { border-color: var(--accent); }
.playlist-select option { background: #16213e; color: #e0e0e0; }
.search-input {
    width: 100%; padding: 8px 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px; color: #e0e0e0;
    font-size: 13px; outline: none;
    transition: border-color 0.3s;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: #666; }

.playlist-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    min-height: 0;
    /* 滚动条不占用内容宽度（仅WebKit） */
}
.playlist-body::-webkit-scrollbar { width: 4px; }
.playlist-body::-webkit-scrollbar-track { background: transparent; }
.playlist-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }
.playlist-body::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }
/* Firefox 滚动条细窄 */
.playlist-body { scrollbar-width: thin; }

/* 歌曲项 */
.song-item {
    display: flex; align-items: center;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    gap: 12px;
}
.song-item:hover { background: rgba(255,255,255,0.05); }
.song-item.active { background: rgba(233,69,96,0.15); }
.song-item.active .song-item-title { color: var(--accent); text-decoration: underline; }
.song-item.active .song-item-index { color: var(--accent); font-weight: bold; }
.song-item-index { color: #666; font-size: 13px; min-width: 24px; text-align: center; }
.song-item-info { flex: 1; overflow: hidden; }
.song-item-title {
    font-size: 14px; color: #e0e0e0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.song-item-artist {
    font-size: 12px; color: #888; margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.song-item-album {
    color: #666; font-size: 12px;
    max-width: 120px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 加载和空状态 */
.loading { text-align: center; padding: 40px; color: #888; }
.spinner {
    width: 32px; height: 32px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}
.empty-state { text-align: center; padding: 60px 20px; color: #666; }
.empty-state p:first-child { font-size: 48px; margin-bottom: 12px; }
.empty-state p:nth-child(2) { font-size: 16px; color: #888; }
.empty-state .hint { font-size: 13px; margin-top: 8px; }

/* ==================== 自动播放遮罩 ==================== */
.autoplay-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    animation: fadeIn 0.3s ease;
}
.autoplay-content {
    text-align: center;
    animation: pulse 2s infinite;
}
.autoplay-icon {
    font-size: 80px;
    color: var(--accent);
    margin-bottom: 20px;
    animation: bounce 1s infinite;
}
.autoplay-text {
    font-size: 24px;
    color: #fff;
    font-weight: 300;
    letter-spacing: 2px;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* ==================== 响应式 ==================== */
@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    .left-column { width: 100%; min-width: 0; overflow: hidden; }
    .player-section {
        flex-direction: row; flex-wrap: wrap;
        padding: 20px; gap: 16px;
        justify-content: center;
        overflow: hidden;
    }
    .cover-wrapper { margin-bottom: 0; }
    .cover-disc { width: 120px; height: 120px; }
    .disc-outer { padding: 8px; }
    .song-info { margin-bottom: 0; text-align: left; flex: 1; min-width: 0; overflow: hidden; }
    .progress-section, .volume-section { width: 100%; }
    .playlist-section {
        height: auto !important;
        min-height: 300px;
    }
    .ad-banner {
        padding: 0 12px 12px;
    }
    /* 防止长文本撑破布局 */
    .recommend-section, .playlist-section { overflow: hidden; }
    .mode-tip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 600px) {
    .top-bar { padding: 12px 16px; }
    .site-desc { display: none; }
    /* 手机端：搜索框+按钮整体缩小，靠右对齐 */
    .top-search-box { width: 150px; }
    .top-search-box input { padding: 7px 12px 7px 30px; font-size: 12px; }
    .top-search-ico { left: 10px; width: 13px; height: 13px; }
    .top-search-btn { padding: 7px 13px; font-size: 12px; }
    .main-content { padding: 12px; }
    .player-section { padding: 16px; }
    .controls { gap: 10px; }
    .ctrl-play { width: 48px; height: 48px; }
    .song-item-album { display: none; }
}

/* ==================== 回到顶部按钮 ==================== */
.back-to-top {
    position: fixed;
    left: 16px;
    bottom: 35%;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    z-index: 999;
    transition: opacity 0.3s, transform 0.3s;
    opacity: 0;
    transform: translateX(-10px);
}
.back-to-top.show {
    display: flex;
    opacity: 1;
    transform: translateX(0);
}
.back-to-top:active {
    transform: scale(0.92);
}
@media (min-width: 901px) {
    .back-to-top { display: none !important; }
}

/* ==================== 设置按钮 ==================== */
.settings-btn {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 4px;
    margin-left: 8px;
    vertical-align: middle;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
}
.settings-btn:hover { color: var(--accent); }

/* ==================== 设置面板 ==================== */
.settings-panel {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}
.settings-panel.show { display: flex; }
.settings-mask {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
}
.settings-box {
    position: relative;
    background: #1a1a2e;
    border-radius: 16px;
    width: 320px;
    max-width: 90vw;
    padding: 24px;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: settingsPop 0.25s ease-out;
}
@keyframes settingsPop {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
.settings-title {
    font-size: 18px;
    font-weight: bold;
    color: #eee;
    margin-bottom: 20px;
}
.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.settings-label {
    flex: 1;
}
.settings-name {
    display: block;
    color: #ddd;
    font-size: 14px;
}
.settings-desc {
    display: block;
    color: #888;
    font-size: 12px;
    margin-top: 3px;
}
.settings-tip {
    text-align: center;
    color: #666;
    font-size: 12px;
    padding-top: 16px;
}

/* 开关样式 */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #444;
    transition: 0.3s;
    border-radius: 24px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}
.switch input:checked + .slider {
    background-color: var(--accent);
}
.switch input:checked + .slider:before {
    transform: translateX(20px);
}