/* FONY design layer.
 *
 * Loaded after the base stylesheets: it defines the design tokens and restyles
 * the surfaces on top of them. Layout/structure lives in styles.css and
 * player.css; this file only changes how things look.
 */

:root {
  /* brand */
  --accent: #00F2B8;
  --ink: #171C2B;

  /* type */
  --font-ui: 'Ruda', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 0.9375rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;

  /* shape */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 28px;
  --radius-xl: 34px;
  --radius-pill: 999px;

  /* spacing (4px grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;

  /* elevation */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.18);
  --shadow-2: 0 6px 18px rgba(0, 0, 0, 0.22);
  --shadow-3: 0 16px 40px rgba(0, 0, 0, 0.32);

  /* glass surface used over the colourful right panel */
  --glass-bg: rgba(18, 22, 36, 0.38);
  --glass-border: rgba(255, 255, 255, 0.14);
  --row-hover: rgba(255, 255, 255, 0.10);
  --row-active: rgba(18, 22, 36, 0.72);
  --row-divider: rgba(255, 255, 255, 0.07);
  --on-glass: #fff;
  --on-glass-muted: rgba(255, 255, 255, 0.62);

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t-fast: 140ms;
  --t-med: 220ms;
}

/* ---------- typography ---------- */

.right-panel,
.right-panel input,
.right-panel select,
.right-panel button,
#playlist li,
#playlist li span,
.genre-select-header,
.genre-select-dropdown {
  font-family: var(--font-ui);
}

.genre-box {
  font-size: var(--text-lg);
  font-weight: 500;
  letter-spacing: -0.01em;
  gap: var(--space-2);
  margin: 0 0 var(--space-4);
}

.genre-box label {
  font-weight: 600;
  opacity: 0.85;
}

.genre-select-header {
  font-size: var(--text-lg);
  font-weight: 600;
  text-decoration: none;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-pill);
}

.genre-select-header:hover {
  background-color: rgba(255, 255, 255, 0.14);
}

/* ---------- search pill ---------- */

.genre-search {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background-color: rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-pill);
  padding: 7px 28px 7px 14px;
  font-size: var(--text-sm);
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

.genre-search::placeholder {
  font-family: var(--font-ui);
  color: var(--on-glass-muted);
  padding-left: 0;
}

.genre-search:focus {
  border-color: var(--accent);
  background-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 0 0 3px rgba(0, 242, 184, 0.22);
}

/* ---------- right panel: glass list surface ---------- */

.playlist-area {
  border-radius: var(--radius-lg);
  padding: var(--space-2);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  box-shadow: var(--shadow-2);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

#playlist {
  padding: var(--space-1);
}

/* Scrollbar: inset from the rounded corners instead of hugging the edge.
 * (Standard scrollbar-* properties would disable the webkit styling.) */
.playlist-area {
  scrollbar-width: auto;
  scrollbar-color: auto;
}

.playlist-area::-webkit-scrollbar {
  width: 16px;
}

.playlist-area::-webkit-scrollbar-track {
  /* faint groove: same 5px inset as the thumb, so it reads as a slim rail */
  background: rgba(0, 0, 0, 0.08);
  background-clip: content-box;
  border: 5px solid transparent;
  border-radius: var(--radius-pill);
  margin: 20px 0;
}

.playlist-area::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.38);
  background-clip: content-box;
  border: 5px solid transparent;
  border-radius: var(--radius-pill);
  min-height: 40px;
}

.playlist-area::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.7);
  background-clip: content-box;
}

@supports not selector(::-webkit-scrollbar) {
  .playlist-area {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.4) transparent;
  }
}

/* ---------- station rows ---------- */

#playlist li,
#playlist li.draggable-favorite {
  background-color: transparent;
  color: var(--on-glass);
  border: none;
  border-bottom: 1px solid var(--row-divider);
  border-radius: var(--radius-pill);
  box-shadow: none;
  margin-bottom: 0;
  padding: 11px var(--space-4);
  gap: var(--space-3);
  font-size: var(--text-md);
  font-weight: 500;
  letter-spacing: -0.005em;
  scale: 1;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

#playlist li:last-child {
  border-bottom-color: transparent;
}

#playlist li:hover,
#playlist li.radio-mode:hover,
#playlist li.draggable-favorite:hover {
  background-color: var(--row-hover);
  color: var(--on-glass);
  scale: 1;
}

/* now-playing row: dark chip with an accent bar */
#playlist li.active,
#playlist li.draggable-favorite.active {
  background-color: var(--row-active);
  color: var(--accent);
  font-weight: 600;
  border-color: rgba(0, 242, 184, 0.40);
  box-shadow: var(--shadow-1);
}

/* radio stations: the broadcast icon (same one as in the player screen) */
#playlist li.active:not(.local-row)::before {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin-left: -2px;
  border-radius: 0;
  background: var(--accent);
  -webkit-mask: url("/img/stream_icon.svg") center / contain no-repeat;
  mask: url("/img/stream_icon.svg") center / contain no-repeat;
}

/* playing indicator: small accent dot in front of the title (local files) */
#playlist li.active::before {
  content: "";
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: var(--accent);
  z-index: 1;
}

#playlist li.active:hover {
  background-color: var(--row-active);
  color: var(--accent);
}

#playlist li.active::after {
  content: none;
}

