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

/* ── Design tokens — match Player2 ─────────────────────────────────── */
:root {
    color-scheme: dark;
    --bg: #000000;
    --surface: rgba(255,255,255,0.08);
    --surface-h: rgba(255,255,255,0.08);
    --border: rgba(255,255,255,0.10);
    --border-h: rgba(255,255,255,0.22);
    /* Accent = Player2's navy (--theme-blue #000080) family. Fills use the same
       diagonal button gradient Player2 uses everywhere; anything that has to
       read as a line, a dot or accented text on black uses --accent-line
       (Player2 --accent-border-strong) or --accent-text (Player2 --vc-text-link),
       because navy-on-black is invisible. */
    --accent: #000080;
    --accent2: #0000a0;
    --accent-glow: rgba(0,0,128,0.5);
    --accent-line: rgba(255,255,255,0.40);
    --accent-edge: rgba(255,255,255,0.25);
    --accent-text: #aaccff;
    --btn-grad: linear-gradient(135deg, #00002a 0%, #000050 20%, #000066 40%, #000080 60%, #000066 80%, #00002a 100%);
    --btn-grad-hover: linear-gradient(135deg, #000050 0%, #000066 25%, #000090 50%, #000080 75%, #000050 100%);
    --text: #e0e0e0;
    --text-head: #ffffff;
    --muted: rgba(255,255,255,0.45);
    --fav: #e04444;
    --scrollbar: rgba(255,255,255,0.15);
    --header-h: 58px;
    --tabs-h: 40px;
    --tags-h: 46px;
}

html {
    background: #000;
}

/* Light mode is the same day sky Player2 paints. This page is framed, so
   the parent canvas stops at the frame edge and the sky has to be repeated
   here -- the same reason dark mode repeats the starfield rather than
   relying on transparency. Keep in step with --sky-wash in player.css. */
html[data-theme="light"] {
    --sky-wash: linear-gradient(180deg, #d9e4ef 0%, #e6edf5 30%, #f5f7fa 58%, #eef0f3 80%, #e8eaee 100%);
    --cloud-far:
        radial-gradient(7.5% 9.5% at 31% 24%, rgba(255,255,255,0.90) 0%, rgba(255,255,255,0.60) 45%, rgba(255,255,255,0) 78%),
        radial-gradient(6.5% 8.5% at 36% 22.5%, rgba(255,255,255,0.90) 0%, rgba(255,255,255,0.60) 45%, rgba(255,255,255,0) 78%),
        radial-gradient(4% 5.5% at 39.5% 25.5%, rgba(255,255,255,0.88) 0%, rgba(255,255,255,0.58) 45%, rgba(255,255,255,0) 78%),
        radial-gradient(10% 5.5% at 34.5% 27%, rgba(255,255,255,0.88) 0%, rgba(255,255,255,0.58) 45%, rgba(255,255,255,0) 80%),
        radial-gradient(6.5% 8.5% at 72% 57%, rgba(255,255,255,0.88) 0%, rgba(255,255,255,0.58) 45%, rgba(255,255,255,0) 78%),
        radial-gradient(5.5% 7% at 76.5% 55.5%, rgba(255,255,255,0.88) 0%, rgba(255,255,255,0.58) 45%, rgba(255,255,255,0) 78%),
        radial-gradient(9% 5% at 74.5% 59.5%, rgba(255,255,255,0.86) 0%, rgba(255,255,255,0.56) 45%, rgba(255,255,255,0) 80%),
        radial-gradient(5.5% 7.5% at 10% 76%, rgba(255,255,255,0.86) 0%, rgba(255,255,255,0.56) 45%, rgba(255,255,255,0) 78%),
        radial-gradient(4.5% 6% at 14% 75%, rgba(255,255,255,0.86) 0%, rgba(255,255,255,0.56) 45%, rgba(255,255,255,0) 78%),
        radial-gradient(8% 4.5% at 12% 78.5%, rgba(255,255,255,0.84) 0%, rgba(255,255,255,0.55) 45%, rgba(255,255,255,0) 80%),
        radial-gradient(11.5% 5.5% at 34.5% 28.5%, rgba(150,168,190,0.28) 0%, rgba(150,168,190,0.12) 50%, rgba(150,168,190,0) 82%),
        radial-gradient(10% 5% at 74.5% 61%, rgba(150,168,190,0.26) 0%, rgba(150,168,190,0.11) 50%, rgba(150,168,190,0) 82%),
        radial-gradient(9% 4.5% at 12% 80%, rgba(150,168,190,0.24) 0%, rgba(150,168,190,0.10) 50%, rgba(150,168,190,0) 82%);
    --cloud-near:
        radial-gradient(6.6% 9.1% at 14% 17%, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.66) 45%, rgba(255,255,255,0) 78%),
        radial-gradient(7.3% 9.9% at 19.3% 15.5%, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.66) 45%, rgba(255,255,255,0) 78%),
        radial-gradient(4.4% 6.1% at 23.7% 18.5%, rgba(255,255,255,0.93) 0%, rgba(255,255,255,0.64) 45%, rgba(255,255,255,0) 78%),
        radial-gradient(11% 6.1% at 17.6% 20.2%, rgba(255,255,255,0.92) 0%, rgba(255,255,255,0.64) 45%, rgba(255,255,255,0) 80%),
        radial-gradient(5.9% 8.4% at 56% 47%, rgba(255,255,255,0.93) 0%, rgba(255,255,255,0.65) 45%, rgba(255,255,255,0) 78%),
        radial-gradient(6.6% 9.1% at 61% 45.5%, rgba(255,255,255,0.93) 0%, rgba(255,255,255,0.65) 45%, rgba(255,255,255,0) 78%),
        radial-gradient(3.7% 5.3% at 64.7% 48.4%, rgba(255,255,255,0.91) 0%, rgba(255,255,255,0.63) 45%, rgba(255,255,255,0) 78%),
        radial-gradient(9.5% 5.3% at 59.5% 50%, rgba(255,255,255,0.90) 0%, rgba(255,255,255,0.63) 45%, rgba(255,255,255,0) 80%),
        radial-gradient(6.6% 9.1% at 83% 76%, rgba(255,255,255,0.94) 0%, rgba(255,255,255,0.66) 45%, rgba(255,255,255,0) 78%),
        radial-gradient(7.3% 9.9% at 88.3% 74.5%, rgba(255,255,255,0.94) 0%, rgba(255,255,255,0.66) 45%, rgba(255,255,255,0) 78%),
        radial-gradient(4.4% 6.1% at 92% 77.5%, rgba(255,255,255,0.92) 0%, rgba(255,255,255,0.64) 45%, rgba(255,255,255,0) 78%),
        radial-gradient(11% 6.1% at 86.6% 79.2%, rgba(255,255,255,0.91) 0%, rgba(255,255,255,0.64) 45%, rgba(255,255,255,0) 80%),
        radial-gradient(13.2% 6.1% at 17.6% 21.7%, rgba(150,168,190,0.40) 0%, rgba(150,168,190,0.18) 50%, rgba(150,168,190,0) 82%),
        radial-gradient(11.7% 5.3% at 59.5% 51.4%, rgba(150,168,190,0.35) 0%, rgba(150,168,190,0.15) 50%, rgba(150,168,190,0) 82%),
        radial-gradient(12% 6.1% at 85% 80.7%, rgba(150,168,190,0.38) 0%, rgba(150,168,190,0.17) 50%, rgba(150,168,190,0) 82%);
    background-color: #e8eaee;
    background-image: var(--sky-wash);
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-size: auto;
}

body {
    background: #000; /* ensures canvas is black even when html overflow:hidden shifts propagation */
}

html[data-theme="light"] body {
    background: transparent;
}

/* ── Light mode tokens ────────────────────────────────────────────────── */
html[data-theme="light"] {
    color-scheme: light;
    --text: #1a1a2e;
    --text-head: #0d0d1a;
    --muted: rgba(20,20,50,0.55);
    --surface: rgba(255,255,255,0.55);
    --surface-h: rgba(255,255,255,0.80);
    --border: rgba(0,0,0,0.14);
    --border-h: rgba(0,0,0,0.28);
    --accent-text: #0044bb;
    --scrollbar: rgba(0,0,0,0.18);
    --fav: #cc2222;
}

html, body {
    height: 100%;
    color: var(--text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden; /* each .view manages its own scroll */
}

/* ── Sky motion: two-speed parallax ──────────────────── */
/* Drift is driven by transform on an oversized strip, not by
   background-position, so the browser composites it instead of repainting a
   full-viewport layer every frame. Each strip is exactly one tile wider than
   the viewport and travels exactly one tile, which is what makes the loop
   seamless: change a background-size and you MUST change the matching
   keyframe and the matching negative inset by the same pixels.
   Two layers at very different speeds is the point. One sheet at a constant
   speed reads as a printed backdrop on rails. Same layers, tiles and timings
   as the block of the same name in Player2/css/player.css. Keep them in step. */
.ns-stars::before,
.ns-twinkling::before,
.ns-clouds::before,
.ns-clouds::after {
    content: '';
    position: absolute;
    background-repeat: repeat;
    pointer-events: none;
    will-change: transform;
}

.ns-stars,
.ns-twinkling,
.ns-sky,
.ns-clouds {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* clip the oversized strips */
    pointer-events: none;
}

/* Dark: the 0.34 black veil stays on the element so it covers the whole
   viewport; only the 2000px star tile moves, and barely. Far layer. */
.ns-stars {
    background: rgba(0,0,0,.34);
    z-index: -2;
}

.ns-stars::before {
    inset: 0 -2000px 0 0;
    background-image: url('../../images/nightsky/stars.png');
    background-size: 2000px 1375px;
    animation: ns-drift-stars 880s linear infinite;
}

@keyframes ns-drift-stars {
    from { transform: translate3d(0,0,0); }
    to   { transform: translate3d(-2000px,0,0); }
}

/* Near layer. Same diagonal and the same 50px/s as the old
   background-position keyframe (-10000px/5000px over 200s), restated as one
   100px tile every 2s so it can composite. */
.ns-twinkling {
    background: transparent;
    z-index: -1;
}

.ns-twinkling::before {
    inset: -100px -100px -100px -100px;
    background-image: url('../../images/nightsky/twinkling.png');
    background-size: 100px 100px;
    animation: ns-drift-twink 2s linear infinite;
}

@keyframes ns-drift-twink {
    from { transform: translate3d(0,0,0); }
    to   { transform: translate3d(-100px,50px,0); }
}

html[data-theme="light"] .ns-stars,
html[data-theme="light"] .ns-twinkling {
    display: none;
}

/* ── Day sky (light theme) ── */
/* .ns-sky is never used: the wash goes on the html canvas so transparent
   elements pick it up without a backdrop-filter. The clouds cannot live
   there too, because a canvas background is not composited and so could
   only ever hold still. */
.ns-sky {
    display: none;
}

.ns-clouds {
    display: none;
    z-index: -2;
}

html[data-theme="light"] .ns-clouds {
    display: block;
    background: transparent;
}

/* Far: small, faint, ~2.3px/s -- about the drift rate of the star field, so
   the two themes read as the same sky at different hours. */
html[data-theme="light"] .ns-clouds::before {
    inset: 0 -900px 0 0;
    background-image: var(--cloud-far);
    background-size: 900px 620px;
    opacity: 0.50;
    animation: ns-drift-far 400s linear infinite;
}

/* Near: large, bright, ~9px/s. Four times the far layer, which is about the
   most separation you can use before the near layer looks driven. */
html[data-theme="light"] .ns-clouds::after {
    inset: 0 -1500px 0 0;
    background-image: var(--cloud-near);
    background-size: 1500px 900px;
    opacity: 0.95;
    animation: ns-drift-near 167s linear infinite;
}

@keyframes ns-drift-far {
    from { transform: translate3d(0,0,0); }
    to   { transform: translate3d(-900px,0,0); }
}

@keyframes ns-drift-near {
    from { transform: translate3d(0,0,0); }
    to   { transform: translate3d(-1500px,0,0); }
}

@media (prefers-reduced-motion: reduce) {
    .ns-stars::before,
    .ns-twinkling::before,
    .ns-clouds::before,
    .ns-clouds::after {
        animation: none;
    }
}

/* ── View switching ────────────────────────────────────────────────── */
.view {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
    z-index: 1;
}

    .view.active {
        opacity: 1;
        pointer-events: auto;
    }

/* Both views are transparent: the sky behind them (.ns-stars / .ns-twinkling in
   dark, .ns-clouds over the html wash in light) is the page background. A view
   that painted its own starfield would cover the drifting one and the page
   would read as a still picture. */
#browse-view {
    background: transparent;
}

/* ═══════════════════════════════════════════════════════════════════════
   BROWSE VIEW
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Header ──────────────────────────────────────────────────────── */
/* The header, tabs, filter and tag rows are all transparent and borderless:
   the sky runs unbroken from the top of the page to the bottom. The only
   outlines left in the chrome are the search box and the country select,
   because a text field and a dropdown have to look like ones. */
#radio-header {
    flex-shrink: 0;
    height: var(--header-h);
    background: transparent;
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 0 14px;
}

