@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

:root {
    --primary-color: #6a5af9;
    --primary-color-rgb: 106, 90, 249; /* For use in rgba() for box-shadow focus */
    --secondary-color: #f0f0f8;
    --text-color: #333;
    --light-text-color: #777;
    --bg-color: #e6e6ef;
    --player-bg: #fff;
    --highlight-color: #5848d8; /* Used for hover/active states */
    --border-radius: 12px;
    --box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Global reset for tap highlight color on touch devices */
* {
    -webkit-tap-highlight-color: transparent;
    outline: none; /* Globally remove outline, rely on :focus-visible for accessibility */
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--bg-color);
    margin: 0;
    color: var(--text-color);
    padding: 20px;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased; /* Smoother fonts on WebKit */
    -moz-osx-font-smoothing: grayscale; /* Smoother fonts on Firefox */
}

.player-container {
    background-color: var(--player-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 25px;
    width: 100%;
    max-width: 380px; /* Default max-width for mobile/small windows */
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow: hidden; /* Important for border-radius and contained elements */
}

/* Responsive adjustments */
@media (min-width: 600px) { /* Small tablets and large phones */
    .player-container {
        max-width: 420px;
    }
}

@media (min-width: 768px) { /* Tablets and small desktops */
    .player-container {
        max-width: 480px;
    }
    .album-art {
        width: 220px;
        height: 220px;
    }
    .lrc-container {
        height: 120px;
    }
    .player-header h2 {
        font-size: 1.7em;
    }
    #volume-slider {
        width: 100px;
    }
    .playlist-container.visible {
        max-height: 180px;
    }
}

@media (min-width: 1024px) { /* Larger desktops */
    .player-container {
        max-width: 500px;
    }
     .album-art {
        width: 240px;
        height: 240px;
    }
    .lrc-container {
        height: 140px;
    }
    .player-header h2 {
        font-size: 1.8em;
    }
    #volume-slider {
        width: 120px;
    }
    .playlist-container.visible {
        max-height: 200px;
    }
}


.player-header {
    text-align: center;
}

.player-header h2 {
    margin: 0 0 5px 0;
    font-size: 1.6em;
    font-weight: 500;
    color: var(--text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.player-header p {
    margin: 0;
    font-size: 0.9em;
    color: var(--light-text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.album-art-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.album-art {
    width: 200px;
    height: 200px;
    border-radius: var(--border-radius);
    object-fit: cover;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: block; /* Helps prevent extra space below img */
}

/* LRC Container */
.lrc-container {
    height: 100px;
    overflow-y: auto;
    text-align: center;
    border: 1px solid #eee;
    border-radius: var(--border-radius);
    padding: 10px;
    background-color: var(--secondary-color);
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--secondary-color);
    position: relative; /* For potential absolute positioning of children if needed */
}

.lrc-container::-webkit-scrollbar {
    width: 6px;
}
.lrc-container::-webkit-scrollbar-track {
    background: var(--secondary-color);
    border-radius: 3px;
}
.lrc-container::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 3px;
}

#lrc-lines {
    /* Container for lyric lines, managed by JS */
}

.lrc-line {
    font-size: 0.95em;
    line-height: 1.6;
    color: var(--light-text-color);
    padding: 2px 0;
    opacity: 0.7;
    transition: opacity 0.3s ease, color 0.3s ease, font-weight 0.3s ease;
    word-break: break-word;
}

.lrc-line.active {
    color: var(--primary-color);
    font-weight: 500;
    opacity: 1;
}

/* Controls */
.controls-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8em;
    color: var(--light-text-color);
}

#progress-bar {
    flex-grow: 1;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    /* outline: none; -- Already globally set */
    border-radius: 4px;
    cursor: pointer;
}
#progress-bar:focus-visible {
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.5);
}


#progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
    margin-top: -4px;
}

#progress-bar::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
}


.main-controls, .extra-controls {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.extra-controls {
    justify-content: space-between;
}


.control-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5em;
    cursor: pointer;
    padding: 10px;
    transition: color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%; /* Make all small control buttons circular */
    /* outline: none; -- Already globally set */
    position: relative; /* For potential pseudo-elements or complex focus styles */
}
.control-btn:hover {
    color: var(--primary-color);
}
.control-btn:active {
    transform: scale(0.9);
    color: var(--highlight-color); /* Slightly darker color on active */
}
.control-btn:disabled {
    color: #ccc !important;
    cursor: not-allowed;
    transform: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
}

