:root {
    --bg: #f9f9f9;
    --text: #1a1a1a;
    --text-muted: #888;
    --card: rgba(255, 255, 255, 0.6);
    --border: rgba(224, 224, 224, 0.5);
    --accent: #111;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0a0a0a;
        --text: #ffffff;
        --text-muted: #999;
        --card: rgba(21, 21, 21, 0.6);
        --border: rgba(50, 50, 50, 0.5);
        --accent: #f0f0f0;
        --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error {
    color: #d32f2f;
    margin-top: 1rem;
    font-size: 0.85rem;
}

/* PLAYER UI */
.player-container {
    width: 100%;
    max-width: 450px;
    width: 100%;
    padding: 1rem;
    margin: 0 auto;
}

.card {
    background: var(--card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.player-top {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

#cover-art {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    object-fit: cover;
    background-color: var(--border);
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.track-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#track-title {
    font-size: 1.15rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.2rem;
}

#track-artist {
    font-size: 0.95rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.album-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.7;
    margin-top: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.progress-section {
    width: 100%;
}

.progress-bar-bg {
    height: 6px;
    background-color: var(--border);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--accent);
    width: 100%;
    transform: scaleX(0); /* updated via JS */
    transform-origin: left;
    border-radius: 3px;
    will-change: transform;
}

/* Fallback indeterminate animation when duration is 0 but playing */
.indeterminate {
    transform: scaleX(0.3) !important;
    animation: indeterminate-slide 2s infinite ease-in-out;
}

@keyframes indeterminate-slide {
    0% { transform: translateX(-100%) scaleX(0.3); }
    50% { transform: translateX(333%) scaleX(0.3); }
    100% { transform: translateX(-100%) scaleX(0.3); }
}

.time-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.6rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Playing Status Icon */
.status-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex-shrink: 0;
}

.status-icon.playing .bar {
    width: 3px;
    background: var(--text);
    border-radius: 2px;
    animation: sound-bars 1s ease-in-out infinite alternate;
}
.status-icon.playing .bar:nth-child(1) { height: 18px; animation-delay: -0.2s; }
.status-icon.playing .bar:nth-child(2) { height: 12px; animation-delay: -0.4s; }
.status-icon.playing .bar:nth-child(3) { height: 16px; animation-delay: -0.6s; }

/* Paused bars */
.status-icon.paused .bar {
    width: 4px;
    height: 16px;
    background: var(--text-muted);
    border-radius: 2px;
}

@keyframes sound-bars {
    0% { height: 4px; }
    100% { height: 20px; }
}