#radio-logo {
    display: flex;
    align-items: center;
    gap: 7px;
    /*  color: var(--accent-text);*/
    font-size: 34px;
    font-weight: 700;
    letter-spacing: .4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.icon-btn {
    background: transparent;
    border: none;
    border-radius: 7px;
    color: var(--muted);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: color .15s;
}

    .icon-btn:hover {
        color: var(--text);
    }

#search-input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
    transition: border-color .15s;
}

    #search-input:focus {
        border-color: var(--accent-line);
    }


/* ── Filter row (country + clear) — sits between tabs and genre chips ── */
#filter-row {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: transparent;
}

.filter-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--muted);
    white-space: nowrap;
    flex-shrink: 0;
}

#country-select {
    flex: 1;
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 7px 10px;
    font-size: 13px;
    outline: none;
    cursor: pointer;
    transition: border-color .15s;
}

    #country-select:focus {
        border-color: var(--accent-line);
    }

    #country-select option {
        background: #16161f;
        color: #e0e0e0;
    }

html[data-theme="light"] #country-select {
    color: #1a1a2e;
}

    html[data-theme="light"] #country-select option {
        background: #ffffff;
        color: #1a1a2e;
    }

#clear-btn {
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--muted);
    padding: 7px 12px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color .15s;
}

    #clear-btn:hover {
        color: var(--text);
    }

