:root {
    --bg-dark: #121212;
    --card-bg: rgba(20, 20, 20, 0.85); /* Darker, more opaque for better contrast */
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --accent: #ff4444; /* Matches the Live badge */
    --backdrop-blur: 30px;
}

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

html {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    /* Use dvh for mobile browsers if supported, fallback to vh */
    min-height: 100dvh; 
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto; /* Allow scrolling on small screens */
    position: relative;
}

/* Layout Wrapper */
.app-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 20px;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* Background Art System */
.bg-art {
    position: fixed;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background-size: cover;
    background-position: center;
    filter: blur(50px) brightness(0.5);
    z-index: -2;
    transition: background-image 1s ease;
    /* Default gradient if no image */
    background-image: linear-gradient(45deg, #1a1a1a, #2c3e50);
}

.bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.9) 100%);
    z-index: -1;
    pointer-events: none;
}

/* Player Card */
.player-card {
    background: var(--card-bg);
    backdrop-filter: blur(var(--backdrop-blur));
    -webkit-backdrop-filter: blur(var(--backdrop-blur));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    margin: auto 0; /* Vertically center if there's extra space */
}

/* Header */
.station-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.station-name {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.5px;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 68, 68, 0.15);
    color: #ff4444;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.pulsating-dot {
    width: 6px;
    height: 6px;
    background-color: currentColor;
    border-radius: 50%;
    animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.9); }
}

/* Album Art */
.album-art-container {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    background-color: rgba(255,255,255,0.05); /* Placeholder color */
    position: relative;
}

.album-art {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Track Info */
.track-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.track-title {
    font-size: 1.5rem;
    line-height: 1.2;
    font-weight: 700;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limit to 2 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 1.2em; /* Prevent layout jump */
}

.track-artist {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 1.2em;
}

/* Progress Bar */
.progress-bar-container {
    width: 100%;
    margin-top: 0.5rem;
    cursor: default;
}

.progress-bar-bg { /* Added background track */
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: width 0.2s linear; /* Smoother update */
}

.time-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 8px;
    font-variant-numeric: tabular-nums; /* Monospace numbers prevent jitter */
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 0.5rem;
}

.play-btn {
    background: var(--text-primary);
    color: #000;
    border: none;
    border-radius: 50%;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(255, 255, 255, 0.3);
}

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

.play-btn svg {
    width: 36px;
    height: 36px;
    /* Optical correction for play icon center */
    margin-left: 4px; 
}
.play-btn svg.icon-pause {
    margin-left: 0;
}

/* Volume */
.volume-control {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 0 10px;
}

.volume-control svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

#volume-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    cursor: pointer;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--text-primary);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.1s;
}

#volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Footer */
.legal-footer {
    margin-top: 2rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    width: 100%;
}

.legal-footer a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted rgba(255, 255, 255, 0.4);
}

/* --- Mobile Responsiveness --- */
@media (max-width: 480px) {
    .player-card {
        padding: 1.5rem;
        border-radius: 20px;
        gap: 1rem;
    }

    .track-title {
        font-size: 1.25rem;
    }
    
    .track-artist {
        font-size: 0.9rem;
    }

    .play-btn {
        width: 64px;
        height: 64px;
    }

    .play-btn svg {
        width: 30px;
        height: 30px;
    }
}

/* Landscape Mobile / Short Screens */
@media (max-height: 700px) and (orientation: landscape) {
    .app-wrapper {
        flex-direction: row;
        gap: 20px;
        align-items: flex-start; /* scroll if needed */
        height: auto;
    }

    .player-card {
        max-width: 700px;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        text-align: left;
        padding: 1.5rem;
    }
    
    .station-header {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .album-art-container {
        width: 160px;
        flex-shrink: 0;
    }

    .track-info, .controls, .volume-control {
        flex: 1;
        min-width: 200px;
    }
    
    .controls {
        justify-content: flex-start;
    }
}