* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
}

.player-container {
    width: 100%;
    max-width: 420px;
    height: 90vh;
    max-height: 800px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 32px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* 封面 */
.cover-container {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 24px;
    overflow: hidden;
    position: relative;
    background: rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
    flex-shrink: 0;
}

.cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease;
    will-change: opacity;
}

.cover-img.loaded {
    opacity: 1;
}

.default-cover {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 80px;
}

/* 歌词 */
.lyrics-container {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
    margin-bottom: 16px;
}

.lyrics-scroll {
    height: 100%;
    overflow-y: auto;
    padding: 20px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.lyrics-scroll::-webkit-scrollbar {
    display: none;
}

.lyric-line {
    text-align: center;
    padding: 8px 16px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 15px;
    line-height: 1.6;
    transition: all 0.3s ease;
    will-change: transform, color, font-size;
}

.lyric-line.active {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    transform: scale(1.05);
}

.no-lyrics {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 14px;
}

/* 歌曲信息 */
.song-info {
    text-align: center;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.song-title {
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-artist {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 进度条 - 核心修复 */
.progress-container {
    margin-bottom: 24px;
    position: relative;
    flex-shrink: 0;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    position: relative;
    cursor: pointer;
    touch-action: none;
    overflow: hidden; /* 核心修复：禁止进度条溢出容器 */
}

.buffer-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}

.play-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
    max-width: 100%; /* 核心修复：最大宽度不超过容器 */
}

.progress-thumb {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    left: 0%;
    transition: transform 0.2s ease;
    will-change: transform, left;
    max-left: 100%; /* 防止圆点超出 */
}

.progress-bar:hover .progress-thumb,
.progress-bar.dragging .progress-thumb {
    transform: translate(-50%, -50%) scale(1);
}

.time-info {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.time-preview {
    position: absolute;
    top: -32px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    transform: translateX(-50%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.time-preview.show {
    opacity: 1;
}

/* 控制栏 */
.controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.control-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    font-size: 20px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    will-change: transform, color;
    position: relative;
}

.control-btn:hover {
    color: #fff;
    transform: scale(1.1);
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn.active {
    color: #667eea;
}

/* 单曲循环按钮的数字标记 */
.control-btn.active.single-mode::after {
    content: '1';
    position: absolute;
    bottom: 4px;
    right: 4px;
    font-size: 10px;
    font-weight: bold;
    color: #667eea;
    line-height: 1;
}

.core-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.play-btn {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-size: 24px;
    color: #fff;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

.play-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}

.right-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 音量控制 */
.volume-container {
    position: relative;
}

.volume-popup {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: rgba(30, 30, 50, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 16px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    will-change: transform, opacity;
}

.volume-popup.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scale(1);
}

.volume-arrow {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid rgba(30, 30, 50, 0.95);
}

.volume-bar {
    width: 8px;
    height: 120px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    touch-action: none;
    overflow: hidden;
}

.volume-level {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    height: 70%;
    transition: height 0.1s ease;
    max-height: 100%;
}

.volume-thumb {
    position: absolute;
    left: 50%;
    transform: translate(-50%, 50%) scale(0);
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    bottom: 70%;
    transition: transform 0.2s ease;
    will-change: transform, bottom;
}

.volume-bar:hover .volume-thumb,
.volume-bar.dragging .volume-thumb {
    transform: translate(-50%, 50%) scale(1);
}

/* 歌单 */
.playlist-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 998;
}

.playlist-overlay.show {
    opacity: 1;
    visibility: visible;
}

.playlist-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 70vh;
    background: rgba(20, 20, 35, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 999;
    display: flex;
    flex-direction: column;
}

.playlist-panel.show {
    transform: translateY(0);
}

.playlist-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.playlist-header h3 {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
}

.close-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.playlist-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.playlist-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.playlist-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.playlist-item.active {
    background: rgba(102, 126, 234, 0.2);
}

.playlist-item-cover {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.1);
    margin-right: 12px;
    flex-shrink: 0;
}

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

.playlist-item-title {
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.playlist-item-artist {
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-item-playing {
    color: #667eea;
    font-size: 14px;
    margin-left: 12px;
    opacity: 0;
}

.playlist-item.active .playlist-item-playing {
    opacity: 1;
}

/* 模式提示 */
.mode-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.mode-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* 响应式 */
@media (max-width: 480px) {
    .player-container {
        height: 95vh;
        max-height: none;
        border-radius: 24px;
        padding: 20px;
    }
    
    .cover-container {
        border-radius: 20px;
        margin-bottom: 16px;
    }
    
    .default-cover {
        font-size: 60px;
    }
}

@media (max-height: 700px) {
    .player-container {
        height: 100vh;
        max-height: none;
        border-radius: 0;
    }
}
