.track-list {
    margin: 0;
    padding: 0;
    list-style-position: inside;
}

.track {
    display: grid;
    grid-template-columns:
        minmax(200px, 2fr)
        minmax(150px, 1.5fr)
        minmax(150px, 1.5fr)
        90px
        140px
        80px
        80px;
    gap: 1rem;
    align-items: center;
    padding: 0.5rem;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
}

.move-controls {
    display: flex;
    gap: 0.25rem;
}

.move-controls button {
    width: 32px;
    height: 28px;
    padding: 0;
}

.track-rating {
    width: 90px;
    min-width: 90px;
    justify-self: end;
}

.track:hover {
    background: rgba(255, 255, 255, 0.08);
}

.track-title {
    font-weight: bold;
}

.track-artist,
.track-release {
    opacity: 0.75;
}

#queue {
    width: 100%;
    box-sizing: border-box;
}

.track-list {
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}

.track-playlist {
    width: 140px;
    min-width: 140px;
}

.playlist {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
}

.playlist-name {
    cursor: pointer;
    min-width: 150px;
}

.playlist-name:hover {
    text-decoration: underline;
}

.playlist button {
    cursor: pointer;
}

.playlist:hover {
    text-decoration: underline;
}

.remove-track {
    width: 80px;
}


#visualizer {
    display: block;
    width: 100%;
    height: 250px;
    background: #000;
}

/* Album art and visualizer side by side */

.media-row {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    width: 100%;
}

.art-container {
    flex: 0 1 500px;
    min-width: 0;
    height: 500px;
}

#art {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.visualizer-container {
    flex: 1 1 0;
    min-width: 0;
}

.visualizer-controls {
    margin-bottom: 10px;
}

#visualizer {
    display: block;
    width: 100%;
    height: 500px;
    background: #000;
}

@media (max-width: 800px) {
    .media-row {
        flex-direction: column;
        align-items: stretch;
    }

    .art-container {
        flex: none;
        height: 350px;
    }

    #visualizer {
        height: 350px;
    }
}

/* Layout selector */
.layout-controls {
    margin-bottom: 16px;
}

/* Compact player */
body.layout-compact {
    margin: 0;
    padding: 12px;
}

.layout-compact #radio {
    max-width: 480px;
    margin: 0 auto;
}

.layout-compact #radio h1 {
    font-size: 1.4rem;
    text-align: center;
}

/* Album artwork */
.layout-compact .media-row {
    display: block;
}

.layout-compact .art-container {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
}

.layout-compact #art {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Hide visualizer */
.layout-compact .visualizer-container {
    display: none;
}

/* Track information */
.layout-compact #track-info {
    text-align: center;
    margin: 16px 0;
}

.layout-compact #title {
    font-size: 1.3rem;
    font-weight: bold;
}

.layout-compact #artist {
    font-size: 1.1rem;
    margin-top: 4px;
}

.layout-compact #release {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Playback controls */
.layout-compact #controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.layout-compact #controls button {
    min-height: 48px;
    padding: 10px 16px;
}

/* Hide sorting controls */
.layout-compact #random,
.layout-compact #alphabetical,
.layout-compact #most-played,
.layout-compact #top-rated,
.layout-compact #weekly-top-10 {
    display: none;
}

/* Progress and volume */
.layout-compact #seek {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 16px 0 8px;
}

.layout-compact #time {
    text-align: center;
}

.layout-compact #volume {
    max-width: 180px;
}

/* Hide playlist management and queue */
.layout-compact #playlists,
.layout-compact #queue {
    display: none;
}

/* Hide DJ testing button */
.layout-compact #test-time-check {
    display: none;
}

/* Compact: album artwork behind visualizer */

.layout-compact .media-row {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #000;
}

.layout-compact .art-container {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.layout-compact #art {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.layout-compact .visualizer-container {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.layout-compact #visualizer {
    width: 100%;
    height: 100%;
    background: transparent;
}

.layout-compact .visualizer-controls {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    pointer-events: auto;
}

/* Full layout: tiled artwork behind the visualizer */
.layout-full .media-row {
    position: relative;
    display: block;
    width: 100%;
    min-height: 500px;
    background: #000;
    overflow: hidden;
}

