:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --text-color: #1f2937;
    --bg-color: #f9fafb;
    --console-bg: #f3f4f6;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    color-scheme: light;
}

.dark-theme {
    --primary-color: #60a5fa;
    --primary-hover: #93c5fd;
    --text-color: #d1d5db;
    --bg-color: #111827;
    --console-bg: #1f2937;
    --card-bg: #374151;
    --border-color: #4b5567;
    --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    color-scheme: dark;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    /* Add a background image to see the glass effect */
    background-image: url('https://images.unsplash.com/photo-1519681393784-d120267933ba?auto=format&fit=crop&w=1950');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    /* Keeps the background static during scroll */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    overflow: hidden;
    /* Prevent page-level scrolling - player is a full-page, single-screen app */
    transition: background-color 0.3s, color 0.3s;
}

/* iOS / Mobile Safari: background-attachment:fixed is broken on iOS — it causes the
   background to move with scroll or flash white. Fix: use scroll + a fixed pseudo-element
   that acts as the wallpaper layer behind everything. */
@media (max-width: 768px) {
    body {
        background-attachment: scroll;
    }

    body::before {
        content: '';
        position: fixed;
        inset: 0;
        z-index: -1;
        background-image: inherit;
        background-size: cover;
        background-position: center;
    }
}

/* Popout window overrides: undo the main player's overflow:hidden so the ad */
/* section below the player card is visible without clipping.                 */
body.popout-body {
    overflow-x: hidden;
    /* hide horizontal scroll */
    overflow-y: auto;
    /* allow vertical scroll if needed */
}

/* Override main-player ad-container sizing for the popout's constrained width */
body.popout-body .ad-container {
    width: 100%;
    margin: 0;
    border-radius: 0;
    margin-top: 8px;
    min-height: 50px; /* Minimum height for mobile banners (e.g. 300x50) */
}

body.popout-body .ad-placeholder {
    padding: 0;
    display: block;
    /* remove flex so the ins can fill 100% width naturally */
}

.main-content {
    /* Add a subtle overlay to ensure text is always readable */
    background-color: rgba(0, 0, 0, 0.2);
    height: 100vh;
    /* Exact viewport height - padding included via box-sizing */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Restore vertical centering */
    align-items: center;
    padding: 20px 10px;
    /* Symmetrical padding */
    overflow: auto;
    /* Allow internal scroll if content is ever taller than viewport */
}

/* Mobile specific alignment: Top-aligned */
@media (max-width: 600px) {
    .main-content {
        justify-content: flex-start;
    }
}

/* Hide scrollbar on the main content area (mobile) — keep it functional but invisible */
.main-content::-webkit-scrollbar {
    display: none;
}