/* ── Tabs ──────────────────────────────────────────────────────────── */
#tabs {
    flex-shrink: 0;
    height: var(--tabs-h);
    display: flex;
    gap: 0;
    padding: 0 14px;
    background: transparent;
    align-items: flex-end;
}

.tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    padding: 0 16px 10px;
    font-size: 14px;
    cursor: pointer;
    transition: color .15s, font-size .15s;
}

    .tab-btn.active {
        color: #fff;
        border-bottom-color: #fff;
        font-size: 16px;
        font-weight: 700;
    }

    .tab-btn:hover:not(.active) {
        color: var(--text);
    }

/* ── Tag chips ─────────────────────────────────────────────────────── */
#tags-row {
    flex-shrink: 0;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 8px 14px;
    scrollbar-width: none;
    background: transparent;
}

    #tags-row::-webkit-scrollbar {
        display: none;
    }

/* A resting chip is bare text. Only the picked one gets a pill, so the row
   reads as a list of words over the sky instead of a strip of outlined boxes,
   and the selection is the one thing that stands out. */
.tag-chip {
    flex-shrink: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 20px;
    color: var(--muted);
    padding: 5px 13px;
    font-size: 12px;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}

    .tag-chip:hover {
        color: var(--text);
    }

    .tag-chip.active {
        background: var(--btn-grad);
        border-color: var(--accent-edge);
        color: #fff;
    }