#playlist li .progress,
#playlist li.radio-mode .progress {
  background-color: rgba(0, 242, 184, 0.24);
  /* the row clips it (overflow:hidden), so the fill follows the row's rounded
   * corners on the left and ends in a straight edge instead of a lens shape */
  border-radius: 0;
}

#playlist li {
  overflow: hidden;
}

#playlist li .title-ellipsis {
  min-width: 0;
}

#playlist li.active .remove-btn,
#playlist li.active:hover .remove-btn {
  color: var(--accent);
  background-color: transparent;
}

#playlist li:hover .remove-btn {
  color: var(--on-glass);
}

/* http badge: quieter */
#playlist li > span[style*="rgba(14, 139, 106"] {
  color: var(--on-glass-muted) !important;
  font-size: var(--text-xs) !important;
  border: 1px solid var(--row-divider);
  border-radius: var(--radius-pill);
  padding: 0 6px;
}

#playlistLoader {
  color: var(--on-glass);
}

/* ---------- now-playing screen ---------- */

.screen {
  background: linear-gradient(180deg, #1b2136 0%, #131829 100%);
  border: 1px solid rgba(0, 242, 184, 0.45);
  border-radius: var(--radius-pill);
  padding: 14px 22px;
  box-shadow: var(--shadow-2), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.screen::after {
  display: none;
}

.station-label,
.track-name {
  font-family: var(--font-ui);
}

.station-label {
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.track-name {
  font-size: var(--text-md);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
}

.track-name a {
  font-weight: 500;
}

.play-timer {
  font-size: 1.9rem;
  color: #fff;
  opacity: 0.95;
}

/* ---------- console (chat) ---------- */

.chat-container {
  border-radius: var(--radius-lg);
  outline: 1px solid rgba(0, 242, 184, 0.45);
  outline-offset: -1px;
  background: linear-gradient(180deg, #171c2d 0%, #121626 100%);
  box-shadow: var(--shadow-3);
}

.chat-header {
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--accent);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-ui);
  font-weight: 500;
  min-height: 44px;
  box-sizing: border-box;
}

/* quick commands: plain text links, no boxes */
#chatGenre {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-4);
}

#chatGenre a,
#chatGenre span {
  color: var(--accent) !important;
  font-size: var(--text-sm);
  margin: 0 !important;
  padding: 2px 0;
  text-decoration: none !important;
  opacity: 0.8;
  transition: opacity var(--t-fast) var(--ease);
}

#chatGenre a:hover {
  opacity: 1;
  text-decoration: underline !important;
  text-underline-offset: 3px;
}

.chat-username-box {
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--accent);
}

.chat-username-box:hover {
  color: #fff;
}

.chat-messages {
  font-size: 0.875rem;
  line-height: 1.55;
  font-weight: 400;
  padding: var(--space-3) var(--space-4);
  margin: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 242, 184, 0.4) transparent;
}

.chat-messages a {
  color: var(--accent);
}

.chat-messages a:hover {
  color: #fff;
  text-decoration: underline;
}

.chat-input-box {
  background: transparent;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: var(--space-3) var(--space-4);
  height: auto;
  margin: 0;
  gap: var(--space-2);
}

.chat-input-box input[type="text"] {
  height: 36px;
  box-sizing: border-box;
  padding: 0 var(--space-4);
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(0, 242, 184, 0.35);
  border-radius: var(--radius-pill);
  color: #fff;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  outline: none;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}

.chat-input-box input[type="text"]:focus {
  border-color: var(--accent);
  background-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(0, 242, 184, 0.2);
}

#chatInput::placeholder {
  color: var(--on-glass-muted);
}

.chat-send-btn {
  margin-left: 0;
}

.chat-send-btn img {
  height: 36px;
}

/* ---------- shared focus ring (keyboard) ---------- */

:where(button, a, [role="button"], select, input):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- modals ---------- */

