@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600&family=Playfair+Display:ital,wght@0,400;0,700;1,400&display=swap');

:root {
    /* Red & Black Palette */
    --bg-deep: #020000; /* Pure Void Black */
    --bg-gradient: radial-gradient(circle at center, #1a0505 0%, #000000 80%);
    
    --accent-primary: #d32f2f; /* Crimson */
    --accent-bright: #ff5252; /* Highlight Red */
    --accent-glow: rgba(211, 47, 47, 0.4);
    
    --glass-surface: rgba(10, 0, 0, 0.75); /* Smoked dark glass */
    --glass-border: 1px solid rgba(100, 20, 20, 0.3);
    --glass-highlight: rgba(255, 50, 50, 0.1);
    
    --text-main: #e0e0e0;
    --text-muted: rgba(255, 255, 255, 0.4);
    
    --nav-height: 80px;
    --player-height: 110px;
    --app-height: 100vh;
}

@supports (height: 100dvh) {
    :root {
        --app-height: 100dvh;
    }
}

body {
    margin: 0;
    padding: 0;
    /* Background handled by Three.js */
    color: var(--text-main);
    font-family: 'Montserrat', sans-serif;
    min-height: var(--app-height);
    height: var(--app-height);
    overflow: hidden;
    position: relative;
}

/* Disable tap highlight on all buttons */

button {
    -webkit-tap-highlight-color: transparent;
}

/* Vignette for depth */

body::after {
    content: "";
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(transparent 50%, #000000 100%);
    pointer-events: none;
    z-index: 2;
}

/* Subtle Red Grain */

body::before {
    content: "";
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 3;
}

#visualizer-canvas {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0;
}

/* --- Layout --- */

.fm-container {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    /* min-height: var(--app-height);
    height: var(--app-height); */
    min-height: 100vh;
    height: 100vh; 
    padding-top: env(safe-area-inset-top, 0px);
    /* padding-bottom: env(safe-area-inset-bottom, 0px); */
    box-sizing: border-box;
    pointer-events: none; /* Let clicks pass to background visualizer */
}

#lyrics-title {
    display: -webkit-box;          /* 关键 */
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;         /* 最多显示 3 行 */
    overflow: hidden;
    font-size: 1rem;
}

/* Re-enable interaction for UI elements */

.fm-nav, 
.playlist-section, 
.lyrics-section, 
.player-bar,
.playlist-overlay,
.mobile-playlist-toggle,
.mobile-more-menu {
    pointer-events: auto;
}

.playlist-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 380;
}

body.mobile-playlist-open .playlist-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* --- Nav --- */

.fm-nav {
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.back-btn {
    text-decoration: none; 
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem; 
    letter-spacing: 1.5px;
    text-transform: uppercase;
    transition: all 0.3s ease;
    position: relative;
    padding-bottom: 4px;
}

.back-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent-bright);
    transition: width 0.3s ease;
}

.back-btn:hover { 
    color: #fff; 
}

.back-btn:hover::after { 
    width: 100%; 
}

/* Removed old img styles */

.fm-title {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 1.8rem;
    background: linear-gradient(to right, #fff, #ff8a80);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(211, 47, 47, 0.5);
    margin: 0;
    cursor: pointer;
}

.fm-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Level Select in Navigation */

.fm-actions .custom-level-select {
    width: auto;
    min-width: 80px;
}

.fm-actions .select-trigger {
    padding: 6px 12px;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.fm-actions .select-options {
    right: 0;
    left: auto;
    min-width: 100px;
}

.mobile-playlist-toggle {
    display: none;
}

.lyrics-back-btn {
    display: none;
    margin-right: 12px;
}

.lyrics-back-btn span {
    letter-spacing: 1px;
}

/* --- Content --- */

.fm-content {
    flex: 1;
    display: flex;
    gap: 30px;
    padding: 20px;
    overflow: hidden;
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* --- Playlist & Lyrics Sections (Lighter Grey) --- */

.playlist-section, .lyrics-section {
    background: rgba(60, 60, 60, 0.65); /* Lighter with less opacity */
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5);
}

.playlist-section {
    width: 340px;
    display: flex;
    flex-direction: column;
    padding: 24px 5px;
    max-height: 100%;
    /* Added for toggle functionality */
    transition: width 0.4s cubic-bezier(0.25, 1, 0.5, 1), padding 0.4s ease, opacity 0.4s ease, background 0.4s;
    position: relative;
    /* Ensure content doesn't overflow when collapsing, but allow button (which we'll handle) */
    /* Actually we need visible overflow for the button if it hangs out, OR button inside. */
    /* Let's put button absolute right: 0; inside padding? No, user asked for "side". */
}

/* Collapsed State */

.playlist-section.collapsed {
    width: 14px;
    min-width: 14px;
    padding: 24px 0;
    border: none;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    pointer-events: auto;
    position: relative;
}

/* Hide content when collapsed */

.playlist-section.collapsed > *:not(.playlist-toggle-btn) {
    display: none; /* Simple hide */
    /* Or opacity 0 for fade? Display none is safer for layout. */
}

.playlist-section.collapsed::before {
    content: '';
    position: absolute;
    top: 18px;
    bottom: 18px;
    right: -1px;
    width: 2px;
    border-radius: 2px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.35), rgba(255,255,255,0));
}

/* Toggle Button */

.playlist-toggle-btn {
    position: absolute;
    right: -24px; /* Hang outside */
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 48px; /* Vertical pill */
    background: rgba(60, 60, 60, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 100;
    padding: 0;
    transition: all 0.3s ease;
    opacity: 1;
    pointer-events: auto; /* Always clickable */
    outline: none;
}

.playlist-section.collapsed .playlist-toggle-btn {
    background: rgba(70, 70, 70, 0.9);
    right: -24px;
    width: 24px;
    height: 48px;
    border-radius: 0 8px 8px 0;
    border-color: rgba(255, 255, 255, 0.2);
}

.playlist-toggle-btn:hover {
    background: var(--accent-primary);
    width: 28px; /* Expand slightly on hover */
    right: -28px;
}

.playlist-toggle-btn img {
    width: 14px;
    height: 14px;
    filter: invert(1);
    opacity: 0.7;
    transition: transform 0.3s ease;
}

.playlist-section.collapsed .playlist-toggle-btn img {
    /* Maybe rotate to indicate expansion? */
    /* vertical-line-icon is symmetric, maybe opacity change or color? */
    opacity: 1;
}

.playlist-tabs {
    flex-shrink: 0;
    margin-bottom: 20px;
    display: flex;
    gap: 20px;
    padding: 0px 20px;
}

.lyrics-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 24px;
    width: 100%;
    min-width: 0; /* Prevent flex item from overflowing */
}

/* Current track info header */