/* ── Station grid ──────────────────────────────────────────────────── */
#content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px 110px; /* bottom pad = mini-bar + breathing room */
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar) transparent;
}

.section-label {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    margin-bottom: 12px;
}

#station-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 388px));
    gap: 14px;
    justify-content: center;
}

/* ── Station card — channel-style vertical card ────────────────────── */
.station-card {
    --station-footer: 88px;
    height: 366px;
    width: 100%;
    border-radius: 18px;
    overflow: hidden;
    border: 3px solid #000;
    cursor: pointer;
    position: relative;
    transition: box-shadow .2s;
}

    .station-card:hover {
        box-shadow: 0 0 0 2px rgba(255,255,255,0.18), 0 6px 28px rgba(0,0,0,0.6);
    }

    .station-card.playing {
        border-color: var(--accent-line);
        box-shadow: 0 0 0 1px var(--accent-line), 0 0 24px var(--accent-glow);
    }

/* Playback failed on this station. It used to be deleted from the grid outright, with no
   message, so a station simply vanished mid-click and you had no idea why. */
.station-card.unavailable { opacity: .45; }
.station-card.unavailable .station-card-inner { outline: 1px solid rgba(255,90,90,.5); }

.station-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Full-bleed dark background fallback */
.station-card-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: var(--station-footer);
    background: linear-gradient(135deg, #0a1628 0%, #1a3a5c 35%, #1e4470 65%, #0d1f38 100%);
}