.main-content {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 25px;
    /* Safe area: leave room for iOS notch/Dynamic Island on left/right */
    padding-left: max(25px, env(safe-area-inset-left));
    padding-right: max(25px, env(safe-area-inset-right));
    /* Glassmorphism effect */
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.tool-header h2 {
    font-size: 1.2rem;
    margin: 0;
    color: var(--primary-color);
    font-weight: 600;
}

.header-home-link {
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.header-home-link:hover {
    opacity: 0.8;
}

.theme-btn {
    background: var(--console-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 10px;
    /* Balanced padding for icon button */
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

/* Touch tap feedback — provides immediate visual response on mobile */
.theme-btn:active,
.console-btn:active {
    transform: scale(0.93);
    opacity: 0.85;
    transition: transform 0.08s ease, opacity 0.08s ease;
}

.radiostream-player {
    /* Glassmorphism effect */
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    border-radius: 16px;
    box-shadow: var(--card-shadow);
    padding: 25px;
    width: 90%;
    max-width: 600px;
    min-width: 0;
    margin: 0 auto;
    color: var(--text-color);
    /* This will be overridden by dark theme if active */
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    /* Changed to column to accommodate integrated ad row */
    padding: 0;
    /* Remove padding here, move it to children */
    overflow: hidden;
    /* Ensure ad row doesn't break rounded corners */
}

.player-main-body {
    display: flex;
    flex-direction: row;
    padding: 25px;
    gap: 20px;
    align-items: stretch;
    width: 100%;
    box-sizing: border-box;
}

.ad-row {
    width: 100%;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.05);
    padding: 10px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100px; /* Prevent layout shift and ensure mobile ads render */
}

.ad-row .ad-placeholder {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.player-content {
    flex: 1;
    min-width: 0;
    /* Critical for text overflow inside flex children */
    display: flex;
    flex-direction: column;
}

.dark-theme .tool-header,
.dark-theme .radiostream-player {
    background: rgba(31, 41, 55, 0.3);
    /* Darker glass for dark mode */
}

.dark-theme .radiostream-player {
    color: #e5e7eb;
    /* Use a lighter text color for better contrast on the dark glass */
}

/* Ensure the popout window shares the same background as the main page for a consistent glass effect */
/* We don't need to override anything. The default body style with the 
   background image will apply, which is what we want. */

.popout-player {
    /* Glassmorphism effect for the popout player */
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    border-radius: 8px;
    padding: 10px;
    text-align: center;
    border: 1px solid var(--border-color);
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
}

.popout-player .control-bar {
    padding: 0 5px;
    margin-top: 5px;
}

.dark-theme .popout-player {
    background: rgba(31, 41, 55, 0.3);
    /* Darker glass for dark mode */
}


.vu-meters {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 10px;
    width: 80px;
    align-items: stretch;
    position: relative;
}

/* Base VU Meter Styles */
.vu-meter {
    background: rgba(0, 0, 0, 0.15);
    /* Darker, translucent idle state for depth */
    border-radius: 8px;
    height: 100%;
    width: 30px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), 0 1px 0 rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Classic VU Style */
.vu-classic .vu-meter {
    width: 15px;
}

.vu-level {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0, 255, 0, 0.8), rgba(0, 255, 0, 1));
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
    transition: height 0.1s ease, background 0.1s ease;
}

/* LED VU Style */
.vu-led .vu-meter {
    width: 20px;
    padding: 1px;
}

.led-container {
    display: flex;
    flex-direction: column-reverse;
    gap: 1px;
    height: calc(100% - 2px);
    width: 100%;
    justify-content: flex-start;
}

.led-segment {
    width: 100%;
    flex: 1;
    min-height: 2px;
    background: #00ff00;
    border-radius: 2px;
    /* Slightly rounder segments */
    opacity: 0.05;
    /* Dimmer idle state for better contrast when lit */
    transition: opacity 0.1s ease, background 0.1s ease;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.2);
}

/* Circular VU Style */
.vu-circular .vu-meter {
    width: 35px;
    height: 100%;
    border-radius: 50%;
    /* Make it a circle */
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    color: var(--text-color);
}

.vu-meters.vu-circular {
    width: 80px;
    gap: 10px;
}

.vu-circular svg {
    width: 30px;
    height: 30px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.circular-level {
    transition: stroke-dashoffset 0.1s ease, stroke 0.1s ease;
}

/* Waveform VU Style */
.vu-waveform .vu-meter {
    width: 60px;
    background: rgba(0, 0, 0, 0.1);
    /* Subtle wash so it's not totally empty */
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.vu-waveform .vu-meters {
    width: 140px;
    gap: 20px;
}

.waveform-canvas {
    width: 100%;
    height: 100%;
    border-radius: 4px;
}

/* Spectrum VU Style */
.vu-spectrum .vu-meter {
    width: 60px;
    background: rgba(0, 0, 0, 0.1);
    padding: 2px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.vu-spectrum .vu-meters {
    width: 140px;
    gap: 20px;
}

.spectrum-container {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 100%;
    width: 100%;
    gap: 1px;
}

.spectrum-bar {
    background: #00ff00;
    width: 3px;
    min-height: 2px;
    transition: height 0.1s ease, background 0.1s ease;
    border-radius: 1px 1px 0 0;
}

/* Retro VU Style */
.vu-retro .vu-meter {
    width: 35px;
    height: 80px;
    background: radial-gradient(ellipse at center bottom, rgba(0, 0, 0, 0.2) 40%, rgba(0, 0, 0, 0.4) 100%);
    border-radius: 35px 35px 0 0;
    overflow: visible;
    position: relative;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
}

.vu-retro .vu-meters {
    width: 80px;
    gap: 10px;
}

.retro-vu {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}

.retro-scale {
    position: absolute;
    bottom: 2px;
    font-size: 4px;
    color: var(--text-color);
    opacity: 0.8;
    white-space: nowrap;
    letter-spacing: 0px;
    line-height: 1;
    transform: scale(0.8);
}

.retro-needle {
    position: absolute;
    bottom: 15px;
    left: 50%;
    width: 1px;
    height: 20px;
    border-left: 1px solid #00ff00;
    transform-origin: bottom center;
    transform: translate(-50%, 0) rotate(-45deg);
    transition: transform 0.2s ease, border-color 0.1s ease;
    z-index: 5;
}

.retro-needle::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: -1px;
    width: 3px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 50%;
}

/* Neon VU Style */
.vu-neon .vu-meter {
    width: 25px;
    background: #000;
    /* Deep black for contrast */
    border: 1px solid #333;
    box-shadow: inset 0 0 10px #000;
}

.neon-level {
    position: absolute;
    bottom: 0;
    width: 100%;
    border-radius: 4px 4px 0 0;
    transition: height 0.1s ease, background 0.1s ease, box-shadow 0.1s ease;
    /* Box shadow is set dynamically in JS */
}

.player-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.station-selector {
    display: flex;
    gap: 8px;
}

.station-selector label {
    /* The label is now hidden, but kept for accessibility.
       We use aria-label on the select element instead. */
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.station-selector select,
.setting-item select,
.settings-input {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-color);
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
    outline: none;
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.password-wrapper .settings-input {
    flex: 1;
    padding-right: 45px !important;
    /* Make room for the toggle icon */
}

.toggle-password {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-color);
    opacity: 0.5;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 2;
    border-radius: 6px;
}

.toggle-password:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.dark-theme .toggle-password:hover {
    background: rgba(0, 0, 0, 0.2);
}

.toggle-password:active {
    transform: scale(0.9);
}

.toggle-password svg {
    pointer-events: none;
    /* Clicking the svg should click the button */
}

.station-selector select,
.setting-item select,
select.settings-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='rgba(255,255,255,0.5)'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Ensure dropdown options are readable in both themes */
select option {
    background-color: var(--card-bg);
    color: var(--text-color);
}

.dark-theme .station-selector select,
.dark-theme .setting-item select {
    background-color: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.05);
}

.station-selector select:focus,
.setting-item select:focus,
.settings-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.control-bar {
    display: flex;
    align-items: center;
    /* Vertically align all items in the bar */
    gap: 10px;
    width: 100%;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-grow: 1;
    /* Allow the volume control to take up remaining space */
    min-width: 100px;
}

.volume-control label {
    /* The label is now hidden, but kept for accessibility.
       We use aria-label on the range input instead. */
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.volume-control input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    /* Make the track slimmer */
    background: transparent;
    /* Background will be set by JS */
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    /* Slightly smaller thumb */
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid var(--card-bg);
    /* Creates a "halo" effect that looks good on the glass */
    box-shadow: var(--card-shadow);
    margin-top: -6px;
    /* Center the thumb on the track */
    transition: transform 0.2s ease;
}

.volume-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid var(--card-bg);
    box-shadow: var(--card-shadow);
}

.volume-control input[type="range"]:hover::-webkit-slider-thumb {
    transform: scale(1.1);
}

.now-playing-container {
    background: var(--console-bg);
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.now-playing-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.now-playing-label {
    font-size: 0.8em;
    font-weight: 600;
    color: var(--text-color);
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-right: 10px;
}

.bitrate-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    opacity: 0.8;
    font-weight: 700;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
    white-space: nowrap;
}

.dark-theme .bitrate-badge {
    background: rgba(0, 0, 0, 0.2);
}

.bitrate-high {
    background: rgba(16, 185, 129, 0.1) !important;
    color: #10b981 !important;
    border-color: rgba(16, 185, 129, 0.2) !important;
}

.bitrate-mid {
    background: rgba(245, 158, 11, 0.1) !important;
    color: #f59e0b !important;
    border-color: rgba(245, 158, 11, 0.2) !important;
}

.bitrate-low {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #ef4444 !important;
    border-color: rgba(239, 68, 68, 0.2) !important;
}

.now-playing-track-wrapper {
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    width: 100%;
}

.now-playing-track {
    font-size: 1.2em;
    font-weight: 500;
    color: var(--primary-color);
    display: inline-block;
    transition: color 0.3s ease;
}

/* Marquee animation class applied via JS when text is too long */
.marquee-active {
    animation: marquee 15s linear infinite;
    padding-right: 50px;
    /* Space before it repeats */
}

@keyframes marquee {
    0% {
        transform: translateX(10%);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* Generic button style for standalone */
.console-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s;
}

.console-btn:hover {
    background-color: var(--primary-hover);
}

.console-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.donation-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #0070ba;
    /* PayPal Blue */
    color: white;
    text-decoration: none;
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.donation-btn:hover {
    background-color: #005ea6;
}

.donation-btn:active {
    transform: scale(0.98);
}

.console-btn .icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

#play-pause-btn {
    padding: 10px;
    /* Make the play/pause button square */
}

/* Favorite Button */
#favorite-btn {
    padding: 10px;
    background-color: var(--console-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

#favorite-btn.active {
    color: #fbbf24;
    /* Amber/Gold color */
    border-color: #fbbf24;
}

/* Adjustments for pop-out player */
.popout-player .now-playing {
    font-size: 0.9em;
    padding: 8px 10px;
    margin: 0 5px;
}

.popout-player .station-selector select {
    padding: 6px;
    font-size: 0.9rem;
}

.popout-player .console-btn {
    padding: 8px;
    /* Make buttons smaller */
}

.popout-player .volume-control {
    min-width: 80px;
    /* Ensure volume slider has some space */
}

.popout-player .volume-control input[type="range"]::-webkit-slider-thumb {
    width: 16px;
    height: 16px;
    margin-top: -5px;
    /* Re-center smaller thumb on track */
}

.popout-player .volume-control input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
}