.current-track-info-header {
    flex-shrink: 0;
    /* margin-bottom: 20px; */
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.current-track-info-header h2 {
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 400;
    margin: 0 0 8px 0;
    text-align: center;
}

.lyrics-origin-link-row {
    display: none;
    flex-shrink: 0;
    margin: 0 0 10px;
    text-align: center;
}

.lyrics-origin-link-row .origin-link {
    font-size: 0.85rem;
}

.origin-link {
    color: #ffffff;
    text-decoration: none;
    font-size: 0.9rem;
    opacity: 0.8;
    transition: all 0.3s ease;
}

.origin-link:hover {
    color: var(--accent-bright);
    opacity: 1;
}

.lyrics-container {
    padding: 10px;
    padding-bottom: 60px;
    flex: 1;
    color: #ffffff;
    font-size: 1rem;
    line-height: 1.6;
    text-align: left;
    overflow-y: auto;
    width: 100%;
    margin-top: 20px;
    min-height: 0; /* Allow flex item to shrink properly */
}

.lyrics-loading,
.lyrics-empty,
.lyrics-error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.6);
}

.lyric-line {
    padding: 10px 0;
    cursor: pointer;
    transition: color 0.3s ease, transform 0.3s ease;
}

.lyric-line .l-en,
.lyric-line .l-zh {
    display: block;
}

.lyric-line .l-zh {
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.75);
    margin-top: 6px;
}

.lyrics-container:not(.bilingual-active) .lyric-line .l-zh {
    display: none;
}

.lyric-line.active {
    color: var(--accent-bright);
    font-weight: 600;
    text-shadow: 0 0 12px rgba(255, 82, 82, 0.4);
    transform: scale(1.02);
}

.lyrics-container::-webkit-scrollbar {
    width: 4px;
}

.lyrics-container::-webkit-scrollbar-track {
    background: transparent;
}

.lyrics-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.lyrics-font-controls {
    position: absolute;
    right: 20px;
    bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 999px;
    padding: 4px 8px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.lyrics-font-btn {
    width: 30px;
    height: 30px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.lyrics-font-btn img {
    width: 14px;
    height: 14px;
    filter: invert(1);
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.bilingual-label {
    display: none;
    margin-left: 6px;
    font-size: 0.75rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.lyrics-font-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.lyrics-font-btn:hover img {
    opacity: 1;
}

.lyrics-font-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tab-btn {
    background: transparent; border: none;
    color: var(--text-muted);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem; text-transform: uppercase; letter-spacing: 3px;
    padding: 10px 0; cursor: pointer; position: relative;
    transition: all 0.4s;
}

.tab-btn.active { color: var(--accent-bright); text-shadow: 0 0 10px var(--accent-glow); }

.tab-btn::after {
    content: ''; position: absolute; bottom: 0; left: 0;
    width: 0; height: 1px; background: var(--accent-primary);
    transition: width 0.4s ease;
}

.tab-btn.active::after { width: 100%; }

.playlist-container {
    flex: 1;
    overflow-y: auto;
    margin-top: 0;
}

.playlist-container::-webkit-scrollbar {
    width: 6px;
}

.playlist-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.playlist-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    transition: background 0.3s ease;
}

.playlist-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.playlist-container.hidden {
    display: none;
}

.track-item {
    padding: 18px 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.status-icon-placeholder {
    width: 15px;
    height: 15px;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.status-icon {
    width: 100%;
    height: 100%;
    filter: invert(1);
    opacity: 0.8;
    display: none;
}

.track-item.active .status-icon {
    display: block;
}

.status-icon.rotating {
    animation: disk-spin 3s linear infinite;
}

@keyframes disk-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

.track-item.active {
    background: linear-gradient(90deg, rgba(211, 47, 47, 0.1), transparent);
    border-left: 2px solid var(--accent-bright);
}

.track-info {
    flex: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.track-title {
    font-size: 1rem;
    flex: 1;
    color: #ffffff;
    font-weight: 400;
    /* letter-spacing: 0.5px; */
    line-height: 1.3;
    overflow: hidden;
    max-width: 100%;
    position: relative;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.track-item.active .track-title {
    color: var(--accent-bright);
    font-weight: 500;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.delete-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 14px;
    cursor: pointer;
    padding: 2px 6px;
    margin-left: 8px;
    opacity: 0;
    transition: all 0.3s ease;
    border-radius: 3px;
    flex-shrink: 0;
    order: 2;
}

.track-item:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    color: var(--accent-bright);
    background: rgba(211, 47, 47, 0.1);
}

.fav-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    margin-left: 8px;
    opacity: 0;
    transition: all 0.3s ease;
    border-radius: 3px;
    flex-shrink: 0;
    order: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.track-item:hover .fav-btn,
.fav-btn.active {
    opacity: 1;
}

.fav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.fav-btn img {
    width: 16px;
    height: 16px;
    filter: invert(1);
    opacity: 0.6;
    transition: opacity 0.2s;
}

/* Active (Favorited) State */

.fav-btn.active img {
    opacity: 1;
    /* Red filter for filled heart if it's not already red. 
       Assuming heart-fill.svg might be black/white. 
       If it is a colored asset, filter might distort it, but let's apply the red filter just in case or to enforce theme. 
    */
    filter: brightness(0) saturate(100%) invert(27%) sepia(51%) saturate(2878%) hue-rotate(346deg) brightness(104%) contrast(97%);
}

.fav-btn:hover img {
    opacity: 1;
    /* No color change on hover as requested, just opacity */
}

/* --- Player Bar --- */

.player-bar {
    height: var(--player-height);
    margin: 15px auto 20px auto;
    background: rgba(30, 30, 30, 0.95); /* Deep grey */
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    display: flex; flex-direction: column; justify-content: center;
    position: relative; z-index: 100;
    padding: 0 30px;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px));
    max-width: 900px; width: calc(100% - 40px); box-sizing: border-box;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}

.player-controls-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.player-track-info {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 30%;
}

.track-cover {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    background-size: cover;
    background-position: center;
    background-color: #1a1a1a;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.track-cover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.track-cover:hover::before {
    opacity: 1;
}

.track-cover:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(211, 47, 47, 0.3);
}

.track-cover:active {
    transform: scale(0.95);
}

.image-switch-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 3;
    pointer-events: auto;
    cursor: pointer;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.image-switch-icon img {
    width: 14px;
    height: 14px;
    filter: invert(1);
}

.track-cover:hover .image-switch-icon {
    opacity: 1;
}

.track-cover:active {
    transform: scale(0.95);
}

.track-text {
    overflow: hidden;
}

.track-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-artist {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.player-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex: 1;
}

.mobile-more-menu {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 0 20px;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 450;
}

.mobile-more-menu.open {
    opacity: 1;
    pointer-events: auto;
}

.mobile-more-menu-content {
    width: 100%;
    max-width: 560px;
    max-height: 66vh;
    overflow-y: auto;
    background: rgba(25, 25, 25, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px 18px 12px 12px;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(3, minmax(80px, 1fr));
    gap: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.mobile-more-menu-btn {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.mobile-more-menu-btn img {
    width: 28px;
    height: 28px;
    filter: invert(1);
    opacity: 0.85;
}

.mobile-more-menu-btn:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.12);
}

.ctrl-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.ctrl-btn img {
    width: 24px;
    height: 24px;
    filter: invert(1);
    opacity: 0.7;
}

.ctrl-btn:hover img {
    opacity: 1;
}

.mobile-more-btn {
    display: none;
}

/* Ensure play mode button icons are visible */

#mode-btn img {
    width: 26px;
    height: 26px;
}

/* For specific icon types that might need different styling */

.ctrl-btn img[src*="music-player"] {
    filter: brightness(0) invert(1);
    width: 26px;
    height: 26px;
    opacity: 0.8;
}

.ctrl-btn img[src*="pause-button"] {
    filter: brightness(0) invert(1);
    width: 24px;
    height: 24px;
    opacity: 0.8;
}

.ctrl-btn img[src*="volume-mute"],
.ctrl-btn img[src*="player-playlist"] {
    filter: brightness(0) invert(1);
    width: 24px;
    height: 24px;
    opacity: 0.8;
}

.ctrl-btn:hover img[src*="music-player"],
.ctrl-btn:hover img[src*="pause-button"],
.ctrl-btn:hover img[src*="volume-mute"],
.ctrl-btn:hover img[src*="player-playlist"] {
    opacity: 1;
}

.play-btn {
    width: 52px;
    height: 52px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.1);
    -webkit-tap-highlight-color: transparent;
}

.play-btn:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.05);
}