.add-playlist-modal,
.gif-search-modal,
.local-help {
  background: rgba(8, 11, 20, 0.62);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.manifesto-modal {
  background-color: rgba(8, 11, 20, 0.5);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

/* desktop: dim the page with a soft vignette instead of blurring it */
@media (min-width: 1025px) {
  html body .manifesto-modal,
  html body.glass .manifesto-modal {
    background: radial-gradient(ellipse at 50% 45%, rgba(8, 11, 20, 0.28) 0%, rgba(4, 6, 14, 0.62) 55%, rgba(2, 3, 9, 0.86) 100%);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

.add-playlist-content,
.gif-search-content,
.manifesto-content,
#gitbookModal .manifesto-content,
.local-help-box {
  font-family: var(--font-ui);
  background: linear-gradient(180deg, #1a2033 0%, #131829 100%);
  border: 1px solid rgba(0, 242, 184, 0.35);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-3);
}

.donate-content {
  border-radius: var(--radius-xl);
}

body:not(.dark) .add-playlist-content,
body:not(.dark) .gif-search-content {
  background: #f6f7f9;
  border-color: rgba(23, 28, 43, 0.18);
  color: var(--ink);
}

.manifesto-content {
  font-family: var(--font-ui);
}

.add-playlist-content h3,
.gif-search-content h3 {
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: none;
}

.add-playlist-field label {
  font-weight: 500;
  letter-spacing: 0.02em;
  opacity: 0.7;
}

.add-playlist-field input,
.gif-search-input {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  padding: 10px var(--space-3);
  border-radius: var(--radius-sm);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

.add-playlist-field input:focus,
.gif-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 242, 184, 0.2);
}

body:not(.dark) .add-playlist-field input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(23, 28, 43, 0.12);
}

.add-playlist-close,
.gif-search-close,
.manifesto-close {
  border-radius: var(--radius-pill);
  transition: opacity var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}

.add-playlist-close:hover,
.gif-search-close:hover,
.manifesto-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* primary / secondary buttons */
.add-playlist-save,
.save-settings-btn,
.local-pop-btn,
.settings-btn,
.donate-copy-btn {
  font-family: var(--font-ui);
  font-weight: 600;
  border-radius: var(--radius-pill);
  transition: transform var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
}

.save-settings-btn:hover,
.add-playlist-save:hover {
  scale: 1;
  opacity: 0.9;
  transform: translateY(-1px);
}

.settings-btn:hover {
  background-color: rgba(0, 242, 184, 0.12);
}

.settings-btn-danger:hover {
  background-color: rgba(255, 95, 124, 0.12);
}

/* ---------- genre dropdown ---------- */

.genre-select-dropdown {
  background: rgba(18, 22, 36, 0.92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-3);
  margin-top: var(--space-2);
}

.genre-select-item {
  font-family: var(--font-ui);
  font-size: var(--text-md);
  font-weight: 500;
  padding: 9px var(--space-3);
}

.genre-select-item:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.genre-select-item.selected {
  background-color: rgba(0, 242, 184, 0.16);
  color: var(--accent);
  font-weight: 600;
}

/* ---------- top bar ---------- */

.top-bar-actions {
  gap: 10px;
}

.top-bar-actions button {
  opacity: 0.8;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.top-bar-actions button:hover {
  opacity: 1;
  transform: translateY(-3px);
}

/* ---------- popovers, toast ---------- */

.local-pop,
.local-toast {
  font-family: var(--font-ui);
}

.local-pop {
  border-color: rgba(0, 242, 184, 0.35);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-3);
}

.local-pop-item,
.local-pop-input {
  border-radius: var(--radius-sm);
}

/* ---------- loading + motion ---------- */

/* dim the list while a playlist is loading instead of showing it half-rendered */
.playlist-area:has(#playlistLoader:not(.hidden)) #playlist {
  opacity: 0.35;
  transition: opacity var(--t-med) var(--ease);
}

#playlist {
  transition: opacity var(--t-med) var(--ease);
}

#playlistLoader:not(.hidden) {
  background: var(--row-active);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-2);
  padding: var(--space-2) var(--space-5);
  font-family: var(--font-ui);
}