/* ============================================
   Tablet Responsive Styles (≤ 768px)
   ============================================ */
@media (max-width: 768px) {
    .radiostream-player {
        width: 95%;
    }

    .player-main-body {
        padding: 20px;
    }

    .console-btn {
        min-width: 44px;
        min-height: 44px;
    }

    #favorite-btn {
        min-width: 44px;
        min-height: 44px;
    }

    /* Tablet: tighten ad spacing */
    .ad-row {
        padding: 5px 0;
    }
}

/* ============================================
   Mobile Responsive Styles (≤ 500px)
   ============================================ */
@media (max-width: 500px) {

    /* --- Body: allow scroll on mobile so ad below player is reachable --- */
    body {
        overflow: auto;
        /* Override the desktop overflow:hidden — on mobile the ad pushes content
           below the fold and users need to scroll to see it */
    }

    /* --- Player Card Layout --- */
    .radiostream-player {
        flex-direction: column;
        min-width: 0;
        width: 100%;
        /* Changed from width: calc(100% - 24px) to fix asymmetric margin */
        margin: 0;
        /* Remove auto-margin on mobile */
        gap: 0;
    }

    .player-main-body {
        flex-direction: column;
        padding: 16px;
        gap: 12px;
    }

    .player-content {
        gap: 10px;
    }

    .main-content {
        padding: 16px;
        /* Standardize mobile padding */
        padding-top: max(16px, env(safe-area-inset-top));
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        align-items: center;
        /* Center player card horizontally */
        /* Allow the whole page to scroll so the ad below is reachable */
        overflow: visible;
        height: auto;
        min-height: 100vh;
    }

    /* --- Header: compact + notch-aware --- */
    .tool-header {
        padding: 6px 16px;
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }

    .tool-header h2 {
        font-size: 1.0rem;
    }

    /* --- VU Meters: prominent horizontal strip on mobile --- */
    .vu-meters {
        flex-direction: row;
        width: 100%;
        justify-content: center;
        height: 64px;
        /* taller than before — more visual impact */
        gap: 8px;
    }

    /* Mobile Classic Style — wider bars for a punchy horizontal look */
    .vu-classic .vu-meter {
        flex: 1;
        height: 24px;
        width: auto;
        border-radius: 4px;
    }

    .vu-classic .vu-level {
        height: 100%;
        width: 0%;
        bottom: auto;
        left: 0;
        border-radius: 4px;
    }

    /* Mobile LED Style */
    .vu-led .vu-meter {
        flex: 1;
        width: auto;
        height: 24px;
        border-radius: 4px;
    }

    .vu-led .led-container {
        flex-direction: row;
        align-items: center;
        height: 100%;
    }

    .vu-led .led-segment {
        width: 3px;
        height: 100%;
        flex: 1;
    }

    /* Mobile Circular Style */
    .vu-meters.vu-circular {
        width: 100%;
        gap: 30px;
        justify-content: center;
    }

    .vu-circular .vu-meter {
        width: 60px;
        height: 60px;
    }

    /* Mobile Waveform Style */
    .vu-waveform .vu-meters {
        width: 100%;
        gap: 12px;
    }

    .vu-waveform .vu-meter {
        flex: 1;
        width: auto;
        height: 48px;
    }

    /* Mobile Spectrum Style */
    .vu-spectrum .vu-meters {
        width: 100%;
        gap: 12px;
    }

    .vu-spectrum .vu-meter {
        flex: 1;
        width: auto;
        height: 48px;
    }

    .vu-spectrum .spectrum-container {
        align-items: flex-end;
    }

    .vu-spectrum .spectrum-bar {
        width: 4px;
    }

    /* Mobile Retro Style */
    .vu-retro .vu-meters {
        width: 100%;
        gap: 30px;
        justify-content: center;
    }

    .vu-retro .vu-meter {
        width: 60px;
        height: 60px;
    }

    .vu-retro .retro-scale {
        font-size: 5px;
    }

    .vu-retro .retro-needle {
        height: 24px;
    }

    /* Mobile Neon Style — wide glowing horizontal bar */
    .vu-neon .vu-meter {
        flex: 1;
        width: auto;
        height: 24px;
        border-radius: 4px;
    }

    .vu-neon .neon-level {
        height: 100%;
        width: 0%;
        bottom: auto;
        left: 0;
        border-radius: 4px;
    }

    /* --- Now Playing: more prominent on mobile --- */
    .now-playing-container {
        padding: 10px 14px;
    }

    .now-playing-label {
        font-size: 0.7em;
        letter-spacing: 0.8px;
    }

    .now-playing-track {
        font-size: 1.15em;
        font-weight: 600;
    }

    /* --- Control Bar: Stacked Layout --- */
    .control-bar {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Station selector takes full width (row 1) */
    .station-selector {
        width: 100%;
        order: 1;
    }

    .station-selector select {
        font-size: 0.95rem;
        padding: 13px 10px;
    }

    /* Play button — bigger, rounder, more tappable */
    #play-pause-btn {
        order: 2;
        min-width: 52px;
        min-height: 52px;
        padding: 14px;
        border-radius: 50%;
    }

    /* Volume slider expands to fill remaining space (row 2) */
    .volume-control {
        order: 3;
        flex-grow: 1;
        min-width: 0;
    }

    .volume-control input[type="range"] {
        height: 8px;
    }

    .volume-control input[type="range"]::-webkit-slider-thumb {
        width: 26px;
        height: 26px;
        margin-top: -9px;
    }

    .volume-control input[type="range"]::-moz-range-thumb {
        width: 26px;
        height: 26px;
    }

    /* Favorite button: larger touch target */
    #favorite-btn {
        min-width: 52px;
        min-height: 52px;
        padding: 13px;
    }

    /* Hide popout button — not useful on mobile browsers */
    #popout-btn {
        display: none;
    }

    /* All icon buttons: enforce minimum touch target */
    .console-btn {
        min-width: 48px;
        min-height: 48px;
    }

    /* --- Ad Container: tighter on mobile --- */
    .ad-container {
        margin-top: 12px;
        width: 100%;
        /* Match standardized player card width */
        border-radius: 12px;
    }

    .ad-placeholder {
        padding: 10px;
        min-height: 60px;
    }

    /* --- Settings Modal: Bottom Sheet --- */
    .settings-modal {
        align-items: flex-end;
    }

    .settings-content {
        width: 100%;
        max-width: 100%;
        max-height: 85vh;
        border-radius: 20px 20px 0 0;
        padding: 16px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
        animation: slideUp 0.3s ease-out;
    }

    /* Settings tabs: larger tap targets */
    .settings-tab-btn {
        padding: 10px 12px;
        font-size: 0.9rem;
        flex: 1;
        text-align: center;
    }

    .settings-tabs {
        gap: 2px;
    }

    /* Directory search: stack vertically */
    .directory-search-container {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .directory-search-container #rb-search-by {
        flex: none !important;
        width: 100%;
    }

    .directory-search-container #rb-search-input {
        width: 100%;
    }

    .directory-search-container #rb-search-btn {
        width: 100%;
        padding: 10px 15px;
    }

    /* Background presets: 2-column grid */
}