.play-btn img {
    width: 28px;
    height: 28px;
}

.time-display {
    font-size: 0.75rem;
    font-family: monospace;
    color: var(--text-muted);
    display: flex;
    gap: 4px;
    align-items: center;
    white-space: nowrap;
}

/* Volume Control Styling */

.volume-control-container {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
    }

.volume-slider-popup {
        position: absolute;
        bottom: 100%;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 120px;
        background: rgba(40, 40, 40, 0.95);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        display: none; /* Show on hover */
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 12px 0;
        margin-bottom: 10px;
        z-index: 1000;
        backdrop-filter: blur(10px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    }

.volume-control-container:hover .volume-slider-popup,
    .volume-control-container.volume-popup-open .volume-slider-popup,
    .volume-control-container:focus-within .volume-slider-popup {
        display: flex;
    }

/* Invisible bridge to prevent popup from closing when moving mouse from button to popup */

.volume-slider-popup::after {
        content: '';
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        height: 15px;
        background: transparent;
    }

.volume-slider {
        -webkit-appearance: none;
        width: 4px; /* Width becomes height in vertical mode for some browsers, but we use transform */
        height: 90px;
        background: transparent;
        outline: none;
        cursor: pointer;
        /* Standard Vertical Range Input Styles if supported, otherwise transform */
        writing-mode: bt-lr; /* IE */
        -webkit-appearance: slider-vertical; /* WebKit */
        appearance: slider-vertical;
    }

/* Custom Vertical Slider: Rotated Horizontal Input */

.volume-slider.vertical {
        width: 80px;
        height: 4px; /* Touch target height */
        -webkit-appearance: none;
        appearance: none;
        background: transparent;
        border-radius: 2px;
        position: absolute;
        top: 50%;
        left: 50%;
        margin: 0;
        transform: translate(-50%, -50%) rotate(-90deg);
        cursor: pointer;
        z-index: 10;
    }

.volume-slider.vertical::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 12px;
        height: 12px;
        background: #fff;
        border-radius: 50%;
        cursor: pointer;
        box-shadow: 0 1px 3px rgba(0,0,0,0.5);
        border: none;
    }

.volume-slider.vertical::-moz-range-thumb {
        width: 12px;
        height: 12px;
        background: #fff;
        border-radius: 50%;
        cursor: pointer;
        box-shadow: 0 1px 3px rgba(0,0,0,0.5);
        border: none;
    }

/* Fill for the slider */

.volume-track-bg {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        width: 4px;
        height: 80px;
        background: rgba(255,255,255,0.2);
        border-radius: 2px;
        pointer-events: none;
        display: block;
    }

/* Desktop Fill */

.volume-track-fill {
        position: absolute;
        bottom: 20px; /* (120px container - 80px slider) / 2 */
        left: 50%;
        transform: translateX(-50%);
        width: 4px;
        /* Height set by JS */
        background: var(--accent-bright);
        border-radius: 2px;
        pointer-events: none;
        display: block;
        z-index: 5;
    }

/* Mobile Volume Controls */

.mobile-volume-controls {
        width: 100%;
        margin-top: 8px;
        padding-top: 16px;
        border-top: 1px solid rgba(255,255,255,0.1);
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

.mobile-volume-row {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 0 8px;
    }

.volume-icon-small,
    .volume-icon-large {
        width: 20px;
        height: 20px;
        filter: invert(1);
        opacity: 0.7;
    }

.mobile-slider-container {
        flex: 1;
        position: relative;
        height: 30px; /* Touch target height */
        display: flex;
        align-items: center;
    }

.mobile-volume-slider {
        -webkit-appearance: none;
        appearance: none;
        width: 100%;
        height: 4px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 2px;
        outline: none;
        position: relative;
        z-index: 2;
    }

.mobile-volume-slider::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 18px;
        height: 18px;
        background: #fff;
        border-radius: 50%;
        cursor: pointer;
        box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    }

.mobile-volume-slider::-moz-range-thumb {
        width: 18px;
        height: 18px;
        background: #fff;
        border-radius: 50%;
        cursor: pointer;
        box-shadow: 0 2px 6px rgba(0,0,0,0.4);
        border: none;
    }

/* Filled track part (JS will handle width) */

.mobile-volume-track-fill {
        position: absolute;
        top: 50%;
        left: 0;
        transform: translateY(-50%);
        height: 4px;
        background: var(--accent-bright);
        border-radius: 2px;
        pointer-events: none;
        z-index: 1;
        width: 100%; /* Default full, JS adjusts */
    }

/* Adjust Mobile Menu Grid for new item? No, it's a separate row. */

/* Speed Control Styling */

.speed-control {
    position: relative;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--text-muted);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 8px;
    border-radius: 4px;
    transition: 0.3s;
    user-select: none; /* Prevent text selection */
    min-width: 56px;
    max-width: 56px;
    width: 56px;
    height: 22px;
    text-align: center;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.speed-control:hover,
.speed-control.active {
    color: #fff;
    border-color: rgba(255,255,255,0.3);
}

#current-speed {
    display: inline-block;
    width: 100%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    line-height: 1;
}