.left-panel,
.right-panel {
  transition: background-color 0.5s ease, background 0.5s ease;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ======================================================================
 * Player buttons (desktop). The SVGs in /img are glyph-only; the round
 * button surface, depth, glow and motion are all drawn here.
 * ====================================================================== */

:root {
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media all {
  .player-btn {
    --btn-bg: linear-gradient(145deg, #ffffff 0%, #e6e9f0 100%);
    --btn-edge: rgba(23, 28, 43, 0.08);
    --btn-shadow: 0 10px 22px rgba(23, 28, 43, 0.14), 0 2px 5px rgba(23, 28, 43, 0.10);
    --btn-hl: inset 0 1px 0 rgba(255, 255, 255, 0.95), inset 0 -2px 4px rgba(23, 28, 43, 0.05);
    --btn-glow: 0 0 0 1px rgba(0, 170, 130, 0.5), 0 12px 24px rgba(23, 28, 43, 0.18);

    box-sizing: border-box;
    padding: calc(var(--btn-size, 40px) * 0.21);
    border-radius: 50%;
    background: var(--btn-bg);
    border: 1px solid var(--btn-edge);
    box-shadow: var(--btn-shadow), var(--btn-hl);
    filter: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.35s var(--spring), box-shadow 0.25s var(--ease), background 0.25s var(--ease);
  }

  body.dark .player-btn {
    --btn-bg: linear-gradient(145deg, #252d47 0%, #161b2d 100%);
    --btn-edge: rgba(0, 242, 184, 0.30);
    --btn-shadow: 0 10px 24px rgba(0, 0, 0, 0.45), 0 2px 5px rgba(0, 0, 0, 0.35);
    --btn-hl: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 -2px 4px rgba(0, 0, 0, 0.3);
    --btn-glow: 0 0 0 1px rgba(0, 242, 184, 0.55), 0 12px 26px rgba(0, 0, 0, 0.45);
  }

  /* hover/press motion is desktop-only: on mobile the play button is centred
   * with its own transform (see mobile.css) which these would clobber */
  @media (min-width: 769px) {
    .player-btn:hover {
      transform: translateY(-3px) scale(1.05);
      box-shadow: var(--btn-glow), var(--btn-hl);
      filter: none;
    }

    .player-btn:active {
      animation: none;
      transform: translateY(0) scale(0.92);
      transition-duration: 0.08s;
      box-shadow: var(--btn-shadow), inset 0 3px 8px rgba(0, 0, 0, 0.18);
    }
  }

  /* toggled-on shuffle */
  #shuffleBtn.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 0 14px rgba(0, 242, 184, 0.35), var(--btn-hl);
  }

  /* big play / pause */
  .player-btn.play-btn,
  body.dark .player-btn.play-btn {
    --btn-bg: linear-gradient(145deg, #2dffd0 0%, #00d6a2 100%);
    --btn-edge: rgba(255, 255, 255, 0.35);
    --btn-shadow: 0 10px 22px rgba(0, 0, 0, 0.22), 0 2px 5px rgba(0, 0, 0, 0.14);
    --btn-hl: inset 0 2px 0 rgba(255, 255, 255, 0.55), inset 0 -4px 10px rgba(0, 120, 90, 0.35);
    --btn-glow: 0 14px 28px rgba(0, 0, 0, 0.26), 0 2px 6px rgba(0, 0, 0, 0.16);
    padding: calc(var(--btn-size, 120px) * 0.27);
    z-index: 2;
  }

  /* button sizes (padding scales with them); expanded mode enlarges them */
  #playPauseBtn { --btn-size: 120px; }
  #ffBtn, #rrBtn { --btn-size: 65px; }
  #shuffleBtn, #favBtn { --btn-size: 38px; }
  .player-controls.expanded #ffBtn,
  .player-controls.expanded #rrBtn { --btn-size: 90px; }
  .player-controls.expanded #playPauseBtn { --btn-size: 160px; }

  /* the decorative ring around play: calmer */
  .play-ellipse {
    opacity: 0.7;
  }

  /* ---- one-shot motion, toggled by js/player-fx.js (desktop only) ---- */

  @media (min-width: 769px) {
    .player-btn.fx-pop { animation: fx-pop 0.45s var(--spring); }
    .player-btn.fx-kick-r { animation: fx-kick-r 0.45s var(--spring); }
    .player-btn.fx-kick-l { animation: fx-kick-l 0.45s var(--spring); }
    .player-btn.fx-flip { animation: fx-flip 0.6s var(--spring); }
    .player-btn.fx-heart { animation: fx-heart 0.6s var(--spring); }
  }
}

@keyframes fx-pop {
  0% { transform: scale(0.8); }
  55% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* next / previous: a small press-in, no sideways shift (the button stays where it is) */
@keyframes fx-kick-r {
  0% { transform: scale(1); }
  35% { transform: scale(0.93); }
  100% { transform: scale(1); }
}

@keyframes fx-kick-l {
  0% { transform: scale(1); }
  35% { transform: scale(0.93); }
  100% { transform: scale(1); }
}

@keyframes fx-flip {
  0% { transform: rotate(0) scale(1); }
  50% { transform: rotate(180deg) scale(1.12); }
  100% { transform: rotate(360deg) scale(1); }
}

@keyframes fx-heart {
  0% { transform: scale(1); }
  25% { transform: scale(0.8); }
  55% { transform: scale(1.28); }
  100% { transform: scale(1); }
}

/* click ripple + heart sparks (spawned on body by js/player-fx.js) */
.fx-ripple {
  position: fixed;
  z-index: 40000;
  border-radius: 50%;
  border: 2px solid var(--accent);
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1);
  opacity: 0.7;
  animation: fx-ripple 0.7s var(--ease) forwards;
}

@keyframes fx-ripple {
  to { transform: translate(-50%, -50%) scale(2.1); opacity: 0; }
}

.fx-spark {
  position: fixed;
  z-index: 40000;
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 50%;
  background: #ff5c8a;
  pointer-events: none;
  animation: fx-spark 0.7s var(--ease) forwards;
}

@keyframes fx-spark {
  to { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; }
}

/* ======================================================================
 * Random-station button (single die) and volume control
 * ====================================================================== */

.player-btn.random-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

body.dark .player-btn.random-btn {
  color: var(--accent);
}

.random-btn .die-face {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  overflow: visible;
  transition: transform 0.4s var(--spring);
}

.random-btn .die-body {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.random-btn .pip {
  fill: currentColor;
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity 0.12s, transform 0.18s var(--spring);
}

.random-btn .pip.off {
  opacity: 0;
  transform: scale(0.3);
}

.random-btn:hover .die-face {
  transform: rotate(-14deg) scale(1.12);
}

.random-btn.is-rolling .die-face {
  animation: die-roll 0.65s cubic-bezier(0.3, 0.7, 0.3, 1);
}

@keyframes die-roll {
  0% { transform: translateY(0) rotate(0) scale(1); }
  30% { transform: translateY(-7px) rotate(200deg) scale(1.2); }
  60% { transform: translateY(0) rotate(400deg) scale(0.92); }
  80% { transform: translateY(-2px) rotate(350deg) scale(1.05); }
  100% { transform: translateY(0) rotate(360deg) scale(1); }
}

/* ---------- volume ---------- */

.volume-scale rect {
  fill: rgba(23, 28, 43, 0.16) !important;
  rx: 2px;
  transition: fill 0.25s var(--ease), filter 0.25s var(--ease);
}

body.dark .volume-scale rect {
  fill: rgba(255, 255, 255, 0.14) !important;
}

.volume-scale rect.on,
body.dark .volume-scale rect.on {
  fill: var(--accent) !important;
  filter: drop-shadow(0 0 4px rgba(0, 242, 184, 0.55));
}

.volume-scale #vol {
  opacity: 1;
}

.volume-slider {
  --vol-px: 0px;
}

.volume-slider .volume-line {
  height: 9px;
  width: 113px;
}

/* accent fill from the left edge up to the knob */
.volume-slider::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  height: 6px;
  width: var(--vol-px);
  transform: translateY(-50%);
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(0, 242, 184, 0.55), var(--accent));
  box-shadow: 0 0 10px rgba(0, 242, 184, 0.4);
  pointer-events: none;
  z-index: 1;
}

.volume-slider .volume-knob {
  width: 14px;
  height: 30px;
  box-sizing: border-box;
  padding: 0;
  object-fit: contain;
  top: 50%;
  z-index: 2;
  border-radius: 7px;
  background: linear-gradient(145deg, #ffffff 0%, #e3e7ee 100%);
  border: 1px solid rgba(23, 28, 43, 0.12);
  box-shadow: 0 4px 10px rgba(23, 28, 43, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  filter: none;
  transition: transform 0.25s var(--spring), box-shadow 0.2s var(--ease);
}

body.dark .volume-slider .volume-knob {
  background: linear-gradient(145deg, #2a3350 0%, #161b2d 100%);
  border-color: rgba(0, 242, 184, 0.45);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.volume-slider .volume-knob:hover,
.volume-slider.dragging .volume-knob {
  transform: translate(-50%, -50%) scale(1.2);
  box-shadow: 0 0 0 4px rgba(0, 242, 184, 0.3), 0 6px 16px rgba(0, 242, 184, 0.35);
  filter: none;
}

.volume-slider.dragging .volume-knob {
  transform: translate(-50%, -50%) scale(1.05);
}

/* icon-only random button */
@media (min-width: 769px) {
  #randomBtn.random-btn {
    width: 46px;
    height: 46px;
    padding: 0;
    border-radius: 50%;
  }
}

/* Symmetric control columns: both stacks share one width (the volume slider's)
 * so the play button sits exactly in the middle, and the bottom items line up. */
@media (min-width: 769px) {
  .left-stack,
  .right-stack {
    width: 113px;
  }

  .volume-container {
    margin-top: -14px;
  }
}

/* button tooltips (created in js/player.js) */
.custom-tooltip {
  font-family: var(--font-ui) !important;
  font-size: var(--text-xs) !important;
  font-weight: 600;
  color: var(--accent) !important;
  background: rgba(18, 22, 36, 0.92);
  border: 1px solid rgba(0, 242, 184, 0.35);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  box-shadow: var(--shadow-2);
  z-index: 41000;
}

/* share icon on the active row: readable instead of dark-on-dark */
#playlist li.active img[alt="Share station"] {
  filter: brightness(0) invert(1);
  opacity: 0.55;
  transition: opacity var(--t-fast) var(--ease);
}

#playlist li.active img[alt="Share station"]:hover {
  opacity: 1;
}

/* progress on the playing row stays clearly visible, hovered or not */
#playlist li.active .progress {
  background-color: rgba(0, 242, 184, 0.34);
}

#playlist li.active:hover .progress {
  background-color: rgba(0, 242, 184, 0.42);
}

/* mobile: compact round random button (mobile.css positions it) */
@media (max-width: 768px) {
  /* horizontal pill: die + label (the label is mobile-only, desktop is icon-only) */
  #randomBtn.random-btn {
    width: 132px;
    height: 44px;
    padding: 0 16px;
    border-radius: var(--radius-pill);
    top: 160px;
  }

  /* mobile.css gives the right panel 40px of top padding; the genre row needs far less */
  /* mobile.css loads after this file, so these need the extra specificity */
  .container .right-panel {
    padding-top: 14px;
  }

  /* the desktop console button stays hidden; the phone console has its own */
  #chatToggleBtn {
    display: none !important;
  }

  #mobileChatToggleBtn {
    min-width: 44px;
    height: 44px;
    padding: 0 14px;
    border-radius: var(--radius-pill);
    font-family: 'Technology', monospace;
    font-size: 1.05rem;
    letter-spacing: 1px;
    box-shadow: var(--shadow-2);
    margin-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* room for the lowered random button */
  .left-panel .player-controls {
    margin-bottom: 34px;
  }

  #randomBtn.random-btn::after {
    content: "Random";
    font-size: var(--text-sm);
    font-weight: 600;
  }
}