/* Bottom sheet slide-up animation for mobile settings */
@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Dark theme adjustments for VU meters */
.dark-theme .waveform-canvas {
    filter: brightness(1.2);
}

.dark-theme .retro-vu {
    background: radial-gradient(circle, var(--console-bg) 60%, var(--border-color) 100%);
}

.dark-theme .led-segment {
    box-shadow: 0 0 2px currentColor;
}

.dark-theme .spectrum-bar {
    box-shadow: 0 0 1px currentColor;
}

/* Animation enhancements */
.vu-meter {
    transition: all 0.3s ease;
}

@keyframes pulse {
    0% {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }

    50% {
        box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
    }

    100% {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
}

/* Hover effects */
.vu-circular svg:hover .circular-level {
    stroke-width: 10;
}

.vu-retro .retro-vu:hover .retro-needle::after {
    box-shadow: 0 0 4px var(--primary-color);
}

/* Accessibility: Focus States */

/* Add a visible outline for keyboard users */
.console-btn:focus-visible,
.theme-btn:focus-visible,
.station-selector select:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* For range inputs, it's better to style the thumb */
.volume-control input[type="range"]:focus-visible::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px var(--bg-color), 0 0 0 5px var(--primary-color);
}

.volume-control input[type="range"]:focus-visible::-moz-range-thumb {
    box-shadow: 0 0 0 3px var(--bg-color), 0 0 0 5px var(--primary-color);
}