.speed-options {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: rgba(40, 40, 40, 0.95);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    display: none;
    flex-direction: column;
    padding: 5px 0;
    margin-bottom: 10px;
    min-width: 80px;
    width: 80px;
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    box-sizing: border-box;
}

/* Show menu when JavaScript adds active class */

.speed-control.active .speed-options {
    display: flex;
}

.speed-options div {
    padding: 6px 8px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.75rem;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    line-height: 1;
}

.speed-options div:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.speed-options div:active {
    background: rgba(255, 255, 255, 0.2);
}

.progress-container {
    position: absolute;
    top: -2px;
    left: 30px;
    right: 30px;
    width: auto;
    height: 4px;
    cursor: pointer;
}

.progress-track-bg { background: rgba(255,255,255,0.05); height: 100%; width: 100%; }

.progress-bar {
    background: var(--accent-bright);
    height: 100%; width: 0;
    transition: width 0.1s linear;
}

/* Mobile Adjustments */

@media (max-width: 900px) {
    body{
        padding-top: 0px !important;
    }

    /* Hide level select in nav on mobile */
    .fm-actions {
        display: none;
    }

    /* Hide filter bar on mobile since level select is now in nav */
    .fm-filter-bar {
        display: none;
    }
    .fm-container {
        padding-top: 50px;
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 100px);
    }

    .fm-content {
        flex-direction: column;
        padding: 10px;
        gap: 12px;
        flex: 1;
        min-height: 0;
    }

    .fm-nav {
        display: none;
    }

    .back-btn,
    .fm-actions {
        display: none;
    }

    .playlist-section {
        position: fixed;
        top: 50px; /* Offset for #mobile-top-bar */
        left: 0;
        width: 100%;
        min-height: calc(var(--app-height));
        height: calc(var(--app-height));
        border-radius: 0;
        max-width: none;
        padding: 28px 18px 24px;
        transform: translateX(-105%);
        opacity: 0;
        transition: transform 0.35s ease, opacity 0.35s ease;
        z-index: 420;
        border: none;
        box-shadow: none;
    }

    .playlist-section.collapsed {
        width: 100%;
        min-width: auto;
        padding: 28px 18px 24px;
    }

    .playlist-toggle-btn {
        display: none;
    }

    .playlist-close-btn {
        position: absolute;
        top: 20px;
        right: 20px;
        background: transparent;
        border: none;
        padding: 10px;
        cursor: pointer;
        z-index: 10;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .playlist-close-btn img {
        width: 24px;
        height: 24px;
        filter: invert(1);
        opacity: 0.7;
        transition: all 0.2s ease;
    }

    .playlist-close-btn:hover img {
        opacity: 1;
        transform: scale(1.1);
    }

    body.mobile-playlist-open .playlist-section {
        transform: translateX(0);
        opacity: 1;
    }

    .lyrics-section {
        flex: 1;
        /* min-height: calc(var(--app-height) - 20px); */
        height: 100%;
        margin-top: 0px;
        width: 100%;
        padding: 20px 0px;
        /* padding: 50px 16px 120px 16px */
    }

    .current-track-info-header {
        justify-content: flex-start;
    }

    .lyrics-back-btn {
        display: inline-flex;
    }

    .lyrics-origin-link-row {
        text-align: center;
        margin-bottom: 6px;
    }

    .lyrics-font-controls {
        display: none;
    }

    .bilingual-label {
        display: inline-block;
    }

    .delete-btn {
        opacity: 1 !important; /* Always show delete button on mobile */
    }

    .fav-btn {
        opacity: 1 !important; /* Always show favorite button on mobile */
    }

    .track-item.active {
        background: rgba(211, 47, 47, 0.2); /* Stronger highlight for active track on mobile */
        border-left: 3px solid var(--accent-bright);
    }

    .lyrics-container {
        margin-top: 12px;
        padding-bottom: 90px;
    }

    .player-controls-wrapper {
        justify-content: center;
        gap: 16px;
    }

    .player-track-info {
        display: none;
    }

    .desktop-only {
        display: none !important;
    }

    .player-controls {
        width: 100%;
        justify-content: space-evenly;
        gap: 0;
    }

    .mobile-more-btn {
        display: flex !important;
    }

    .mobile-playlist-toggle {
        display: flex;
    }

    .mobile-playlist-toggle img {
        width: 24px; /* Slightly larger for new icon */
        height: 24px;
    }

    .speed-control {
        min-width: 64px;
        max-width: 64px;
    }

    .mobile-more-menu {
        display: flex;
    }

    .player-controls .ctrl-btn {
        border: none;
        background: transparent;
        padding: 12px;
        width: 58px;
        height: 58px;
    }
    
    .player-controls .play-btn {
        width: 72px;
        height: 72px;
        border: none;
        background: rgba(255, 255, 255, 0.08);
        border-radius: 50%;
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
    }

    .player-controls .ctrl-btn img {
        opacity: 0.9;
        width: 28px; /* Slightly larger icon to fill space */
        height: 28px;
    }
    
    .player-controls .play-btn img {
        width: 34px; /* Play icon slightly larger visual weight */
        height: 34px;
    }

    /* Mobile More Menu Updates */
    .mobile-more-menu-content {
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
        justify-content: flex-start;
        padding-bottom: 24px;
        position: relative; /* For close button */
        padding-top: 50px; /* Space for close button */
    }

    .player-bar{
        height: 72px;
        position: fixed;
        left: 50%;
        bottom: 12px;
        transform: translateX(-50%);
        margin: 0;
        width: calc(100% - 24px);
        max-width: 520px;
        box-shadow: 0 16px 50px rgba(0,0,0,0.55);
        padding: 0 18px calc(env(safe-area-inset-bottom, 0px) + 6px);
    }
    
    .mobile-menu-close-btn {
        position: absolute;
        top: 10px;
        right: 10px;
        background: rgba(255, 255, 255, 0.1);
        border: none;
        color: rgba(255, 255, 255, 0.6);
        width: 24px;
        height: 24px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        line-height: 1;
        cursor: pointer;
        padding: 0;
    }

    .mobile-more-menu-btn {
        flex-direction: column;
        gap: 8px;
        width: calc(25% - 9px);
        aspect-ratio: 1;
        padding: 10px 4px;
        border-radius: 16px;
        background: rgba(255,255,255,0.08);
        border: 1px solid rgba(255,255,255,0.05);
    }
    
    .mobile-more-menu-btn:hover {
        background: rgba(255,255,255,0.12);
    }

    .mobile-more-menu-btn .menu-label {
        font-size: 11px;
        color: rgba(255,255,255,0.7);
        white-space: nowrap;
    }
    
    .mobile-speed-controls {
        width: 100%;
        margin-top: 8px;
        padding-top: 16px;
        border-top: 1px solid rgba(255,255,255,0.1);
    }
    
    .menu-section-title {
        color: rgba(255,255,255,0.5);
        font-size: 12px;
        margin-bottom: 12px;
        padding-left: 4px;
    }

    .speed-options-mobile {
        display: flex;
        justify-content: space-between;
        gap: 8px;
        background: rgba(0,0,0,0.2);
        padding: 4px;
        border-radius: 12px;
    }
    
    .speed-opt-btn {
        flex: 1;
        background: transparent;
        border: none;
        color: rgba(255,255,255,0.6);
        padding: 8px 0;
        border-radius: 8px;
        font-size: 12px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s;
    }
    
    .speed-opt-btn.active {
        background: rgba(255,255,255,0.15);
        color: #fff;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    }

    .mobile-font-controls {
        width: 100%;
        margin-top: 8px;
        padding-top: 16px;
        border-top: 1px solid rgba(255,255,255,0.1);
    }

    .font-options-mobile {
        display: flex;
        gap: 12px;
    }

    .font-opt-btn {
        flex: 1;
        border: none;
        border-radius: 12px;
        padding: 10px 0;
        font-size: 14px;
        font-weight: 600;
        color: #fff;
        background: rgba(255,255,255,0.1);
        box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
        cursor: pointer;
        transition: background 0.2s ease, transform 0.2s ease;
    }

    .font-opt-btn:active {
        transform: scale(0.96);
    }

    /* Lyrics Header & Back Button */
    .lyrics-header-title {
        display: flex;
        align-items: baseline;
        justify-content: center;
        gap: 8px; /* Reduced gap */
        width: 100%;
    }
    
    .lyrics-back-btn {
        display: inline-flex;
        position: relative; /* Changed from absolute */
        left: auto;
        top: auto;
        transform: none;
        margin-right: 0;
        padding: 6px; /* Touch target */
    }

    .lyrics-back-btn span {
        display: none; /* Hide text "Back", show only arrow if possible, or keep text? User said "like a small button before title" */
        /* Let's keep the text for now as user didn't explicitly say hide text, but "Back" might be too long. */
        /* Actually, usually mobile back buttons are just icons "<". */
        /* The HTML has "Back" text. Let's hide it on mobile and use CSS pseudo element or just the border-bottom style from base? */
        /* The user said "small button". Let's style it. */
    }

    /* Override base .back-btn styles for this specific context on mobile */
    .lyrics-back-btn.back-btn {
        font-size: 0; /* Hide text */
        width: 24px;
        height: 24px;
        border: 1px solid rgba(255,255,255,0.3);
        border-radius: 30%;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
    }

    .lyrics-back-btn.back-btn::after {
        display: none; /* Remove underline */
    }

    .lyrics-back-btn.back-btn::before {
        content: '';
        display: block;
        width: 8px;
        height: 8px;
        border-top: 2px solid #fff;
        border-left: 2px solid #fff;
        transform: rotate(-45deg);
        margin-left: 2px; /* Center optically */
    }
    
    .current-track-info-header {
        position: relative;
        justify-content: center;
        min-height: 32px;
        margin-bottom: 0;
    }
    
    /* Weakened Lyrics Font Controls */
    .lyrics-font-controls {
        position: absolute;
        bottom: 16px;
        right: 16px;
        width: auto;
        margin: 0;
        padding: 4px 8px;
        background: rgba(0,0,0,0.4);
        backdrop-filter: blur(8px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.2);
        border: 1px solid rgba(255,255,255,0.05);
        justify-content: center;
    }
    
    .lyrics-font-controls .origin-link {
        display: none; /* Hide 'Read Article' on mobile to save space if needed? User didn't say. Keep it. */
        display: block;
        font-size: 10px;
        padding: 2px 8px;
    }
    
    .lyrics-font-btn {
        width: 24px;
        height: 24px;
    }
    
    .lyrics-font-btn img {
        width: 12px;
        height: 12px;
    }
    /* Fullscreen Settings Panel Mobile Override */
    .fullscreen-settings-panel {
        top: auto !important;
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: none !important;
        height: 50vh !important;
        max-height: 50vh !important;
        border-radius: 16px 16px 0 0 !important;
        transform: translateY(100%);
    }
    
    .fullscreen-settings-panel.open {
        transform: translateY(0);
    }
}

@media (min-width: 900px) {
    .mobile-more-menu {
        display: none;
    }

    .mobile-playlist-toggle {
        display: none !important;
    }

    .playlist-close-btn {
        display: none;
    }
}

/* --- Fullscreen Mode --- */

.fullscreen-controls-group {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 9999;
    display: none;
    gap: 12px;
}

body.fullscreen-mode .fullscreen-controls-group {
    display: flex;
    animation: fadeIn 0.5s ease 0.5s forwards;
    opacity: 0;
}

.fullscreen-control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    color: #fff;
    padding: 8px 20px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.fullscreen-control-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

/* Specific styling for Exit button if needed, e.g. red accent on hover */

.fullscreen-exit-btn:hover {
    background: rgba(211, 47, 47, 0.2); /* Red tint */
    border-color: var(--accent-bright);
}

/* Fullscreen Settings Panel */

.fullscreen-settings-panel {
    position: fixed;
    top: 80px;
    right: 30px;
    width: 300px;
    max-width: calc(100vw - 60px);
    max-height: calc(var(--app-height) - 120px);
    background: rgba(10, 10, 10, 0.85); /* Dark Glass */
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fullscreen-lyrics-overlay {
    position: fixed;
    left: 50%;
    bottom: 60px;
    transform: translate(-50%, 20px);
    width: calc(100% - 60px);
    max-width: 900px;
    background: rgba(60, 60, 60, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px 24px;
    color: #ffffff;
    font-size: 1rem;
    line-height: 1.6;
    text-align: center;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    pointer-events: none;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 9000;
}

.fullscreen-lyrics-overlay.hidden {
    display: none !important;
}

body.fullscreen-mode .fullscreen-lyrics-overlay {
    display: block;
}

.fullscreen-lyrics-overlay.active {
    opacity: 1;
    transform: translate(-50%, 0);
}

.fullscreen-lyrics-overlay .overlay-line {
    margin: 0;
}

.fullscreen-lyrics-overlay .overlay-line .l-en,
.fullscreen-lyrics-overlay .overlay-line .l-zh {
    display: block;
    font-weight: 400;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fullscreen-lyrics-overlay .overlay-line .l-zh {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.9em;
    margin-top: 8px;
}

.fullscreen-lyrics-overlay:not(.bilingual-active) .overlay-line .l-zh {
    display: none;
}

.fullscreen-settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    gap: 16px;
}

.settings-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.settings-title {
    font-size: 0.85rem;
    color: #fff;
}

.settings-desc {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.settings-toggle {
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    padding: 6px 14px;
    border-radius: 999px;
    color: #fff;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    min-width: 70px;
}

.settings-toggle.off {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.6);
}

.settings-toggle:hover {
    border-color: rgba(255, 255, 255, 0.4);
}

.theme-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    flex: 1;
}

.theme-option {
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-option:hover {
    border-color: rgba(255, 255, 255, 0.4);
}

.theme-option.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    box-shadow: 0 0 12px rgba(211, 47, 47, 0.4);
    color: #fff;
}

.theme-option[data-theme-option="light"] {
    background: rgba(255, 255, 255, 0.92);
    color: #151515;
    border-color: rgba(255, 255, 255, 0.6);
}

.theme-option[data-theme-option="light"]:hover {
    border-color: rgba(0, 0, 0, 0.3);
}

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

.settings-header h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
    color: #fff;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-family: 'Montserrat', sans-serif;
}

.settings-close-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.settings-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: rotate(90deg);
}