.layout-full .art-container {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background-image: var(--radio-art-url);
    background-repeat: repeat;
    background-position: top left;
    background-size: auto 100%;
    pointer-events: none;
}

.layout-full #art {
    display: none;
}

.layout-full .visualizer-container {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 500px;
}

.layout-full #visualizer {
    width: 100%;
    height: 500px;
    background: transparent;
}

/* Keep visualizer controls above the visualizer in both layouts */
.layout-full .visualizer-controls,
.layout-compact .visualizer-controls {
    position: relative;
    top: auto;
    right: auto;
    z-index: 2;
    margin-bottom: 10px;
    pointer-events: auto;
}

/* Reserve space for the controls in Compact mode */
.layout-compact .visualizer-container {
    position: relative;
    inset: auto;
    height: auto;
}

.layout-compact .media-row {
    aspect-ratio: auto;
}

.layout-compact .art-container {
    position: absolute;
    inset: 0;
}

.layout-compact #visualizer {
    height: auto;
    aspect-ratio: 1 / 1;
}


/* Visualizer controls outside media overlay */
.visualizer-controls,
.layout-full .visualizer-controls,
.layout-compact .visualizer-controls {
    position: static;
    inset: auto;
    margin-bottom: 10px;
    pointer-events: auto;
}

/* Black page background with white text */
html,
body {
    background-color: #000;
    color: #fff;
}

#radio {
    color: #fff;
}

input,
select,
textarea,
button {
    background-color: #222;
    color: #fff;
    border: 1px solid #666;
}

/* Extra space between DJ selector and playback controls */
/* Space between DJ controls and playback buttons */
.dj-controls {
    margin-bottom: 25px;
}


/* Compact, scrollable and searchable track browser */
.track-browser-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}
#track-search { flex: 1 1 260px; min-width: 150px; padding: 8px; }
#track-search-scope, #track-search-clear { padding: 8px; }
#track-search-count { font-size: 0.9rem; opacity: 0.75; }
#track-list {
    height: 460px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid #555;
    background: #0d0d0d;
}
#track-list .track {
    gap: 8px;
    padding: 7px 10px;
    min-height: 42px;
    border-bottom: 1px solid #303030;
}
#track-list .track-title, #track-list .track-artist,
#track-list .track-release { overflow-wrap: anywhere; }

/* Listener activity */
#listener-activity { margin: 1rem 0; padding: .8rem; border: 1px solid #555; border-radius: 6px; }
#listener-admin-button { margin-left: 1rem; }
#listener-details { margin-top: 1rem; }
.listener-table-wrap { max-width: 100%; overflow-x: auto; }
#listener-details table { border-collapse: collapse; width: 100%; font-size: .85rem; }
#listener-details th, #listener-details td { border: 1px solid #555; padding: .45rem; text-align: left; }
#listener-details th { white-space: nowrap; }

/* Radio chat */
#radio-chat { max-width: 1000px; margin: 1rem auto; padding: 1rem; border: 1px solid #555; border-radius: 8px; }
#radio-chat-messages { height: 270px; overflow-y: auto; padding: .7rem; background: rgba(0,0,0,.3); overflow-wrap: anywhere; }
.radio-chat-line { padding: .25rem 0; }
.radio-chat-dj { color: #b9caff; font-style: italic; }
.radio-chat-line small { opacity: .7; }
#radio-chat-form { display: flex; gap: .5rem; margin-top: .75rem; }
#radio-chat-input { flex: 1; min-width: 0; }
#radio-chat-status { min-height: 1.4em; }


/* Main radio navigation menu */
.radio-main-menu {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 10000;
}

.radio-main-menu summary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: #222;
    color: #fff;
    border: 1px solid #555;
    cursor: pointer;
    font-size: 27px;
    line-height: 1;
    list-style: none;
}

.radio-main-menu summary::-webkit-details-marker {
    display: none;
}

.radio-menu-content {
    position: absolute;
    top: 44px;
    left: 0;
    width: min(300px, calc(100vw - 24px));
    box-sizing: border-box;
    padding: 14px;
    background: #1c1c1c;
    color: #eee;
    border: 1px solid #555;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.5);
}