/* Settings Modal */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.settings-content {
    background: rgba(255, 255, 255, 0.85);
    /* Increased opacity for light mode contrast */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: #111827;
    /* Darker text for light mode */
    padding: 0;
    border-radius: 16px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.4);
    max-height: 90vh;
    min-height: 520px;
    /* Fixed minimum height to prevent layout jumps between tabs */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dark-theme .settings-content {
    background: rgba(17, 24, 39, 0.6);
    /* Slightly more opaque for dark mode too */
    color: #e5e7eb;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.dark-theme .settings-header {
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.settings-body {
    overflow-y: auto;
    flex-grow: 1;
    padding: 24px;
    /* Smooth transition for content changes in the future */
    scroll-behavior: smooth;
}

.settings-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-color);
    cursor: pointer;
    padding: 0 5px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.setting-item label {
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0.9;
    color: var(--text-color);
    margin-bottom: 2px;
}

.settings-input {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.5);
    color: #111827;
    box-sizing: border-box;
    font-family: inherit;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.settings-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.dark-theme .settings-input {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.05);
    color: #e5e7eb;
}

.setting-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.setting-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Custom Stations List */
.custom-stations-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 15px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.station-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s ease;
}

.station-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.station-item:last-child {
    border-bottom: none;
}

.station-name {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
}

.station-actions {
    display: flex;
    gap: 5px;
    align-items: center;
}

.edit-btn,
.delete-btn {
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
}

.edit-btn {
    background: var(--primary-color);
    color: white;
    font-size: 0.9rem;
}

.edit-btn:hover {
    background: var(--primary-hover);
}

.delete-btn {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    line-height: 1;
    flex-shrink: 0;
}

.delete-btn:hover {
    background: #dc2626;
}

.no-stations {
    padding: 10px;
    text-align: center;
    color: var(--text-color);
    opacity: 0.7;
    font-size: 0.9rem;
}

.settings-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.settings-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Background Presets */
.bg-presets-label {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--text-color);
    font-weight: 500;
}

.bg-preset-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.bg-preset-btn {
    aspect-ratio: 16/9;
    border-radius: 8px;
    border: 2px solid transparent;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    position: relative;
    overflow: hidden;
}

.bg-preset-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.bg-preset-btn.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(18, 18, 18, 0.5), 0 0 0 4px var(--primary-color);
}

.bg-preset-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity 0.3s;
}

.bg-preset-btn:hover::after {
    opacity: 1;
}

@media (max-width: 500px) {
    .bg-preset-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Settings Tabs */
.settings-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border-color);
    padding: 0 10px;
    overflow-x: auto;
    /* Handle many tabs on small screens */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
    background: rgba(0, 0, 0, 0.02);
}

.settings-tabs::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.settings-tab-btn {
    background: transparent;
    border: none;
    color: #111827;
    opacity: 0.6;
    padding: 14px 16px;
    margin-bottom: -1px;
    /* Align border with tab bar bottom */
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
    flex: 0 0 auto;
    /* Don't stretch, allow scroll */
    font-weight: 500;
    white-space: nowrap;
}