.settings-content {
    flex: 1;
    padding: 10px 0; /* GUI handles its own padding mostly */
    overflow-y: auto;
    min-height: 200px;
}

/* Scrollbar for settings */

.settings-content::-webkit-scrollbar { width: 4px; }

.settings-content::-webkit-scrollbar-track { background: transparent; }

.settings-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

.settings-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: center;
    background: rgba(0,0,0,0.2);
}

.exit-fullscreen-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.2s ease;
    font-family: 'Montserrat', sans-serif;
    width: 100%;
}

.exit-fullscreen-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Settings panel styling for lil-gui */

.settings-content .lil-gui {
    --background-color: transparent !important;
    --text-color: #eee !important;
    --title-background-color: rgba(255, 255, 255, 0.05) !important;
    --widget-color: rgba(255, 255, 255, 0.1) !important;
    --hover-color: rgba(255, 255, 255, 0.2) !important;
    --focus-color: rgba(255, 255, 255, 0.3) !important;
    --number-color: var(--accent-bright) !important;
    --string-color: #a8f0a8 !important;
    --font-family: 'Montserrat', sans-serif !important;
    --font-size: 11px !important;
    width: 100% !important;
}

/* Hide the root title of lil-gui to avoid duplication with panel header */

.settings-content .lil-gui > .title {
    display: none !important;
}