.radio-menu-content a {
    display: block;
    padding: 10px;
    color: #eee;
    text-decoration: none;
    border-radius: 5px;
}

.radio-menu-content a:hover {
    background: #333;
}

.radio-menu-login {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #444;
}

.radio-menu-login input {
    box-sizing: border-box;
    max-width: 100%;
}

/* Reserve space for the upper-left navigation button */
#radio > h1 {
    padding-left: 55px;
}


/* Radio settings inside the navigation menu */
.radio-menu-settings {
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid #444;
}

.radio-menu-settings h3 {
    margin: 0 0 12px;
    font-size: 15px;
}

.radio-menu-settings .layout-controls,
.radio-menu-settings .visualizer-controls,
.radio-menu-settings .dj-controls {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin-bottom: 12px;
}

.radio-menu-settings select,
.radio-menu-settings button {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
}

/* Keep track metadata available to JavaScript but hide its display */
#track-info {
    display: none !important;
}

/* Compact track information beneath the artwork */
#track-info {
    display: block !important;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
    margin: 8px 0 12px;
    padding: 0;
}

#track-info #title {
    font-size: 13px;
    font-weight: 600;
}

#track-info #artist {
    font-size: 12px;
    font-weight: 400;
}

#track-info #release {
    font-size: 11px;
    font-weight: 400;
    opacity: 0.7;
}


/* Native 50px radio icons */
#previous,
#next,
#play {
    width: 58px;
    height: 58px;
    min-width: 58px;
    min-height: 58px;
    padding: 4px;
}

#previous img,
#next img {
    width: 50px;
    height: 50px;
}

#play {
    background-size: 50px 50px;
}

.radio-main-menu summary {
    width: 58px;
    height: 58px;
}

.radio-main-menu summary img {
    width: 50px;
    height: 50px;
}

/* Make room for the larger menu icon */
#radio > h1 {
    padding-left: 75px;
}

/* Force PNG icons for radio controls */
#controls #play,
#controls #previous,
#controls #next {
    font-size: 0 !important;
    color: transparent !important;
    text-indent: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background-color: transparent !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 50px 50px !important;
    width: 58px !important;
    height: 58px !important;
    padding: 4px !important;
}

#controls #previous {
    background-image: url('../images/back_icon.png') !important;
}

#controls #next {
    background-image: url('../images/next_icon.png') !important;
}



/* Hide the text of the menu control */
.radio-main-menu summary {
    font-size: 0 !important;
    color: transparent !important;
    background: transparent !important;
    border: none !important;
}

.radio-main-menu summary img {
    display: block !important;
    width: 50px !important;
    height: 50px !important;
}


/* Play/Pause icon state */
#controls #play {
    background-image: url('../images/play_icon.png');
}
#controls #play.radio-is-playing {
    background-image: url('../images/pause_icon.png');
}


/* Dedicated playback controls row */
#controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

#playback-controls {
    display: flex;
    flex: 0 0 100%;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

#playback-controls button {
    flex-shrink: 0;
}


/* DJ time icon - playback row */
#playback-controls #test-time-check {
    display: block !important;
    flex-shrink: 0;
    width: 58px !important;
    height: 58px !important;
    min-width: 58px !important;
    padding: 4px !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent url('../images/time_icon.png')
                center / 50px 50px no-repeat !important;
    font-size: 0 !important;
    cursor: pointer;
}

/* Four-row radio control layout. Does not change visualizer or other UI. */
#controls { margin-bottom: 10px; }
.radio-seek-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-bottom: 12px;
}
.radio-seek-row #seek,
.layout-compact .radio-seek-row #seek {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    margin: 0;
    box-sizing: border-box;
}
.radio-seek-row #time {
    flex: 0 0 auto;
    white-space: nowrap;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.radio-volume-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-bottom: 12px;
}
.radio-volume-row #volume,
.layout-compact .radio-volume-row #volume {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    max-width: none;
}
.radio-other-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
@media (max-width: 480px) {
    .radio-seek-row { gap: 8px; }
    .radio-seek-row #time { font-size: 12px; }
}