.dark-theme .settings-tab-btn {
    color: #e5e7eb;
}

.settings-tab-btn:hover {
    opacity: 1;
    color: var(--primary-color);
}

.settings-tab-btn.active {
    opacity: 1;
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Profile Message styling */
.profile-msg {
    margin-bottom: 15px;
    font-size: 0.9em;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    animation: slideIn 0.3s ease-out;
}

.profile-msg.success {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.profile-msg.error {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

@keyframes slideIn {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.settings-tab-content {
    /* Animation for smooth tab switching */
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Directory Search UI */
.directory-search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.rb-results-container {
    max-height: 350px;
    overflow-y: auto;
    border-radius: 12px;
    padding: 5px;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Custom Scrollbar for premium feel */
.settings-body::-webkit-scrollbar,
.custom-stations-list::-webkit-scrollbar,
.rb-results-container::-webkit-scrollbar {
    width: 6px;
}

.settings-body::-webkit-scrollbar-track,
.custom-stations-list::-webkit-scrollbar-track,
.rb-results-container::-webkit-scrollbar-track {
    background: transparent;
}

.settings-body::-webkit-scrollbar-thumb,
.custom-stations-list::-webkit-scrollbar-thumb,
.rb-results-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.settings-body::-webkit-scrollbar-thumb:hover,
.custom-stations-list::-webkit-scrollbar-thumb:hover,
.rb-results-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.rb-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: all 0.2s ease;
}

.rb-result-item:last-child {
    border-bottom: none;
}

.rb-result-item:hover {
    background-color: var(--console-bg);
}

.rb-result-info {
    flex-grow: 1;
    min-width: 0;
    /* allows truncation */
    margin-right: 15px;
}

.rb-result-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rb-result-meta {
    font-size: 0.8rem;
    color: var(--text-color);
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rb-add-btn {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.rb-add-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* Ad Container Styling */
.ad-container {
    margin-top: 30px;
    width: 90%;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    /* Glassmorphism effect */
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    transition: all 0.3s ease;
}

.dark-theme .ad-container {
    background: rgba(31, 41, 55, 0.25);
}

.ad-placeholder {
    padding: 15px;
    text-align: center;
    position: relative;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.ad-placeholder p {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.5;
    margin: 0 0 10px 0;
    font-weight: 600;
}

/* Radio Logo Component */
.radio-logo {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 2;
    filter: drop-shadow(0 0 5px rgba(59, 130, 246, 0.2));
    transition: stroke 0.3s ease, filter 0.2s ease, transform 0.1s linear;
}

.radio-logo__body {
    fill: var(--primary-color);
    fill-opacity: 0.15;
    transition: fill-opacity 0.5s ease;
}

.radio-logo__speaker-inner {
    fill: var(--primary-color);
    transition: transform 0.3s ease;
}

/* Playing State: Enhanced Visuals */
.radio-logo--is-playing {
    /* Base glow + Dynamic expansion based on audio level */
    filter: drop-shadow(0 0 calc(6px + (var(--logo-reactivity, 0) * 14px)) var(--primary-glow-color, rgba(59, 130, 246, 0.6)));
    
    /* Increased scale factor (up to 1.15x) */
    transform: scale(calc(1 + (var(--logo-reactivity, 0) * 0.15)));
    
    /* Dynamic peak color */
    stroke: var(--logo-peak-color, var(--primary-color));
    
    animation: pulse-premium 3s infinite ease-in-out;
    transform-origin: center;
}

.radio-logo--is-playing .radio-logo__body {
    fill-opacity: calc(0.2 + (var(--logo-reactivity, 0) * 0.3));
    fill: var(--logo-peak-color, var(--primary-color));
}

.radio-logo--is-playing .radio-logo__speaker {
    transform-origin: center;
}

.radio-logo--is-playing .radio-logo__speaker-inner {
    fill: var(--primary-hover, #2563eb);
}

@keyframes pulse-premium {
    0%, 100% { opacity: 0.9; }
    50% { opacity: 1; }
}


/* Hide ads on very small screens where they would break layout */
@media (max-width: 350px) {
    .ad-container {
        display: none !important;
    }
}

/* ============================================
   Mobile-first scrollbar utility
   Already hidden on .main-content above;
   also suppress on the body on mobile
   ============================================ */


.desktop-only {
    display: flex !important;
}

.mobile-only {
    display: none !important;
}

@media (max-width: 600px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: flex !important;
    }

    /* Optimize header for mobile */
    .tool-header h2 {
        font-size: 1.1rem;
    }
}

/* Mobile Nav Overlay */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-nav-overlay.active {
    display: flex;
    opacity: 1;
}

/* Mobile Nav Bottom Sheet */
.mobile-nav-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 24px 24px 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 2001;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
}

.dark-theme .mobile-nav-sheet {
    background: rgba(17, 24, 39, 0.8);
}

.mobile-nav-sheet.active {
    transform: translateY(0);
}

.mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mobile-nav-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--primary-color);
    font-weight: 600;
}

.mobile-nav-body {
    padding: 12px 0;
    display: flex;
    flex-direction: column;
    max-height: 70vh;
    overflow-y: auto;
}

.mobile-nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.05rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease;
    width: 100%;
    font-family: inherit;
    text-decoration: none;
}

.mobile-nav-item:active {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-nav-item svg {
    opacity: 0.8;
    color: var(--primary-color);
}

#mobile-auth-group {
    display: flex;
    flex-direction: column;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 8px;
    padding-top: 8px;
}

/* ============================================
   FULLSCREEN / IMMERSIVE MODE — PREMIUM v2.3
   ============================================ */

/* Fullscreen trigger: subtle icon to right of bitrate badge in normal player */
.fs-trigger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: var(--text-secondary, rgba(255,255,255,0.35));
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
    padding: 3px;
    flex-shrink: 0;
}

.fs-trigger-btn:hover {
    color: var(--accent, #3b82f6);
    background: rgba(59, 130, 246, 0.1);
    border-radius: 4px;
}

/* Hide during fullscreen (exit btn takes over) */
.fullscreen-mode .fs-trigger-btn {
    display: none !important;
}

/* Exit button — pinned top right, circular glass */
#exit-fullscreen-btn {
    display: none;
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: rgba(255, 255, 255, 0.7);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}

#exit-fullscreen-btn:hover {
    background: rgba(239, 68, 68, 0.4);
    border-color: rgba(239, 68, 68, 0.6);
    color: #fff;
    transform: scale(1.1);
}

/* Show the button only in fullscreen */
.fullscreen-mode #exit-fullscreen-btn {
    display: flex !important;
}

/* === Player Container === */
.radiostream-player.fullscreen-mode {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    z-index: 4000;
    /* Deep blue-black gradient background for ambiance */
    background: radial-gradient(ellipse at 50% 10%, #0d1f3c 0%, #060d1a 50%, #000 100%) !important;
    overflow: hidden;
}

/* Ambient animated glow layer behind the VU meters */
.radiostream-player.fullscreen-mode::before {
    content: '';
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 60vw;
    height: 50vh;
    background: radial-gradient(ellipse, rgba(59, 130, 246, 0.12) 0%, transparent 70%);
    pointer-events: none;
    animation: fs-ambient-pulse 4s ease-in-out infinite;
    z-index: 0;
}

@keyframes fs-ambient-pulse {
    0%, 100% { opacity: 0.6; transform: translateX(-50%) scale(1); }
    50%       { opacity: 1;   transform: translateX(-50%) scale(1.1); }
}

/* === Hide unwanted elements === */
.radiostream-player.fullscreen-mode .player-header,
.radiostream-player.fullscreen-mode .station-sidebar,
.radiostream-player.fullscreen-mode .station-selector,
.radiostream-player.fullscreen-mode #popout-btn,
.radiostream-player.fullscreen-mode #bitrate-badge,
.radiostream-player.fullscreen-mode .now-playing-header .bitrate-badge {
    display: none !important;
}

/* === Main content layout: full height flex column === */
.radiostream-player.fullscreen-mode .main-content {
    position: relative;
    z-index: 1;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    height: 100vh !important;
    width: 100% !important;
    border: none !important;
    background: transparent !important;
    overflow: hidden;
    padding: 0 !important;
}

/* === Player body: positioning context === */
.radiostream-player.fullscreen-mode .player-main-body {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    flex: 1 !important;
    padding: 0 !important;
}

/* === Player content (inner): centered in the space above VU meters === */
.radiostream-player.fullscreen-mode .player-content {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important; /* Center content vertically in the allocated height */
    height: 33.2vh !important; /* Position centered in the top space (above VU meters at 33.2vh) */
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    z-index: 10;
}

/* === Now Playing text — centered in the space above VU meters === */
.radiostream-player.fullscreen-mode .now-playing-container {
    width: 100% !important;
    max-width: 85vw !important;
    text-align: center !important;
    background: none !important;
    border: none !important;
    padding: 0 20px !important; /* Removed top padding to allow true centering */
    margin: 0 auto !important;
}

/* Center the now-playing-header row in fullscreen (overrides flex row) */
.radiostream-player.fullscreen-mode .now-playing-header {
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
}

.radiostream-player.fullscreen-mode #now-playing-station {
    font-size: clamp(1.8rem, 4vw, 3.5rem) !important;
    font-weight: 800 !important;
    letter-spacing: -0.5px !important;
    color: #ffffff !important;
    text-shadow: 0 0 40px rgba(59, 130, 246, 0.6), 0 2px 8px rgba(0,0,0,0.8) !important;
    line-height: 1.2 !important;
    margin-bottom: 8px !important;
}

.radiostream-player.fullscreen-mode #now-playing-track {
    font-size: clamp(0.9rem, 1.8vw, 1.3rem) !important;
    font-weight: 400 !important;
    color: rgba(147, 197, 253, 0.85) !important;
    text-shadow: none !important;
    letter-spacing: 0.5px !important;
}