.settings-content .lil-gui .title {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    font-weight: 600 !important;
    color: rgba(255, 255, 255, 0.9) !important;
}

.settings-content .lil-gui .widget {
    margin-bottom: 4px !important;
}

/* Theme Variations */

:root[data-theme="light"] {
    --text-main: #1f1f1f;
    --text-muted: rgba(0, 0, 0, 0.55);
    color: var(--text-main);
}

:root[data-theme="light"] body::after {
    background: radial-gradient(transparent 60%, rgba(0, 0, 0, 0.08) 100%);
}

:root[data-theme="light"] body::before {
    opacity: 0.12;
}

:root[data-theme="light"] .fm-title {
    background: linear-gradient(to right, #b71c1c, #ff7043);
    text-shadow: none;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

:root[data-theme="light"] .back-btn {
    color: rgba(0, 0, 0, 0.75);
}

:root[data-theme="light"] .back-btn::after {
    background: var(--accent-primary);
}

:root[data-theme="light"] .playlist-section,
:root[data-theme="light"] .lyrics-section {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.15);
}

:root[data-theme="light"] .playlist-section.collapsed::before {
    background: linear-gradient(to bottom, rgba(0,0,0,0.2), rgba(0,0,0,0));
}

:root[data-theme="light"] .playlist-toggle-btn {
    background: rgba(255, 255, 255, 0.94);
    border-color: rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .playlist-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

:root[data-theme="light"] .playlist-close-btn img {
    filter: none;
    opacity: 0.6;
}

:root[data-theme="light"] .playlist-toggle-btn img {
    filter: none;
    opacity: 0.6;
}

:root[data-theme="light"] .track-item {
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

:root[data-theme="light"] .track-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

:root[data-theme="light"] .track-item.active {
    background: linear-gradient(90deg, rgba(211, 47, 47, 0.12), transparent);
    border-left: 2px solid var(--accent-primary);
}

:root[data-theme="light"] .track-title {
    color: #1f1f1f;
}

:root[data-theme="light"] .delete-btn {
    color: rgba(0, 0, 0, 0.6);
}

:root[data-theme="light"] .delete-btn:hover {
    color: var(--accent-primary);
    background: rgba(211, 47, 47, 0.08);
}

:root[data-theme="light"] .current-track-info-header h2 {
    color: #1f1f1f;
}

:root[data-theme="light"] .origin-link {
    color: var(--accent-primary);
}

:root[data-theme="light"] .origin-link:hover {
    color: #000;
}

:root[data-theme="light"] .lyrics-container {
    color: #1b1b1b;
}

:root[data-theme="light"] .lyric-line .l-zh {
    color: rgba(0, 0, 0, 0.6);
}

:root[data-theme="light"] .lyric-line.active {
    color: var(--accent-primary);
    text-shadow: 0 0 12px rgba(211, 47, 47, 0.25);
}

:root[data-theme="light"] .lyrics-font-controls {
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

:root[data-theme="light"] .lyrics-font-btn {
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.04);
}

:root[data-theme="light"] .lyrics-font-btn img {
    filter: none;
    opacity: 0.7;
}

:root[data-theme="light"] .mobile-playlist-toggle img {
    filter: none;
    opacity: 0.6;
}

:root[data-theme="light"] .lyrics-font-controls .origin-link {
    color: #1f1f1f;
    border-color: rgba(0, 0, 0, 0.15);
}

/* FM Filter Bar */

.fm-filter-bar {
    padding: 0 12px 12px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 0;
}

.custom-level-select {
    position: relative;
    width: 100%;
    font-family: 'Montserrat', sans-serif;
}

.select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: rgba(40, 40, 40, 0.6);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.1);
    user-select: none;
}

.select-trigger:hover {
    background-color: rgba(60, 60, 60, 0.7);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.15);
}

.custom-level-select.open .select-trigger {
    border-color: var(--accent-bright);
    background-color: rgba(60, 60, 60, 0.75);
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0;
}

.select-arrow {
    width: 14px;
    height: 14px;
    filter: invert(1);
    opacity: 0.8;
    transition: transform 0.3s ease;
}

.custom-level-select.open .select-arrow {
    transform: rotate(180deg);
}

.select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: none;
    border-radius: 0 0 8px 8px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    max-height: 200px;
    overflow-y: auto;
    /* Hide scrollbar */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Hide scrollbar for WebKit browsers */

.select-options::-webkit-scrollbar {
    display: none;
}