/* Track title card is a sibling of both art and visualizer: always on top. */
.layout-compact .media-row, .layout-full .media-row { isolation: isolate; }
#compact-track-overlay { display: none; }
.layout-compact #compact-track-overlay, .layout-full #compact-track-overlay {
    display: block;
    position: absolute;
    z-index: 10;
    left: 12px;
    bottom: 12px;
    max-width: min(85%, 390px);
    box-sizing: border-box;
    padding: 10px 14px;
    background: rgba(0,0,0,.82);
    color: white;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.35;
    text-align: left;
    overflow-wrap: anywhere;
    opacity: 0;
    pointer-events: auto;
    cursor: pointer;
    transform-origin: left center;
    clip-path: inset(0 0 100% 0);
}
#compact-track-overlay.is-visible { opacity: 1; clip-path: inset(0); }
#compact-track-title { font-size: 15px; font-weight: 700; }
#compact-track-artist { font-size: 13px; margin-top: 3px; }
#compact-track-release { font-size: 12px; color: #bbb; margin-top: 2px; }
/* Hidden card keeps a small hit target; JS handles hover, not CSS visibility. */
#compact-track-overlay:not(.is-visible):not(.glitch-out):not(.glitch-in) {
    background: transparent;
    opacity: 0;
    clip-path: none;
}
#compact-track-overlay.glitch-in {
    animation: radio-title-glitch-in 540ms steps(1, end) both !important;
}
#compact-track-overlay.glitch-out {
    animation: radio-title-glitch-out 480ms steps(1, end) both !important;
    pointer-events: none;
}
@keyframes radio-title-glitch-in {
    0%   { opacity:0; transform:translateX(-18px) skewX(12deg); clip-path:inset(0 0 100% 0); filter:contrast(3); }
    9%   { opacity:1; transform:translateX(13px); clip-path:inset(0 0 77% 0); }
    17%  { opacity:0; transform:translateX(-9px); clip-path:inset(30% 0 32% 0); }
    25%  { opacity:1; transform:translateX(-14px) skewX(-9deg); clip-path:inset(55% 0 8% 0); }
    34%  { opacity:.25; transform:translateX(17px); clip-path:inset(8% 0 66% 0); }
    45%  { opacity:1; transform:translateX(-6px); clip-path:inset(0 0 0 0); }
    55%  { opacity:0; transform:translateX(9px); clip-path:inset(62% 0 12% 0); }
    67%  { opacity:1; transform:translateX(-4px); clip-path:inset(0 0 0 0); }
    79%  { opacity:.45; transform:translateX(3px); clip-path:inset(22% 0 43% 0); }
    88%  { opacity:1; transform:translateX(-2px); clip-path:inset(0); }
    100% { opacity:1; transform:none; clip-path:inset(0); filter:none; }
}
@keyframes radio-title-glitch-out {
    0%   { opacity:1; transform:none; clip-path:inset(0); }
    12%  { opacity:.2; transform:translateX(12px); clip-path:inset(24% 0 47% 0); }
    23%  { opacity:1; transform:translateX(-15px) skewX(-8deg); clip-path:inset(0 0 68% 0); }
    37%  { opacity:0; transform:translateX(8px); clip-path:inset(57% 0 12% 0); }
    50%  { opacity:1; transform:translateX(17px); clip-path:inset(35% 0 39% 0); }
    65%  { opacity:.35; transform:translateX(-10px); clip-path:inset(0 0 79% 0); }
    80%  { opacity:1; transform:translateX(5px); clip-path:inset(75% 0 5% 0); }
    100% { opacity:0; transform:translateX(-18px); clip-path:inset(0 0 100% 0); }
}
@media (prefers-reduced-motion: reduce) {
    #compact-track-overlay.glitch-in, #compact-track-overlay.glitch-out { animation: none !important; }
}
/* Existing metadata remains accessible to player.js, but is not duplicated. */
.layout-compact #track-info, .layout-full #track-info { display: none !important; }

/* Invisible overlay must not capture hover: only the corner hotspot does. */
#compact-track-overlay { pointer-events: none !important; }
#compact-track-hotspot { display: none; }
.layout-compact #compact-track-hotspot,
.layout-full #compact-track-hotspot {
    display: block;
    position: absolute;
    left: 0;
    bottom: 0;
    width: 52px;
    height: 36px;
    z-index: 12;
    cursor: pointer;
    background: transparent;
}