/* Station artwork — full bleed above the footer */
.station-art {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: var(--station-footer);
    width: 100%;
    height: calc(100% - var(--station-footer));
    object-fit: cover;
    object-position: center;
    z-index: 3;
    background: transparent;
}

/* RADIO badge — top-left */
.station-radio-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 6;
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 6px;
    padding: 3px 8px;
    color: var(--accent-text);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 4px;
    text-transform: uppercase;
    backdrop-filter: blur(4px);
}

/* Shimmer */
.station-card-shimmer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: var(--station-footer);
    z-index: 2;
    animation: stationShimmer 8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes stationShimmer {
    0% {
        background: rgba(0,0,0,0.03);
    }

    33% {
        background: rgba(255,255,255,0.07);
    }

    66% {
        background: rgba(0,0,0,0.06);
    }

    100% {
        background: rgba(0,0,0,0.03);
    }
}

/* Hover darkening overlay */
.station-card-inner::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: var(--station-footer);
    background: rgba(0,0,0,0.22);
    opacity: 0;
    transition: opacity .2s;
    pointer-events: none;
    z-index: 4;
}

.station-card:hover .station-card-inner::after {
    opacity: 1;
}

/* Play chevron */
.station-card-play {
    position: absolute;
    top: calc((100% - var(--station-footer)) / 2);
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    opacity: 0;
    transition: opacity .2s;
    pointer-events: none;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.6));
}

.station-card:hover .station-card-play {
    opacity: 0.85;
}

.station-card.playing .station-card-play {
    opacity: 1;
}

/* Footer strip */
.station-card-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--station-footer);
    box-sizing: border-box;
    background: linear-gradient(to bottom, #000000, #000080, #000000);
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    z-index: 4;
}

.station-name {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    margin-right: 36px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.station-genre {
    font-size: 13px;
    color: #bbb;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 3px;
}

.station-data {
    font-size: 10px;
    color: rgba(255,255,255,0.35);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

/* Three-dot more button */
.station-card-more {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.45);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    font-size: 15px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0;
    transition: opacity .2s, background .15s;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.station-card:hover .station-card-more {
    opacity: 0.85;
}

.station-card-more:hover {
    background: rgba(255,255,255,0.18);
    opacity: 1 !important;
}

/* Card-level favorite (heart) button */
.btn-fav {
    position: absolute;
    bottom: calc(var(--station-footer) + 8px);
    right: 8px;
    z-index: 7;
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: opacity .2s, color .15s, border-color .15s, background .15s;
    backdrop-filter: blur(4px);
    opacity: 0;
}

    .station-card:hover .btn-fav,
    .btn-fav.saved {
        opacity: 1;
    }

    .btn-fav.saved {
        color: var(--fav);
        border-color: rgba(224,68,68,0.6);
        background: rgba(224,68,68,0.15);
    }

    .btn-fav:not(.saved):hover {
        color: #fff;
        border-color: rgba(255,255,255,0.4);
    }

/* Playing pulse dot */
.station-card.playing::after {
    content: '';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-text);
    animation: pulse 1.5s ease-in-out infinite;
    z-index: 10;
}

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

    50% {
        opacity: .3;
        transform: scale(.65);
    }
}

/* ── Card dropdown menu ─────────────────────────────────────── */
.radio-card-menu {
    position: fixed;
    background: #12122a;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 10px;
    padding: 6px 0;
    min-width: 140px;
    z-index: 9999;
    box-shadow: 0 8px 32px rgba(0,0,0,0.75);
    animation: radio-menu-pop 0.12s ease;
}

@keyframes radio-menu-pop {
    from {
        opacity: 0;
        transform: scale(0.88);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.radio-card-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 18px;
    background: none;
    border: none;
    color: #e0e0e0;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    transition: background 0.12s;
}

    .radio-card-menu-item:hover {
        background: rgba(255,255,255,0.09);
        color: #fff;
    }

/* ── Toast ─────────────────────────────────────────────────── */
.radio-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background: rgba(18,18,42,0.96);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 10px;
    padding: 10px 22px;
    color: #e0e0e0;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s, transform .22s;
    white-space: nowrap;
}

    .radio-toast.visible {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

/* ── Mini now-playing bar ─────────────────────────────────────────── */
#mini-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 68px;
    background: linear-gradient(135deg, #111 0%, #1a1a1a 100%);
    border-top: 1px solid var(--accent-line);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 14px;
    transform: translateY(100%);
    transition: transform .25s ease;
}

    #mini-bar.visible {
        transform: translateY(0);
    }