.custom-level-select.open .select-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.option-item {
    padding: 10px 14px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.option-item.selected {
    color: var(--accent-bright);
    background: rgba(211, 47, 47, 0.15);
    font-weight: 600;
}

/* Light Mode Overrides for Select */

:root[data-theme="light"] .select-trigger {
    background: rgba(255, 255, 255, 0.9);
    color: #1f1f1f;
    border-color: rgba(0, 0, 0, 0.15);
    background-color: rgba(240, 240, 240, 0.8);
}

:root[data-theme="light"] .select-trigger:hover {
    background-color: #fff;
    border-color: rgba(0, 0, 0, 0.3);
}

:root[data-theme="light"] .select-arrow {
    filter: none;
    opacity: 0.6;
}

:root[data-theme="light"] .select-options {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] .option-item {
    color: rgba(0, 0, 0, 0.7);
}

:root[data-theme="light"] .option-item:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #000;
}

:root[data-theme="light"] .option-item.selected {
    color: var(--accent-primary);
    background: rgba(211, 47, 47, 0.08);
}

:root[data-theme="light"] .lyrics-font-controls .origin-link:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #000;
}

:root[data-theme="light"] .bilingual-label {
    color: #1f1f1f;
}

:root[data-theme="light"] .mobile-more-menu-content {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .mobile-more-menu-btn {
    border-color: rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.04);
}

:root[data-theme="light"] .mobile-more-menu-btn img {
    filter: none;
    opacity: 0.7;
}

:root[data-theme="light"] .mobile-more-menu-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .mobile-more-menu-btn .menu-label {
    color: rgba(0, 0, 0, 0.7);
}

/* Mobile menu sections light theme */

:root[data-theme="light"] .mobile-speed-controls {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] .menu-section-title {
    color: rgba(0, 0, 0, 0.5);
}

:root[data-theme="light"] .speed-options-mobile {
    background: rgba(0, 0, 0, 0.05);
}

:root[data-theme="light"] .speed-opt-btn {
    color: rgba(0, 0, 0, 0.6);
}

:root[data-theme="light"] .speed-opt-btn.active {
    background: rgba(0, 0, 0, 0.1);
    color: #1f1f1f;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

:root[data-theme="light"] .mobile-font-controls {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] .font-opt-btn {
    color: #1f1f1f;
    background: rgba(0, 0, 0, 0.05);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}

:root[data-theme="light"] .font-opt-btn:active {
    background: rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] .mobile-menu-close-btn {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.5);
}

:root[data-theme="light"] .mobile-menu-close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #000;
}

:root[data-theme="light"] .mobile-theme-controls {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] .lyrics-font-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.25);
}

:root[data-theme="light"] .playlist-container::-webkit-scrollbar-thumb,
:root[data-theme="light"] .lyrics-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
}

:root[data-theme="light"] #time-tooltip {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #111 !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

:root[data-theme="light"] .player-bar {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    color: #1f1f1f;
}

:root[data-theme="light"] .track-cover {
    background-color: #f5f5f5;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

:root[data-theme="light"] .image-switch-icon {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] .image-switch-icon img {
    filter: none;
}

:root[data-theme="light"] .track-name {
    color: #1f1f1f;
}

:root[data-theme="light"] .ctrl-btn img,
:root[data-theme="light"] .ctrl-btn img[src*="music-player"],
:root[data-theme="light"] .ctrl-btn img[src*="pause-button"],
:root[data-theme="light"] .ctrl-btn img[src*="volume-mute"],
:root[data-theme="light"] .ctrl-btn img[src*="player-playlist"] {
    filter: none !important;
    opacity: 0.7;
}

:root[data-theme="light"] .ctrl-btn:hover img {
    opacity: 1;
}

:root[data-theme="light"] .play-btn {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.15);
}

:root[data-theme="light"] .speed-control {
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: rgba(0,0,0,0.02);
    color: var(--text-muted);
}

:root[data-theme="light"] .speed-control:hover,
:root[data-theme="light"] .speed-control.active {
    color: #000;
    border-color: rgba(0,0,0,0.25);
}

:root[data-theme="light"] .speed-options {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

:root[data-theme="light"] .speed-options div:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #000;
}

:root[data-theme="light"] .progress-track-bg {
    background: rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .fullscreen-settings-panel {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    color: #1f1f1f;
}

:root[data-theme="light"] .settings-header,
:root[data-theme="light"] .fullscreen-settings-row {
    border-color: rgba(0,0,0,0.05) !important;
}

:root[data-theme="light"] .settings-header h3,
:root[data-theme="light"] .settings-title {
    color: #1f1f1f;
}

:root[data-theme="light"] .settings-desc {
    color: rgba(0,0,0,0.6);
}

:root[data-theme="light"] .settings-toggle {
    border: 1px solid rgba(0,0,0,0.1);
    background: rgba(0,0,0,0.05);
    color: #1f1f1f;
}

:root[data-theme="light"] .settings-toggle.off {
    color: rgba(0,0,0,0.5);
    background: rgba(0,0,0,0.03);
}

:root[data-theme="light"] .settings-toggle:hover {
    border-color: rgba(0,0,0,0.3);
}

:root[data-theme="light"] .settings-close-btn {
    color: rgba(0,0,0,0.5);
}

:root[data-theme="light"] .settings-close-btn:hover {
    background: rgba(0,0,0,0.08);
    color: #000;
}

:root[data-theme="light"] .settings-footer {
    background: rgba(0,0,0,0.02);
    border-top: 1px solid rgba(0,0,0,0.05);
}

:root[data-theme="light"] .exit-fullscreen-btn {
    background: rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.1);
    color: #1f1f1f;
}

:root[data-theme="light"] .exit-fullscreen-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}

:root[data-theme="light"] .fullscreen-settings-btn {
    background: rgba(255,255,255,0.95);
    border-color: rgba(0,0,0,0.08);
}

:root[data-theme="light"] .fullscreen-settings-btn img {
    filter: none;
}

:root[data-theme="light"] .fullscreen-control-btn {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1f1f1f;
}

:root[data-theme="light"] .fullscreen-control-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.2);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] .fullscreen-exit-btn:hover {
    background: rgba(211, 47, 47, 0.15);
    border-color: var(--accent-primary);
}

:root[data-theme="light"] .fullscreen-lyrics-overlay {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(0,0,0,0.08);
    color: #1f1f1f;
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}

:root[data-theme="light"] .fullscreen-lyrics-overlay .l-zh {
    color: rgba(0,0,0,0.55);
}

:root[data-theme="light"] .theme-option {
    border: 1px solid rgba(0,0,0,0.1);
    background: rgba(0,0,0,0.04);
    color: #1f1f1f;
}

:root[data-theme="light"] .theme-option:hover {
    border-color: rgba(0,0,0,0.25);
}

:root[data-theme="light"] .theme-option.active {
    color: #1f1f1f;
    box-shadow: 0 0 12px rgba(211,47,47,0.35);
}