/* Strong, unmistakable RGB scanline breakup on every title-card transition. */
#compact-track-overlay { isolation: isolate; }
#compact-track-overlay::before,
#compact-track-overlay::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,.65) 3px 5px, transparent 5px 10px);
    mix-blend-mode: screen;
}
#compact-track-overlay.glitch-in::before,
#compact-track-overlay.glitch-out::before {
    animation: radio-rgb-tear-a 650ms steps(1,end) both !important;
}
#compact-track-overlay.glitch-in::after,
#compact-track-overlay.glitch-out::after {
    animation: radio-rgb-tear-b 650ms steps(1,end) both !important;
}
.layout-compact #compact-track-overlay.glitch-in,
.layout-full #compact-track-overlay.glitch-in {
    animation: radio-hard-glitch-in 650ms steps(1,end) both !important;
}
.layout-compact #compact-track-overlay.glitch-out,
.layout-full #compact-track-overlay.glitch-out {
    animation: radio-hard-glitch-out 650ms steps(1,end) both !important;
}
@keyframes radio-hard-glitch-in {
  0% {opacity:0;clip-path:inset(0 0 100% 0);transform:translateX(-25px)}
  10% {opacity:1;clip-path:inset(0 0 78% 0);transform:translateX(21px);filter:drop-shadow(-7px 0 #f04) drop-shadow(7px 0 #0ff)}
  20% {opacity:1;clip-path:inset(35% 0 32% 0);transform:translateX(-19px)}
  30% {opacity:0;clip-path:inset(0);transform:translateX(12px)}
  40% {opacity:1;clip-path:inset(58% 0 4% 0);transform:translateX(17px);filter:drop-shadow(-5px 0 #f04) drop-shadow(5px 0 #0ff)}
  50% {opacity:1;clip-path:inset(0);transform:translateX(-9px)}
  60% {opacity:0;clip-path:inset(20% 0 30% 0);transform:translateX(16px)}
  70% {opacity:1;clip-path:inset(0 0 15% 0);transform:translateX(-5px)}
  82% {opacity:1;clip-path:inset(0);transform:translateX(3px);filter:drop-shadow(-3px 0 #f04) drop-shadow(3px 0 #0ff)}
  100% {opacity:1;clip-path:inset(0);transform:none;filter:none}
}
@keyframes radio-hard-glitch-out {
  0% {opacity:1;clip-path:inset(0);transform:none}
  12% {opacity:1;clip-path:inset(20% 0 35% 0);transform:translateX(18px);filter:drop-shadow(-6px 0 #f04) drop-shadow(6px 0 #0ff)}
  25% {opacity:0;clip-path:inset(0);transform:translateX(-12px)}
  37% {opacity:1;clip-path:inset(60% 0 5% 0);transform:translateX(-22px)}
  50% {opacity:1;clip-path:inset(0 0 55% 0);transform:translateX(16px)}
  62% {opacity:0;clip-path:inset(0);transform:translateX(-12px)}
  75% {opacity:1;clip-path:inset(75% 0 0 0);transform:translateX(22px);filter:drop-shadow(-8px 0 #f04) drop-shadow(8px 0 #0ff)}
  88% {opacity:1;clip-path:inset(42% 0 40% 0);transform:translateX(-16px)}
  100% {opacity:0;clip-path:inset(0 0 100% 0);transform:translateX(24px);filter:none}
}
@keyframes radio-rgb-tear-a {
  0%,100% {opacity:0;transform:none}
  10%,30%,55%,80% {opacity:.85;transform:translateX(13px);filter:drop-shadow(-8px 0 #ff0055)}
  20%,45%,70% {opacity:.4;transform:translateX(-15px)}
}
@keyframes radio-rgb-tear-b {
  0%,100% {opacity:0;transform:none}
  15%,40%,65%,85% {opacity:.7;transform:translateX(-13px);filter:drop-shadow(8px 0 #00ffff)}
  25%,50%,75% {opacity:.3;transform:translateX(15px)}
}

/* Reliable corner hover/click target in both layouts. */
.layout-compact #compact-track-hotspot,
.layout-full #compact-track-hotspot {
    width: 140px;
    height: 90px;
    z-index: 20;
}
/* Only the visible title card can receive hover/clicks; hidden card cannot trap the cursor. */
#compact-track-overlay { pointer-events: none !important; }
#compact-track-overlay.is-visible:not(.glitch-out) { pointer-events: auto !important; }

/* Keep the invisible reveal target small so art clicks still remix the visualizer. */
.layout-compact #compact-track-hotspot,
.layout-full #compact-track-hotspot { width: 52px; height: 36px; }

/* Hover/click target follows the entire title card, not a tiny corner. */
.layout-compact #compact-track-hotspot,
.layout-full #compact-track-hotspot {
    left: 12px;
    bottom: 12px;
    width: min(85%, 390px); /* fallback until JS measures the text */
    height: 90px;
    min-width: 140px;
    min-height: 90px;
    box-sizing: border-box;
}

/* Brief intermittent interference while the title is on-screen. */
.layout-compact #compact-track-overlay.glitch-pulse:not(.glitch-in):not(.glitch-out),
.layout-full #compact-track-overlay.glitch-pulse:not(.glitch-in):not(.glitch-out) {
    animation: radio-overlay-pulse 190ms steps(1,end) both !important;
}
#compact-track-overlay.glitch-pulse::before,
#compact-track-overlay.glitch-pulse::after {
    animation: radio-rgb-tear-a 190ms steps(1,end) both !important;
}
@keyframes radio-overlay-pulse {
    0%,100% { opacity:1; transform:none; clip-path:inset(0); filter:none; }
    22% { transform:translateX(-5px); clip-path:inset(18% 0 36% 0); filter:drop-shadow(-3px 0 #ff0055) drop-shadow(3px 0 #00ffff); }
    48% { transform:translateX(4px); clip-path:inset(50% 0 12% 0); }
    70% { transform:translateX(-2px); clip-path:inset(0); filter:drop-shadow(2px 0 #00ffff); }
}
@media (prefers-reduced-motion: reduce) {
    #compact-track-overlay.glitch-pulse,
    #compact-track-overlay.glitch-pulse::before,
    #compact-track-overlay.glitch-pulse::after { animation:none !important; }
}


/* Heart uses the two supplied image assets; a 5-star rating selects hearted_icon.png. */
#playback-controls #heart-rating {
    display: block !important;
    width: 58px !important;
    height: 58px !important;
    min-width: 58px !important;
    min-height: 58px !important;
    padding: 4px !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent url('../images/heart_icon.png') center / 50px 50px no-repeat !important;
    cursor: pointer;
    transition: opacity 140ms ease;
}
#playback-controls #heart-rating.is-favorite {
    background-image: url('../images/hearted_icon.png') !important;
}
#playback-controls #heart-rating:disabled { cursor: default; }
#playback-controls #heart-rating:focus-visible { outline: 2px solid currentColor !important; outline-offset: 2px; }

/* First-play invitation; attached to the actual Play button in both layouts. */
#playback-controls .radio-play-start-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}
#playback-controls .radio-play-start-wrap:not(.radio-play-started) #play {
    animation: radio-play-invite-pulse 1.8s ease-in-out infinite;
    border-radius: 50% !important;
}
#playback-controls .radio-play-start-prompt {
    position: absolute;
    bottom: calc(100% + 13px);
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    padding: 8px 12px;
    border: 1px solid #777;
    background: rgba(12,12,12,.95);
    color: #fff;
    font-size: 14px;
    line-height: 1.3;
    font-weight: 600;
    z-index: 70;
    pointer-events: none;
    box-shadow: 0 3px 12px rgba(0,0,0,.55);
}
#playback-controls .radio-play-start-prompt::after {
    content: '';
    position: absolute;
    left: calc(50% - 6px);
    top: 100%;
    border: 6px solid transparent;
    border-top-color: #777;
}
#playback-controls .radio-play-start-prompt[hidden] { display: none !important; }
@keyframes radio-play-invite-pulse {
    0%,100% { filter: drop-shadow(0 0 2px rgba(255,255,255,.2)); transform: scale(1); }
    50% { filter: drop-shadow(0 0 12px rgba(255,255,255,.8)); transform: scale(1.08); }
}
@media (prefers-reduced-motion: reduce) {
    #playback-controls .radio-play-start-wrap #play { animation: none !important; }
}

/* NoiseWiki-only classification row, immediately beneath playback buttons. */
#track-tags[hidden] { display: none !important; }
#track-tags.radio-track-tags {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
    margin: 4px 0 8px;
}
#track-tags button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    padding: 2px;
    background: transparent;
    border: none;
    cursor: pointer;
}
#track-tags button img {
    display: block;
    width: 48px;
    height: 48px;
    object-fit: contain;
    filter: brightness(.5);
    transition: filter 120ms ease;
}
#track-tags button[aria-pressed="true"] img { filter: brightness(1); }
#track-tags button:disabled { cursor: wait; }
#track-tags button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Classification icons: one clean row in all layouts. */
#controls #track-tags.radio-track-tags,
#track-tags.radio-track-tags {
    display: flex;
    flex-wrap: nowrap !important;
    justify-content: center;
    align-items: center;
    gap: clamp(2px, 1vw, 8px);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    margin: 2px 0 8px;
    padding: 0;
}
#controls #track-tags button,
.layout-compact #controls #track-tags button,
#track-tags button {
    flex: 0 1 48px;
    min-width: 0 !important;
    min-height: 0 !important;
    width: min(48px, calc((100vw - 56px) / 7)) !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    outline: 0;
    box-shadow: none !important;
    background: none !important;
    appearance: none;
    -webkit-appearance: none;
    line-height: 0;
}
#track-tags button img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
#track-tags button:focus-visible {
    outline: 1px dashed #aaa !important;
    outline-offset: 1px;
}

/* NoiseWiki administrator visualizer preset manager */
#visualizer-preset-save:not([hidden]) {position:absolute;right:10px;bottom:10px;z-index:55;width:42px;height:42px;display:grid;place-items:center;border:1px solid #777;background:rgba(0,0,0,.55);color:white;font-size:22px;cursor:pointer;opacity:.65}
#visualizer-preset-save:hover,#visualizer-preset-save:focus-visible {opacity:1}
#visualizer-preset-menu:not([hidden]) {display:block;width:100%;text-align:left;cursor:pointer}
.nw-preset-backdrop {position:fixed;inset:0;background:rgba(0,0,0,.8);z-index:20000;display:flex;justify-content:center;align-items:center;padding:20px}
.nw-preset-panel {box-sizing:border-box;position:relative;max-height:85vh;overflow:auto;width:min(650px,100%);padding:24px;background:#181818;color:#eee;border:1px solid #666;box-shadow:0 12px 50px #000;font-family:inherit}
.nw-preset-panel h2 {margin:0 75px 20px 0;font-size:1.3rem}
.nw-preset-panel button {padding:7px 10px;margin:3px;cursor:pointer}
.nw-preset-close {position:absolute;top:16px;right:16px}
.nw-preset-field {display:flex;flex-direction:column;gap:6px;margin:14px 0}
.nw-preset-field input {padding:9px;background:#222;color:white;border:1px solid #777}
.nw-preset-check {display:flex;align-items:center;gap:8px;margin:10px 0}
.nw-preset-muted {color:#aaa;font-size:.9em;overflow-wrap:anywhere}
.nw-preset-item {border-top:1px solid #555;padding:14px 0}
.nw-preset-actions {display:flex;flex-wrap:wrap;gap:4px}

/* Custom floppy-disk image for visualizer preset save control. */
#visualizer-preset-save img {display:block;width:34px;height:34px;object-fit:contain;pointer-events:none;}

/* Artwork overlay icons: transparent hit areas, only PNG silhouettes visible. */
#visualizer-cycle,
#visualizer-preset-save:not([hidden]) {
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    border-radius: 0 !important;
    padding: 0 !important;
    -webkit-appearance: none;
    appearance: none;
}
#visualizer-cycle img,
#visualizer-preset-save img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,.95));
}
#visualizer-cycle:focus-visible,
#visualizer-preset-save:focus-visible {
    outline: none !important;
}