/* === VU Meters — HERO: absolutely centered on screen === */
.radiostream-player.fullscreen-mode .vu-meters {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -40%) !important; /* slightly above true center */
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-end !important;
    justify-content: center !important;
    gap: 24px !important;
    width: 50vw !important;
    max-width: 480px !important;
    min-width: 200px !important;
    height: 42vh !important;
    min-height: 220px !important;
    padding: 0 !important;
    margin: 0 !important;
    flex: none !important;
    z-index: 5;
}

.radiostream-player.fullscreen-mode .vu-meter {
    flex: 1 !important;
    max-width: 80px !important;
    height: 100% !important;
    display: flex !important;
    align-items: flex-end !important;
}

/* Classic and Neon level bars fill the full height */
.radiostream-player.fullscreen-mode .vu-level,
.radiostream-player.fullscreen-mode .neon-level {
    width: 100% !important;
    min-width: 40px !important;
    border-radius: 4px 4px 0 0 !important;
    transition: height 0.05s linear, background 0.1s ease !important;
}

/* LED: make segments taller */
.radiostream-player.fullscreen-mode .led-container {
    height: 100% !important;
    flex-direction: column-reverse !important;
    gap: 3px !important;
}

.radiostream-player.fullscreen-mode .led-segment {
    height: 100% !important;
    flex: 1 !important;
    border-radius: 2px !important;
}