@media (max-width: 768px) {
  /* mobile.css clamps the placeholder to 6ch and the active title to width-160px */
  .right-panel .genre-search::placeholder {
    width: auto;
  }

  #playlist li.active .title-ellipsis {
    max-width: calc(100% - 64px);
  }
}

/* scrollIntoView() snaps the playing row to the edge; keep a margin so it
 * lands with the same breathing room as the first row at the top. */
#playlist li {
  scroll-margin-top: 12px;
  scroll-margin-bottom: 12px;
}

/* With a real album cover showing, the play button shrinks so the art is visible. */
@media (min-width: 769px) {
  .center-circle .play-btn {
    transition: transform 0.35s var(--spring), box-shadow 0.25s var(--ease), background 0.25s var(--ease),
                width 0.5s var(--ease), height 0.5s var(--ease), top 0.5s var(--ease), left 0.5s var(--ease);
  }

  .center-circle.has-cover #playPauseBtn,
  .center-circle.has-disc #playPauseBtn {
    --btn-size: 34px;
    width: 34px;
    height: 34px;
    top: 83px;
    left: 83px;
  }
}

/* small disc, big glyph: far less padding than the normal 27% */
.center-circle.has-cover #playPauseBtn,
.center-circle.has-disc #playPauseBtn {
  padding: calc(var(--btn-size, 34px) * 0.1);
}

/* hover/press: grow and shrink in place, no lift (the glyph used to slide up) */
@media (min-width: 769px) {
  .center-circle.has-cover #playPauseBtn:hover,
  .center-circle.has-disc #playPauseBtn:hover {
    transform: scale(1.08);
  }

  .center-circle.has-cover #playPauseBtn:active,
  .center-circle.has-disc #playPauseBtn:active {
    transform: scale(0.94);
  }
}