#mini-art {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
    background: #1a1a1a;
    flex-shrink: 0;
}

#mini-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-text);
    animation: pulse 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

#mini-bar.buffering #mini-pulse {
    background: var(--muted);
}

#mini-bar.error #mini-pulse {
    background: var(--fav);
    animation: none;
}

#mini-info {
    flex: 1;
    min-width: 0;
}

#mini-name {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#mini-status {
    font-size: 13px;
    color: var(--muted);
}

#mini-bar.error #mini-status {
    color: var(--fav);
}

/* Volume group in the mini bar */
#mini-vol {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

    #mini-vol .icon-btn.muted {
        color: var(--fav);
    }

#mini-volume {
    width: 90px;
    accent-color: var(--accent-text);
    cursor: pointer;
}

.mini-open-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    padding: 7px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: border-color .15s;
    flex-shrink: 0;
}

    .mini-open-btn:hover {
        border-color: var(--accent-line);
    }

/* ═══════════════════════════════════════════════════════════════════════
   NOW-PLAYING FULL-SCREEN VIEW
   ═══════════════════════════════════════════════════════════════════════ */

#now-playing-view {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar) transparent;
    z-index: 5;
    background: #000 url('../../images/nightsky/stars.png') repeat top center;
}

/* Top bar: back · station name · stop */
#np-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(135deg, #111 0%, #1a1a1a 100%);
    border-bottom: 1px solid var(--border);
    height: 54px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
}

.np-back-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--muted);
    padding: 7px 12px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color .15s, border-color .15s;
    flex-shrink: 0;
}

    .np-back-btn:hover {
        color: var(--text);
        border-color: var(--border-h);
    }

#np-topbar-name {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-head);
}

.np-stop-btn {
    background: var(--btn-grad);
    border: 1px solid var(--accent-edge);
    border-radius: 8px;
    color: #fff;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background .15s;
    flex-shrink: 0;
}

    .np-stop-btn:hover {
        background: var(--btn-grad-hover);
        border-color: var(--accent-line);
    }

/* Main content (centered column) */
#np-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 24px 80px;
    gap: 0;
    min-height: calc(100vh - 54px);
}

/* Artwork + equalizer stack */
#np-art-wrap {
    position: relative;
    width: 220px;
    height: 220px;
    margin-bottom: 28px;
}

#np-art {
    width: 220px;
    height: 220px;
    border-radius: 18px;
    object-fit: cover;
    background: #1a1a1a;
    box-shadow: 0 8px 40px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.08);
}

/* Equalizer bars — overlaid bottom-center of the art */
#np-bars {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 32px;
}

.bar {
    width: 5px;
    border-radius: 3px;
    background: var(--accent-text);
    transform-origin: bottom;
    transform: scaleY(0.15);
}

#now-playing-view.playing .bar {
    animation: eq-wave 0.6s ease-in-out infinite alternate;
}

.bar:nth-child(1) {
    animation-duration: 0.52s;
    height: 28px;
}

.bar:nth-child(2) {
    animation-duration: 0.38s;
    height: 36px;
    animation-delay: -.1s;
}

.bar:nth-child(3) {
    animation-duration: 0.45s;
    height: 44px;
    animation-delay: -.22s;
}

.bar:nth-child(4) {
    animation-duration: 0.60s;
    height: 32px;
    animation-delay: -.05s;
}

.bar:nth-child(5) {
    animation-duration: 0.35s;
    height: 24px;
    animation-delay: -.18s;
}

@keyframes eq-wave {
    from {
        transform: scaleY(0.15);
    }

    to {
        transform: scaleY(1);
    }
}

/* Station name */
#np-name {
    font-size: 30px;
    font-weight: 800;
    color: var(--text-head);
    text-align: center;
    line-height: 1.2;
    margin-bottom: 8px;
    max-width: 480px;
}

#np-meta {
    font-size: 16px;
    color: var(--muted);
    text-align: center;
    margin-bottom: 12px;
}

/* Status: connecting / buffering / playing / error */
#np-status {
    min-height: 20px;
    font-size: 15px;
    color: var(--muted);
    text-align: center;
    margin-bottom: 32px;
}