/* Spectrum bars */
.radiostream-player.fullscreen-mode .spectrum-container {
    height: 100% !important;
    align-items: flex-end !important;
    gap: 4px !important;
}

.radiostream-player.fullscreen-mode .spectrum-bar {
    flex: 1 !important;
    min-width: 10px !important;
    border-radius: 3px 3px 0 0 !important;
}

/* Retro and Circular: scale them up */
.radiostream-player.fullscreen-mode .vu-meters.vu-retro .retro-vu {
    transform: scale(1.6) !important;
    transform-origin: bottom center !important;
}

.radiostream-player.fullscreen-mode .vu-meters.vu-circular svg {
    width: 120px !important;
    height: 120px !important;
}

/* Waveform canvas size */
.radiostream-player.fullscreen-mode .waveform-canvas {
    width: 100% !important;
    height: 100% !important;
}

/* === Control Dock — frosted glass pill, pinned to bottom === */
.radiostream-player.fullscreen-mode .control-bar {
    position: fixed !important;
    bottom: 32px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: auto !important;
    min-width: 280px !important;
    max-width: 520px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 16px !important;
    padding: 14px 32px !important;
    background: rgba(15, 23, 42, 0.6) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 60px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(59, 130, 246, 0.1) !important;
    opacity: 0.25;
    transition: opacity 0.4s ease, box-shadow 0.4s ease !important;
    z-index: 200 !important;
}

.radiostream-player.fullscreen-mode .control-bar:hover {
    opacity: 1 !important;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(59, 130, 246, 0.35) !important;
}

/* Volume slider width constrained inside the dock */
.radiostream-player.fullscreen-mode .volume-control {
    width: 120px !important;
}

/* === Ad — pinned just above control dock, no cropping === */
.radiostream-player.fullscreen-mode .ad-row {
    position: fixed !important;
    bottom: 110px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    max-width: 420px !important;
    width: auto !important;       /* Let ad content define width */
    min-width: 280px !important;
    padding: 0 !important;        /* Let the ad tag control its own padding */
    background: rgba(0, 0, 0, 0.45) !important;
    backdrop-filter: blur(10px) !important;
    border-radius: 10px !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    overflow: visible !important;  /* Never crop the ad */
    z-index: 150 !important;
}


/* --- Premium UI: Song History & Ad-Replacement --- */
.history-row {
    margin-top: 15px;
    width: 100%;
    max-width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
    display: none; /* Controlled by index.php for Premium status */
    animation: fadeIn 0.4s ease-out;
}

.history-hidden {
    display: none !important;
}

.history-container {
    padding: 15px;
    min-height: 80px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.history-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary-color);
    opacity: 0.9;
}

.history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    transition: background 0.3s ease;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.history-time {
    font-size: 0.7rem;
    opacity: 0.5;
    font-family: monospace;
    white-space: nowrap;
}

.history-track-info {
    flex: 1;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* --- Premium Monetization UI (Info Modal) --- */
.premium-benefits-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.benefit-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    opacity: 0.85;
}

.benefit-item span {
    font-size: 0.9rem;
}

.pricing-cards {
    margin: 25px 0;
}

.pricing-card {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    transition: transform 0.3s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.pricing-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.08);
}

.card-tag {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    opacity: 0.6;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--primary-color);
}

.card-price {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 5px;
}

.card-price span {
    font-size: 0.8rem;
    opacity: 0.6;
    font-weight: 400;
}

.card-desc {
    font-size: 0.75rem;
    opacity: 0.7;
    line-height: 1.2;
}

.premium-cta-btn {
    display: block;
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 700;
    margin-top: 15px;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
}

.premium-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
    filter: brightness(1.1);
}

.premium-badge-large {
    margin-bottom: 20px;
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.3));
    animation: pulseGold 2s infinite ease-in-out;
}

@keyframes pulseGold {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.social-mini-btn {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.social-mini-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-color);
}

.donation-btn-small {
    display: block;
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.donation-btn-small:hover {
    background: rgba(255, 255, 255, 0.08);
    opacity: 0.9;
}