/* Glass theme, cover showing: white glyph on a small glass disc. The disc is a
 * pseudo-element on the circle: the glyph needs a filter to turn white, which
 * would whiten a dark disc drawn on the button itself. Other themes simply
 * keep their own (smaller) play button, see above. */
body.glass .center-circle.has-cover #playPauseBtn {
  background: none;
  border-color: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  filter: brightness(0) invert(1);
}

body.glass .center-circle.has-cover #playPauseBtn:hover,
body.glass .center-circle.has-cover #playPauseBtn:active {
  box-shadow: none;
}

body.glass .center-circle.has-cover::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  /* clear glass, not frosted: barely any blur, so the art stays sharp through it */
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 38%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.30), rgba(255, 255, 255, 0.04) 52%, rgba(255, 255, 255, 0.20)),
    rgba(10, 14, 40, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.85),
    inset 0 -1.5px 3px rgba(255, 255, 255, 0.28),
    inset 0 0 8px rgba(255, 255, 255, 0.22),
    0 6px 14px rgba(0, 0, 0, 0.30);
  -webkit-backdrop-filter: blur(1.5px) saturate(190%) brightness(1.12);
  backdrop-filter: blur(1.5px) saturate(190%) brightness(1.12);
  pointer-events: none;
  z-index: 1;
}

@media (max-width: 768px) {
  .center-circle.has-cover #playPauseBtn,
  .center-circle.has-disc #playPauseBtn {
    --btn-size: 42px;
    width: 42px;
    height: 42px;
  }

  body.glass .center-circle.has-cover::after {
    width: 42px;
    height: 42px;
  }
}

/* overflow-x:hidden on the list made it a scroll container of its own, which
 * stops position:sticky (local breadcrumb bar) from working against the real
 * scroller. clip hides the same overflow without creating a scroll container. */
#playlist {
  overflow-x: clip;
  overflow-y: visible;
}


/* Player controls in one row: js/chat-resize.js switches to this when the console
 * has been dragged so tall that the stacked layout would have to shrink too far.
 * Two equal 1fr columns around the play button keep it exactly centred. */
@media (min-width: 1025px) {
  .player-controls.controls-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
  }

  .player-controls.controls-row .left-stack,
  .player-controls.controls-row .right-stack {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    width: auto;
    height: auto;
  }

  .player-controls.controls-row .left-stack { justify-content: flex-end; }
  .player-controls.controls-row .right-stack { justify-content: flex-start; }

  .player-controls.controls-row #randomBtn { order: 1; }
  .player-controls.controls-row #shuffleBtn { order: 2; }
  .player-controls.controls-row #rrBtn { order: 3; }
  .player-controls.controls-row .center-circle { zoom: 0.55; }
  .player-controls.controls-row #ffBtn { order: 1; }
  .player-controls.controls-row #favBtn { order: 2; }
  .player-controls.controls-row .volume-container { order: 3; margin-top: 0; }

  .player-controls.controls-row #rrBtn,
  .player-controls.controls-row #ffBtn {
    --btn-size: 52px;
    width: 52px;
    height: 52px;
  }
}

/* ---------- FONY tips (console) ---------- */

.chat-messages .tips-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chat-messages a.tips-chip {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid rgba(0, 242, 184, 0.5);
  border-radius: var(--radius-pill);
  background: rgba(0, 242, 184, 0.08);
  color: var(--accent);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}

.chat-messages a.tips-chip:hover {
  background: rgba(0, 242, 184, 0.22);
  border-color: var(--accent);
  text-decoration: none;
}

.chat-messages .tips-item {
  margin-top: 12px;
  padding-left: 10px;
  border-left: 2px solid rgba(0, 242, 184, 0.4);
  line-height: 1.5;
}

.chat-messages .tips-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
}

.chat-messages a.tips-try {
  color: var(--accent);
  font-size: var(--text-sm);
}