.control-btn:focus-visible {
    color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.3);
}


#play-pause-btn {
    font-size: 2.2em;
    background-color: var(--primary-color);
    color: white;
    width: 60px;
    height: 60px;
    box-shadow: 0 4px 10px rgba(var(--primary-color-rgb), 0.4);
}
#play-pause-btn:hover {
    background-color: var(--highlight-color);
    color: white;
}
#play-pause-btn:active {
    background-color: var(--highlight-color); /* Keep consistent with hover for this button */
    transform: scale(0.95); /* Slightly different scale for main button */
}
#play-pause-btn:disabled {
    background-color: #d8d8d8 !important;
    color: #a0a0a0 !important;
}

#play-pause-btn:focus-visible {
    background-color: var(--highlight-color);
    color: white;
    box-shadow: 0 0 0 4px rgba(var(--primary-color-rgb), 0.5), 0 4px 10px rgba(var(--primary-color-rgb), 0.4);
}


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

#volume-slider {
    width: 80px;
    -webkit-appearance: none;
    appearance: none;
    height: 5px;
    background: #e0e0e0;
    /* outline: none; -- Already globally set */
    border-radius: 2.5px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}
#volume-slider:focus-visible {
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.5);
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    margin-top: -3.5px;
}
#volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    border: none;
}
#volume-slider:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* Playlist */
.playlist-container {
    max-height: 0;
    opacity: 0;
    overflow-y: auto;
    transition: max-height 0.4s ease-out, opacity 0.3s ease-out, padding 0.4s ease-out;
    background-color: var(--secondary-color);
    border-radius: var(--border-radius);
    padding: 0 15px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--secondary-color);
}
.playlist-container::-webkit-scrollbar {
    width: 5px;
}
.playlist-container::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 2.5px;
}


.playlist-container.visible {
    max-height: 150px;
    opacity: 1;
    padding: 15px 15px 5px 15px;
}


.playlist-container h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1em;
    color: var(--text-color);
    text-align: center;
}

#playlist-ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#playlist-ul li {
    padding: 10px 8px;
    cursor: pointer;
    border-bottom: 1px solid #ddd;
    font-size: 0.9em;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    /* outline: none; -- Already globally set */
    position: relative; /* For focus styles */
}
#playlist-ul li:focus-visible {
    background-color: #e0e0f0;
    color: var(--primary-color);
    /* Using a border or inset shadow for list items often looks cleaner */
    box-shadow: inset 2px 0 0 0 var(--primary-color);
}


#playlist-ul li:last-child {
    border-bottom: none;
}

#playlist-ul li:hover {
    background-color: #e0e0f0;
    color: var(--text-color); /* Or var(--primary-color) if preferred on hover too */
}
#playlist-ul li:active {
    background-color: #d0d0e0; /* Slightly darker on active */
}

#playlist-ul li.playing {
    color: var(--primary-color);
    font-weight: 500;
    background-color: #e8e6ff;
}
#playlist-ul li.playing:hover {
    background-color: #dde0ff; /* Slightly different hover for playing item */
}
#playlist-ul li.playing:focus-visible {
    background-color: #dde0ff;
    box-shadow: inset 2px 0 0 0 var(--highlight-color); /* Use highlight color for focused playing item */
}


/* Album art placeholder */
img.album-art[src$="pic.png"] {
    background-color: #ccc;
    display: flex;
    justify-content: center;
    align-items: center;
    color: transparent; /* Hides broken image icon/alt text */
}
img.album-art[src$="pic.png"]::after {
    content: "🎵";
    font-size: clamp(40px, 15vw, 60px); /* Responsive icon size */
    color: #888;
    display: block;
    line-height: 1; /* Helps center icon vertically if img has height */
    text-align: center; /* Ensures icon is centered if img is wider */
}


/* Utility: FontAwesome icons inside buttons */
.control-btn i {
    pointer-events: none; /* Clicks pass through to the button */
    display: inline-block; /* Helps with alignment and sizing */
    vertical-align: middle; /* Better vertical alignment if needed */
}