#now-playing-view.error #np-status {
    color: var(--fav);
}

#now-playing-view.playing #np-status {
    color: rgba(255,255,255,.3);
}

/* Controls row */
#np-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
}

.ctrl-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    cursor: pointer;
    transition: background .15s, border-color .15s;
    flex-shrink: 0;
}

    .ctrl-btn:hover {
        background: var(--surface-h);
        border-color: var(--border-h);
    }

    .ctrl-btn.muted {
        color: var(--muted);
    }

.np-fav-btn {
    color: var(--muted);
}

    .np-fav-btn.saved {
        color: var(--fav);
        border-color: var(--fav);
        background: rgba(224,68,68,.1);
    }

#np-volume {
    width: 160px;
    accent-color: var(--accent-text);
    cursor: pointer;
}

/* Admin controls */
#np-admin {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    padding: 16px 20px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 12px;
    background: rgba(255,255,255,.02);
    min-width: 300px;
}

    #np-admin.visible {
        display: flex;
    }

#np-admin-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--muted);
    font-weight: 700;
}

#np-admin-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.admin-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 7px 14px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background .15s, border-color .15s;
}

    .admin-btn:hover {
        background: var(--surface-h);
        border-color: var(--border-h);
    }

    .admin-btn.danger {
        border-color: rgba(224,68,68,.4);
        color: var(--fav);
    }

        .admin-btn.danger:hover {
            background: rgba(224,68,68,.1);
            border-color: var(--fav);
        }

    .admin-btn.active {
        background: var(--btn-grad);
        border-color: var(--accent-edge);
        color: #fff;
    }

        .admin-btn.active.danger {
            background: var(--fav);
            border-color: var(--fav);
        }

#np-admin-msg {
    font-size: 12px;
    color: var(--muted);
    min-height: 16px;
    text-align: center;
}

/* Raw info panel */
#np-raw-wrap {
    display: none;
    max-width: 560px;
    width: 100%;
    margin-bottom: 24px;
}

    #np-raw-wrap.visible {
        display: block;
    }

#np-raw {
    background: rgba(255,255,255,.04);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    font-size: 11px;
    line-height: 1.6;
    color: var(--muted);
    white-space: pre-wrap;
    word-break: break-all;
    font-family: 'Consolas', 'Courier New', monospace;
    max-height: 320px;
    overflow-y: auto;
}

/* ── Now Playing tab panel ─────────────────────────────────────────── */
.np-tab-panel {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 24px 80px;
}

.np-tab-art-wrap {
    position: relative;
    width: 200px;
    height: 200px;
    margin-bottom: 40px;
}

.np-tab-art {
    width: 200px;
    height: 200px;
    border-radius: 18px;
    object-fit: cover;
    background: #1a1a1a;
    box-shadow: 0 8px 40px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.08);
}

.np-tab-bars {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 32px;
}

    .np-tab-bars .bar {
        background: var(--accent-text);
        transform: scaleY(0.15);
    }

    .np-tab-bars.active .bar {
        animation: eq-wave 0.6s ease-in-out infinite alternate;
    }

.np-tab-name {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-head);
    text-align: center;
    line-height: 1.2;
    margin-bottom: 8px;
    max-width: 520px;
}

.np-tab-meta {
    font-size: 16px;
    color: var(--muted);
    text-align: center;
    margin-bottom: 10px;
}

.np-tab-status {
    min-height: 20px;
    font-size: 15px;
    color: var(--muted);
    text-align: center;
    margin-bottom: 30px;
}

.np-tab-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.np-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 24px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    border: 1px solid var(--border);
    color: var(--text);
    background: var(--surface);
    font-family: inherit;
}

    .np-tab-btn:hover {
        background: var(--surface-h);
        border-color: var(--border-h);
    }

.np-tab-play {
    background: var(--btn-grad);
    border-color: var(--accent-edge);
    color: #fff;
}

    .np-tab-play:hover {
        background: var(--btn-grad-hover);
        border-color: var(--accent-line);
    }

.np-tab-stop {
    border-color: rgba(224,68,68,.4);
    color: var(--fav);
}

    .np-tab-stop:hover {
        background: rgba(224,68,68,.1);
        border-color: var(--fav);
    }