.chat-messages a.tips-act {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.chat-messages a.tips-act:hover {
  text-decoration-style: solid;
}

/* tip of the day: plain text, no frame or background */

@keyframes tipCardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes tipBulb {
  0%, 100% { transform: rotate(0deg) scale(1); }
  30% { transform: rotate(-14deg) scale(1.15); }
  60% { transform: rotate(10deg) scale(1.1); }
}

.chat-messages .tip-card {
  max-width: 62ch; /* wrap earlier so it reads as a short note, not one wide line */
  line-height: 1.5;
  animation: tipCardIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.chat-messages .tip-card-icon {
  display: inline-block;
  margin-right: 4px;
  transform-origin: 50% 80%;
  animation: tipBulb 1.4s ease-in-out 0.5s 2;
}

.chat-messages .tip-card-links {
  margin-top: 4px;
  font-size: var(--text-sm);
  opacity: 0.75;
}

.chat-messages .tip-card-links a {
  color: var(--accent);
  text-decoration: none;
}

.chat-messages .tip-card-links a:hover {
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  .chat-messages .tip-card,
  .chat-messages .tip-card-icon { animation: none; }
}

/* ---------- /skins studio (console card) ---------- */

.sk-card {
  display: grid;
  gap: 12px;
  padding: 2px 0 4px;
}

.sk-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.sk-spacer {
  flex: 1;
}

.sk-label {
  margin-right: 2px;
  font-size: var(--text-sm);
  opacity: 0.7;
}

.sk-ico {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.4s var(--spring);
}

.sk-ico .sk-dot,
.sk-die circle,
.sk-ico-fill {
  fill: currentColor;
  stroke: none;
}

.sk-die-body {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.sk-cat:hover .sk-die {
  transform: rotate(-14deg) scale(1.12);
}

.sk-cat:hover .sk-ico:not(.sk-die) {
  transform: scale(1.12);
}

/* quiet actions: plain text, no frame */
.sk-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: var(--text-sm);
  opacity: 0.7;
  cursor: pointer;
  transition: opacity var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.sk-link:hover {
  color: var(--accent);
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sk-link .sk-ico {
  width: 16px;
  height: 16px;
}

.sk-cat .sk-ico {
  width: 20px;
  height: 20px;
}

/* category switches: bare icons, the active one lit and underlined */
.sk-cat {
  padding: 4px 6px 3px;
  border-bottom: 2px solid transparent;
  color: var(--accent);
  opacity: 0.6;
}

.sk-cat:hover {
  text-decoration: none;
}

.sk-cat.on {
  border-bottom-color: var(--accent);
  opacity: 1;
}

.sk-art img {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: cover;
}

.sk-slots {
  display: flex;
  gap: 8px;
}

.sk-slot {
  position: relative;
  display: inline-flex;
}

.sk-thumb {
  width: 48px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 7px;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}

.sk-thumb:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.65);
}

.sk-thumb.on {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.sk-x {
  position: absolute;
  top: -6px;
  right: -6px;
  display: none;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #171C2B;
  color: #fff;
  font-size: 12px;
  line-height: 16px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.sk-slot:hover .sk-x {
  display: block;
}

/* ---------- placeholder discs (no album art) ----------
 * The art is cd.svg / vinyl.svg / reel.svg as the background of .album-cover-bg.
 * A centre piece is drawn on top of each, inside the same spinning element and
 * below the play/pause button: the clear hub ring of a CD, the paper label of a
 * record, the spindle hub of a reel. No holes: the button glyph sits there. */

.album-cover-bg[style*="cd.svg"]::after,
.album-cover-bg[style*="vinyl.svg"]::after,
.album-cover-bg[style*="reel.svg"]::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* CD: the clear plastic hub ring */
.album-cover-bg[style*="cd.svg"]::after {
  width: 28%;
  height: 28%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.25) 0 62%, rgba(255, 255, 255, 0.5) 63% 67%, transparent 69%);
  box-shadow: inset 0 0 6px rgba(255, 255, 255, 0.35);
}

/* record: paper label */
.album-cover-bg[style*="vinyl.svg"]::after {
  width: 34%;
  height: 34%;
  background:
    radial-gradient(circle, transparent 0 56%, rgba(0, 0, 0, 0.25) 57% 59%, transparent 60%),
    radial-gradient(circle at 35% 30%, #4dffd9 0%, #00d9a6 45%, #00916f 100%);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.45), inset 0 0 8px rgba(0, 0, 0, 0.35);
}

/* reel: metal spindle hub */
.album-cover-bg[style*="reel.svg"]::after {
  width: 26%;
  height: 26%;
  background: radial-gradient(circle, #d6d6d6 0 62%, #8d8d8d 63% 72%, #3a3a3a 73% 100%);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* ---------- search field: a magnifier instead of the placeholder text ----------
 * Only while the placeholder is a search hint ("Search across all genres",
 * "Search this view"): other placeholders, like "New playlist name", stay text. */

:root {
  --lupe: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none' stroke='white' stroke-opacity='0.9' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='8.5' cy='8.5' r='5.5'/%3E%3Cpath d='M12.7 12.7 17 17'/%3E%3C/svg%3E");
}

.genre-search[placeholder^="Search"] {
  background-image: var(--lupe);
  background-repeat: no-repeat;
  background-position: 11px center;
  background-size: 16px 16px;
  padding-left: 34px;
}

.genre-search[placeholder^="Search"]::placeholder {
  color: transparent;
}

/* Favorites is just your saved stations: no "+" (add playlist) and no search there */
.genre-box:has(#favoritesFilterBtn.active) #addPlaylistBtn,
.genre-box:has(#favoritesFilterBtn.active) .search-wrapper {
  display: none;
}

/* "Sort by" in Favorites: an icon instead of the words */
.favorites-sort label.sort-ico {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  font-size: 0;
  background: currentColor;
  color: #fff;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 5h9M3 10h6M3 15h3'/%3E%3Cpath d='M15 4v12M12 13l3 3 3-3'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 5h9M3 10h6M3 15h3'/%3E%3Cpath d='M15 4v12M12 13l3 3 3-3'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: 0.9;
  cursor: pointer;
}

/* ---------- Favorites sort: plain underlined text, styled menu ----------
 * Chrome's customizable select (appearance: base-select) lets the open menu be
 * styled; browsers without it keep their native menu. The closed select stays
 * plain text (no pill, no fill). */

@supports (appearance: base-select) {
  .favorites-sort select,
  .favorites-sort select::picker(select) {
    appearance: base-select;
  }

  .favorites-sort select {
    padding: 4px 0;
    border: none;
    background: transparent;
  }

  .favorites-sort select::picker-icon {
    display: none;
  }

  .favorites-sort select::picker(select) {
    margin-top: 8px;
    padding: 6px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    background: rgba(18, 22, 36, 0.94);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow-3);
    color: #fff;
  }

  .favorites-sort select option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: transparent;
    color: #fff;
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
  }

  .favorites-sort select option::checkmark {
    display: none;
  }

  .favorites-sort select option:hover,
  .favorites-sort select option:focus-visible {
    background: rgba(255, 255, 255, 0.1);
  }

  .favorites-sort select option:checked {
    background: rgba(0, 242, 184, 0.16);
    color: var(--accent);
    font-weight: 600;
  }
}

/* Active station: the genre icon comes first, the broadcast icon after it */
#playlist li.active .station-favorite-icon {
  order: -1;
}

/* radio stations: the station logo replaces the broadcast icon when one is found */
#playlist li.active.has-logo:not(.local-row)::before {
  content: "" !important;
  flex: 0 0 30px !important;
  width: 30px !important;
  height: 30px !important;
  margin-left: -4px !important;
  border-radius: 6px !important;
  background: var(--station-logo) center / cover no-repeat !important;
  -webkit-mask: none !important;
  mask: none !important;
  filter: none !important;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}

/* ---------- search: a magnifier that slides open (desktop) ----------
 * The magnifier is always the last item of the row (before the back-to-radio icon). Closed it is just
 * the icon, no plate. Opening grows the field into the free space of the row: it never covers its
 * neighbours and never gets wider than what is left. */

@media (min-width: 769px) {
  .genre-box .search-wrapper {
    position: relative;
    flex: 0 1 auto;
    width: 32px;
    min-width: 32px;
    height: 36px;
    margin-left: auto;
    transition: width 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  /* when the field opens, the long things in the row give way (with an ellipsis) instead of overflowing */
  .genre-box > *:not(.search-wrapper):not(.custom-genre-select):not(#nostrModeLabel):not(#localModeLabel) { flex-shrink: 0; }
  .genre-box .custom-genre-select { flex: 0 1 auto; min-width: 80px; }
  .genre-box .genre-select-header { min-width: 0; }
  .genre-box .genre-select-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .genre-box #nostrModeLabel,
  .genre-box #localModeLabel { flex-shrink: 1; min-width: 0; overflow: hidden; white-space: nowrap; }
  .genre-box .nostr-who { flex-shrink: 1; min-width: 0; }
  .genre-box #nostrModeLabel,
  .genre-box #localModeLabel { margin-right: 0; }
  .genre-box #radioModeBtn { margin-left: 2px; }

  .genre-box .search-wrapper:hover,
  .genre-box .search-wrapper:focus-within,
  .genre-box .search-wrapper:has(.genre-search:not(:placeholder-shown)) {
    width: 280px;
  }

  .genre-box .search-wrapper .genre-search[placeholder^="Search"] {
    height: 36px;
    transition: padding 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), background-position 0.35s cubic-bezier(0.2, 0.7, 0.2, 1),
      border-color 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
  }

  /* closed: only the magnifier, no plate and no outline */
  .genre-box .search-wrapper:not(:hover):not(:focus-within) .genre-search[placeholder^="Search"]:placeholder-shown {
    padding-left: 0;
    padding-right: 0;
    background-image: var(--lupe) !important;
    background-color: transparent !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
    background-size: 20px 20px !important;   /* about the size of the icons next to it */
    border-color: transparent !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    cursor: pointer;
    caret-color: transparent;
  }

  .genre-box .search-wrapper:not(:hover):not(:focus-within) #clearSearch { display: none !important; }
}

/* narrow desktop windows: drop the "Genre:" word to leave room for the search field */
@media (min-width: 769px) and (max-width: 1000px) {
  .genre-box label[for="customGenreSelect"] { display: none; }
}

/* the browser's autofill / suggestion highlight turned the search field white (and hid the clear cross) */
.genre-search:-webkit-autofill,
.genre-search:-webkit-autofill:hover,
.genre-search:-webkit-autofill:focus {
  -webkit-text-fill-color: #fff;
  caret-color: #fff;
  box-shadow: 0 0 0 100px rgba(18, 22, 36, 0.9) inset;
  transition: background-color 600000s ease 0s;
}

.genre-search { color-scheme: dark; }

/* the clear cross stays visible and clickable above the field */
#clearSearch {
  z-index: 2;
  padding: 4px;
  right: 6px;
  color: rgba(255, 255, 255, 0.85);
}

/* the genre list is as wide as its longest name, whatever width the closed select has in the row */
.custom-genre-select .genre-select-dropdown {
  right: auto;
  min-width: max(100%, 230px);
  width: max-content;
  max-width: min(340px, 92vw);
}

.custom-genre-select .genre-select-item-name {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

/* genre list: a thin, quiet scrollbar */
.custom-genre-select .genre-select-dropdown {
  scrollbar-width: auto;       /* the ::-webkit-scrollbar rules below apply (the standard thin one would be an auto-hiding overlay) */
  scrollbar-color: auto;
}

.custom-genre-select .genre-select-dropdown::-webkit-scrollbar { width: 8px; }
.custom-genre-select .genre-select-dropdown::-webkit-scrollbar-track { background: transparent; margin: 8px 0; }
.custom-genre-select .genre-select-dropdown::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  border: 1px solid transparent;
  background-clip: padding-box;
}
.custom-genre-select .genre-select-dropdown::-webkit-scrollbar-thumb:hover { background: rgba(0, 242, 184, 0.7); background-clip: padding-box; }