:root[data-theme="light"] .settings-content .lil-gui {
    --text-color: #1f1f1f !important;
    --title-background-color: rgba(0,0,0,0.05) !important;
    --widget-color: rgba(0,0,0,0.05) !important;
    --hover-color: rgba(0,0,0,0.08) !important;
    --focus-color: rgba(0,0,0,0.15) !important;
    --background-color: transparent !important;
}

/* Effect switcher buttons light theme */

:root[data-theme="light"] .switcher-btn {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] .switcher-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.2);
}

:root[data-theme="light"] .switcher-btn img {
    filter: none;
    opacity: 0.7;
}

:root[data-theme="light"] .status-icon {
    filter: none !important;
    opacity: 0.8;
}

:root[data-theme="light"] .image-preview-wrapper {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Settings actions buttons light theme */

:root[data-theme="light"] .settings-actions {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] .effect-upload-btn {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1f1f1f;
}

:root[data-theme="light"] .effect-upload-btn img {
    filter: none;
}

:root[data-theme="light"] .effect-upload-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    border-color: var(--accent-primary);
}

:root[data-theme="light"] .effect-delete-btn {
    background: rgba(0, 0, 0, 0.05);
    color: #1f1f1f;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] .effect-delete-btn:hover {
    background: rgba(211, 47, 47, 0.1);
    border-color: rgba(211, 47, 47, 0.5);
    color: var(--accent-primary);
}

:root[data-theme="light"] .effect-delete-btn:active {
    background: rgba(211, 47, 47, 0.15);
}

/* Fullscreen state styles */

html.fullscreen-mode,
body.fullscreen-mode {
    overflow: hidden !important;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

html.fullscreen-mode::-webkit-scrollbar,
body.fullscreen-mode::-webkit-scrollbar {
    display: none !important;
}

body.fullscreen-mode .fm-nav,
body.fullscreen-mode .fm-content,
body.fullscreen-mode .player-bar {
    display: none !important;
}

body.fullscreen-mode #visualizer-canvas {
    display: block !important;
}

/* Show settings button in fullscreen */

body.fullscreen-mode .fullscreen-settings-btn {
    display: flex !important;
    animation: fadeIn 0.5s ease 0.5s forwards;
    opacity: 0;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Show settings panel when open */

.fullscreen-settings-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Loading and Empty States */

.loading-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.loading-text {
    font-size: 0.9rem;
    opacity: 0.7;
    position: relative;
}

.loading-text::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--accent-bright);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-text {
    font-size: 0.85rem;
    opacity: 0.5;
    font-style: italic;
}

.fm-tooltip {
    position: fixed;
    background: rgba(15, 15, 15, 0.95);
    color: #fff;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.4;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -35px);
    transition: opacity 0.12s ease;
    z-index: 2000;
    max-width: 320px;
    text-align: center;
    white-space: normal;
}

.fm-tooltip.show {
    opacity: 1;
}

/* Toast Notification */

.fm-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 99999;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: toastFadeIn 0.3s ease, toastFadeOut 0.3s ease 1.7s forwards;
}

@keyframes toastFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes toastFadeOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
}

/* Light theme toast */

:root[data-theme="light"] .fm-toast {
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* --- Effect Settings UI --- */

.effect-settings-ui {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 10px;
}

.settings-section-title {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.image-switcher-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

.switcher-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.switcher-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

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

.switcher-btn img {
    width: 16px;
    height: 16px;
    filter: invert(1);
    opacity: 0.8;
}

.image-preview-wrapper {
    flex: 1;
    height: 120px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.effect-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* GUI Container adjustments */

.lil-gui-container {
    padding: 0 10px;
}

/* Confirm Button */

.settings-actions {
    padding: 20px;
    display: flex;
    flex-direction: row;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 10px;
}

.effect-upload-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    padding: 0;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.effect-upload-btn img {
    width: 20px;
    height: 20px;
    filter: invert(1);
    opacity: 0.9;
}

.effect-upload-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent-bright);
    transform: translateY(-2px);
}

.effect-upload-btn:active {
    transform: translateY(0);
}

.effect-upload-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.effect-confirm-btn {
    background: var(--accent-primary);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(211, 47, 47, 0.3);
    transition: all 0.2s ease;
    flex: 1;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: 80px;
}

.effect-confirm-btn:hover {
    background: #e53935;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(211, 47, 47, 0.4);
}

.effect-confirm-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(211, 47, 47, 0.2);
}

.effect-delete-btn {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 10px 20px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: 80px;
}

.effect-delete-btn:hover {
    border-color: rgba(211, 47, 47, 0.7);
    background: rgba(211, 47, 47, 0.15);
    color: #fff;
    transform: translateY(-1px);
}

.effect-delete-btn:active {
    transform: translateY(0);
    background: rgba(211, 47, 47, 0.25);
}

.effect-delete-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    transform: none;
    box-shadow: none;
}

/* === Sidebar Toggle Button Styles === */

/* Reset button styles for .back-btn since it's now a button */

button.back-btn {
    background: none;
    border: none;
    padding: 0;
    padding-bottom: 4px; /* Keep the existing padding for underline effect */
    font-family: inherit;
    cursor: pointer;
}

/* Mobile Sidebar Button - Removed */

@media (max-width: 900px) {
    /* Removed mobile-sidebar-btn display */
}

/* === Force Mobile Top Bar Theme to Match FM Page === */

/* Dark theme (default) */

#mobile-top-bar {
    background-color: #020000 !important; /* Match FM's --bg-deep */
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

#mobile-top-bar .mobile-top-bar-title {
    color: #ffffff !important;
}

#mobile-top-bar .mobile-sidebar-btn img {
    filter: brightness(0) invert(1) !important; /* White icon */
}

/* Light theme */

:root[data-theme="light"] #mobile-top-bar {
    background-color: rgba(255, 255, 255, 0.95) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}

:root[data-theme="light"] #mobile-top-bar .mobile-top-bar-title {
    color: #1f1f1f !important;
}

:root[data-theme="light"] #mobile-top-bar .mobile-sidebar-btn img {
    filter: none !important; /* Dark icon */
}

/* Mobile Close Button for Subtitles */

.lyrics-close-btn-mobile {
    display: none;
    position: absolute;
    top: -12px;
    right: -12px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    z-index: 10;
}

:root[data-theme="light"] .lyrics-close-btn-mobile {
    background: rgba(255, 255, 255, 0.8);
    color: #000;
    border-color: rgba(0, 0, 0, 0.1);
}

@media (max-width: 900px) {
    .lyrics-close-btn-mobile {
        display: flex;
    }

    .fullscreen-lyrics-overlay {
        padding: 16px 20px; /* Adjust padding if needed */
        overflow: visible; /* Allow button to hang out */
    }

    .fullscreen-lyrics-overlay .overlay-line .l-en,
    .fullscreen-lyrics-overlay .overlay-line .l-zh {
        -webkit-line-clamp: 4; /* Increase line limit on mobile */
    }
}