/* Mute + volume inside the Now Playing tab panel */
.np-tab-vol-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    flex-shrink: 0;
}

    .np-tab-vol-btn:hover {
        background: var(--surface-h);
        border-color: var(--border-h);
    }

    .np-tab-vol-btn.muted {
        color: var(--muted);
    }

.np-tab-volume {
    width: 150px;
    accent-color: var(--accent-text);
    cursor: pointer;
}

.np-tab-fav {
    color: var(--muted);
}

    .np-tab-fav.saved {
        color: var(--fav);
        border-color: rgba(224,68,68,.5);
        background: rgba(224,68,68,.08);
    }

/* Artwork overlay play/stop button */
.np-tab-art-btn {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0);
    border: none;
    border-radius: 18px;
    cursor: pointer;
    opacity: 0;
    transition: background .2s, opacity .2s;
    z-index: 2;
}

.np-tab-art-wrap:hover .np-tab-art-btn {
    background: rgba(0,0,0,0.45);
    opacity: 1;
}

/* Now Playing tab button playing indicator */
.tab-btn[data-view="nowplaying"].playing {
    color: var(--fav);
}

    .tab-btn[data-view="nowplaying"].playing.active {
        color: var(--fav);
        border-bottom-color: var(--fav);
    }

    .tab-btn[data-view="nowplaying"].playing::after {
        content: '';
        display: inline-block;
        width: 5px;
        height: 5px;
        border-radius: 50%;
        background: var(--fav);
        margin-left: 5px;
        vertical-align: middle;
        animation: pulse 1.5s ease-in-out infinite;
    }

/* ── Shared: spinner & empty ────────────────────────────────────────── */
.spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    justify-content: center;
    padding: 60px 24px;
    color: var(--muted);
    font-size: 14px;
    grid-column: 1 / -1;
}

    .spinner::before {
        content: '';
        width: 26px;
        height: 26px;
        border: 2px solid rgba(255,255,255,.1);
        border-top-color: var(--accent-text);
        border-radius: 50%;
        animation: spin .75s linear infinite;
    }

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

.empty-msg {
    text-align: center;
    color: var(--muted);
    padding: 60px 24px;
    font-size: 14px;
    grid-column: 1 / -1;
    line-height: 1.8;
}

.retry-btn {
    display: inline-block;
    margin-top: 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--muted);
    padding: 8px 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all .15s;
}

    .retry-btn:hover {
        color: var(--text);
        border-color: var(--border-h);
    }

/* ── Scrollbar ───────────────────────────────────────────────────── */
*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: var(--scrollbar);
    border-radius: 3px;
}

    *::-webkit-scrollbar-thumb:hover {
        background: rgba(255,255,255,.25);
    }

/* ── Light mode chrome ────────────────────────────────────────────────── */
html[data-theme="light"] #mini-bar,
html[data-theme="light"] #np-topbar {
    background: rgba(255,255,255,0.58);
}

/* #tabs, #filter-row and #tags-row have no light-mode wash of their own: they
   are transparent in both themes so the sky is continuous behind the chrome. */

html[data-theme="light"] #now-playing-view {
    background: transparent;
}

html[data-theme="light"] .tab-btn {
    color: rgba(10,10,40,0.55);
}

    html[data-theme="light"] .tab-btn.active {
        color: #0d0d1a;
        border-bottom-color: #0d0d1a;
    }

    html[data-theme="light"] .tab-btn:hover:not(.active) {
        color: #0d0d1a;
    }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
    #station-grid {
        grid-template-columns: 1fr;
    }

    .station-card {
        height: 300px;
        --station-footer: 80px;
    }

    #np-main {
        padding: 32px 16px 60px;
    }

    #np-art-wrap, #np-art {
        width: 180px;
        height: 180px;
    }

    #np-name {
        font-size: 20px;
    }

    #np-volume {
        width: 120px;
    }

    .np-tab-volume {
        width: 120px;
    }

    #mini-volume {
        width: 64px;
    }

    #np-admin {
        min-width: unset;
        width: 100%;
    }

    #radio-header {
        padding: 0 10px;
        gap: 7px;
    }

    #filter-row {
        padding: 6px 10px;
        gap: 8px;
    }
}

@media (max-width: 400px) {
    #radio-logo span {
        display: none;
    }

    #np-controls {
        gap: 10px;
    }

    /* No room for a slider next to the open/stop buttons: keep mute only.
       The full slider is still one tap away in the now-playing view. */
    #mini-volume {
        display: none;
    }
}
