.modal-description .info-body--full {
  font-size: 15px;
  line-height: 1.7;
  color: var(--fg);
}
/* FAVORITES: Ajuste visual para listado de pistas y cabecera de álbum */
.favorites-album-header {
  font-weight: 600;
  font-size: 15px;
  color: var(--fg);
  margin: 18px 0 6px 0;
  padding-left: 8px;
  letter-spacing: 0.01em;
}
.favorites-album-header:first-child {
  margin-top: 0;
}
/* Card visual para cada álbum de favoritos */
.favorites-album-card {
  background: var(--collection-card-bg, var(--surface-2, #fff));
  border-radius: 14px;
  border: 1px solid var(--surface-border, #e0e0e0);
  box-shadow: var(--collection-shadow, 0 2px 12px rgba(0,0,0,0.08));
  margin-bottom: 24px;
  padding: 0 0 8px 0;
  transition: box-shadow 0.2s;
}
.favorites-album-card:hover {
  box-shadow: 0 4px 18px 0 rgba(0,0,0,0.13);
}
.favorites-album-card .tracks-container {
  background: none;
  border: none;
  border-radius: 0;
  margin: 0;
  box-shadow: none;
  padding: 0 8px 8px 8px;
}
.favorites-list .tlv2-row {
  border-bottom: 1px solid var(--surface-border-subtle, #ececec);
}
.favorites-list .tlv2-row:last-child {
  border-bottom: none;
}
.favorites-list .tlv2-row {
  background: transparent;
}
#description-container {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5em;
  align-items: center;
  margin-bottom: 0.5em;
}
#description-container .btn-secondary,
#description-container .icon-control {
  margin: 0;
}

.icon-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.icon-control .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-control .btn-svg {
  width: 18px;
  height: 18px;
  display: block;
  stroke: currentColor;
  fill: none;
}

.icon-control:hover {
  background: rgba(var(--primary-rgb), 0.12);
  border-color: rgba(var(--primary-rgb), 0.24);
  color: var(--fg);
}

.icon-control:active {
  background: rgba(var(--primary-rgb), 0.18);
}

.icon-control:focus {
  outline: none;
}

.icon-control:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring-shadow);
}

.icon-control.active {
  background: rgba(var(--primary-rgb), 0.22);
  border-color: rgba(var(--primary-rgb), 0.45);
  color: var(--fg);
}

.icon-control.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Shared overlay shell for panels (search/results/tracks) */
.panel-overlay {
  background: var(--collection-panel-bg, var(--card));
  border: var(--panel-border, 2px solid rgba(128, 128, 128, 0.3));
  box-shadow: var(--panel-shadow, 0 8px 28px rgba(0,0,0,0.45), 0 0 0 3px rgba(var(--primary-rgb), 0.18));
  border-radius: var(--panel-radius, 16px);
}

/* Shared header styling for overlay panels */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Shared tracklist base (aligned with Search list styles) */
.tracklist {
  border: none;
  border-radius: 8px;
  background: var(--collection-subpanel-bg, var(--surface-subtle, rgba(255,255,255,0.02)));
  box-shadow: none;
  box-sizing: border-box;
}

/* Current album tracks: inline panel (not modal) — position overridden by #tracks-list-container.tracks-inline */
.tracklist.tracks-inline {
  display: block;
  position: relative;
  width: 100%;
  max-height: none;
  margin-top: 0;
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.tracklist .search-results-header {
  margin: 0;
}

.tracklist .tracks-overlay-count {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
}

.tracklist .tracks-overlay-list {
  padding-bottom: 6px;
}

.tracklist__list {
  overflow-x: hidden;
  height: auto;
  margin: 0 auto;
  padding: 0 10px;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0) + var(--vv-bottom-inset, 0px));
}

.tracklist__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tracklist__summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 10px 0;
  flex-wrap: wrap;
}

.tracklist__summary-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
}

.tracklist__summary-duration {
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.tracklist__summary-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

/* Unified track row styling across contexts */
.track-row {
  background: var(--collection-row-bg, transparent);
  border: 1px solid var(--surface-border-subtle, rgba(255,255,255,0.08));
  box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb), 0.08);
  border-radius: 10px;
}

.track-row:hover {
  background: var(--collection-row-hover-bg, var(--surface-hover, rgba(var(--primary-rgb), 0.12)));
}

/* In-player Tracks overlay: match track cards styling */
#tracks-list-container .tlv2-row,
#tracks-list-container .track-row {
  background: var(--collection-row-bg, var(--surface-2, rgba(255,255,255,0.04)));
  border: 1px solid var(--surface-border, rgba(255,255,255,0.12));
  box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb), 0.08);
  border-radius: 10px;
  padding: 10px 8px;
}

#tracks-list-container .tlv2-row:hover,
#tracks-list-container .tlv2-row:focus-visible,
#tracks-list-container .track-row:hover,
#tracks-list-container .track-row:focus-visible {
  background: var(--collection-row-hover-bg, var(--surface-hover, rgba(var(--primary-rgb), 0.12)));
}

.track-row-title {
  font-weight: 600;
  color: var(--fg);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: block;
  min-width: 0;
}

/* Track title ticker inside Tracks overlay */
@keyframes tracksTicker {
  0%, 15% { transform: translateX(0%); }
  85%, 100% { transform: translateX(-60%); }
}

.tracklist .track-item-info,
.tracklist .tlv2-info,
.tracks-container .tlv2-info,
.tracks-container .track-item-info,
.search-results .favorite-title,
.search-results .result-title,
.card-grid .card-title {
  overflow: hidden;
}

/* Track titles - base styles for overflow handling */
/* Multi-line titles with proper ellipsis when not using ticker animation */
body.tracks-open #tracks-list-container .track-title,
.tracklist .track-title,
body.tracks-open #tracks-list-container .tlv2-title,
.tracklist .tlv2-title,
body.tracks-open #tracks-list-container .track-row-title,
.tracklist .track-row-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  min-width: 0;
}

/* Search results and card titles - keep ellipsis behavior */
.search-results .favorite-title,
.search-results .result-title,
.card-grid .card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  min-width: 0;
}

body.tracks-open #tracks-list-container .track-title .ticker-text,
.tracklist .track-title .ticker-text,
.search-results .favorite-title .ticker-text,
.search-results .result-title .ticker-text,
.card-grid .card-title .ticker-text,
body.tracks-open #tracks-list-container .tlv2-title .ticker-text,
.tracklist .tlv2-title .ticker-text,
body.tracks-open #tracks-list-container .track-row-title .ticker-text,
.tracklist .track-row-title .ticker-text {
  display: inline-block;
  white-space: nowrap;
  text-overflow: clip;
  will-change: transform;
  padding-right: 24px;
}

body.tracks-open #tracks-list-container .track-title .ticker-text.ticker,
body.tracks-open #tracks-list-container .tlv2-title .ticker-text.ticker,
body.tracks-open #tracks-list-container .track-row-title .ticker-text.ticker,
.tracklist .track-title .ticker-text.ticker,
.tracklist .tlv2-title .ticker-text.ticker,
.tracklist .track-row-title .ticker-text.ticker,
.search-results .favorite-title .ticker-text.ticker,
.search-results .result-title .ticker-text.ticker,
.card-grid .card-title .ticker-text.ticker {
  display: inline-block;
  white-space: nowrap;
  text-overflow: clip;
  will-change: transform;
  padding-right: 24px;
  animation: tracksTicker var(--list-ticker-duration, 14s) linear infinite;
}

body.tracks-open #tracks-list-container .track-title:hover .ticker-text,
body.tracks-open #tracks-list-container .tlv2-title:hover .ticker-text,
body.tracks-open #tracks-list-container .track-row-title:hover .ticker-text,
.tracklist .track-title:hover .ticker-text,
.tracklist .tlv2-title:hover .ticker-text,
.tracklist .track-row-title:hover .ticker-text,
.search-results .favorite-title:hover .ticker-text,
.search-results .result-title:hover .ticker-text,
.card-grid .card-title:hover .ticker-text {
  animation-play-state: paused;
}

/* Tracklist V2 inside the overlay should allow scrolling (parent handles size) */
body.tracks-open #tracks-list-container .tlv2-list {
  /* Let parent container handle overflow */
  overflow: auto;
  max-height: none;
  padding: 4px 2px 6px 2px;
  /* Smooth scrolling for better UX */
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* === Estilos para el listado de pistas del álbum actual === */

.album-tracklist-container {
  margin-top: 1em;
  text-align: left;
  width: 100%;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  background: var(--collection-panel-bg, #f9f9f9);
  border: 1px solid var(--surface-border, rgba(0, 0, 0, 0.08));
  box-shadow: var(--collection-shadow, 0 2px 12px rgba(0,0,0,0.10));
  border-radius: 14px;
  padding: 0.5em 0.2em 1em 0.2em;
}

#album-tracklist {
  max-height: 60vh;
  min-height: 120px;
  overflow-y: auto;
  margin-bottom: 1em;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  background: var(--collection-subpanel-bg, #fff);
  border: 1px solid var(--surface-border-subtle, rgba(0, 0, 0, 0.08));
  scrollbar-width: thin;
  scrollbar-color: var(--muted) var(--collection-subpanel-bg, #f0f0f0);
}

#album-tracklist::-webkit-scrollbar {
  width: 8px;
}
#album-tracklist::-webkit-scrollbar-thumb {
  background: var(--muted);
  border-radius: 4px;
}
#album-tracklist::-webkit-scrollbar-track {
  background: var(--collection-subpanel-bg, #f0f0f0);
  border-radius: 4px;
}

/* Ajuste para el listado de pistas dentro del contenedor */
.album-tracklist-container .tracks-list {
  max-height: none;
  padding: 0.5em 0.2em;
  background: var(--collection-subpanel-bg, #fff);
  border-radius: 10px;
  box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}
.album-tracklist-empty {
  padding: 0.8em;
  color: var(--muted);
  font-style: italic;
}
/* Modal de descripción */
.description-modal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.description-modal-content {
  background: var(--card);
  border: 2px solid rgba(128, 128, 128, 0.3);
  box-shadow: 0 8px 32px rgba(0,0,0,0.55), 0 0 0 4px rgba(var(--primary-rgb), 0.2);
  border-radius: 16px;
  padding: 32px 24px 24px 24px;
  max-width: 480px;
  width: 90vw;
  max-height: 70vh;
  overflow-y: auto;
  position: relative;
  color: var(--fg);
}
.modal-description {
  font-size: 16px;
  line-height: 1.7;
  color: var(--fg);
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
}
.modal-description .info-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.modal-description .info-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: 0.01em;
}
.modal-description .info-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}
.modal-description .info-meta-item {
  color: var(--muted);
}
.modal-description .info-body {
  font-size: 15px;
  line-height: 1.7;
  color: var(--fg);
  text-align: left;
  text-justify: auto;
  word-spacing: normal;
  hyphens: auto;
}
.modal-description .info-body p {
  margin: 0 0 0.9em 0;
}
.modal-description .info-body p:last-child {
  margin-bottom: 0;
}
.modal-description .info-body ul,
.modal-description .info-body ol {
  margin: 0 0 1em 1.2em;
  padding: 0;
}
.modal-description .info-body li {
  margin-bottom: 0.35em;
}
.modal-description .info-content {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.modal-description .info-toggle {
  margin-top: 14px;
  align-self: flex-end;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: var(--surface-subtle);
  color: var(--fg);
  cursor: pointer;
  font-size: 12.5px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border 0.2s ease;
}
.modal-description .info-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(var(--primary-rgb), 0.4);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
}
.modal-description .info-searches {
  margin-top: 18px;
  border-top: 1px solid var(--surface-border-subtle);
  padding-top: 14px;
}
.modal-description .info-searches-title {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.modal-description .info-searches-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.modal-description .info-chip {
  background: var(--chip-bg, rgba(var(--primary-rgb), 0.16));
  color: var(--chip-fg, var(--fg));
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11.5px;
  border: 1px solid rgba(var(--primary-rgb), 0.25);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.modal-description .info-chip--action {
  cursor: pointer;
  background: var(--chip-bg-quiet, rgba(var(--primary-rgb), 0.12));
}
.modal-description .info-chip:hover,
.modal-description .info-chip--action:hover {
  border-color: rgba(var(--primary-rgb), 0.45);
}
.close-description-modal {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
  display: inline-flex;
}

/**
 * Resonate Player - Enhanced CSS (2025)
 * Modern music streaming interface with adaptive design
 * Optimized for performance and user experience across devices
 * 
 * REFACTORING IMPROVEMENTS:
 * - Consolidated transition variables for consistency
 * - Enhanced shadow variables for better depth control
 * - Organized button states with clear pseudo-class patterns
 * - Mobile-first responsive design with semantic breakpoints
 * 
 * For maintenance notes, see CSS_REFACTORING_NOTES.md
 */

/* ===== CSS VARIABLES & RESET ===== 
   All variables follow a naming convention:
   - Color: --{purpose} (e.g., --bg, --accent, --btn)
   - Spacing: --spacing-{size} (e.g., --spacing-sm, --spacing-lg)
   - Transitions: --transition-{type} (e.g., --transition-fast, --transition-bounce)
   - Sizing: --{component}-size-{breakpoint} (e.g., --art-size-mobile)
   
   For maintenance, update variables here and all uses update automatically.
 */
:root {
  /* Color Palette - Modo Día (por defecto) - Ahorro de energía con colores oscuros */
  --bg: #0f0f0f;
  --bg-rgb: 15, 15, 15;
  --fg: #ffffff;
  --muted: #b0b8c1;
  --accent: #e8e8f5;
  --accent-alt: #38bdf8;
  --highlight: #f472b6;
  --secondary: #fbbf24;
  --primary: #3da9ff;
  --primary-text: var(--primary);
  --primary-rgb: 61, 169, 255;
  --error: #ff5555;
  --success: #2ecc71;
  --warning: #ffb84d;
  --control-fg: var(--fg);

  /* Themed UI tokens (search + favorites lists) */
  --surface-border: rgba(255, 255, 255, 0.08);
  --surface-border-subtle: rgba(255, 255, 255, 0.06);
  --surface-hover: rgba(255, 255, 255, 0.04);
  --surface-subtle: rgba(255, 255, 255, 0.03);

  --panel-border: 2px solid rgba(128, 128, 128, 0.3);
  --panel-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), 0 0 0 3px rgba(var(--primary-rgb), 0.18), 0 0 0 9999px rgba(0, 0, 0, 0.55);
  --panel-radius: 16px;

  --shadow-card-hover: 0 10px 24px rgba(0, 0, 0, 0.35);

  --focus-ring-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.22);

  /* Chips / badges */
  --chip-bg: rgba(var(--primary-rgb), 0.18);
  --chip-fg: var(--fg);
  --chip-bg-quiet: rgba(var(--primary-rgb), 0.12);

  /* Favorites should use the primary theme color */
  --favorite: var(--primary);
  --favorite-bg: rgba(var(--primary-rgb), 0.16);

  /* Text color when placed on top of --accent surfaces */
  --on-accent: #000;

  /* Text color when placed on top of --primary surfaces (e.g. CTA buttons) */
  --on-primary: #fff;

  /* UI Components */
  --card: #262d35;
  --sheet-bg: #3b4756;
  --sheet-border: rgba(255, 255, 255, 0.14);
  --sheet-border-subtle: rgba(255, 255, 255, 0.08);
  --sheet-handle-bg: rgba(255, 255, 255, 0.22);
  --sheet-shadow: 0 -18px 42px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(var(--primary-rgb), 0.08);
  --sheet-item-hover-bg: rgba(var(--primary-rgb), 0.12);
  --sheet-item-active-bg: rgba(var(--primary-rgb), 0.18);
  --sheet-icon-bg: rgba(var(--primary-rgb), 0.14);
  --collection-panel-bg: #3a4655;
  --collection-panel-header-bg: #323d4a;
  --collection-card-bg: #36414f;
  --collection-card-hover-bg: #3f4d5c;
  --collection-subpanel-bg: #2d3743;
  --collection-row-bg: #313c48;
  --collection-row-hover-bg: rgba(var(--primary-rgb), 0.14);
  --collection-shadow: 0 12px 30px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(var(--primary-rgb), 0.05);
  --btn: #3d464f;
  --btn-hover: rgba(var(--primary-rgb), 0.12);
  --btn-active: #1a1a1a;
  --result-hover: rgba(var(--primary-rgb), 0.1);
  --item-hover: rgba(255, 255, 255, 0.12);
  --neutral: #e2e8f0;

  /* Spacing & Sizing - Mobile First */
  --border-radius: 8px;
  --border-radius-large: 12px;
  --border-radius-small: 6px;
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 16px;
  --spacing-xl: 20px;
  --spacing-xxl: 24px;

  /* Shadows & Effects */
  --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-accent: 0 0 12px rgba(var(--primary-rgb), 0.1);
  --shadow-subtle: 0 2px 4px rgba(0, 0, 0, 0.2);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;
  --transition-bounce: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-default: all var(--transition-normal);
  --transition-all-slow: all var(--transition-slow);
  --transition-all-norm: all 0.2s ease;

  /* Ticker speed (track lists) */
  --list-ticker-duration: 14s;

  /* Component Sizes - Mobile Optimized */
  /* Mobile cover: responsive to viewport height to avoid clipping controls */
  --art-size-mobile: clamp(140px, 26vh, 220px);
  --art-size-tablet: 320px;
  --art-size-desktop: 380px;
  /* Mobile controls: keep accessible tap targets while protecting vertical space */
  --btn-size-mobile: 60px;
  --btn-size-tablet: 44px;
  --btn-size-desktop: 40px;
  --btn-large-mobile: 72px;
  --btn-large-tablet: 52px;
  --btn-large-desktop: 50px;
  --search-height-mobile: 44px;
  --search-height-tablet: 44px;
  --search-height-desktop: 48px;
  --content-max-width: 500px;
  --progress-height: 8px;
  --progress-height-desktop: 6px;

  /* Search input legibility (all themes) */
  --search-input-bg: var(--btn);
  --search-input-bg-focus: rgba(61, 70, 79, 0.8);
  --search-input-fg: var(--fg);
  --search-input-placeholder: var(--muted);
  --search-input-caret: var(--fg);

  /* Skeleton / surface fill tokens (used by loaders.css shimmer) */
  --surface-1: #2a2a2a;
  --surface-2: #353535;

  /* Browser chrome color scheme: dark by default */
  color-scheme: dark;
}

/* ===== TEMA NOCHE - Colores más profundos para OLED ===== */
[data-theme="night"] {
  --bg: #000000;
  --bg-rgb: 0, 0, 0;
  --fg: #f0f0f0;
  --muted: #a0a0a0;
  --accent: #d0d0e0;
  --accent-alt: #3da9ff;
  --accent-alt-rgb: 61, 169, 255;
  --primary: #3da9ff;
  --primary-rgb: 61, 169, 255;
  --highlight: #e879c1;
  --secondary: #f59e0b;
  --card: #121212;
  --sheet-bg: #242c36;
  --sheet-border: rgba(255, 255, 255, 0.12);
  --sheet-border-subtle: rgba(255, 255, 255, 0.08);
  --sheet-handle-bg: rgba(255, 255, 255, 0.2);
  --sheet-shadow: 0 -18px 44px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(var(--primary-rgb), 0.1);
  --sheet-item-hover-bg: rgba(var(--primary-rgb), 0.14);
  --sheet-item-active-bg: rgba(var(--primary-rgb), 0.2);
  --sheet-icon-bg: rgba(var(--primary-rgb), 0.16);
  --collection-panel-bg: #2b3541;
  --collection-panel-header-bg: #242d38;
  --collection-card-bg: #2f3945;
  --collection-card-hover-bg: #384451;
  --collection-subpanel-bg: #212a34;
  --collection-row-bg: #28323d;
  --collection-row-hover-bg: rgba(var(--primary-rgb), 0.16);
  --collection-shadow: 0 12px 30px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(var(--primary-rgb), 0.08);
  --btn: #1f1f1f;
  --btn-hover: rgba(var(--primary-rgb), 0.12);
  --btn-active: #0a0a0a;
  --result-hover: rgba(var(--primary-rgb), 0.08);
  --item-hover: rgba(255, 255, 255, 0.08);
  --neutral: #e2e8f0;
  --control-fg: var(--fg);

  /* Status colors for night theme */
  --error: #ff6b6b;
  --success: #4ade80;
  --warning: #fbbf24;

  --surface-border: rgba(255, 255, 255, 0.10);
  --surface-border-subtle: rgba(255, 255, 255, 0.08);
  --surface-hover: rgba(255, 255, 255, 0.05);
  --surface-subtle: rgba(255, 255, 255, 0.03);

  --shadow-card-hover: 0 10px 24px rgba(0, 0, 0, 0.45);

  --focus-ring-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.24);

  --chip-bg: rgba(var(--primary-rgb), 0.18);
  --chip-fg: var(--fg);
  --chip-bg-quiet: rgba(var(--primary-rgb), 0.12);

  --favorite: var(--primary);
  --favorite-bg: rgba(var(--primary-rgb), 0.16);

  --header-btn-bg: rgba(255, 255, 255, 0.12);
  --header-btn-border: rgba(255, 255, 255, 0.14);

  --on-accent: #000;

  /* Text color when placed on top of --primary surfaces (e.g. CTA buttons) */
  --on-primary: #fff;

  --list-ticker-duration: 14s;

  /* Surface tokens */
  --surface-1: #2a2a2a;
  --surface-2: #353535;

  /* Browser chrome */
  color-scheme: dark;
}
[data-theme="day"] {
  --bg: #f5f5f5;
  --bg-rgb: 245, 245, 245;
  --fg: #1a1a1a;
  --muted: #4a4a4a;
  --accent: #1a1a2e;
  --accent-alt: #1e6ba8;
  --accent-alt-rgb: 30, 107, 168;
  --primary: #10b981;
  --primary-text: #047857;
  --primary-rgb: 16, 185, 129;
  --highlight: #d63384;
  --secondary: #d97706;
  --error: #b91c1c;
  --success: #15803d;
  --warning: #ea580c;
  --card: #ffffff;
  --sheet-bg: #ffffff;
  --sheet-border: rgba(15, 23, 42, 0.1);
  --sheet-border-subtle: rgba(15, 23, 42, 0.08);
  --sheet-handle-bg: rgba(15, 23, 42, 0.18);
  --sheet-shadow: 0 -18px 42px rgba(15, 23, 42, 0.16), 0 0 0 1px rgba(var(--primary-rgb), 0.08);
  --sheet-item-hover-bg: rgba(var(--primary-rgb), 0.1);
  --sheet-item-active-bg: rgba(var(--primary-rgb), 0.16);
  --sheet-icon-bg: rgba(var(--primary-rgb), 0.12);
  --collection-panel-bg: #ffffff;
  --collection-panel-header-bg: #f5f8f7;
  --collection-card-bg: #ffffff;
  --collection-card-hover-bg: #f3f8f6;
  --collection-subpanel-bg: #f6faf8;
  --collection-row-bg: #f8fbfa;
  --collection-row-hover-bg: rgba(var(--primary-rgb), 0.12);
  --collection-shadow: 0 10px 24px rgba(15, 23, 42, 0.1), 0 0 0 1px rgba(var(--primary-rgb), 0.04);
  --btn: #e5e5e5;
  --btn-hover: rgba(var(--primary-rgb), 0.12);
  --btn-active: #d0d0d0;
  --result-hover: rgba(var(--primary-rgb), 0.1);
  --item-hover: rgba(0, 0, 0, 0.08);
  --neutral: #374151;
  --control-fg: #333333;

  /* Search input: keep focus background light so text stays readable */
  --search-input-bg: #ffffff;
  --search-input-bg-focus: #ffffff;
  --search-input-fg: var(--fg);
  --search-input-placeholder: var(--muted);
  --search-input-caret: var(--fg);
  
  /* Sombras ajustadas para modo día */
  --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-heavy: 0 8px 32px rgba(0, 0, 0, 0.15);
  --shadow-subtle: 0 2px 4px rgba(0, 0, 0, 0.08);
  --shadow-accent: 0 0 12px rgba(var(--primary-rgb), 0.12);

  --surface-border: rgba(0, 0, 0, 0.12);
  --surface-border-subtle: rgba(0, 0, 0, 0.08);
  --surface-hover: rgba(0, 0, 0, 0.04);
  --surface-subtle: rgba(0, 0, 0, 0.03);

  --shadow-card-hover: 0 10px 24px rgba(0, 0, 0, 0.14);

  --focus-ring-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.28);

  --chip-bg: rgba(var(--primary-rgb), 0.14);
  --chip-fg: var(--fg);
  --chip-bg-quiet: rgba(var(--primary-rgb), 0.10);

  --favorite: var(--primary);
  --favorite-bg: rgba(var(--primary-rgb), 0.14);

  --header-btn-bg: rgba(0, 0, 0, 0.06);
  --header-btn-border: rgba(0, 0, 0, 0.1);

  --on-accent: #fff;

  /* Text color when placed on top of --primary surfaces (e.g. CTA buttons) */
  /* Day primary (#10b981 emerald green) is light enough to need dark text for readability */
  --on-primary: #000;

  --list-ticker-duration: 12s;

  /* Surface tokens (light backgrounds for skeleton shimmer) */
  --surface-1: #f0f0f0;
  --surface-2: #e4e4e4;

  /* Browser chrome */
  color-scheme: light;
}
[data-theme="day"] header {
  border-bottom: 1px solid rgba(var(--primary-rgb), 0.12);
}

[data-theme="day"] .description-modal {
  background: rgba(0, 0, 0, 0.4);
}

[data-theme="day"] h1 {
  color: var(--primary-text);
  text-shadow: 0 2px 8px rgba(31, 127, 184, 0.12);
}

/* Mejoras de visibilidad de la barra de progreso en modo día */
[data-theme="day"] .progress-bar {
  background: #e0e0e0;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="day"] .progress-buffered {
  background: rgba(var(--primary-rgb), 0.15);
}

[data-theme="day"] .progress {
  /* Fallback for browsers without color-mix() support (Safari < 16.2, Chrome < 111) */
  background: linear-gradient(90deg, var(--primary), #059669);
  /* color-mix() gives a theme-aware darker shade of --primary */
  background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 80%, #000));
  box-shadow: 0 0 12px rgba(var(--primary-rgb), 0.5);
}

[data-theme="day"] .progress-thumb::after {
  background: var(--primary);
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.5), 0 0 0 2px rgba(255, 255, 255, 1);
}

[data-theme="day"] .progress-tooltip {
  background: rgba(var(--primary-rgb), 0.95);
}

[data-theme="day"] .progress-tooltip::after {
  border-top-color: rgba(var(--primary-rgb), 0.95);
}

[data-theme="day"] .current-time,
[data-theme="day"] .total-time {
  color: var(--primary-text);
}

[data-theme="day"] .progress-bar:focus,
[data-theme="day"] .progress-bar.focused {
  outline-color: var(--primary);
}

[data-theme="day"] .progress-section:hover {
  background: rgba(var(--primary-rgb), 0.06);
  box-shadow: 0 0 16px rgba(var(--primary-rgb), 0.1);
}

[data-theme="day"] .progress-section:active,
[data-theme="day"] .progress-section.dragging {
  background: rgba(var(--primary-rgb), 0.08);
  box-shadow: 0 0 24px rgba(var(--primary-rgb), 0.16);
}

/* ===== MODO AHORRO DE ENERGÍA - Máximo ahorro con OLED puro ===== */
[data-theme="eco"] {
  --bg: #000000;
  --fg: #c0c0c0;
  --muted: #959595;
  --accent: #a0a0a0;
  --accent-alt: #7a9fb0;
  --accent-alt-rgb: 122, 159, 176;
  --primary: #7aa7b8;
  --primary-rgb: 122, 167, 184;
  --highlight: #c080a0;
  --secondary: #c0a060;
  --error: #d88888;
  --success: #66cc66;
  --warning: #dd9955;
  --card: #0a0a0a;
  --sheet-bg: #1a2428;
  --sheet-border: rgba(122, 167, 184, 0.18);
  --sheet-border-subtle: rgba(122, 167, 184, 0.1);
  --sheet-handle-bg: rgba(122, 167, 184, 0.2);
  --sheet-shadow: 0 -18px 40px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(var(--primary-rgb), 0.08);
  --sheet-item-hover-bg: rgba(var(--primary-rgb), 0.12);
  --sheet-item-active-bg: rgba(var(--primary-rgb), 0.18);
  --sheet-icon-bg: rgba(var(--primary-rgb), 0.14);
  --collection-panel-bg: #1d282d;
  --collection-panel-header-bg: #162126;
  --collection-card-bg: #223035;
  --collection-card-hover-bg: #2a393f;
  --collection-subpanel-bg: #131b1f;
  --collection-row-bg: #1b262b;
  --collection-row-hover-bg: rgba(var(--primary-rgb), 0.14);
  --collection-shadow: 0 12px 30px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(var(--primary-rgb), 0.08);
  --btn: #181818;
  --btn-hover: rgba(var(--primary-rgb), 0.08);
  --btn-active: #050505;
  --result-hover: rgba(var(--primary-rgb), 0.06);
  --item-hover: rgba(255, 255, 255, 0.05);
  --neutral: #909090;
  --control-fg: var(--fg);

  --header-btn-bg: rgba(255, 255, 255, 0.12);
  --header-btn-border: rgba(255, 255, 255, 0.12);

  --list-ticker-duration: 20s;

  /* Text color when placed on top of --primary surfaces (e.g. CTA buttons) */
  /* Energy-saver primary (#7aa7b8 light teal) is too light for white text */
  --on-primary: #0a0a0a;

  /* Surface tokens (OLED-safe near-black) */
  --surface-1: #141414;
  --surface-2: #1e1e1e;

  /* Browser chrome */
  color-scheme: dark;
}
[data-theme="eco"] * {
  animation-duration: 0.05s !important;
}

/* Excluir ticker de optimizaciones en modo eco para mantener legibilidad */
[data-theme="eco"] .title.ticker .title-text {
  animation-duration: var(--list-ticker-duration, 20s) !important;
}

[data-theme="eco"] .ticker-text.ticker {
  animation-duration: var(--list-ticker-duration, 20s) !important;
}

[data-theme="eco"] .no-results-icon {
  animation: none !important;
  transform: none !important;
}

[data-theme="eco"] .art {
  filter: brightness(0.7);
}

/* ===== GLOBAL RESET & BASE STYLES ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

/* ===== LAYOUT SYSTEM ===== */
.app {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--app-height, 100vh);
  min-height: 0;
  overflow-x: hidden;
  overflow-y: hidden;
  justify-content: flex-start;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 8px;
  z-index: 10000;
  padding: 8px 12px;
  border-radius: 4px;
  background: var(--surface-2, #fff);
  color: var(--fg, #111);
}

.skip-link:focus {
  top: 8px;
}

/* Main content wrapper between header and footer */
.content-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Mobile/tablet: when favorites is open, make it full-height */
@media (max-width: 1023px) {
  /* Favorites becomes the primary view; hide other sections to let it span the screen */
  .favorites-embedded-open .discovery-section,
  .favorites-embedded-open .main-player-section,
  .resontes-open .discovery-section,
  .resontes-open .main-player-section {
    display: none;
  }

  .favorites-embedded-open .content-layout,
  .resontes-open .content-layout {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .favorites-embedded-open .favorites-list,
  .resontes-open .resontes-list {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    margin-top: 0;
  }

  .favorites-embedded-open .favorites-list.active,
  .resontes-open .resontes-list.active {
    height: 100%;
    max-height: none;
  }
}

@supports (height: 100dvh) {
  .app {
    height: var(--app-height, 100dvh);
    min-height: var(--app-height, 100dvh);
  }
}

.main-player-section {
  /* Allow the player to fit within the fixed-height app without clipping */
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-top: var(--spacing-lg);
  padding-left: 0;
  padding-right: 0;
  /* Keep controls clear of the mobile browser inset without duplicating sticky footer space. */
  padding-bottom: calc(var(--spacing-md) + env(safe-area-inset-bottom, 0) + var(--vv-bottom-inset, 0px));
  box-sizing: border-box;
  position: relative;
  /* z-index removed: a stacking context here caused the artwork to render above
     fixed panels (search results, track listings) due to compositing layer ordering.
     Panels use z-index: 140 which is sufficient to appear above this section. */
}

.discovery-section {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0);
  min-height: 0;
}

/* Cuando el listado de pistas está abierto, ocupa todo el espacio entre header y footer (position:fixed como search-results) */
#tracks-list-container.tracks-inline {
  display: block;
  position: fixed;
  left: 10px;
  right: 10px;
  top: var(--tracks-panel-top, 62px);
  bottom: var(--tracks-panel-bottom, calc(var(--footer-height, 44px) + env(safe-area-inset-bottom, 0) + var(--vv-bottom-inset, 0px) + 10px));
  width: auto;
  max-width: none;
  height: auto;
  max-height: none;
  min-height: 160px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--card);
  border: var(--panel-border);
  border-radius: var(--panel-radius);
  box-shadow: var(--panel-shadow);
  z-index: 140;
  box-sizing: border-box;
}

#tracks-list-container.tracks-inline .tlv2-list,
#tracks-list-container.tracks-inline .tracklist__list {
  max-height: none;
  overflow: visible;
}

@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
  #tracks-list-container.tracks-inline {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(600px, calc(100vw - 48px));
    max-width: min(600px, calc(100vw - 48px));
  }
}

/* ===== HEADER & NAVIGATION ===== */
header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: rgba(var(--bg-rgb, 15, 15, 15), 0.92);
  z-index: 200;
  padding: 4px var(--spacing-md);
  border-bottom: 1px solid rgba(var(--primary-rgb), 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: box-shadow var(--transition-slow), background var(--transition-slow);
  min-height: 48px;
  gap: var(--spacing-sm);
}

/* Elevated state — applied via JS when page is scrolled */
header.header--elevated {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.22), 0 1px 0 rgba(var(--primary-rgb), 0.08);
  border-bottom-color: rgba(var(--primary-rgb), 0.14);
}

/* Offset the app container below the PWA install banner so the sticky header stays visible */
body:has(#pwa-install-banner.active) .app {
  top: var(--pwa-banner-h, 95px);
  height: calc(var(--app-height, 100vh) - var(--pwa-banner-h, 95px));
  min-height: calc(var(--app-height, 100vh) - var(--pwa-banner-h, 95px));
}

#app-title {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex: 1 1 auto;
  overflow: hidden;
  border-radius: var(--border-radius);
  padding: 4px var(--spacing-xs);
  margin-left: calc(-1 * var(--spacing-xs));
  transition: background var(--transition-fast);
}

.app-title-action {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--spacing-sm);
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.app-title-action:hover {
  background: rgba(var(--primary-rgb), 0.07);
}

.app-title-action:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (forced-colors: active) {
  .app-title-action:focus-visible {
    outline: 2px solid ButtonText;
    outline-offset: 2px;
  }
}

.app-title-action:hover .app-logo-svg {
  filter: drop-shadow(0 0 6px rgba(var(--primary-rgb), 0.45));
}

/* App logo icon in the title */
.app-logo {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--primary);
}

.app-logo-svg {
  width: 28px;
  height: 28px;
  display: block;
  transition: filter var(--transition-fast), transform var(--transition-fast);
}

.app-title-action:active .app-logo-svg {
  transform: scale(0.93);
}

.app-title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Header Controls Container */
.header-controls {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 4px;
}

.track-share .header-icon,
.result-share .header-icon,
.card-btn.share .header-icon,
.tlv2-share .header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--primary);
}

.theme-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes castPulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.theme-selector.cast-pulse {
  animation: castPulse 0.32s ease-out;
}


@media (max-width: 480px) {
  header {
    padding: 6px var(--spacing-sm);
  }
  h1 {
    font-size: 19px;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }
  .title {
    font-size: 18px;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    display: block;
    word-break: break-word;
    line-height: 1.2;
    padding: 0 4px;
  }
  .footer {
    text-align: center !important;
    width: 100% !important;
    opacity: 1 !important;
    font-size: 10px !important;
    padding: 8px 12px !important;
    left: 0 !important;
    right: 0 !important;
    color: var(--primary-text) !important;
  }

  .offline-indicator {
    font-size: 9px;
    padding: 5px 8px;
  }
}

/* Theme Selector */
.theme-selector {
  background: transparent;
  color: var(--fg);
  border: 1px solid rgba(var(--primary-rgb), 0.16);
  border-radius: var(--border-radius-small);
  height: 44px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 12px;
  font-size: 9px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
  text-align: center;
  box-shadow: none;
  margin-right: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  gap: 3px;
}

.theme-selector:hover {
  background: var(--card);
  border-color: rgba(var(--primary-rgb), 0.26);
  box-shadow: none;
  transform: none;
}

.theme-selector:focus {
  border-color: rgba(var(--primary-rgb), 0.34);
  box-shadow: 0 0 0 1px rgba(var(--primary-rgb), 0.16);
  outline: none;
}


/* ===== OFFLINE INDICATOR ===== */



.offline-text {
  white-space: nowrap;
}

.offline-mode .app {
  border-left: 3px solid var(--error);
}

h1 {
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--primary-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  transition: all var(--transition-normal);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  flex: 1 1 auto;
  min-width: 0;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
  margin: 0 0 var(--spacing-md) 0;
  text-align: center;
}

h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
  text-align: center;
  margin: 0 0 var(--spacing-md) 0;
}

/* ===== PLAYER SECTION ===== */
.player-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  animation: artLoad 0.5s ease forwards;
}

.player-content {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
  box-sizing: border-box;
}

.art {
  width: var(--art-size-mobile);
  height: var(--art-size-mobile);
  border-radius: var(--border-radius-large);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transition: var(--transition-all-slow);
  margin: 0 auto var(--spacing-md);
  flex-shrink: 0;
  position: relative;
  background: var(--btn);
}

.art:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
  border-color: rgba(var(--primary-rgb), 0.18);
}

.art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Skeleton placeholder - ONLY show when container is empty */
.result-cover:empty,
.card-media:empty,
.art:empty {
  background: linear-gradient(
    90deg,
    rgba(var(--btn-rgb, 30, 30, 30), 0.5) 0%,
    rgba(var(--btn-rgb, 30, 30, 30), 0.7) 50%,
    rgba(var(--btn-rgb, 30, 30, 30), 0.5) 100%
  );
  background-size: 200% 100%;
  animation: skeletonLoading 1.5s ease-in-out infinite;
}

@keyframes skeletonLoading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@keyframes artLoad {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Title Ticker Animation */
@keyframes titleTicker {
  0%, 15% {
    transform: translateX(0);
  }
  85%, 100% {
    transform: translateX(calc(-1 * var(--title-overflow, 0px)));
  }
}

.current-track-info {
  width: 100%;
  text-align: center;
  padding: var(--spacing-xl) 0 var(--spacing-xs) 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

#description-container {
  width: 100%;
  display: flex;
  flex-direction: row;
  gap: var(--spacing-sm);
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.title-share-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  overflow: hidden;
  position: relative;
  max-width: 100%;
  min-width: 0;
}

.title {
  font-size: 24px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  text-align: center;
  width: 100%;
  display: inline-block;
  transition: none;
  max-width: 100%;
  min-width: 0;
}

.title .title-text {
  display: inline-block;
  white-space: nowrap;
  will-change: transform;
}

.title.ticker {
  text-overflow: clip;
  overflow: hidden;
}

.title.ticker .title-text {
  animation: titleTicker 15s linear infinite;
}

.creator {
  font-size: 16px;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  text-align: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.description {
  font-size: 15px;
  font-weight: 400;
  color: var(--fg);
  line-height: 1.6;
  margin: 12px 0 20px 0;
  text-align: left;
  background: var(--card);
  border-radius: 8px;
  padding: 12px 16px;
  white-space: pre-line;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
  /* Sin altura fija ni scroll, crece dinámicamente */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ===== PROGRESS BAR ===== */
.progress-section {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  flex-shrink: 0;
  display: block;
  padding: 8px 10px 22px 10px;
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  user-select: none;
  box-sizing: border-box;
  box-shadow: none;
  background: transparent;
  overflow: visible;
}

.progress-section:hover {
  background: rgba(var(--primary-rgb), 0.08);
  box-shadow: 0 0 16px rgba(var(--primary-rgb), 0.12);
}

.progress-section:active,
.progress-section.dragging {
  background: rgba(var(--primary-rgb), 0.1);
  box-shadow: 0 0 24px rgba(var(--primary-rgb), 0.2);
}

.progress-section.dragging {
  box-shadow: 0 0 24px rgba(var(--primary-rgb), 0.2);
}

.time-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.progress-bar {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: var(--progress-height);
  background: var(--card);
  border-radius: 4px;
  overflow: visible;
  cursor: pointer;
  position: relative;
  transition: height var(--transition-fast), box-shadow 0.2s ease;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  touch-action: none;
  outline: none;
  box-sizing: border-box;
  display: block;
}

.progress-bar:hover {
  height: 14px;
}

/* Focus indicator for keyboard navigation */
.progress-bar:focus,
.progress-bar.focused {
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.3);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Buffered progress (shows loaded audio) */
.progress-buffered {
  height: 100%;
  background: rgba(var(--primary-rgb), 0.15);
  border-radius: 3px;
  width: 0%;
  max-width: 100%;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  transition: width 0.3s ease;
  will-change: width;
}

/* Progress Fill (Inner Bar) */
.progress {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-alt), var(--accent));
  border-radius: 3px;
  width: 100%;
  max-width: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
  transition: transform 0.1s linear;
  position: absolute;
  left: 0;
  top: 0;
  box-shadow: 0 0 12px rgba(var(--primary-rgb), 0.4);
  z-index: 3;
}

/* Progress thumb is moved independently so fill updates stay compositor-friendly. */
.progress-thumb {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  transform: translate3d(0, 0, 0);
  will-change: transform;
  pointer-events: none;
  z-index: 10;
}

.progress-thumb::after {
  content: '';
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 2px rgba(255, 255, 255, 0.9);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10;
}

.progress-bar:hover .progress-thumb::after,
.progress-bar.dragging .progress-thumb::after,
.progress-bar:focus .progress-thumb::after,
.progress-bar.focused .progress-thumb::after {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.progress-bar.dragging .progress-thumb::after {
  transform: translate(-50%, -50%) scale(1.2);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(255, 255, 255, 0.9);
}

/* Progress Tooltip */
.progress-tooltip {
  position: absolute;
  top: -35px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 1000;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.progress-tooltip::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid rgba(0, 0, 0, 0.85);
}

.current-time,
.total-time {
  font-variant-numeric: tabular-nums;
  color: rgba(var(--primary-rgb), 0.75);
  font-size: 12px;
  font-weight: 600;
  position: absolute;
  pointer-events: none;
  z-index: 10;
  letter-spacing: 0.5px;
  transition: color 0.2s ease;
  white-space: nowrap;
  min-width: 35px;
}

.current-time {
  left: 0;
  top: calc(100% + 2px);
}

.total-time {
  right: 0;
  top: calc(100% + 2px);
}

.progress-bar:hover .current-time,
.progress-bar:hover .total-time,
.progress-bar:focus .current-time,
.progress-bar:focus .total-time {
  color: var(--accent);
}

/* ===== CONTROLS =====
   Button State Patterns:
   1. Base: Static styling (background, sizing, font)
   2. :hover - Scale & highlight (--transition-default applied)
   3. :active - Compress effect (scale 0.94)
   4. :focus - Outline indicator (outline-offset varies by button type)
   5. :disabled - Reduced opacity (0.5)
   
   Special buttons:
   - .play-btn: Bounce transition (--transition-bounce)
   - .shuffle-favorites-btn: Border only when .active
   - .favorites-toggle: Border visibility managed by .disabled state
 */
.main-player-section .controls {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  /* Keep 5 buttons fitting on 375–390px wide devices (e.g., iPhone X / iPhone 12 Pro) */
  gap: clamp(6px, 3vw, 18px);
  margin: 6px auto 0 auto;
  flex-shrink: 0;
  flex-wrap: nowrap;
  width: 100%;
  box-sizing: border-box;
  padding-left: calc(var(--spacing-sm) + env(safe-area-inset-left, 0));
  padding-right: calc(var(--spacing-sm) + env(safe-area-inset-right, 0));
  padding-bottom: var(--vv-bottom-inset, 0px);
}

/* Footer is informational only; never let it block control taps */
.footer {
  pointer-events: none;
}

/* Add a small touch-safe bottom inset for mobile web (gesture bars may not map to safe-area/env). */
@media (hover: none) and (pointer: coarse) {
  .main-player-section .controls {
    padding-bottom: calc(var(--vv-bottom-inset, 0px) + 10px);
  }
}

@media (max-width: 400px) {
  .main-player-section .controls {
    gap: clamp(6px, 2vw, 12px);
  }
  .offline-indicator {
    height: 36px;
  }
  
  .progress-section {
    padding: 5px 8px 16px 8px;
    margin-bottom: 3px;
    min-height: 32px;
  }
  
  .current-time,
  .total-time {
    font-size: 11px;
  }
}

.main-player-section .controls button {
  width: var(--btn-size-mobile);
  height: var(--btn-size-mobile);
  flex-shrink: 0;
  min-width: var(--btn-size-mobile);
  min-height: var(--btn-size-mobile);
  position: relative;
  font-size: 20px;
}

/* Base button styles */
/* ===== GLOBAL BUTTON STYLES ===== */
/* Excepciones al selector global button */
.history-remove,
.btn-tertiary {
  height: auto;
  min-height: auto;
  width: auto;
  display: inline-flex;
}

button {
  height: auto;
  border: none;
  border-radius: var(--border-radius-large);
  background: var(--btn);
  color: var(--fg);
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  padding: 0 var(--spacing-md);
  transition: var(--transition-default);
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  position: relative;
  overflow: hidden;
}

button:hover:not(:disabled) {
  background: var(--card);
  box-shadow: 0 8px 24px rgba(var(--primary-rgb), 0.12);
  transform: translateY(-3px);
  transition: var(--transition-default);
}

button:focus-visible:not(:disabled):not(.play-btn):not(.play-btn-favorite) {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

button:focus:not(:disabled):not(.play-btn):not(.play-btn-favorite) {
  outline-offset: 2px;
}

/* Focus styles for play button */
.play-btn:focus-visible,
.play-btn-favorite:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.play-btn:focus,
.play-btn-favorite:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  outline: 1px solid rgba(var(--primary-rgb), 0.2);
  outline-offset: 2px;
}

button:active:not(:disabled) {
  transform: scale(0.92);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: transform 0.08s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Play button variants */
.play-btn,
.play-btn-favorite {
  /* Sizing - Fixed size */
  width: var(--btn-large-mobile);
  height: var(--btn-large-mobile);
  min-width: var(--btn-large-mobile);
  min-height: var(--btn-large-mobile);
  
  /* Shape & Border */
  border-radius: 50%;
  border: none;
  outline: none;
  outline-offset: -2px;
  
  /* Background & Color */
  background: var(--btn);
  color: var(--control-fg);
  box-shadow: none;
  
  /* Typography */
  font-size: 22px;
  font-weight: 900;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  letter-spacing: -2px;
  line-height: 1.2;
  
  /* Layout & Spacing */
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  
  /* Animation */
  transition: var(--transition-bounce);
}

/* Ensure the play button stays larger than the other controls */
.main-player-section .controls .play-btn,
.main-player-section .controls .play-btn-favorite {
  width: var(--btn-large-mobile);
  height: var(--btn-large-mobile);
  min-width: var(--btn-large-mobile);
  min-height: var(--btn-large-mobile);
}

.play-btn:hover,
.play-btn-favorite:hover {
  transform: scale(1.12);
  background: var(--btn);
  box-shadow: 0 8px 20px rgba(var(--primary-rgb), 0.16);
  transition: var(--transition-bounce);
}

.play-btn:active,
.play-btn-favorite:active {
  transform: scale(0.95);
  background: var(--btn);
  box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.08s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.play-btn:focus,
.play-btn-favorite:focus {
  outline: 2px solid var(--accent) !important;
  outline-offset: -2px !important;
}

/* Navigation buttons */
.prev-btn,
.next-btn {
  min-width: var(--btn-size-mobile);
  color: var(--control-fg);
}

.prev-btn .control-icon,
.next-btn .control-icon {
  width: 22px;
  height: 22px;
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

.shuffle-favorites-btn .control-icon {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

.prev-btn:hover:not(:disabled),
.next-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  background: var(--card);
  box-shadow: 0 8px 24px rgba(var(--primary-rgb), 0.12);
}

.prev-btn:focus-visible:not(:disabled),
.next-btn:focus-visible:not(:disabled) {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.prev-btn:active:not(:disabled),
.next-btn:active:not(:disabled) {
  transform: scale(0.92);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Favorite button */
.favorite-btn,
.additional-btn {
  width: var(--btn-size-mobile);
  color: var(--control-fg);
}

/* Playback control "Resonate" button (#favorite-btn) uses currentColor SVG */
.main-player-section .controls #favorite-btn {
  color: var(--muted);
  transition: color var(--transition-fast), transform var(--transition-bounce), background-color var(--transition-fast);
}

.main-player-section .controls #favorite-btn.active {
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.1);
}

.main-player-section .controls #favorite-btn:hover:not(:disabled) {
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.12);
  transform: scale(1.1);
}

.main-player-section .controls #favorite-btn:active:not(:disabled) {
  transform: scale(0.92);
  transition: transform 0.08s ease;
}

.main-player-section .controls #favorite-btn.active:hover:not(:disabled) {
  background: rgba(var(--primary-rgb), 0.2);
}

.favorite-item:hover {
  background: var(--result-hover);
  padding-left: 20px;
  box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb), 0.14);
}

.favorite-item:active {
  background: rgba(var(--primary-rgb), 0.08);
}

.favorite-btn.active:hover {
  background: rgba(var(--primary-rgb), 0.14);
}

/* Shuffle button */
.shuffle-favorites-btn {
  width: var(--btn-size-mobile);
  outline: none !important;
  color: var(--control-fg);
}

/* Touch devices can apply :hover in a sticky way; avoid layout shifts that can clip controls */
@media (hover: none) and (pointer: coarse) {
  .progress-section:hover,
  .art:hover,
  button:hover:not(:disabled),
  .play-btn:hover,
  .play-btn-favorite:hover {
    transform: none;
  }

  /* Reset art hover shadow to base value on touch */
  .art:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  }

  .progress-bar:hover {
    height: var(--progress-height);
  }
}

.shuffle-favorites-btn:focus-visible {
  outline: 2px solid var(--primary) !important;
  outline-offset: 2px !important;
}

.shuffle-favorites-btn:focus {
  outline: none !important;
}

.shuffle-favorites-btn.active {
  color: var(--accent);
  background: var(--btn);
  outline: 2px solid var(--accent) !important;
  outline-offset: -2px !important;
}

.shuffle-favorites-btn.active:focus {
  outline: 2px solid var(--accent) !important;
  outline-offset: -2px !important;
}

.shuffle-favorites-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shuffle-favorites-btn.active svg {
  stroke: var(--accent);
}

/* Quality indicator */
.adaptive-quality-indicator {
  align-items: center;
  justify-content: center;
  background: var(--btn);
  border-radius: 6px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: var(--transition-default);
  height: 28px;
  min-width: 40px;
}

.adaptive-quality-indicator:hover {
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
}

.adaptive-quality-indicator:active {
  transform: scale(0.95);
  background: var(--card);
}

/* Volume control */
.volume-control {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: 10px;
}

.volume-icon {
  font-size: 16px;
  color: var(--accent);
  cursor: pointer;
  padding: 5px;
}


.contact-section a {
  transition: transform 0.2s;
  cursor: pointer;
}

.contact-section a:hover {
  transform: scale(1.05);
}

.contact-section img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
}

select {
  width: 100%;
  height: 38px;
  border: none;
  border-radius: 10px;
  background: var(--btn);
  color: var(--fg);
  font-size: 13px;
  cursor: pointer;
  padding: 0 10px;
}

select:focus {
  outline: 2px solid var(--accent);
}

/* ===== FAVORITES SECTION ===== */
.favorites-section {
  flex-shrink: 0;
  padding: 0 5px;
  display: none;
  flex-direction: row-reverse;
}

.favorites-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.favorites-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  transition: var(--transition-all-norm);
  user-select: none;
}

.favorites-label:hover {
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.08);
}

.favorites-label.active {
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.1);
}

.favorites-icon {
  font-size: 18px;
  font-weight: 700;
  transition: var(--transition-bounce);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--favorite);
  filter: drop-shadow(0 2px 4px rgba(var(--primary-rgb), 0.25));
}

.favorites-toggle .favorites-icon {
  font-size: 18px;
}

.resontes-toggle .resontes-icon {
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.resontes-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--muted);
}

.resontes-toggle .resontes-icon .resonate-icon {
  width: 30px;
  height: 30px;
  display: block;
}

/* Works for inline SVG and <use>/<symbol> */
.resontes-toggle .resontes-icon .resonate-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 32;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Resonate logo sizing across Resonates buttons */
.main-player-section .controls #favorite-btn .resonate-icon {
  width: 34px;
  height: 34px;
  display: block;
}

.card-btn .resonate-icon,
.result-favorite .resonate-icon {
  width: 34px;
  height: 34px;
  display: block;
}

/* Dense grids (Resonates/Favorites panels): slightly smaller to avoid clipping */
.favorites-list-content .card-btn .resonate-icon,
.resontes-list-content .card-btn .resonate-icon {
  width: 30px;
  height: 30px;
}

.tracks-container .tlv2-resonte .resonate-icon,
.tracks-container .track-resonte .resonate-icon,
.track-favorite .resonate-icon {
  width: 22px;
  height: 22px;
  display: block;
}

.favorites-toggle.active .favorites-icon {
  animation: heartBeat 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 2px 6px rgba(var(--primary-rgb), 0.4));
}

.resontes-toggle.active .resontes-icon {
  animation: heartBeat 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 2px 6px rgba(var(--primary-rgb), 0.4));
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* Resonate button pop animation — triggered when a track is added/removed */
@keyframes resonatePop {
  0%   { transform: scale(1); filter: none; }
  35%  { transform: scale(1.35); filter: drop-shadow(0 0 6px rgba(var(--primary-rgb), 0.55)); }
  65%  { transform: scale(0.92); filter: drop-shadow(0 0 3px rgba(var(--primary-rgb), 0.2)); }
  100% { transform: scale(1); filter: none; }
}

/* Resonate button loading pulse */
@keyframes resonateLoadingPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.45; transform: scale(0.88); }
}

/* Applied via JS after toggling a resonate button */
.resonate-btn-pop .resonate-icon {
  animation: resonatePop 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Applied via JS while an async resonate action is in-flight */
.resonate-btn-loading {
  pointer-events: none;
  cursor: wait !important;
}
.resonate-btn-loading .resonate-icon {
  animation: resonateLoadingPulse 0.7s ease-in-out infinite;
}

.favorites-label.active .favorites-icon {
  transform: rotate(180deg);
}

.favorites-text {
  font-weight: 600;
}

.favorites-count,
.resontes-count {
  color: #fff;
  background: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 24px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 2px 4px rgba(var(--primary-rgb), 0.12);
}

/* Favorites toggle button styling */

.favorites-icon,
.resontes-icon {
  font-size: 14px;
  font-weight: 900;
  transition: var(--transition-bounce);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  margin: 0;
  line-height: 1;
  height: 16px;
  width: 16px;
}

/* Favorites (legacy) keep the red accent */
.favorites-icon {
  color: var(--favorite);
  filter: drop-shadow(0 1px 2px rgba(var(--primary-rgb), 0.2));
}

/* Resonates icon should inherit the button color (SVG uses currentColor) */
.resontes-icon {
  color: inherit;
  filter: drop-shadow(0 1px 2px rgba(var(--primary-rgb), 0.14));
}

/* Ensure the header toggle actually changes color in active state */
#resontes-toggle {
  color: var(--muted);
}

#resontes-toggle.active,
.resontes-toggle.active {
  color: var(--primary);
}

#resontes-toggle.has-resontes,
.resontes-toggle.has-resontes {
  color: var(--primary);
}

.resontes-toggle.has-resontes .resontes-label {
  color: var(--primary);
}

.resontes-toggle.active .resontes-label {
  color: var(--primary);
}

.favorites-toggle.active .favorites-icon,
.resontes-toggle.active .resontes-icon {
  animation: heartBeat 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 2px 6px rgba(var(--primary-rgb), 0.4));
}

.favorites-count,
.resontes-count {
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.16);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  margin-left: 4px;
  border-radius: 999px;
  min-width: 22px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: none;
  border: 1px solid rgba(var(--primary-rgb), 0.35);
}

@media (max-width: 768px) and (min-width: 481px) {
  header {
    padding: 6px var(--spacing-sm);
  }
  h1 {
    font-size: 19px;
  }
  .footer {
    width: 100% !important;
    opacity: 0.6 !important;
    font-size: 10px !important;
    padding: 8px 0 !important;
    left: 0 !important;
    right: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
  }
}

.favorites-count,
.resontes-count {
  padding: 0;
  border-radius: 0;
  min-width: auto;
  text-align: center;
  display: inline;
  align-items: center;
  justify-content: center;
  margin-left: 2px;
}

.favorites-toggle.active .favorites-count,
.resontes-toggle.active .resontes-count {
  background: var(--primary);
  color: var(--bg);
}

@media (max-width: 520px) {
  .resontes-label {
    display: none;
  }
  .offline-indicator {
    gap: 6px;
    padding: 3px 6px;
    font-size: 11px;
  }
}

#play-all-favorites-btn {
  color: var(--accent);
  display: none;
}

.favorites-list,
.resontes-list {
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  margin-top: 6px;
  display: none;
  background: var(--collection-panel-bg, var(--card));
  overflow-x: hidden;
  overflow-y: auto;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0;
}

.favorites-list.active,
.resontes-list.active {
  display: flex;
  flex-direction: column;
  position: relative;
  left: auto;
  right: auto;
  top: auto;
  bottom: auto;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: min(55vh, 600px);
  min-height: 160px;
  opacity: 1;
  background: var(--collection-panel-bg, var(--card));
  box-shadow: var(--collection-shadow, var(--shadow-subtle));
  z-index: 120;
}

/* Embedded desktop sidebar: let the layout determine width/height */
@media (min-width: 1024px) {
  .favorites-embedded-open .favorites-list.active {
    margin-top: 0;
    max-height: none;
    height: 100%;
    min-height: 0;
    border-radius: 12px;
    box-shadow: var(--collection-shadow, 0 12px 30px rgba(0, 0, 0, 0.22));
  }

  .resontes-list.active {
    max-height: min(65vh, 800px);
  }
}

.favorites-list-content,
.resontes-list-content {
  /* Keep existing list padding behavior but inside the content region */
  padding: 10px 10px 0;
}

.favorites-results-header {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 8px 10px;
  /* Opaque header so scrolling chips/content never show through */
  background: var(--collection-panel-header-bg, var(--bg));
  border-bottom: 1px solid var(--surface-border);
  backdrop-filter: blur(10px);
}

/* The filter placeholder already carries the count; hide the redundant label. */
.favorites-results-summary {
  display: none;
}

.favorites-results-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-start;
  flex: 1 1 auto;
  min-width: 0;
}

.favorites-filter {
  height: 36px;
  background: var(--btn);
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--fg);
  padding: 0 10px;
  flex: 1 1 auto;
  min-width: 0;
}

#favorites-close {
  margin-left: 4px;
  align-self: center;
}

.favorites-control-toggle {
  gap: 5px;
  font-size: 11px;
}

.favorites-filter:focus {
  outline: none;
  box-shadow: var(--focus-ring-shadow);
}

.favorites-control-toggle,
.search-control-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  user-select: none;
}

.favorites-control-toggle input,
.search-control-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

/* Close buttons in panel toolbars: treat as subtle icon buttons */
#favorites-close,
#resontes-close {
  color: var(--muted);
  background: transparent;
}

#favorites-close:hover,
#resontes-close:hover {
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--fg);
}

.favorite-item {
  padding: 16px;
  border-bottom: 1px solid var(--surface-border-subtle);
  cursor: pointer;
  display: grid;
  grid-template-columns: 80px 1fr auto;
  grid-template-rows: auto auto auto auto;
  gap: 12px;
  transition: background-color 0.2s, padding-left 0.15s;
  align-items: start;
}

.favorite-item:last-child {
  border-bottom: none;
}

.favorite-item:hover {
  background: var(--result-hover);
  padding-left: 20px;
  box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb), 0.14);
}

.favorite-item:active {
  background: rgba(var(--primary-rgb), 0.08);
}

.favorite-item.now-playing {
  background: rgba(var(--primary-rgb), 0.08);
  border-left: 4px solid var(--primary);
  animation: pulse-item 2s ease-in-out infinite;
}

@keyframes pulse-item {
  0%, 100% { background: rgba(var(--primary-rgb), 0.08); }
  50% { background: rgba(var(--primary-rgb), 0.12); }
}

.favorite-item.now-playing .favorite-title {
  color: var(--primary);
  font-weight: 700;
}

.favorite-info {
  display: contents;
}

.favorite-title {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.35;
  color: var(--fg);
  grid-row: 1;
  /* Allow multi-line with ellipsis */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

.favorite-creator {
  display: none;
}

.favorite-actions {
  display: flex;
  flex-direction: row-reverse;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
  grid-column: 2 / -1;
  grid-row: 4;
  justify-self: end;
}

.favorite-actions .button {
  height: 48px;
  min-width: 48px;
  padding: 8px;
  font-size: 12px;
  transition: background-color 0.2s, transform 0.15s, box-shadow 0.2s;
  border-radius: 8px;
}

.favorite-actions .button:hover {
  background: var(--card);
  transform: scale(1.08);
}

.favorite-actions .button:active {
  transform: scale(0.95);
}

.favorite-play {
  background: var(--accent);
  border: none;
  color: var(--on-accent);
  font-size: 10px;
  cursor: pointer;
  padding: 4px 7px;
  border-radius: 5px;
  font-weight: bold;
  height: auto;
}

.favorite-remove {
  background: transparent;
  border: none;
  color: var(--error);
  font-size: 13px;
  cursor: pointer;
  padding: 4px;
  border-radius: 5px;
  height: auto;
}

.favorite-remove:active {
  background: rgba(255, 107, 107, 0.1);
}

/* ===== SEARCH SECTION ===== */
.search-section {
  display: flex;
  flex-direction: column;
  padding: 2px 4px;
  margin-top: var(--spacing-sm, 8px);
}

.search-container {
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  margin: 0 auto;
  gap: 8px;
  width: 100%;
  max-width: var(--content-max-width);
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 0;
}

.search-input-icon {
  position: absolute;
  left: var(--spacing-md);
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
  z-index: 1;
}

.search-input-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.search-input-wrapper:has(.search-input:focus) .search-input-icon {
  color: var(--primary);
}

.search-input {
  height: var(--search-height-mobile);
  background: var(--btn);
  border: 2px solid var(--surface-border);
  border-radius: var(--border-radius-large);
  color: var(--fg);
  /* Avoid showing the native search clear icon (we provide our own clear button). */
  -webkit-appearance: none;
  font-size: 16px;
  padding: 0 var(--spacing-md) 0 calc(var(--spacing-md) + 18px + 8px); /* left: spacing-md + icon(18px) + gap(8px) */
  transition: var(--transition-all-slow);
  width: 100%;
  min-width: 0;
}

/* Hide native search decorations (WebKit/Blink) to prevent a double-clear button. */
.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-decoration,
.search-input::-webkit-search-results-button,
.search-input::-webkit-search-results-decoration {
  -webkit-appearance: none;
  display: none;
}

.search-clear-btn {
  /* Sibling control (no overlay) so it never hides the input border */
  flex: 0 0 auto;
  width: var(--search-height-mobile);
  height: var(--search-height-mobile);
  min-width: var(--search-height-mobile);
  min-height: var(--search-height-mobile);
  border-radius: 8px;
  border: none;
  background: var(--btn);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.2s, color 0.2s, transform 0.15s, box-shadow 0.15s ease;
}

.search-clear-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* Respect the HTML hidden attribute (author styles can override UA defaults). */
.search-clear-btn[hidden] {
  display: none !important;
}

.search-clear-btn:active {
  background: var(--card);
  color: var(--fg);
  transform: none;
}

.search-clear-btn:hover {
  background: var(--card);
  color: var(--fg);
}

.search-clear-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.22);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--search-input-bg-focus, var(--search-input-bg, var(--btn)));
  color: var(--search-input-fg, var(--fg));
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.search-input::placeholder {
  color: var(--search-input-placeholder, var(--muted));
}

.search-button {
  display: none;
}

/* ===== SEARCH RESULTS ===== */
.search-results {
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  display: none;
  height: auto;
  max-height: none;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.search-results.active {
  display: block;
  position: fixed;
  left: 10px;
  right: 10px;
  top: var(--search-panel-top, 120px);
  bottom: var(--search-panel-bottom, calc(var(--footer-height, 44px) + env(safe-area-inset-bottom, 0) + var(--vv-bottom-inset, 0px) + 10px));
  width: auto;
  max-width: none;
  height: auto;
  max-height: none;
  min-height: 160px;
  opacity: 1;
  background: var(--collection-panel-bg, var(--card));
  border: var(--panel-border);
  border-radius: var(--panel-radius);
  box-shadow: var(--panel-shadow);
  z-index: 140;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Desktop: anchored panel that uses the space down to the footer */
@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
  .search-results.active {
    position: fixed;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(1200px, calc(100vw - 48px));
    max-width: min(1200px, calc(100vw - 48px));
    top: var(--search-panel-top, 120px);
    bottom: var(--search-panel-bottom, calc(var(--footer-height, 44px) + env(safe-area-inset-bottom, 0) + var(--vv-bottom-inset, 0px) + 10px));
    z-index: 140;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: auto;
  }

  /* Avoid double scroll: only the panel scrolls */
  .search-results-list {
    overflow: visible;
    max-height: none;
    max-width: 1200px;
    margin: 0 auto;
  }
}

.search-results-header {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--surface-border);
  /* Opaque header so scrolling chips/content never show through */
  background: var(--collection-panel-header-bg, var(--bg));
  backdrop-filter: blur(10px);
}

.search-results-summary {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 0 1 auto;
}

.search-filter-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.search-filter-summary::-webkit-scrollbar {
  display: none;
}

.search-option-btn {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(var(--primary-rgb), 0.18);
  background: transparent;
  color: var(--fg);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  min-height: 26px;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  scroll-snap-align: start;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.search-option-btn:hover {
  background: rgba(var(--primary-rgb), 0.08);
}

.search-option-btn.active {
  background: rgba(var(--primary-rgb), 0.14);
  border-color: rgba(var(--primary-rgb), 0.30);
  color: var(--primary);
}

.search-option-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.search-option-btn:focus-visible {
  outline: 2px solid rgba(var(--primary-rgb), 0.50);
  outline-offset: 2px;
}

.search-results-controls {
  display: inline-flex;
  flex-direction: row;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* Force horizontal layout for filter pills inside controls */
.search-results-controls > .filter-pills,
#search-type-filters,
#resontes-type-filters {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 6px;
}

/* Filter pill button styles */
.filter-pill {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(var(--primary-rgb), 0.18);
  background: transparent;
  color: var(--fg);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  min-height: 26px;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.filter-pill:hover {
  background: rgba(var(--primary-rgb), 0.08);
}

.filter-pill.active {
  background: rgba(var(--primary-rgb), 0.14);
  border-color: rgba(var(--primary-rgb), 0.30);
  color: var(--primary);
}

.filter-pill:focus-visible {
  outline: 2px solid rgba(var(--primary-rgb), 0.50);
  outline-offset: 2px;
}


.search-control-btn {
  background: var(--btn);
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 8px;
  height: 48px;
  min-width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, color 0.2s, transform 0.15s;
}

.search-control-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.search-control-btn:active {
  background: var(--card);
  color: var(--fg);
}

.search-control-btn:hover {
  background: var(--card);
  color: var(--fg);
}

.search-results-list {
  overflow-x: hidden;
  height: auto;
  max-width: 1024px;
  margin: 0 auto;
  /* Match Resonates list horizontal padding for identical card layout */
  padding: 10px 10px 0;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0) + var(--vv-bottom-inset, 0px));
}

.search-result {
  padding: 14px 16px;
  border: 1px solid var(--surface-border);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  transition: all 0.2s ease;
  gap: 12px;
  overflow-x: hidden;
  background: var(--card);
  border-radius: var(--border-radius-large);
  box-shadow: var(--shadow-subtle);
}

/* When search results reuse favorites-style markup, keep grid layout (avoid title/actions overlap) */
.search-result.favorite-item {
  display: grid;
  overflow-x: visible;
}

/* Allow long titles to wrap/shrink instead of pushing into actions */
.search-result.favorite-item .favorite-title {
  min-width: 0;
}

.search-result:hover {
  background: var(--card);
  transform: translateY(-1px);
  box-shadow: var(--shadow-light);
  border-color: rgba(var(--primary-rgb), 0.14);
}

.search-result:active {
  background: rgba(var(--primary-rgb), 0.08);
}

.search-result.focused {
  background: rgba(var(--primary-rgb), 0.08);
  border-color: rgba(var(--primary-rgb), 0.2);
  box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb), 0.14);
}

.result-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  width: 100%;
}

.result-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.result-info {
  flex: 1;
  min-width: 0;
  text-align: left;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.result-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 6px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}
@media (min-width: 1024px) { .result-title { -webkit-line-clamp: 6; line-clamp: 6; } }

.result-creator { display: none; }

.result-meta {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  grid-column: 2;
  grid-row: 3;
}

.result-meta-overlay {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  background: var(--chip-bg);
  color: var(--chip-fg);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  z-index: 10;
}

/* ===== Expandable results ===== */
.result-favorite {
  background: var(--btn);
  border: none;
  border-radius: 8px;
  height: 48px;
  min-width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: background-color var(--transition-fast), color var(--transition-fast), transform var(--transition-bounce), box-shadow 0.2s;
  color: var(--muted);
}

.result-favorite:hover {
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.18);
}

.result-favorite:active {
  transform: scale(0.92);
  background: rgba(var(--primary-rgb), 0.2);
  transition: transform 0.08s ease;
}

.result-favorite.active {
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.14);
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.2);
}

.result-favorite.active:hover {
  background: rgba(var(--primary-rgb), 0.25);
  box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.28);
}

.result-expand {
  background: var(--btn);
  border: none;
  border-radius: 6px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
  display: none;
}

.result-expand:active {
  background: var(--card);
}

.expand-icon {
  transition: transform 0.2s;
}

.expand-icon.expanded {
  transform: rotate(180deg);
}

/* ===== SHARE COMPONENTS ===== */
.result-share,
.track-share {
  background: var(--btn);
  border: none;
  border-radius: 6px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
  color: var(--primary);
}

.result-share:active,
.track-share:active {
  background: var(--card);
}

/* Hide share controls when offline */
body.offline-mode #current-track-share,
body.offline-mode .result-share,
body.offline-mode .track-share,
body.offline-mode .tlv2-share,
body.offline-mode .card-btn.share,
body.offline-mode .share-result-button,
body.offline-mode .share-track-button {
  display: none !important;
}

/* ===== TRACK COMPONENTS ===== */
/* Container of multiple track-item rows: stack vertically */
.tracks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px auto 0;
  max-width: 100%;
  padding: 8px 0;
  background: transparent;
  border-radius: 0;
}

.track-item:last-child {
  border-bottom: none;
}

/* Per-row layout inside tracks-list */
.track-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #f6faff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  margin-bottom: 8px;
  transition: var(--transition-all-norm);
  background: #d0f0ff;
  box-shadow: 0 0 0 2px #1890ff66;
}

.track-item:hover {
  background: var(--result-hover);
  box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb), 0.15);
}

.track-item-info {
  flex: 1;
  min-width: 0;
  font-size: 1em;
  font-weight: 600;
  color: #1a1a1a;
  letter-spacing: 0.01em;
  padding-left: 0.2em;
  display: flex;
  align-items: center;
}

.track-number {
  display: inline-block;
  min-width: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.track-title {
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  min-width: 0;
}

.track-creator {
  display: none;
}

.track-actions {
  display: flex;
  flex-direction: row-reverse;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  justify-content: flex-end;
}

.track-play {
  background: var(--accent);
  border: none;
  color: #000;
  font-size: 14px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: bold;
  height: 40px;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(196, 196, 221, 0.2);
}

.track-play:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(196, 196, 221, 0.4);
}

.track-favorite {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  height: 40px;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast), color var(--transition-fast), transform var(--transition-bounce);
}

.track-favorite:hover {
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
  transform: scale(1.12);
}

.track-favorite:active {
  transform: scale(0.9);
  transition: transform 0.08s ease;
}

.track-favorite.active {
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.08);
}

.track-favorite.active:hover {
  background: rgba(var(--primary-rgb), 0.18);
}

.track-number {
  color: var(--muted);
  font-size: 10px;
  text-align: right;
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 4px;
  display: none;
}

.tracks-container {
  max-width: 100%;
  box-sizing: border-box;
  width: 100%;
}

/* Estilos homogéneos para tracklist en favoritos/resonates */
.favorites-list .tracks-container,
.resontes-list-content .tracks-container,
.search-results-list .tracks-container,
.content-card .tracks-container {
  background: var(--collection-subpanel-bg, var(--surface-subtle, rgba(255,255,255,0.02)));
  border: 1px solid var(--surface-border-subtle, rgba(255,255,255,0.08));
  border-radius: 8px;
  margin: 8px 0;
  padding: 0;
  /* Transición suave para expand/collapse */
  max-height: 3000px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease-out, margin 0.35s ease-out;
}

.favorites-list .tracks-container.collapsing,
.resontes-list-content .tracks-container.collapsing,
.search-results-list .tracks-container.collapsing,
.content-card .tracks-container.collapsing {
  max-height: 0;
  opacity: 0;
  margin: 0;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}


  
/* index.html: default hidden state (toggled visible by JS) */
#tracks-list-container,
#description-modal {
  display: none;
}

.expand-tracks,
.card-actions .expand {
  background: transparent;
  border: none;
  color: var(--accent, var(--primary));
  font-size: 14px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  min-height: 36px;
  min-width: 36px;
  position: relative;
  overflow: hidden;
}

.expand-tracks .expand-icon,
.card-actions .expand .expand-icon {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-block;
  font-size: 16px;
}

.expand-tracks.expanded .expand-icon,
.card-actions .expand.expanded .expand-icon {
  transform: rotate(180deg);
}

.expand-tracks:hover,
.card-actions .expand:hover {
  background: var(--surface-hover, rgba(var(--primary-rgb), 0.12));
  transform: scale(1.05);
}

.expand-tracks:active,
.card-actions .expand:active {
  transform: scale(0.95);
  background: rgba(var(--primary-rgb), 0.18);
}

.expand-tracks:focus-visible,
.card-actions .expand:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.1);
}

.expand-tracks:active {
  background: rgba(var(--primary-rgb), 0.1);
}

.album-indicator {
  position: absolute;
  top: 0;
  left: 0;
  margin: 8px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  padding: 5px 10px;
  border-radius: 999px;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  white-space: nowrap;
}

.album-indicator-text {
  font-weight: bold;
  white-space: nowrap;
}

/* ===== UTILITY COMPONENTS ===== */
.result-cover {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--card);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  grid-row: 1 / 4;
  grid-column: 1;
  position: relative;
}

.result-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lazy-load-observer {
  pointer-events: none;
  height: 1px;
  visibility: hidden;
}

.loading-indicator {
  text-align: center;
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
}

/* ===== LOADERS REMOVED ===== */

.no-results {
  text-align: center;
  color: var(--muted);
  padding: 32px 20px;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: fadeIn 0.4s ease;
}

/* ===== CARD GRID (New) ===== */
/* Grid layout is defined in unified-grid.css; keep card styling context-specific. */
.search-results-list .content-card,
.resontes-list-content .content-card { border-radius: 10px; }

/* Art (card-media) sizing: always square, fills full card width */
.search-results-list .card-media,
.resontes-list-content .card-media {
  width: 100%;
  /* Fallback for browsers without aspect-ratio support */
  padding-bottom: 100%;
  height: 0;
  /* Modern browsers use aspect-ratio */
  aspect-ratio: 1 / 1;
  border-radius: 10px 10px 0 0;
}
@supports (aspect-ratio: 1 / 1) {
  .search-results-list .card-media,
  .resontes-list-content .card-media {
    padding-bottom: 0;
    height: auto;
    min-height: 0;
  }
}

/* Ensure images inside the card art always fill the container */
.search-results-list .card-media img,
.resontes-list-content .card-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.search-results-list .card-chips,
.resontes-list-content .card-chips { top: 6px; left: 6px; gap: 5px; }

.search-results-list .chip,
.resontes-list-content .chip { font-size: 10px; padding: 2px 6px; }

.search-results-list .card-body,
.resontes-list-content .card-body { padding: 8px 10px; gap: 4px; }

.search-results-list .card-title,
.resontes-list-content .card-title { font-size: 13px; line-height: 1.2; -webkit-line-clamp: 2; line-clamp: 2; }

.search-results-list .card-creator,
.resontes-list-content .card-creator { font-size: 11px; }

.search-results-list .content-card .result-meta,
.resontes-list-content .content-card .result-meta { padding-top: 2px; }

.search-results-list .card-actions,
.resontes-list-content .card-actions { padding: 6px 8px; min-height: 0; gap: 6px; justify-content: center; }

.search-results-list .card-btn,
.resontes-list-content .card-btn { width: 38px; height: 38px; min-width: 38px; min-height: 38px; border-radius: 8px; }

.content-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--collection-card-bg, var(--card));
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--collection-shadow, var(--shadow-subtle));
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
  height: 100%;
}

/* Cards that use an overlay action bar don't need a third row */
.content-card.actions-overlay {
  grid-template-rows: auto 1fr;
}

.content-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  background: var(--collection-card-hover-bg, var(--surface-hover));
}

.content-card:focus-visible {
  outline: none;
  border-color: rgba(var(--primary-rgb), 0.45);
  box-shadow: var(--shadow-subtle), var(--focus-ring-shadow);
}

.content-card:focus-within {
  border-color: rgba(var(--primary-rgb), 0.35);
  box-shadow: var(--shadow-subtle), var(--focus-ring-shadow);
}

/* "Now playing" state: highlight the matching card */
.content-card.is-playing {
  border-color: rgba(var(--primary-rgb), 0.55);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.28), var(--shadow-subtle);
}

/* Play indicator overlay: visible on hover/focus to show the cover is clickable */
.card-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  transition: background 0.18s ease;
  pointer-events: none;
  z-index: 15;
}

.card-play-overlay::after {
  content: '▶';
  font-size: 28px;
  color: transparent;
  transition: color 0.18s ease, transform 0.18s ease;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  transform: scale(0.75);
  line-height: 1;
}

.content-card:hover .card-play-overlay,
.content-card:focus-visible .card-play-overlay {
  background: rgba(0, 0, 0, 0.22);
}

.content-card:hover .card-play-overlay::after,
.content-card:focus-visible .card-play-overlay::after {
  color: rgba(255, 255, 255, 0.92);
  transform: scale(1);
}

.content-card.is-playing .card-play-overlay::after {
  content: '♪';
  color: rgba(255, 255, 255, 0.75);
  transform: scale(1);
}

/* Card media styles are now centralized in unified-card.css */
/* These styles provide the same fallback pattern for consistent cover sizing */
.card-media {
  position: relative;
  width: 100%;
  /* Fallback for browsers without aspect-ratio support */
  padding-bottom: 100%;
  height: 0;
  /* Modern browsers use aspect-ratio */
  aspect-ratio: 1 / 1;
  background: var(--btn);
  overflow: hidden;
}
@supports (aspect-ratio: 1 / 1) {
  .card-media {
    padding-bottom: 0;
    height: auto;
    min-height: 0;
  }
}
.card-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }

.card-chips { position: absolute; top: 8px; left: 8px; display: flex; gap: 6px; flex-wrap: wrap; z-index: 10; }
.chip {
  /* Ensure strong readability on top of cover art in all themes */
  background: linear-gradient(
    to bottom,
    rgba(var(--primary-rgb), 0.44),
    rgba(var(--primary-rgb), 0.28)
  );
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(var(--primary-rgb), 0.40);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.26);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
}
.chip-quiet {
  background: linear-gradient(
    to bottom,
    rgba(var(--primary-rgb), 0.32),
    rgba(var(--primary-rgb), 0.22)
  );
  color: #fff;
  border-color: rgba(var(--primary-rgb), 0.30);
}

/* Offline chip visibility is controlled by the Offline checkbox */
.chip-offline { display: none; }
/* .chip-offline is no longer shown in search results */
body.favorites-show-offline-chips .favorites-list-content .chip-offline { display: inline-flex; }

/* When the Offline checkbox is enabled, make the Offline chip look "active" */
body.favorites-show-offline-chips .favorites-list-content .chip-offline {
  background: rgba(var(--primary-rgb), 0.30);
  color: var(--chip-fg);
  border-color: rgba(var(--primary-rgb), 0.40);
  box-shadow: 0 0 0 1px rgba(var(--primary-rgb), 0.10);
}

.card-body { padding: 10px 12px; display: grid; gap: 6px; grid-template-columns: 1fr 1fr; /* Two columns */ grid-template-rows: auto auto; /* Two rows */ grid-auto-flow: row; align-content: start; }
.content-card .card-body { position: relative; }
.card-title { grid-column: 1 / -1; grid-row: 1; width: 100%; font-weight: 700; font-size: 15px; line-height: 1.25; white-space: normal; overflow-wrap: break-word; word-wrap: break-word; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; min-width: 0; }
/* Mobile default: clamp to 3 lines */
.card-title { -webkit-line-clamp: 3; line-clamp: 3; }
/* Desktop: show up to 6 lines */
@media (min-width: 1024px) { .card-title { -webkit-line-clamp: 6; line-clamp: 6; } }

/* Favorites: keep titles compact even on desktop */
@media (min-width: 1024px) {
  .favorites-list-content .card-title,
  .resontes-list-content .card-title { -webkit-line-clamp: 2; line-clamp: 2; }
}
.card-subtitle { display: none; }
.card-creator {
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.result-meta { grid-column: 1 / -1; grid-row: 2; display: block; }
/* Ensure metadata stays visible and readable under the title in both cards and legacy list rows */
.favorite-item .result-meta,
.content-card .result-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 20px;
  padding-top: 4px;
  position: static;
}

.favorite-item .result-meta .result-meta-pill,
.favorite-item .result-meta .result-meta-status,
.content-card .result-meta .result-meta-pill,
.content-card .result-meta .result-meta-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--surface-border-subtle);
  background: var(--collection-subpanel-bg, rgba(var(--primary-rgb), 0.08));
  color: var(--fg);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.favorite-item .result-meta .album-indicator,
.content-card .result-meta .album-indicator {
  position: static;
  top: auto;
  left: auto;
  margin: 0;
  box-shadow: none;
}

.favorite-item .result-meta .track-duration,
.content-card .result-meta .track-duration {
  background: rgba(var(--primary-rgb), 0.12);
  border-color: rgba(var(--primary-rgb), 0.24);
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.favorite-item .result-meta .result-meta-status,
.content-card .result-meta .result-meta-status {
  color: var(--muted);
  font-weight: 500;
}

.card-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 10px 12px; min-height: 44px; }
.card-btn { background: var(--btn); border: none; color: var(--fg); border-radius: 8px; width: 44px; height: 40px; display: flex; align-items: center; justify-content: center; font-size: 14px; transition: transform 0.15s, background 0.2s; }
.card-btn:hover { background: var(--card); transform: translateY(-1px); }
.card-btn:active { transform: scale(0.95); }
.card-btn:focus-visible { outline: none; box-shadow: var(--focus-ring-shadow); }
.card-btn.favorite.active,
.card-btn.resonte.active {
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.14);
}

/* Premium desktop: de-emphasize actions until hover/focus (keeps scanability) */
@media (min-width: 1024px) {
  .content-card .card-actions {
    opacity: 0.86;
    transition: opacity 0.16s ease, transform 0.16s ease;
  }

  .content-card:hover .card-actions,
  .content-card:focus-within .card-actions {
    opacity: 1;
  }

  /* Make actions feel like a unified control strip */
  .content-card .card-actions {
    background: linear-gradient(
      to top,
	    rgba(var(--primary-rgb), 0.06),
	    rgba(var(--primary-rgb), 0.00)
    );
  }
}

/* Desktop density: Compact by default (no toggle) */
@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
  .card-grid { gap: 12px; }
  .content-card { border-radius: 10px; }
  .card-body { padding: 8px 10px; gap: 4px; }
  .card-title { font-size: 14px; -webkit-line-clamp: 5; line-clamp: 5; }
  .card-chips { top: 6px; left: 6px; gap: 5px; }
  .chip { font-size: 10px; padding: 2px 7px; }
  .card-actions { padding: 8px 10px; min-height: 40px; gap: 6px; }
  .card-btn { width: 40px; height: 40px; border-radius: 8px; }
}

/* Single-track favorites keep same square media to standardize height */
.content-card.single .card-actions { padding-top: 6px; }

/* Grid breakpoints */
@media (min-width: 768px) {
  .content-list { max-width: 1024px; margin: 0 auto; padding: 10px 16px 0; }
}
@media (min-width: 1024px) {
  .content-list { max-width: 1200px; padding: 10px 24px 0; }
}

/* Extra desktop (1280px and up) - Wider container and denser grid */
@media (min-width: 1280px) {
  .search-results,
  .search-container,
  .content-list { max-width: 1200px; }
}

/* Mobile tightening for 2-column grid */
@media (max-width: 420px) {
  .content-list { padding: 8px 8px 0; }
  .content-list .card-actions.card-actions-overlay { padding: 3px 5px; gap: 5px; }
  /* Proportionate button sizes on small mobile */
  .content-list .card-actions.card-actions-overlay .card-btn { width: 34px; height: 34px; }
}

.no-results-icon {
  font-size: 48px;
  opacity: 0.6;
  margin-bottom: 8px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

.no-results-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 4px;
}

.no-results-hint {
  font-size: 13px;
  color: var(--muted);
}

.load-more {
  text-align: center;
  padding: 12px;
  border-top: 1px solid var(--surface-border-subtle);
}

.load-more-btn {
  background: var(--primary);
  color: #000000;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s;
  text-align: center;
  display: inline-block;
}

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

/* ===== OVERLAYS & MODALS ===== */
.start-view {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: var(--bg);
  z-index: 1000;
  transition: opacity 0.4s, visibility 0.4s;
  display: none;
}

.start-view.hidden {
  opacity: 0;
  visibility: hidden;
}

.start-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.8rem;
  text-align: center;
}

.start-subtitle {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1.8rem;
  text-align: center;
  max-width: 80%;
}

.start-button {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  padding: 12px 24px;
  box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.25);
}

.start-button:active {
  transform: scale(0.97);
}

/* ===== FAVORITES TAB ===== */
.favorites-section {
  display: flex;
  flex-direction: row-reverse;
  /*height: 100%;*/
}

/* ===== SEARCH TAB ===== */
.search-section {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.search-container {
  flex-shrink: 0;
}

.search-results {
  flex: 1;
  margin-left: 0;
  margin-right: 0;
}

/* ===== IMPROVED CONTROLS ===== */
.volume-slider {
  display: block;
  /* Always visible */
}

/* ===== FOOTER ===== */
.stage {
  color: var(--muted);
  font-size: 12px;
}

/* ===== FOOTER ===== */
.footer {
  color: var(--primary-text);
  font-size: 10px;
  padding: 8px 0 !important;
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  z-index: 220;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  opacity: 1;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin-top: 0;
  width: 100% !important;
  line-height: 1.25;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-sizing: border-box;
  text-align: center !important;
}

/* ===== MEDIA QUERIES ===== */
/* Mobile First - Progressive Enhancement */

/* Tablet (768px and up) */
@media (min-width: 768px) {
  :root {
    --art-size-mobile: var(--art-size-tablet);
    --btn-size-mobile: var(--btn-size-tablet);
    --btn-large-mobile: var(--btn-large-tablet);
    --search-height-mobile: var(--search-height-tablet);
  }

  /* Tablet footer - use sticky like mobile */
  .footer {
    position: sticky;
    bottom: 0;
    padding: 10px 0 !important;
    opacity: 1;
    font-size: 10px;
    width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    color: var(--primary-text);
  }

  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 20px;
  }

  h3 {
    font-size: 18px;
  }

  .art {
    width: var(--art-size-tablet);
    height: var(--art-size-tablet);
  }

  .title {
    font-size: 26px;
  }

  .creator {
    font-size: 18px;
  }

  button {
    font-size: 16px;
  }

  .play-btn,
  .play-btn-favorite {
    width: 80px;
    height: 80px;
    font-size: 24px;
  }

  .main-player-section .controls {
    display: flex;
    flex-direction: row;
    gap: 32px;
  }

  .main-player-section .controls button {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
  }

  .search-input {
    height: var(--search-height-tablet);
    font-size: 15px;
  }
}

/* Desktop (1024px and up) - Complete fixed layout */
@media (min-width: 1024px) {
  :root {
    --art-size-mobile: var(--art-size-desktop);
    --btn-size-mobile: var(--btn-size-desktop);
    --btn-large-mobile: var(--btn-large-desktop);
    --search-height-mobile: var(--search-height-desktop);
    --content-max-width: 700px;
    --progress-height: var(--progress-height-desktop);
  }

  /* Desktop layout - Fixed viewport */
  html,
  body {
    overflow: hidden; /* Keep fixed layout for desktop */
  }

  /* Desktop layout - Flexbox dynamic */
  .app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    max-width: 100vw;
    overflow-x: hidden;
    padding-top: 0;
    padding-bottom: 48px; /* Space for fixed footer */
  }

  /* Sticky header instead of fixed for better UX */
  header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: auto;
    background: var(--bg);
    z-index: 1000;
    padding: 0 var(--spacing-xl);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
  }

  /* Discovery section - grows dynamically */
  .discovery-section {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--spacing-md) var(--spacing-lg);
    min-height: 160px;
    display: flex;
    flex-direction: column;
    align-items: stretch; /* Stretch children to full width for desktop */
  }

  /* Main player section - can shrink so search stays visible */
  .main-player-section {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    max-width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--spacing-lg) 0;
  }

  /* Embedded Favorites layout: two columns only when favorites is open */
  .favorites-embedded-open .content-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(320px, 32vw, 460px);
    grid-template-rows: minmax(160px, 1fr) minmax(260px, 1fr);
    column-gap: var(--spacing-lg);
    row-gap: var(--spacing-lg);
    padding: var(--spacing-md) var(--spacing-lg);
  }

  .favorites-embedded-open .discovery-section {
    grid-column: 1;
    grid-row: 1;
    padding: 0;
    min-height: 0;
  }

  .favorites-embedded-open .main-player-section {
    grid-column: 1;
    grid-row: 2;
    padding: 0;
    min-height: 0;
  }

  .favorites-embedded-open .favorites-list {
    grid-column: 2;
    grid-row: 1 / span 2;
    min-height: 0;
    width: 100%;
    max-width: 100%;
  }

  /* Fixed footer - always visible */
  .footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg);
    z-index: 10000; /* High z-index to ensure visibility */
    padding: 10px var(--spacing-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    height: auto;
    margin-top: 0; /* Override mobile margin-top: auto */
    opacity: 1;
    font-size: 10px;
    text-align: center;
    width: 100%;
    color: var(--primary-text);
  }

  h1 {
    font-size: 34px;
    padding: var(--spacing-sm) 0;
    letter-spacing: -1px;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  }

  h2 {
    font-size: 24px;
  }

  h3 {
    font-size: 20px;
  }

  .art {
    width: var(--art-size-desktop);
    height: var(--art-size-desktop);
    max-width: none;
    margin-bottom: var(--spacing-md); /* Reduced margin */
  }

  .player-content {
    padding: 0 var(--spacing-lg); /* Reduced padding */
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
  }

  .current-track-info {
    padding: var(--spacing-lg) 0; /* Reduced padding */
  }

  .title {
    font-size: 28px; /* Slightly smaller for fit */
  }

  .creator {
    font-size: 18px;
  }

  .progress-section {
    margin: var(--spacing-md) 0; /* Reduced margins */
  }

  .main-player-section .controls {
    display: flex;
    flex-direction: row;
    max-width: 960px;
    gap: 32px;
  }

  .main-player-section .controls button {
    width: 70px;
    height: 70px;
  }

  button {
    font-size: 16px;
  }

  .play-btn,
  .play-btn-favorite {
    width: 80px;
    height: 80px;
    font-size: 24px;
  }

  .search-section {
    width: 100%;
    max-width: 1000px;
    margin: 8px auto 0 auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-sm);
  }

  .search-container {
    width: 100%;
    margin: 0;
  }

  .search-input {
    height: var(--search-height-desktop);
    font-size: 16px;
    width: 100%;
    max-width: none;
    background: var(--search-input-bg, var(--btn));
    border: 2px solid transparent;
    color: var(--search-input-fg, var(--fg));
    caret-color: var(--search-input-caret, currentColor);
  }

  .search-input::placeholder {
    color: var(--search-input-placeholder, var(--muted));
  }

  .progress-bar {
    height: var(--progress-height-desktop);
  }

  .progress-bar:hover {
    height: 8px;
  }

  .player-container {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
  }

  /* Search results / recent searches: full width, natural height (scroll handled by .discovery-section) */
  .search-results:not(.active) {
    width: 100%;
    max-width: 1000px;
    margin: 6px auto 0 !important;
    overflow-y: visible;
    max-height: none;
    height: auto;
  }

  .search-results-list {
    width: 100%;
    max-width: none;
  }
  
  .search-container {
    max-width: 1000px;
    width: 100%;
  }
  
  .favorites-list:not(.active) {
    max-width: 1000px;
    margin: 6px auto !important;
    overflow-y: visible;
    max-height: none;
    height: auto;
  }
}

/* Legacy max-width queries for specific overrides */
@media (max-width: 768px) {
  /* Layout optimizations for mobile - titles on top of buttons */
  
  /* Theme selector on mobile */
  .theme-selector {
    font-size: 12px;
    padding: 3px 6px;
    min-width: 45px;
  }
  
  .footer {
    width: 100% !important;
    opacity: 0.6;
    font-size: 10px;
    padding: 8px 0 !important;
    left: 0 !important;
    right: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
  }
  
  h1 {
    font-size: 18px;
  }
  
  header {
    padding: var(--spacing-sm);
  }
  
  /* Improve button sizing on mobile */
  .result-favorite,
  .result-expand,
  .result-share,
  .track-share,
  .search-control-btn {
    height: 48px;
    min-width: 48px;
  }
  
  /* Search results vertical layout */
  .search-result {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
  }
  
  .result-buttons {
    width: 100%;
    justify-content: flex-start;
    margin-top: 8px;
  }
  
  /* Favorites grid layout */
  .favorite-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    grid-template-rows: auto auto auto;
    gap: 12px;
    align-items: start;
  }
  
  .favorite-title {
    grid-column: 2 / -1;
    grid-row: 1;
  }
  
  .result-cover {
    grid-row: 1 / 4;
    grid-column: 1;
  }
  
  .favorite-creator {
    grid-column: 2;
    grid-row: 2;
  }
  
  .result-meta {
    grid-column: 2;
    grid-row: 3;
  }
  
  .favorite-actions {
    flex-direction: row-reverse;
    grid-column: 2 / -1;
    grid-row: 4;
    justify-self: end;
  }
  
  /* Track items layout (mobile tweaks retained, leveraging base styles above) */
  .track-item { grid-template-columns: auto 1fr auto; }
  .track-item-info { grid-column: 2; min-width: 0; }
  .track-actions { justify-content: flex-end; }
}

@media (min-width: 600px) {
  :root {
    --content-max-width: 600px;
  }
  .search-section {
    padding: 8px 0 0 0;
  }
  .search-container {
    max-width: var(--content-max-width);
    margin: 0 auto;
  }
  .search-input {
    height: var(--search-height-tablet);
    font-size: 15px;
    max-width: 100%;
  }
}
@media (min-width: 900px) {
  :root {
    --content-max-width: 700px;
  }
  .search-container {
    max-width: var(--content-max-width);
  }
}
@media (min-width: 1200px) {
  :root {
    --content-max-width: 900px;
  }
  .search-container {
    max-width: var(--content-max-width);
  }
}
/* Large phones / small tablets (481px–767px) */
@media (min-width: 481px) and (max-width: 767px) {
  .main-player-section .controls {
    gap: clamp(var(--spacing-md), 4vw, calc(var(--spacing-lg) * 2));
  }

  .main-player-section .controls button {
    width: 72px;
    height: 72px;
    min-width: 72px;
    min-height: 72px;
    font-size: 22px;
  }

  .play-btn,
  .play-btn-favorite {
    width: 86px;
    height: 86px;
    min-width: 86px;
    min-height: 86px;
    font-size: 30px;
  }
}

/* ===== STRICT NO-SCROLL COMPACT RULES (short viewports) =====
   Placed at the end so they override any later responsive blocks.
*/
@media (max-height: 568px) {
  :root {
    --art-size-mobile: clamp(150px, 26vh, 200px);
    --btn-size-mobile: 52px;
    --btn-large-mobile: 64px;
  }

  .main-player-section {
    padding-top: 10px;
  }

  .player-content {
    gap: 12px;
    padding-bottom: 6px;
  }

  .art {
    margin: 0 auto 10px;
  }

  .current-track-info {
    padding: 10px 0 4px 0;
    gap: 4px;
  }

  .title {
    font-size: 20px;
    line-height: 1.2;
  }

  .creator {
    font-size: 14px;
    line-height: 1.15;
  }

  .progress-section {
    padding: 8px;
    margin: 0 0 6px 0;
  }

  .main-player-section .controls {
    gap: clamp(6px, 2.5vw, 12px);
    margin-top: 6px;
  }

  .main-player-section .controls button {
    width: var(--btn-size-mobile);
    height: var(--btn-size-mobile);
    min-width: var(--btn-size-mobile);
    min-height: var(--btn-size-mobile);
    font-size: 20px;
  }

  .play-btn,
  .play-btn-favorite {
    width: var(--btn-large-mobile);
    height: var(--btn-large-mobile);
    min-width: var(--btn-large-mobile);
    min-height: var(--btn-large-mobile);
    font-size: 22px;
  }

  .progress-bar:hover {
    height: var(--progress-height);
  }
}

@media (max-height: 430px) {
  :root {
    --art-size-mobile: clamp(100px, 20vh, 140px);
    --btn-size-mobile: 44px;
    --btn-large-mobile: 56px;
  }

  .main-player-section {
    padding-top: 6px;
  }

  .player-content {
    gap: 8px;
    padding-bottom: 4px;
  }

  .art {
    margin: 0 auto 6px;
  }

  .current-track-info {
    padding: 4px 0 2px 0;
    gap: 2px;
  }

  .title {
    font-size: 17px;
    line-height: 1.15;
  }

  .creator {
    font-size: 12px;
    line-height: 1.1;
  }

  /* Keep the track options button available without extra vertical spacing. */
  #description-container {
    margin: 0;
  }

  .current-time,
  .total-time {
    display: none;
  }

  .progress-section {
    padding: 6px 8px 16px 8px;
    margin: 0;
  }
  
  .progress-bar {
    height: 6px;
  }
  
  .progress-bar:hover {
    height: 6px;
  }

  .main-player-section .controls {
    gap: clamp(6px, 2vw, 10px);
    margin-top: 4px;
  }

  .main-player-section .controls button {
    width: var(--btn-size-mobile);
    height: var(--btn-size-mobile);
    min-width: var(--btn-size-mobile);
    min-height: var(--btn-size-mobile);
    font-size: 18px;
  }

  .play-btn,
  .play-btn-favorite {
    width: var(--btn-large-mobile);
    height: var(--btn-large-mobile);
    min-width: var(--btn-large-mobile);
    min-height: var(--btn-large-mobile);
    font-size: 20px;
  }

  .progress-bar:hover {
    height: var(--progress-height);
  }

  /* Avoid hover scale effects causing clipping in fixed-height layouts */
  .progress-section:hover,
  .main-player-section .controls button:hover,
  .play-btn:hover,
  .play-btn-favorite:hover {
    transform: none;
  }
}

/* ===== SECONDARY BUTTON STYLE ===== */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--btn);
  border: 1px solid var(--surface-border);
  color: var(--control-fg);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border-radius: var(--border-radius-small);
  padding: 0 12px;
  height: 44px;
  min-height: 44px;
  line-height: 1;
  letter-spacing: 0.01em;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18), inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  font-family: inherit;
}

.btn-secondary.icon-only {
  width: 44px;
  min-width: 44px;
  padding: 0;
}

.btn-secondary .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-secondary .btn-svg {
  width: 18px;
  height: 18px;
  display: block;
  stroke: currentColor;
  fill: none;
}

.visually-hidden,
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.o-50 {
  opacity: 0.5;
}

.offline-track-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 1.5em;
  margin-inline-start: auto;
  font-size: 0.9em;
}

.offline-track-cached .offline-track-status {
  color: #218838;
}

.offline-track-partial .offline-track-status {
  color: #9a6700;
}

.offline-track-network-required .offline-track-status {
  color: #666;
}

.btn-secondary:hover {
  background: rgba(var(--primary-rgb), 0.14);
  border-color: rgba(var(--primary-rgb), 0.4);
  color: var(--fg);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.btn-secondary:active {
  transform: translateY(1px);
  background: rgba(var(--primary-rgb), 0.22);
  border-color: rgba(var(--primary-rgb), 0.5);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.25);
}

.btn-secondary:focus {
  outline: none;
  border-color: rgba(var(--primary-rgb), 0.45);
  box-shadow: var(--focus-ring-shadow);
}

.btn-secondary:focus-visible {
  outline: none;
  border-color: rgba(var(--primary-rgb), 0.55);
  box-shadow: var(--focus-ring-shadow), 0 6px 16px rgba(0, 0, 0, 0.28);
}

.btn-secondary.active {
  background: rgba(var(--primary-rgb), 0.28);
  border-color: rgba(var(--primary-rgb), 0.55);
  color: var(--fg);
  box-shadow: 0 8px 18px rgba(var(--primary-rgb), 0.25), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.btn-secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--btn);
  border-color: var(--surface-border-subtle);
  box-shadow: none;
}

/* ===== BOTÓN TERCIARIO - Mínimo tamaño ===== */
.btn-tertiary {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 8px !important;
  border-radius: 6px;
  min-width: 36px !important;
  min-height: 36px !important;
  height: 36px !important;
  max-height: 36px !important;
  transition: all var(--transition-fast);
  line-height: 1;
  flex-shrink: 0;
  overflow: visible !important;
}

.btn-tertiary:hover {
  background: rgba(var(--primary-rgb), 0.16);
  color: var(--primary);
}

.btn-tertiary:active {
  background: rgba(var(--primary-rgb), 0.18);
  transform: scale(0.95);
}

.btn-tertiary:focus {
  outline: none;
  box-shadow: 0 0 0 1px rgba(var(--primary-rgb), 0.2);
}

/* Mejorar visibilidad e interacción del botón de descripción */
#toggle-description-btn {
  margin-bottom: 0;
}
/* ===== SEARCH HISTORY ===== */
.search-history-item {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(var(--primary-rgb), 0.12);
  cursor: pointer;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  transition: var(--transition-fast);
  gap: 8px;
  overflow-x: hidden;
  min-height: 48px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.search-history-item:last-child {
  border-bottom: none;
}

.search-history-item:hover {
  background: rgba(var(--primary-rgb), 0.08);
  border-bottom-color: rgba(var(--primary-rgb), 0.24);
}

.search-history-item:active {
  background: rgba(var(--primary-rgb), 0.06);
}

.search-history-item:focus {
  outline: none;
  background: rgba(var(--primary-rgb), 0.1);
  box-shadow: inset 0 0 0 2px rgba(var(--primary-rgb), 0.4);
}

.history-icon {
  font-size: 16px;
  flex-shrink: 0;
  opacity: 0.55;
  line-height: 1;
}

.history-query {
  font-weight: 500;
  font-size: 14px;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.history-time {
  font-size: 11px;
  color: var(--fg);
  opacity: 0.45;
  white-space: nowrap;
  flex-shrink: 0;
}

.history-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  min-width: 36px;
  min-height: 36px;
  height: 36px;
  max-height: 36px;
  transition: all var(--transition-fast);
  line-height: 1;
  flex-shrink: 0;
  overflow: visible;
  margin-left: auto;
}

.history-remove:hover {
  background: rgba(var(--primary-rgb), 0.16);
  color: var(--primary);
}

.history-remove:active {
  background: rgba(var(--primary-rgb), 0.18);
  transform: scale(0.95);
}

.history-remove:focus {
  outline: none;
  box-shadow: 0 0 0 1px rgba(var(--primary-rgb), 0.2);
}

.history-remove.btn-tertiary {
  /* Hereda estilos del btn-tertiary */
}

/* Mejorar visibilidad del botón eliminar en tema Eco */
[data-theme="eco"] .btn-tertiary {
  opacity: 0.85;
}

.search-history-clear {
  padding: 16px 12px;
  text-align: center;
  border-top: 1px solid rgba(var(--primary-rgb), 0.12);
}

.clear-history-btn {
  background: rgba(var(--primary-rgb), 0.1);
  border: 1px solid rgba(var(--primary-rgb), 0.24);
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
  padding: 10px 20px;
  border-radius: var(--border-radius-small);
  font-weight: 600;
  transition: var(--transition-fast);
  min-height: 40px;
}

.clear-history-btn:hover {
  background: rgba(var(--primary-rgb), 0.14);
  border-color: rgba(var(--primary-rgb), 0.32);
}

.clear-history-btn:active {
  background: rgba(var(--primary-rgb), 0.12);
  transform: scale(0.98);
}

/* ===== PWA INSTALL BANNER ===== */
.pwa-install-banner {
  position: fixed;
  top:  0;
  left: 0;
  right: 0;
  background: var(--card);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-light);
  z-index: 10000;
  opacity: 0;
  transform: translateY(-100%);
  transition: var(--transition-all-slow);
  padding: var(--spacing-md) var(--spacing-lg);
}

.pwa-install-banner.active {
  opacity: 1;
  transform: translateY(0);
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 1200px;
  margin: 0 auto;
  gap: var(--spacing-md);
}

.pwa-banner-text {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 14px;
  color: var(--fg);
  flex: 1;
  flex-wrap: wrap;
  justify-content: center;
}

.pwa-icon {
  font-size: 18px;
}

.pwa-banner-buttons {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
}

.pwa-install-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--border-radius);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-all-norm);
  padding: 10px 14px;
  min-height: 40px;
  line-height: 1;
}

.pwa-install-btn.pwa-install-btn-secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.pwa-install-btn.pwa-install-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

/* ===== SHARED LINK "OPEN IN APP" BANNER ===== */
.open-in-app-banner .pwa-banner-content {
  justify-content: space-between;
}

.open-in-app-banner .open-in-app-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
}

.open-in-app-banner .open-in-app-title {
  font-weight: 700;
  color: var(--fg);
}

.open-in-app-banner .open-in-app-subtitle {
  font-size: 13px;
  color: var(--muted);
}

.open-in-app-banner .open-in-app-actions {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.open-in-app-banner .open-in-app-btn {
  background: var(--primary);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding-left: 16px;
  padding-right: 16px;
}

.open-in-app-banner .open-in-app-btn:hover {
  background: var(--accent-alt);
}

@media (max-width: 520px) {
  .open-in-app-banner .pwa-banner-content {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .open-in-app-banner .open-in-app-actions {
    justify-content: flex-start;
  }
}

.pwa-install-btn:hover {
  background: var(--accent-alt);
  transform: translateY(-1px);
}

.pwa-install-btn:active {
  transform: translateY(0);
  background: var(--primary);
}

/* ===== SW UPDATE BANNER (Mode B) ===== */
.sw-update-banner .pwa-install-btn.sw-update-apply-btn {
  background: var(--primary);
  color: #fff;
}

.sw-update-banner .pwa-install-btn.sw-update-apply-btn:hover {
  background: var(--accent-alt);
}

/* ===== SW UPDATE MODAL ===== */
.sw-update-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10100;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sw-update-modal-overlay.active {
  opacity: 1;
}

.sw-update-modal {
  background: var(--card);
  border: 1px solid rgba(128, 128, 128, 0.25);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 0 4px rgba(var(--primary-rgb), 0.15);
  border-radius: 18px;
  padding: 32px 28px 24px;
  max-width: 420px;
  width: 90vw;
  position: relative;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.25s ease, opacity 0.25s ease;
  opacity: 0;
}

.sw-update-modal-overlay.active .sw-update-modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.sw-update-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}

.sw-update-modal-close:hover {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.08);
}

.sw-update-modal-icon {
  font-size: 36px;
  margin-bottom: 12px;
  display: block;
  text-align: center;
}

.sw-update-modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 8px;
  text-align: center;
  letter-spacing: -0.01em;
}

.sw-update-modal-version {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 16px;
}

.sw-update-modal-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  text-align: center;
  margin-bottom: 24px;
}

.sw-update-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sw-update-modal-btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--border-radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 13px 20px;
  transition: background 0.18s, transform 0.12s;
  width: 100%;
  min-height: 46px;
}

.sw-update-modal-btn-primary:hover {
  background: var(--accent-alt);
  transform: translateY(-1px);
}

.sw-update-modal-btn-primary:active {
  transform: translateY(0);
  background: var(--primary);
}

.sw-update-modal-btn-secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid rgba(128, 128, 128, 0.3);
  border-radius: var(--border-radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 11px 20px;
  transition: background 0.18s, border-color 0.18s;
  width: 100%;
  min-height: 42px;
}

.sw-update-modal-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(128, 128, 128, 0.5);
}

.sw-update-modal-schedule {
  display: none;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.sw-update-modal-schedule.visible {
  display: flex;
}

.sw-update-modal-schedule-label {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 2px;
}

.sw-update-modal-schedule-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.sw-update-modal-schedule-btn {
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
  border: 1px solid rgba(128, 128, 128, 0.25);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 7px 14px;
  transition: background 0.15s, border-color 0.15s;
}

.sw-update-modal-schedule-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(128, 128, 128, 0.5);
}

.pwa-close-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pwa-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--fg);
}

.pwa-close-btn:active {
   background: rgba(255, 255, 255, 0.2);
  transform: scale(0.95);
}

/* ===== CURRENT TRACK SHARE BUTTON ===== */
/* (section removed) */

/* ===== Tracklist V2 (scoped under .tracklist) ===== */
.tracklist .tlv2 { 
  padding: 8px 4px; 
  border-top: 1px solid var(--surface-border-subtle);
  overflow: hidden;
}

.tracklist .tlv2-list { 
  display: flex; 
  flex-direction: column; 
  gap: 6px;
  /* Garantizar scroll consistente en todos los contextos */
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  /* Permitir interacción dentro del scroll */
  touch-action: auto;
}

/* Estilos de scroll para mejor visibilidad */
.tracklist .tlv2-list::-webkit-scrollbar {
  width: 8px;
}

.tracklist .tlv2-list::-webkit-scrollbar-track {
  background: transparent;
}

.tracklist .tlv2-list::-webkit-scrollbar-thumb {
  background: var(--surface-border);
  border-radius: 4px;
}

.tracklist .tlv2-list::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Firefox scrollbar */
.tracklist .tlv2-list {
  scrollbar-color: var(--surface-border) transparent;
  scrollbar-width: thin;
}

/* Tracklist V2: estilos globales para todos los contextos */
.tracklist .tlv2-row {
  display: grid;
  grid-template-columns: 32px 32px 32px 32px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 6px;
  padding: 10px 8px;
  border-radius: 8px;
  background: var(--collection-row-bg, transparent);
  transition: background 0.15s;
  min-height: 60px;
  cursor: pointer;
  user-select: none;
  /* Garantizar que sea clickeable incluso dentro de overflow */
  touch-action: manipulation;
  box-shadow: inset 0 0 0 1px var(--surface-border-subtle);
}

@media (max-width: 480px) {
  .tracklist .tlv2-row {
    grid-template-columns: 32px 32px 32px 32px minmax(0, 1fr) 44px;
    gap: 2px;
    padding: 8px 6px;
    min-height: 56px;
  }
}
.tracklist .tlv2-row:hover,
.tracklist .tlv2-row:focus-visible {
  background: var(--collection-row-hover-bg, var(--surface-hover));
}
.tracklist .tlv2-row:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.tracklist .tlv2-row--playing {
  background: var(--collection-row-active-bg, rgba(var(--primary-rgb), 0.15));
  font-weight: 600;
}
.tracklist .tlv2-row--playing .tlv2-title,
.tracklist .tlv2-row--playing .track-row-title {
  color: var(--primary);
}
.tracklist .tlv2-left {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
}
.tracklist .tlv2-number {
  display: inline-block;
  min-width: 20px;
  text-align: center;
}
.tracklist .tlv2-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tracklist .tlv2-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
  justify-content: center;
}
.tracklist .tlv2-title {
  font-size: 14px;
  line-height: 1.35;
  color: var(--fg);
  /* Allow 2 lines with ellipsis for better readability */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  min-width: 0;
}

/* Tracklist V2: fallback global (cuando el contenedor no usa .tracklist) */
.tlv2-title {
  /* Allow 2 lines with ellipsis for better readability */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  min-width: 0;
}
.tracklist .tlv2-creator {
  font-size: 11px;
  line-height: 1.3;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tracklist .tlv2-meta {
  font-size: 11px;
  line-height: 1.3;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tracklist .tlv2-description {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  white-space: normal;
  word-break: break-word;
}
.tracklist .tlv2-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.tracklist .tlv2-duration {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
   min-width: 48px;
   font-size: 12px;
   color: var(--fg);
   opacity: 0.82;
   font-variant-numeric: tabular-nums;
   white-space: nowrap;
}
.tracklist .tlv2-action {
  background: transparent;
  border: none;
  color: var(--control-fg);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-bounce);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  /* Ensure adequate touch target while keeping visual appearance compact */
  position: relative;
}

/* Extend touch target to 44x44px for accessibility */
.tracklist .tlv2-action::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
}

@media (max-width: 480px) {
  .tracklist .tlv2-action {
    font-size: 13px;
    min-width: 28px;
    min-height: 28px;
    padding: 3px;
  }
}

.tracklist .tlv2-action:hover,
.tracklist .tlv2-action:focus-visible {
  background: var(--btn-hover);
}
.tracklist .tlv2-fav.active {
  color: var(--favorite);
}

/* Tracklist V2: Resonates button (uses inline SVG with currentColor) */
.tracklist .tlv2-resonte,
.tracklist .track-resonte {
  color: var(--muted);
  transition: color var(--transition-fast), background var(--transition-fast), transform var(--transition-bounce);
}

.tracklist .tlv2-resonte:hover,
.tracklist .track-resonte:hover {
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.1);
  transform: scale(1.12);
}

.tracklist .tlv2-resonte:active,
.tracklist .track-resonte:active {
  transform: scale(0.9);
  transition: transform 0.08s ease;
}

.tracklist .tlv2-resonte.active,
.tracklist .track-resonte.active {
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.08);
}

.tracklist .tlv2-resonte.active:hover,
.tracklist .track-resonte.active:hover {
  background: rgba(var(--primary-rgb), 0.18);
}
.tracklist .tlv2-offline {
  font-size: 12px;
  color: var(--muted);
}
.tracklist .tlv2-download {
  font-size: 13px;
}

/* ===== Tracklist V2: UX Improvements ===== */

/* Staggered row entrance animation */
@keyframes tlv2-row-enter {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tracklist .tlv2-row {
  animation: tlv2-row-enter 0.2s ease both;
  animation-delay: calc(var(--row-i, 0) * 0.028s);
}

/* Animated equalizer bars for the currently playing row */
@keyframes eq-bars {
  0%   { background-size: 3px 8px,  3px 4px,  3px 10px; }
  25%  { background-size: 3px 12px, 3px 8px,  3px 5px;  }
  50%  { background-size: 3px 4px,  3px 12px, 3px 8px;  }
  75%  { background-size: 3px 10px, 3px 5px,  3px 12px; }
  100% { background-size: 3px 8px,  3px 4px,  3px 10px; }
}

/* Track number column: show play icon on hover (non-playing rows) */
.tracklist .tlv2-number {
  position: relative;
  transition: color 0.15s;
}

.tracklist .tlv2-row:hover:not(.tlv2-row--playing) .tlv2-number {
  color: transparent;
}

.tracklist .tlv2-row:hover:not(.tlv2-row--playing) .tlv2-number::before {
  content: '▶';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg);
  font-size: 10px;
}

/* Track number column: show animated equalizer when playing */
.tracklist .tlv2-row--playing .tlv2-number {
  color: transparent;
}

.tracklist .tlv2-row--playing .tlv2-number::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  /* Offset = half the element's width (16px) to truly center the 3-bar graphic */
  transform: translate(-8px, -50%);
  width: 16px;
  height: 14px;
  background-image:
    linear-gradient(var(--primary), var(--primary)),
    linear-gradient(var(--primary), var(--primary)),
    linear-gradient(var(--primary), var(--primary));
  background-size: 3px 8px, 3px 4px, 3px 10px;
  background-position: 0 bottom, 6px bottom, 12px bottom;
  background-repeat: no-repeat;
  animation: eq-bars 0.9s ease-in-out infinite;
}

/* Playing row: left accent border */
.tracklist .tlv2-row--playing {
  border-left: 3px solid var(--primary);
  padding-left: calc(6px - 3px);
}

/* Cached/offline track: subtle dot on the duration badge */
.tracklist .tlv2-row--cached .tlv2-duration {
  position: relative;
  padding-left: 10px;
}

.tracklist .tlv2-row--cached .tlv2-duration::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.65;
}

/* Ensure expanded tracklists span the full width of the card grid */
.card-grid .tracks-container {
  grid-column: 1 / -1;
  width: 100%;
  display: block;
  padding: 4px 0 8px;
}

/* Subtle background to separate the tracklist from cards when inside grid */
.card-grid .tracks-container .tlv2 {
  background: var(--surface-subtle);
  border-radius: 8px;
}

/* ===== STATUS MESSAGES ===== */
#status-messages {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9998;
  pointer-events: none;
  width: auto;
  max-width: 90vw;
}

.status-message {
  background: var(--card);
  color: var(--fg);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  animation: slideUp 0.3s ease forwards;
  pointer-events: auto;
  white-space: nowrap;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-message.fade-out {
  animation: fadeOut 0.3s ease forwards;
}

.status-info {
  border-left: 3px solid var(--accent);
}

.status-error {
  border-left: 3px solid var(--error);
  background: rgba(255, 85, 85, 0.1);
}

.status-warning {
  border-left: 3px solid var(--warning);
}

.status-offline {
  border-left: 3px solid var(--error);
  background: rgba(255, 85, 85, 0.15);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateY(-5px);
  }
}

/* ===== MEDIA QUERIES: SEARCH HISTORY ===== */

/* MOBILE (max-width: 480px) */
@media (max-width: 480px) {
  .search-history-item {
    padding: 16px 12px;
    min-height: 52px;
    gap: 10px;
    flex-direction: row;
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.12);
  }

  .search-history-item:hover {
    background: rgba(var(--primary-rgb), 0.08);
    border-bottom-color: rgba(var(--primary-rgb), 0.24);
  }

  .history-icon {
    font-size: 17px;
  }

  .history-query {
    font-size: 15px;
    font-weight: 500;
  }

  .history-time {
    font-size: 11px;
    display: none;
  }

  .btn-tertiary,
  .history-remove {
    min-width: 40px;
    min-height: 40px;
    height: 40px;
    max-height: 40px;
    font-size: 18px;
    padding: 8px;
    flex-shrink: 0;
  }

  .history-remove:hover {
    background: rgba(var(--primary-rgb), 0.16);
  }

  .search-history-clear {
    padding: 18px 12px;
    border-top: 1px solid rgba(var(--primary-rgb), 0.12);
  }

  .clear-history-btn {
    width: 100%;
    padding: 12px 20px;
    min-height: 44px;
    font-size: 14px;
    font-weight: 600;
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid rgba(var(--primary-rgb), 0.24);
    color: var(--primary);
  }

  .clear-history-btn:hover {
    background: rgba(var(--primary-rgb), 0.14);
    border-color: rgba(var(--primary-rgb), 0.32);
  }
}

/* TABLET (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
  .search-history-item {
    padding: 15px 12px;
    min-height: 50px;
    flex-direction: row;
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.12);
  }

  .search-history-item:hover {
    background: rgba(var(--primary-rgb), 0.08);
    border-bottom-color: rgba(var(--primary-rgb), 0.24);
  }

  .history-icon {
    font-size: 16px;
  }

  .history-query {
    font-size: 14px;
  }

  .history-time {
    font-size: 11px;
  }

  .btn-tertiary,
  .history-remove {
    min-width: 38px;
    min-height: 38px;
    height: 38px;
    max-height: 38px;
    font-size: 16px;
    flex-shrink: 0;
  }

  .history-remove:hover {
    background: rgba(var(--primary-rgb), 0.16);
  }

  .search-history-clear {
    padding: 16px 12px;
    border-top: 1px solid rgba(var(--primary-rgb), 0.12);
  }

  .clear-history-btn {
    padding: 11px 18px;
    min-height: 42px;
    font-size: 13px;
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid rgba(var(--primary-rgb), 0.24);
    color: var(--primary);
  }

  .clear-history-btn:hover {
    background: rgba(var(--primary-rgb), 0.14);
    border-color: rgba(var(--primary-rgb), 0.32);
  }
}

/* DESKTOP (min-width: 769px) */
@media (min-width: 769px) {
  .search-history-item {
    padding: 14px 12px;
    min-height: 48px;
    flex-direction: row;
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.12);
  }

  .search-history-item:hover {
    background: rgba(var(--primary-rgb), 0.08);
    border-bottom-color: rgba(var(--primary-rgb), 0.24);
  }

  .history-icon {
    font-size: 16px;
  }

  .history-query {
    font-size: 14px;
  }

  .history-time {
    font-size: 11px;
  }

  .btn-tertiary,
  .history-remove {
    min-width: 36px;
    min-height: 36px;
    height: 36px;
    max-height: 36px;
    font-size: 16px;
    flex-shrink: 0;
  }

  .history-remove:hover {
    background: rgba(var(--primary-rgb), 0.16);
  }

  .search-history-clear {
    padding: 16px 12px;
    border-top: 1px solid rgba(var(--primary-rgb), 0.12);
  }

  .clear-history-btn {
    padding: 10px 20px;
    min-height: 40px;
    font-size: 13px;
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid rgba(var(--primary-rgb), 0.24);
    color: var(--primary);
  }

  .clear-history-btn:hover {
    background: rgba(var(--primary-rgb), 0.14);
    border-color: rgba(var(--primary-rgb), 0.32);
  }
}

/* Subtitle Display Styles */
.subtitle-display {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90%;
  width: auto;
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.85);
  color: #ffffff;
  font-size: 16px;
  line-height: 1.5;
  text-align: center;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 9999;
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  word-wrap: break-word;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.subtitle-display.visible {
  opacity: 1;
  visibility: visible;
}

/* Subtitle Toggle Button */
.subtitle-toggle-btn {
  font-size: 16px;
  font-weight: 600;
  padding: 8px 14px;
  background: rgba(var(--primary-rgb), 0.1);
  border: 1px solid rgba(var(--primary-rgb), 0.2);
  color: var(--fg);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 8px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  letter-spacing: 0.5px;
}

.subtitle-toggle-btn:hover {
  background: rgba(var(--primary-rgb), 0.15);
  border-color: rgba(var(--primary-rgb), 0.3);
  transform: scale(1.05);
}

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

.subtitle-toggle-btn.active {
  background: rgba(var(--primary-rgb), 0.9);
  color: #ffffff;
  border-color: var(--primary);
}

.subtitle-toggle-btn[aria-pressed="true"] {
  background: rgba(var(--primary-rgb), 0.9);
  color: #ffffff;
  border-color: var(--primary);
}

/* Mobile optimizations for subtitles */
@media (max-width: 768px) {
  .subtitle-display {
    bottom: 100px;
    font-size: 14px;
    padding: 10px 16px;
    max-width: 85%;
  }
  
  .subtitle-toggle-btn {
    font-size: 14px;
    padding: 6px 12px;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .subtitle-display {
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #ffffff;
  }
  
  .subtitle-toggle-btn.active {
    border-width: 2px;
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .subtitle-display {
    transition: none;
  }
  
  .subtitle-toggle-btn {
    transition: none;
  }
}

/* ============================================================
   Archive.org Maintenance Banner
   ============================================================ */

.archive-maintenance-banner {
  display: flex;
  align-items: stretch;
  background: linear-gradient(
    135deg,
    rgba(var(--primary-rgb, 61, 169, 255), 0.10) 0%,
    rgba(var(--primary-rgb, 61, 169, 255), 0.06) 100%
  );
  border-bottom: 2px solid rgba(var(--primary-rgb, 61, 169, 255), 0.30);
  color: var(--fg);
  padding: 0;
  z-index: 200;
  position: relative;
  animation: archiveBannerSlideDown 0.3s ease-out both;
  overflow: hidden;
}

.archive-maintenance-banner[hidden] {
  display: none;
}

@keyframes archiveBannerSlideDown {
  from {
    opacity: 0;
    transform: translateY(-100%);
    max-height: 0;
  }
  to {
    opacity: 1;
    transform: translateY(0);
    max-height: 200px;
  }
}

.archive-banner-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  flex-wrap: wrap;
}

.archive-banner-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  color: var(--warning, #ffb84d);
  opacity: 0.9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.archive-banner-icon svg {
  width: 22px;
  height: 22px;
  stroke: var(--warning, #ffb84d);
}

.archive-banner-body {
  flex: 1 1 200px;
  min-width: 0;
}

.archive-banner-title {
  font-weight: 600;
  font-size: 13px;
  margin: 0 0 2px 0;
  color: var(--fg);
  line-height: 1.3;
}

.archive-banner-subtitle {
  font-size: 12px;
  margin: 0;
  opacity: 0.75;
  line-height: 1.4;
  color: var(--fg);
}

.archive-banner-notice {
  font-size: 11px;
  margin: 4px 0 0 0;
  font-weight: 500;
}

.archive-banner-notice--error  { color: var(--error, #ff5555); }
.archive-banner-notice--warning { color: var(--warning, #ffb84d); }
.archive-banner-notice--info    { color: var(--primary, #3da9ff); }

.archive-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* Play from cache CTA – primary action */
.archive-banner-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary, #3da9ff);
  color: #fff;
  border: none;
  border-radius: var(--border-radius-small, 8px);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.2;
  transition: background 0.18s, opacity 0.18s, transform 0.12s;
  white-space: nowrap;
  text-align: left;
}

.archive-banner-play-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--primary, #3da9ff) 80%, #fff 20%);
  transform: translateY(-1px);
}

.archive-banner-play-btn:active:not(:disabled) {
  transform: translateY(0);
}

.archive-banner-play-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.archive-banner-play-icon {
  font-size: 14px;
  line-height: 1;
}

.archive-banner-play-label {
  display: flex;
  flex-direction: column;
}

.archive-banner-play-label small {
  font-size: 10px;
  font-weight: 400;
  opacity: 0.9;
}

/* Secondary action buttons */
.archive-banner-retry-btn,
.archive-banner-dismiss-btn {
  background: transparent;
  border: 1px solid rgba(var(--primary-rgb, 61, 169, 255), 0.30);
  color: var(--fg);
  border-radius: var(--border-radius-small, 8px);
  padding: 7px 12px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s;
  white-space: nowrap;
}

.archive-banner-retry-btn:hover:not(:disabled),
.archive-banner-dismiss-btn:hover {
  background: rgba(var(--primary-rgb, 61, 169, 255), 0.10);
  border-color: rgba(var(--primary-rgb, 61, 169, 255), 0.50);
}

.archive-banner-retry-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

.archive-banner-dismiss-btn {
  padding: 7px 10px;
  font-size: 14px;
  opacity: 0.7;
}

.archive-banner-dismiss-btn:hover {
  opacity: 1;
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .archive-banner-inner {
    gap: 10px;
    padding: 10px 12px;
  }

  .archive-banner-title {
    font-size: 12px;
  }

  .archive-banner-subtitle {
    font-size: 11px;
  }

  .archive-banner-play-btn {
    font-size: 11px;
    padding: 7px 10px;
  }

  .archive-banner-retry-btn {
    font-size: 11px;
    padding: 6px 10px;
  }
}

@media (max-width: 360px) {
  .archive-banner-actions {
    width: 100%;
  }

  .archive-banner-play-btn {
    flex: 1;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .archive-maintenance-banner {
    animation: none;
  }

  .archive-banner-play-btn:hover:not(:disabled) {
    transform: none;
  }
}

/* ===== PREFERS-COLOR-SCHEME: AUTO DAY THEME =====
   When the user's OS is in light mode and no explicit data-theme has been
   chosen, activate the Day palette automatically. The body[data-theme]
   selector has higher specificity and takes precedence once the user picks
   a theme via the UI.
   ===================================================================== */
@media (prefers-color-scheme: light) {
  :root:not(body[data-theme]) {
    --bg: #f5f5f5;
    --bg-rgb: 245, 245, 245;
    --fg: #1a1a1a;
    --muted: #4a4a4a;
    --accent: #1a1a2e;
    --accent-alt: #1e6ba8;
    --accent-alt-rgb: 30, 107, 168;
    --primary: #10b981;
    --primary-text: #047857;
    --primary-rgb: 16, 185, 129;
    --highlight: #d63384;
    --secondary: #d97706;
    --error: #b91c1c;
    --success: #15803d;
    --warning: #ea580c;
    --card: #ffffff;
    --sheet-bg: #ffffff;
    --sheet-border: rgba(15, 23, 42, 0.1);
    --sheet-border-subtle: rgba(15, 23, 42, 0.08);
    --sheet-handle-bg: rgba(15, 23, 42, 0.18);
    --sheet-shadow: 0 -18px 42px rgba(15, 23, 42, 0.16), 0 0 0 1px rgba(var(--primary-rgb), 0.08);
    --sheet-item-hover-bg: rgba(var(--primary-rgb), 0.1);
    --sheet-item-active-bg: rgba(var(--primary-rgb), 0.16);
    --sheet-icon-bg: rgba(var(--primary-rgb), 0.12);
    --collection-panel-bg: #ffffff;
    --collection-panel-header-bg: #f5f8f7;
    --collection-card-bg: #ffffff;
    --collection-card-hover-bg: #f3f8f6;
    --collection-subpanel-bg: #f6faf8;
    --collection-row-bg: #f8fbfa;
    --collection-row-hover-bg: rgba(var(--primary-rgb), 0.12);
    --collection-shadow: 0 10px 24px rgba(15, 23, 42, 0.1), 0 0 0 1px rgba(var(--primary-rgb), 0.04);
    --btn: #e5e5e5;
    --btn-hover: rgba(var(--primary-rgb), 0.12);
    --btn-active: #d0d0d0;
    --result-hover: rgba(var(--primary-rgb), 0.1);
    --item-hover: rgba(0, 0, 0, 0.08);
    --neutral: #374151;
    --control-fg: #333333;
    --surface-border: rgba(0, 0, 0, 0.12);
    --surface-border-subtle: rgba(0, 0, 0, 0.08);
    --surface-hover: rgba(0, 0, 0, 0.04);
    --surface-subtle: rgba(0, 0, 0, 0.03);
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-subtle: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-card-hover: 0 10px 24px rgba(0, 0, 0, 0.14);
    --focus-ring-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.28);
    --chip-bg: rgba(var(--primary-rgb), 0.14);
    --chip-fg: var(--fg);
    --chip-bg-quiet: rgba(var(--primary-rgb), 0.10);
    --favorite: var(--primary);
    --favorite-bg: rgba(var(--primary-rgb), 0.14);
    --header-btn-bg: rgba(0, 0, 0, 0.06);
    --header-btn-border: rgba(0, 0, 0, 0.1);
    --on-accent: #fff;
    --on-primary: #000;
    --search-input-bg: #ffffff;
    --search-input-bg-focus: #ffffff;
    --search-input-fg: var(--fg);
    --search-input-placeholder: var(--muted);
    --surface-1: #f0f0f0;
    --surface-2: #e4e4e4;
    color-scheme: light;
  }
}

/* ===== PREFERS-REDUCED-MOTION — Global =====
   Honour the user's OS accessibility preference.
   Ticker animations are excluded so track titles remain readable.
   Loader spinners are excluded so loading state is still clear.
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    scroll-behavior: auto !important;
  }

  /* Keep ticker animations so long titles are still legible */
  .title.ticker .title-text,
  .ticker-text.ticker {
    animation-duration: var(--list-ticker-duration, 14s) !important;
    animation-iteration-count: infinite !important;
  }

  /* Keep loader spinners so loading state is communicated */
  .loader-spinner,
  .loader,
  .search-status-spinner {
    animation-duration: 2s !important;
    animation-iteration-count: infinite !important;
  }

  /* Remove hover transforms entirely */
  button:hover:not(:disabled),
  .play-btn:hover,
  .play-btn-favorite:hover,
  .art:hover,
  .content-card:hover,
  .pl-card:hover,
  .playlists-new-btn:hover {
    transform: none !important;
  }
}
/**
 * Unified Search Component CSS
 * 
 * This module provides a consistent search experience across:
 * - Global search
 * - Resonates list filter
 * 
 * Mobile-first, sticky behavior, compact and touch-friendly
 */

/* ===== CSS VARIABLES FOR SEARCH ===== */
:root {
  --search-border-radius: 12px;
  --search-sticky-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  --search-sticky-bg: var(--collection-panel-header-bg, var(--bg));
}

/* ===== UNIFIED SEARCH SECTION ===== */
.search-section {
  display: flex;
  flex-direction: column;
  padding: 0 4px;
  margin-top: var(--spacing-sm, 6px);
  z-index: 50;
}

/* Sticky search behavior */
.search-section.is-sticky {
  position: sticky;
  top: 0;
  background: var(--search-sticky-bg);
  box-shadow: var(--search-sticky-shadow);
  padding-top: 4px;
  padding-bottom: 4px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  z-index: 100;
  transition: box-shadow 0.2s ease, background 0.2s ease;
}

/* ===== UNIFIED SEARCH CONTAINER ===== */
.search-container {
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  margin: 0 auto;
  gap: 8px;
  width: 100%;
  max-width: var(--content-max-width, 600px);
}

/* ===== UNIFIED SEARCH INPUT WRAPPER ===== */
.search-input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 0;
}

/* ===== UNIFIED SEARCH INPUT ICON ===== */
.search-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
  z-index: 1;
}

.search-input-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.search-input-wrapper:has(.search-input:focus) .search-input-icon {
  color: var(--primary);
}

/* ===== UNIFIED SEARCH INPUT ===== */
.search-input {
  height: var(--search-height-mobile);
  min-height: var(--search-height-mobile);
  background: var(--btn);
  border: 2px solid var(--surface-border);
  border-radius: var(--search-border-radius);
  color: var(--fg);
  -webkit-appearance: none;
  appearance: none;
  font-size: 16px;
  padding: 0 12px 0 calc(12px + 18px + 8px); /* left: padding + icon + gap */
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  width: 100%;
  min-width: 0;
}

/* Hide native search decorations */
.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-decoration,
.search-input::-webkit-search-results-button,
.search-input::-webkit-search-results-decoration {
  -webkit-appearance: none;
  display: none;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--search-input-bg-focus, var(--btn));
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

.search-input::placeholder {
  color: var(--search-input-placeholder, var(--muted));
}

/* ===== UNIFIED SEARCH CLEAR BUTTON ===== */
.search-clear-btn {
  flex: 0 0 auto;
  width: var(--search-height-mobile);
  height: var(--search-height-mobile);
  min-width: 44px;
  min-height: 44px;
  border-radius: 10px;
  border: none;
  background: var(--btn);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.search-clear-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.search-clear-btn[hidden] {
  display: none !important;
}

.search-clear-btn:active {
  background: var(--card);
  color: var(--fg);
  transform: scale(0.95);
}

.search-clear-btn:hover {
  background: var(--card);
  color: var(--fg);
}

.search-clear-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.22);
}

/* ===== TABLET & DESKTOP RESPONSIVE ===== */
@media (min-width: 600px) {
  .search-section {
    padding: 4px 0;
  }
  
  .search-container {
    max-width: var(--content-max-width, 600px);
    margin: 0 auto;
  }
  
  .search-input {
    height: var(--search-height-tablet);
    min-height: var(--search-height-tablet);
    font-size: 16px;
  }
  
  .search-clear-btn {
    width: var(--search-height-tablet);
    height: var(--search-height-tablet);
  }
}

@media (min-width: 1024px) {
  .search-input {
    height: var(--search-height-desktop);
    min-height: var(--search-height-desktop);
    font-size: 16px;
    background: var(--search-input-bg, var(--btn));
    border: 2px solid transparent;
    color: var(--search-input-fg, var(--fg));
  }
  
  .search-input:hover {
    border-color: var(--surface-border);
  }
  
  .search-input:focus {
    border-color: var(--primary);
    background: var(--search-input-bg-focus, var(--btn));
  }
  
  .search-clear-btn {
    width: var(--search-height-desktop);
    height: var(--search-height-desktop);
  }
}

/* ===== RESONATES FILTER BAR (Unified with search) ===== */
.resontes-filter-bar {
  padding: 8px 10px;
  background: var(--collection-panel-header-bg, var(--bg));
  border-bottom: 1px solid var(--surface-border);
  position: sticky;
  top: 0;
  z-index: 30;
}

.resontes-filter-bar .search-container {
  margin: 0;
  max-width: none;
}

.resontes-filter-bar .search-input {
  height: var(--search-height-mobile);
  min-height: var(--search-height-mobile);
  font-size: 14px;
  border-radius: 10px;
}

@media (min-width: 600px) {
  .resontes-filter-bar .search-input {
    height: var(--search-height-tablet);
    min-height: var(--search-height-tablet);
  }

  .resontes-filter-bar .search-clear-btn {
    width: var(--search-height-tablet);
    height: var(--search-height-tablet);
    min-width: var(--search-height-tablet);
    min-height: var(--search-height-tablet);
  }
}

@media (min-width: 1024px) {
  .resontes-filter-bar .search-input {
    height: var(--search-height-desktop);
    min-height: var(--search-height-desktop);
  }

  .resontes-filter-bar .search-clear-btn {
    width: var(--search-height-desktop);
    height: var(--search-height-desktop);
    min-width: var(--search-height-desktop);
    min-height: var(--search-height-desktop);
  }
}

.resontes-filter-bar .search-clear-btn {
  width: var(--search-height-mobile);
  height: var(--search-height-mobile);
  min-width: var(--search-height-mobile);
  min-height: var(--search-height-mobile);
  border-radius: 8px;
}
/**
 * Unified Filter Pills CSS
 * 
 * Compact, touch-friendly filter buttons used in:
 * - Search results (All, Single, Album)
 * - Resonates list filtering
 * 
 * Mobile-first, pill style, horizontal scroll support
 */

/* ===== FORCE FILTER PILLS HORIZONTAL LAYOUT ===== */
#search-type-filters,
#resontes-type-filters,
.filter-pills {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 6px !important;
}

/* Ensure [hidden] attribute hides filter pills even when display: flex !important is set above */
#search-type-filters[hidden],
#resontes-type-filters[hidden],
.filter-pills[hidden] {
  display: none !important;
}

#search-type-filters > button,
#resontes-type-filters > button,
.filter-pills > button {
  display: inline-flex !important;
  flex-shrink: 0 !important;
}

/* ===== COMPACT FILTER PILL BUTTON ===== */
.filter-pill,
.filter-pills > button,
.search-option-btn {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(var(--primary-rgb), 0.18);
  background: transparent;
  color: var(--fg);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  min-height: 26px;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  scroll-snap-align: start;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.filter-pill:hover,
.search-option-btn:hover {
  background: rgba(var(--primary-rgb), 0.08);
  border-color: rgba(var(--primary-rgb), 0.24);
}

.filter-pill:active,
.search-option-btn:active {
  transform: scale(0.96);
}

.filter-pill.active,
.search-option-btn.active {
  background: rgba(var(--primary-rgb), 0.14);
  border-color: rgba(var(--primary-rgb), 0.30);
  color: var(--primary);
}

.filter-pill:disabled,
.search-option-btn:disabled {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}

.filter-pill:focus-visible,
.search-option-btn:focus-visible {
  outline: 2px solid rgba(var(--primary-rgb), 0.50);
  outline-offset: 2px;
}

/* ===== FILTER CLOSE/CLEAR BUTTON ===== */
.filter-close-btn {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(var(--primary-rgb), 0.18);
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  margin-left: auto;
}

.filter-close-btn svg {
  width: 12px;
  height: 12px;
}

.filter-close-btn:hover {
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--fg);
}

.filter-close-btn:active {
  background: rgba(var(--primary-rgb), 0.18);
}

/* ===== RESULTS HEADER WITH FILTERS ===== */
.search-results-header,
.resontes-results-header {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--surface-border);
  background: var(--collection-panel-header-bg, var(--bg));
  backdrop-filter: blur(10px);
}

/* ===== RESULTS SUMMARY ===== */
.search-results-summary {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-weight: 500;
  flex: 1 1 auto;
}

/* ===== RESULTS CONTROLS ===== */
.search-results-controls {
  display: flex;
  flex-direction: row;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* Force filter-pills inside controls to be horizontal */
.search-results-controls .filter-pills {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

/* ===== CONTROL BUTTON (Close, etc) ===== */
.search-control-btn {
  background: var(--btn);
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  border-radius: 8px;
  height: 36px;
  width: 36px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.search-control-btn svg {
  width: 14px;
  height: 14px;
  display: block;
}

.search-control-btn:hover {
  background: var(--card);
  color: var(--fg);
}

.search-control-btn:active {
  background: rgba(var(--primary-rgb), 0.12);
}

/* ===== TABLET & DESKTOP RESPONSIVE ===== */
@media (min-width: 600px) {
  .filter-pill,
  .search-option-btn {
    font-size: 12px;
    padding: 6px 12px;
    min-height: 28px;
  }
  
  .search-results-header,
  .resontes-results-header {
    padding: 8px 12px;
  }
  
  .search-control-btn {
    height: 40px;
    width: 40px;
  }
}

@media (min-width: 1024px) {
  .search-results-header,
  .resontes-results-header {
    padding: 8px 16px;
    row-gap: 6px;
  }
}
/**
 * Unified Grid System CSS
 * 
 * Consistent grid layout for:
 * - Search results
 * - Resonates list
 * 
 * Mobile-first, 2 columns on mobile, responsive breakpoints
 * Both listings use identical column counts at every breakpoint for visual consistency.
 */

/* ===== UNIFIED GRID ===== */
.resonate-grid,
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 10px;
  width: 100%;
  padding: 0;
  margin: 0;
}

/* Prevent grid items from overflowing their column */
.resonate-grid > *,
.card-grid > * {
  min-width: 0;
}

/* ===== LIST CONTENT AREAS ===== */
.content-list {
  overflow-x: hidden;
  height: auto;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0) + var(--vv-bottom-inset, 0px));
}

/* ===== TABLET RESPONSIVE (3 columns) ===== */
@media (min-width: 600px) {
  .resonate-grid,
  .card-grid {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
    gap: 12px;
  }

  .content-list {
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0));
  }
}

/* ===== WIDE TABLET / SMALL DESKTOP (3 columns) ===== */
@media (min-width: 768px) {
  .resonate-grid,
  .card-grid {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    gap: 14px;
  }

  .content-list {
    max-width: 1024px;
    margin: 0 auto;
    padding: 10px 16px 0;
  }
}

/* ===== DESKTOP (4 columns) ===== */
@media (min-width: 1024px) {
  .resonate-grid,
  .card-grid {
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 14px;
  }

  .content-list {
    max-width: 1200px;
    padding: 10px 24px 0;
  }
}

/* ===== WIDE DESKTOP (5 columns) ===== */
@media (min-width: 1280px) {
  .resonate-grid,
  .card-grid {
    grid-template-columns: repeat(5, minmax(160px, 1fr));
    gap: 16px;
  }

  .content-list,
  .search-container {
    max-width: 1200px;
  }
}

/* ===== SMALL MOBILE TIGHTENING ===== */
@media (max-width: 420px) {
  .resonate-grid,
  .card-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
    gap: 8px;
  }

  .content-list {
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0));
  }
}

/* ===== NO RESULTS STATE ===== */
.no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  text-align: center;
}

.no-results-icon {
  font-size: 40px;
  opacity: 0.5;
  margin-bottom: 8px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
}

.no-results-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 4px;
}

.no-results-hint {
  font-size: 12px;
  color: var(--muted);
}
/**
 * Unified Content Card CSS
 * 
 * Single card design for:
 * - Search results
 * - Resonates list items
 * 
 * Structure:
 * - Album cover (1:1 aspect ratio, rounded corners)
 * - Top badges (Album / tracks count)
 * - Simplified overlay actions (Play + More)
 * - Title
 * - Subtitle (artist)
 */

/* ===== CONTENT CARD ===== */
.content-card {
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--collection-card-bg, var(--card));
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--collection-shadow, var(--shadow-subtle));
  transition: transform 0.15s ease, box-shadow 0.18s ease;
  height: 100%;
  cursor: pointer;
}

@media (hover: hover) {
  .content-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover, 0 8px 20px rgba(0, 0, 0, 0.18));
  }
}

.content-card:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-color: rgba(var(--primary-rgb), 0.50);
  box-shadow: var(--shadow-subtle), 0 0 0 4px rgba(var(--primary-rgb), 0.25);
}

/* Now playing state */
.content-card.is-playing {
  border-color: rgba(var(--primary-rgb), 0.60);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.30), var(--shadow-subtle);
}

/* ===== CARD MEDIA (Cover) ===== */
.card-media {
  position: relative;
  width: 100%;
  /* Fallback for browsers without aspect-ratio support: padding-bottom creates a 1:1 box */
  padding-bottom: 100%;
  height: 0;
  /* Modern browsers: use aspect-ratio and reset padding/height */
  aspect-ratio: 1 / 1;
  background: var(--btn);
  border-radius: 12px 12px 0 0;
  overflow: hidden;
  flex-shrink: 0;
}

/* Modern browsers that support aspect-ratio should reset the padding hack */
@supports (aspect-ratio: 1 / 1) {
  .card-media {
    padding-bottom: 0;
    height: auto;
    min-height: 0;
  }
}

.card-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: 0;
}

/* ===== PLAY OVERLAY ===== */
.card-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  transition: background 0.18s ease;
  pointer-events: none;
  z-index: 15;
}

/* CSS triangle — more reliable than a unicode character across fonts/platforms */
.card-play-overlay::after {
  content: '';
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 13px 0 13px 22px;
  border-color: transparent;
  margin-left: 4px; /* optical centering */
  transition: border-left-color 0.18s ease, transform 0.18s ease;
  transform: scale(0.75);
}

@media (hover: hover) {
  .content-card:hover .card-play-overlay {
    background: rgba(0, 0, 0, 0.25);
  }

  .content-card:hover .card-play-overlay::after {
    border-left-color: rgba(255, 255, 255, 0.95);
    transform: scale(1);
  }
}

.content-card:focus-visible .card-play-overlay {
  background: rgba(0, 0, 0, 0.25);
}

.content-card:focus-visible .card-play-overlay::after {
  border-left-color: rgba(255, 255, 255, 0.95);
  transform: scale(1);
}

.content-card.is-playing .card-play-overlay::after {
  /* Pause bars via two thin rectangles using box-shadow trick */
  border: none;
  width: 5px;
  height: 18px;
  background: rgba(255, 255, 255, 0.80);
  border-radius: 2px;
  box-shadow: 10px 0 0 rgba(255, 255, 255, 0.80);
  transform: scale(1);
  margin-left: 0;
}

/* ===== CARD BADGES/CHIPS ===== */
.card-chips {
  position: absolute;
  top: 6px;
  left: 6px;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  z-index: 10;
}

.chip {
  background: linear-gradient(
    to bottom,
    rgba(var(--primary-rgb), 0.50),
    rgba(var(--primary-rgb), 0.30)
  );
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(var(--primary-rgb), 0.40);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  line-height: 1.2;
}

.chip-quiet {
  background: linear-gradient(
    to bottom,
    rgba(var(--primary-rgb), 0.35),
    rgba(var(--primary-rgb), 0.20)
  );
  border-color: rgba(var(--primary-rgb), 0.30);
}

/* ===== CARD BODY ===== */
.card-body {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
}

.card-title {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.35;
  color: var(--fg);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
}

.card-creator,
.card-subtitle {
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== METADATA PILLS ===== */
.result-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.result-meta-pill,
.result-meta-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 18px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--surface-border-subtle);
  background: var(--collection-subpanel-bg, rgba(var(--primary-rgb), 0.08));
  color: var(--fg);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.track-duration {
  background: rgba(var(--primary-rgb), 0.12);
  border-color: rgba(var(--primary-rgb), 0.24);
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

/* ===== PENDING METADATA CHIP ===== */
/* Displayed while metadata is being fetched in the background */
.chip.chip-pending {
  background: linear-gradient(
    90deg,
    rgba(var(--primary-rgb), 0.25) 0%,
    rgba(var(--primary-rgb), 0.50) 50%,
    rgba(var(--primary-rgb), 0.25) 100%
  );
  background-size: 200% 100%;
  animation: chip-shimmer 1.5s ease-in-out infinite;
  border-color: rgba(var(--primary-rgb), 0.30);
}

@keyframes chip-shimmer {
  0% { background-position: 200% center; }
  100% { background-position: -200% center; }
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (min-width: 600px) {
  .content-card {
    border-radius: 14px;
  }
  
  .card-media {
    border-radius: 14px 14px 0 0;
  }
  
  .card-body {
    padding: 10px 12px;
    gap: 3px;
  }
  
  .card-title {
    font-size: 14px;
  }
  
  .card-creator {
    font-size: 12px;
  }
}

@media (min-width: 1024px) {
  .card-body {
    padding: 10px 12px;
    gap: 4px;
  }
  
  .card-title {
    font-size: 14px;
    -webkit-line-clamp: 3;
    line-clamp: 3;
  }
  
  .card-chips {
    top: 8px;
    left: 8px;
    gap: 6px;
  }
  
  .chip {
    font-size: 11px;
    padding: 3px 8px;
  }
}

/* ===== SMALL MOBILE TIGHTENING ===== */
@media (max-width: 420px) {
  .content-card {
    border-radius: 10px;
  }
  
  .card-media {
    border-radius: 10px 10px 0 0;
  }
  
  .card-body {
    padding: 6px 8px;
  }
  
  .card-title {
    font-size: 12px;
  }
  
  .card-creator {
    font-size: 10px;
  }
  
  .card-chips {
    top: 5px;
    left: 5px;
    gap: 4px;
  }
  
  .chip {
    font-size: 9px;
    padding: 2px 5px;
  }
}
/**
 * Unified Card Actions CSS
 *
 * - .card-actions-overlay: shared overlay over card media in search and resonates lists
 * - Only 2 visible actions on mobile: Favorite + More (⋯)
 * - Works on any album art (light or dark)
 */

/* ===== CARD ACTIONS ===== */
.card-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 8px;
  min-height: 0;
}

/* ===== CARD ACTIONS OVERLAY (absolutely positioned over cover art – search) ===== */
.card-actions-overlay {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  min-height: 0;
  /* Clean dark gradient for contrast on any image */
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.70),
    rgba(0, 0, 0, 0.50)
  );
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  backdrop-filter: blur(8px);
  transition: opacity 0.18s ease, transform 0.15s ease;
}

/* Always visible on mobile for better UX */
@media (hover: none), (max-width: 1023px) {
  .card-actions-overlay {
    opacity: 1;
  }
}

/* On desktop with hover, show on hover */
@media (min-width: 1024px) and (hover: hover) {
  .card-actions-overlay {
    opacity: 0.85;
  }

  .content-card:hover .card-actions-overlay,
  .content-card:focus-within .card-actions-overlay {
    opacity: 1;
  }
}

/* ===== ACTION BUTTON ===== */
.card-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.card-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.card-btn:hover {
  background: rgba(var(--primary-rgb), 0.30);
  border-color: rgba(var(--primary-rgb), 0.50);
}

.card-btn:active {
  transform: scale(0.92);
  background: rgba(var(--primary-rgb), 0.40);
}

.card-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.55);
}

/* ===== ACTIVE STATE (Favorited) ===== */
.card-btn.favorite.active,
.card-btn.resonte.active {
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.25);
  border-color: rgba(var(--primary-rgb), 0.45);
}

/* ===== MORE BUTTON (ellipsis) ===== */
.card-btn.more {
  color: rgba(255, 255, 255, 0.92);
}

.card-btn.more .card-more-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.card-btn.more[aria-expanded="true"] {
  background: rgba(var(--primary-rgb), 0.30);
  border-color: rgba(var(--primary-rgb), 0.55);
  color: #fff;
}

/* ===== HIDE SECONDARY ACTIONS BY DEFAULT ===== */
/* Only show Favorite and More, hide Share and Expand initially */
.card-btn.share,
.card-btn.expand {
  display: none;
}

/* Show all actions in expanded/desktop mode */
@media (min-width: 1024px) and (hover: hover) {
  .card-btn.share,
  .card-btn.expand {
    display: flex;
  }

  .card-actions-overlay {
    gap: 6px;
    padding: 5px 8px;
  }
}

/* ===== ACCESSIBILITY - Touch Targets ===== */
/* Ensure adequate touch targets on mobile */
@media (max-width: 1023px) {
  .card-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
  }

  .card-actions-overlay {
    padding: 4px 6px;
    gap: 6px;
    border-radius: 22px;
  }
}

/* ===== SMALL MOBILE ===== */
@media (max-width: 420px) {
  .card-btn {
    width: 36px;
    height: 36px;
    font-size: 13px;
  }

  .card-actions-overlay {
    bottom: 6px;
    padding: 3px 5px;
    gap: 5px;
    border-radius: 20px;
  }
}

/* ===== RESONATE LOGO BUTTON ANIMATION ===== */
@keyframes resonate-btn-pop {
  0% { transform: scale(1); }
  30% { transform: scale(1.25); }
  60% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

.card-btn.resonate-btn-pop {
  animation: resonate-btn-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===== SVG ICON SIZING ===== */
.card-btn .resonate-icon {
  width: 18px;
  height: 18px;
}

/* Expand button icon */
.card-btn.expand .expand-icon {
  font-size: 12px;
  transition: transform 0.2s ease;
}

.card-btn.expand[aria-expanded="true"] .expand-icon {
  transform: rotate(180deg);
}
/**
 * loaders.css — Loader & Skeleton Styles
 *
 * Contains all loading-state styles for the Resonate player:
 *   - CSS custom properties for loader sizing and timing
 *   - Overlay spinner loader (used by js/loaders.js)
 *   - Skeleton loaders for tracks and search results
 *   - Search status message and spinner
 *   - Energy-saver theme overrides to preserve loader animations
 */

/* ===== LOADER CUSTOM PROPERTIES ===== */
:root {
  --loader-size: 24px;
  --loader-border-width: 2px;
  --loader-duration: 2s;
}

/* ===== LOADER ANIMATIONS ===== */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ===== OVERLAY LOADER ===== */
.loader-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease-in;
}

.loader-overlay--hiding {
  animation: fadeOut 0.2s ease-out forwards;
  pointer-events: none;
}

.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  min-width: 140px;
  background: var(--card);
  border: 1px solid rgba(var(--primary-rgb), 0.2);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.loader-spinner {
  width: var(--loader-size, 40px);
  height: var(--loader-size, 40px);
  border-radius: 50%;
  border: var(--loader-border-width, 4px) solid rgba(var(--primary-rgb), 0.2);
  border-top: var(--loader-border-width, 4px) solid var(--primary);
  animation: spin var(--loader-duration, 2s) linear infinite;
}

.loader-progress {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--fg);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  text-align: center;
  min-width: 48px;
}

.loader-message {
  font-size: 12px;
  font-weight: 400;
  text-align: center;
  line-height: 1.4;
  max-width: 280px;
  margin-top: 4px;
  opacity: 0.85;
  color: var(--muted);
}

.loader {
  width: var(--loader-size, 24px);
  height: var(--loader-size, 24px);
  border-radius: 50%;
  border: var(--loader-border-width, 2px) solid rgba(var(--primary-rgb), 0.2);
  border-top: var(--loader-border-width, 2px) solid var(--primary);
  animation: spin var(--loader-duration, 2s) linear infinite;
}

.search-loading {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--muted);
}

.loader-text {
  color: var(--muted);
  font-size: 13px;
}

/* ===== SKELETON LOADER FOR TRACKS ===== */
.tracks-loading-skeleton {
  padding: 16px;
  animation: fadeIn 0.2s ease-in;
}

.skeleton-loader {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-track {
  height: 48px;
  background: linear-gradient(
    90deg,
    var(--surface-1) 0%,
    var(--surface-2) 50%,
    var(--surface-1) 100%
  );
  background-size: 200% 100%;
  border-radius: 8px;
  animation: shimmer 1.5s ease-in-out infinite;
}

/* (No separate dark-mode override needed: --surface-1/--surface-2 are theme-aware) */

/* ===== SEARCH RESULT SKELETON CARDS ===== */
.search-skeleton-container {
  display: grid;
  /* Match the .card-grid responsive column counts from unified-grid.css */
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  gap: 8px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0));
  animation: fadeIn 0.2s ease-in;
}

@media (min-width: 420px) {
  .search-skeleton-container {
    gap: 10px;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0));
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

@media (min-width: 600px) {
  .search-skeleton-container {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
    gap: 12px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0));
  }
}

@media (min-width: 768px) {
  .search-skeleton-container {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    gap: 14px;
    padding: 10px 16px 0;
    max-width: 1024px;
    margin: 0 auto;
  }
}

@media (min-width: 1024px) {
  .search-skeleton-container {
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 14px;
    padding: 10px 24px 0;
    max-width: 1200px;
  }
}

@media (min-width: 1280px) {
  .search-skeleton-container {
    grid-template-columns: repeat(5, minmax(160px, 1fr));
    gap: 16px;
  }
}

.search-skeleton-card {
  background: var(--card);
  border: 1px solid var(--surface-border-subtle);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-subtle);
  /* Use aspect-ratio to match real content cards (cover + body) */
  display: grid;
  grid-template-rows: auto 1fr;
}

.search-skeleton-cover {
  width: 100%;
  /* 1:1 aspect ratio cover matching .card-media */
  /* Fallback for browsers without aspect-ratio support */
  padding-bottom: 100%;
  height: 0;
  /* Modern browsers use aspect-ratio */
  aspect-ratio: 1 / 1;
  background: linear-gradient(
    90deg,
    var(--surface-1) 0%,
    var(--surface-2) 50%,
    var(--surface-1) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}
@supports (aspect-ratio: 1 / 1) {
  .search-skeleton-cover {
    padding-bottom: 0;
    height: auto;
    min-height: 0;
  }
}

.search-skeleton-content {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-skeleton-title {
  height: 20px;
  width: 80%;
  background: linear-gradient(
    90deg,
    var(--surface-1) 0%,
    var(--surface-2) 50%,
    var(--surface-1) 100%
  );
  background-size: 200% 100%;
  border-radius: 4px;
  animation: shimmer 1.5s ease-in-out infinite;
}

.search-skeleton-subtitle {
  height: 16px;
  width: 60%;
  background: linear-gradient(
    90deg,
    var(--surface-1) 0%,
    var(--surface-2) 50%,
    var(--surface-1) 100%
  );
  background-size: 200% 100%;
  border-radius: 4px;
  animation: shimmer 1.5s ease-in-out infinite;
  animation-delay: 0.1s;
}

/* (No separate dark-mode override needed: --surface-1/--surface-2 are theme-aware) */

/* ===== SEARCH STATUS MESSAGE ===== */
.search-status-message {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px 16px;
  color: var(--muted);
  font-size: 14px;
  animation: fadeIn 0.3s ease-in;
}

.search-status-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--surface-border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ===== ENERGY-SAVER THEME OVERRIDES ===== */
/* Exclude loader spinners from reduced-motion so they remain visible */
[data-theme="eco"] .loader-spinner {
  animation-duration: var(--loader-duration, 2s) !important;
}

[data-theme="eco"] .loader {
  animation-duration: var(--loader-duration, 2s) !important;
}

[data-theme="eco"] .search-status-spinner {
  animation-duration: var(--loader-duration, 2s) !important;
}
/**
 * player-layout.css — Mobile Player Layout Enhancements
 *
 * Improves the visual quality and spacing of the Resonate Player on mobile.
 * Loaded after resonate.css to extend/override mobile-specific styles.
 *
 * Targets:
 *   - Portrait mobile (max-width: 767px, min-height: 480px)
 *   - Landscape exclusion via min-height guard to preserve compact modes
 *   - Does NOT affect tablet (≥768px) or desktop (≥1024px) layouts
 */

/* =====================================================================
   ALBUM ARTWORK — Primary visual element
   Previous mobile size: clamp(140px, 26vh, 220px) — viewport-height
   New mobile size:      clamp(200px, 75vw, 360px) — viewport-width
   Guard: min-height: 480px excludes landscape phones where space is tight
   ===================================================================== */
@media (max-width: 767px) and (min-height: 480px) {
  .art {
    /* Larger, viewport-width-based artwork for portrait mobile */
    width: clamp(200px, 75vw, 360px);
    height: clamp(200px, 75vw, 360px);

    /* Modern rounded corners (up from 12px) */
    border-radius: 20px;

    /* Rich depth shadow */
    box-shadow:
      0 24px 64px rgba(0, 0, 0, 0.45),
      0 8px 24px rgba(0, 0, 0, 0.28),
      0 2px 6px rgba(0, 0, 0, 0.18);

    /* Breathing room below artwork */
    margin: 0 auto var(--spacing-xl, 20px);

    /* Smooth size/shadow transitions */
    transition: transform 0.35s ease, box-shadow 0.35s ease;
  }

  /* Player content: consistent 16px horizontal padding */
  .player-content {
    padding: 0 16px;
  }

  /* Track info section: tighter top/bottom padding */
  .current-track-info {
    padding: var(--spacing-md, 12px) 0 var(--spacing-xs, 4px);
    gap: 4px;
  }

  /* Description/icon controls: compact spacing */
  #description-container {
    margin-top: var(--spacing-xs, 4px);
    margin-bottom: var(--spacing-xs, 4px);
  }

  /* Progress section: 20–24px vertical breathing room */
  .progress-section {
    padding: 10px 0 30px 0;
    margin: 4px 0 0 0;
  }

  /* Main player section: consistent top padding */
  .main-player-section {
    padding-top: var(--spacing-xl, 20px);
  }
}

/* =====================================================================
   DAY THEME — Softer artwork shadow for light backgrounds
   ===================================================================== */
@media (max-width: 767px) and (min-height: 480px) {
  [data-theme="day"] .art {
    box-shadow:
      0 20px 50px rgba(0, 0, 0, 0.18),
      0 6px 18px rgba(0, 0, 0, 0.12),
      0 2px 4px rgba(0, 0, 0, 0.08);
  }
}

.app.has-art-background {
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.58), rgba(0, 0, 0, 0.58)),
    var(--player-art-background);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.app.has-art-background #app-header,
.app.has-art-background .discovery-section,
.app.has-art-background .main-player-section {
  background-color: transparent;
}

[data-theme="day"] .app.has-art-background {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.68)),
    var(--player-art-background);
}
/**
 * player-typography.css — Mobile Typography Hierarchy
 *
 * Defines a clear typographic scale for the player on mobile.
 * Loaded after resonate.css; these rules refine (not replace) the base styles.
 *
 * Scale:
 *   Track title  → 22px / weight 600 / tight letter-spacing
 *   Artist text  → 14px / weight 400 / readable contrast
 */

/* =====================================================================
   MOBILE PORTRAIT — Typography refinements
   ===================================================================== */
@media (max-width: 767px) and (min-height: 480px) {

  /* Track title: slightly smaller than desktop (24px → 22px), but bolder feel */
  .title {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.25;
  }

  /* Artist / creator: secondary line without reducing text contrast */
  .creator {
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.01em;
    line-height: 1.35;
  }
}

[data-theme="day"] .creator {
  color: #595959;
  opacity: 1;
}

/* =====================================================================
   COMPACT LANDSCAPE — Already handled by resonate.css height queries.
   No overrides needed here; the min-height guard above ensures those
   rules remain in effect.
   ===================================================================== */
/**
 * player-progress.css — Touch-Friendly Progress Bar
 *
 * Refines the seek bar for one-handed mobile interaction.
 * Loaded after resonate.css; only overrides mobile-relevant properties.
 *
 * Goals:
 *   - 6px visual track (modern and refined)
 *   - 18px draggable thumb, always visible on touch devices
 *   - Larger invisible touch target via padding on .progress-section
 *   - Smooth transition on thumb appearance
 */

/* =====================================================================
   PROGRESS BAR — Refined for touch (portrait mobile)
   ===================================================================== */
@media (max-width: 767px) and (min-height: 480px) {

  /* Slim 6px track */
  .progress-bar {
    height: 6px;
    border-radius: 3px;
  }

  /* Keep height at 6px on touch (don't expand on "hover" tap-stick) */
  .progress-bar:hover {
    height: 6px;
  }

  /* Thumb: always visible on touch devices, larger for finger precision */
  .progress-thumb::after {
    /* 18px thumb diameter */
    width: 18px;
    height: 18px;
    left: -9px;

    /* Always visible on touch (no hover required) */
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);

    /* Larger glow ring */
    box-shadow:
      0 2px 10px rgba(0, 0, 0, 0.35),
      0 0 0 2px rgba(255, 255, 255, 0.9);
  }

  /* Grow thumb slightly while dragging */
  .progress-bar.dragging .progress-thumb::after {
    width: 22px;
    height: 22px;
    left: -11px;
    transform: translate(-50%, -50%) scale(1);
    box-shadow:
      0 3px 14px rgba(0, 0, 0, 0.4),
      0 0 0 3px rgba(255, 255, 255, 0.9);
  }

  /* Rounded track ends */
  .progress,
  .progress-buffered {
    border-radius: 3px;
  }
}

/* =====================================================================
   TOUCH DEVICES — Ensure thumb is never hidden on coarse pointers
   ===================================================================== */
@media (hover: none) and (pointer: coarse) {
  .progress-thumb::after {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}
/**
 * player-controls.css — Playback Controls Redesign
 *
 * Establishes a clear visual hierarchy for the playback controls:
 *   Primary:   Play/Pause button — large, accent-colored, with shadow
 *   Secondary: Prev, Next, Shuffle, Favorite — smaller, standard style
 *
 * Loaded after resonate.css; overrides mobile control styles only.
 *
 * Color strategy:
 *   Uses `--primary` and `--primary-rgb` (defined in resonate.css) for the
 *   play button accent so all four themes are respected:
 *     Dark/night themes: --primary = #3da9ff  --primary-rgb = 61, 169, 255
 *     Day theme:         --primary = #10b981  --primary-rgb = 16, 185, 129
 *     Energy-saver:      --primary = #7aa7b8  --primary-rgb = 122, 167, 184
 */

/* =====================================================================
   PLAY BUTTON — Dominant accent-colored circular button
   ===================================================================== */

/* Apply accent color to play button globally (all breakpoints) */
.play-btn,
.play-btn-favorite {
  background: var(--primary);
  color: #fff;
  box-shadow:
    0 4px 20px rgba(var(--primary-rgb), 0.45),
    0 2px 6px rgba(var(--primary-rgb), 0.3);
}

.play-btn {
  letter-spacing: 0;
  line-height: 1;
  text-shadow: none;
}

.play-btn .transport-icon {
  position: relative;
  display: block;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  pointer-events: none;
}

.play-btn .transport-icon::before,
.play-btn .transport-icon::after {
  content: '';
  position: absolute;
  display: block;
  box-sizing: border-box;
}

.play-btn[data-state="play"] .transport-icon::before {
  top: 4px;
  left: 9px;
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 15px solid currentColor;
}

.play-btn[data-state="play"] .transport-icon::after {
  display: none;
}

.play-btn[data-state="pause"] .transport-icon::before,
.play-btn[data-state="pause"] .transport-icon::after {
  top: 4px;
  width: 6px;
  height: 20px;
  border-radius: 999px;
  background: currentColor;
}

.play-btn[data-state="pause"] .transport-icon::before {
  left: 7px;
}

.play-btn[data-state="pause"] .transport-icon::after {
  right: 7px;
}

.play-btn:hover:not(:disabled),
.play-btn-favorite:hover:not(:disabled) {
  background: var(--primary);
  box-shadow:
    0 8px 28px rgba(var(--primary-rgb), 0.55),
    0 4px 10px rgba(var(--primary-rgb), 0.35);
}

.play-btn:active,
.play-btn-favorite:active {
  background: var(--primary);
  /* !important needed: button:active:not(:disabled) in resonate.css has higher specificity (0,2,1) */
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.25),
    0 2px 8px rgba(var(--primary-rgb), 0.3) !important;
}

/* Press microinteraction: scale down then bounce back */
.play-btn:active {
  transform: scale(0.93);
  transition: transform 0.1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* =====================================================================
   MOBILE PORTRAIT — Control sizing and spacing
   ===================================================================== */
@media (max-width: 767px) and (min-height: 480px) {

  /* Controls row: generous gap for comfortable thumb reach */
  .main-player-section .controls {
    gap: clamp(8px, 3.5vw, 20px);
    margin-top: 8px;
    /* Keep the play button fully clear of the sticky footer on mobile. */
    min-height: calc(72px + 16px + var(--vv-bottom-inset, 0px));
    padding-top: 4px;
    padding-bottom: calc(12px + var(--vv-bottom-inset, 0px));
    padding-left: calc(16px + env(safe-area-inset-left, 0));
    padding-right: calc(16px + env(safe-area-inset-right, 0));
  }

  /* Secondary buttons: 48px touch target (WCAG AA: 44px minimum) */
  .main-player-section .controls button:not(.play-btn):not(.play-btn-favorite) {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
  }

  /* Prev/Next SVG icons scale up slightly for larger touch targets */
  .main-player-section .controls .prev-btn .control-icon,
  .main-player-section .controls .next-btn .control-icon {
    width: 24px;
    height: 24px;
  }

  /* Play button stays larger at 72px */
  .main-player-section .controls .play-btn,
  .main-player-section .controls .play-btn-favorite {
    width: 72px;
    height: 72px;
  }

  /* Shuffle active indicator: use primary accent */
  .shuffle-favorites-btn.active {
    color: var(--primary);
    outline-color: var(--primary) !important;
  }

  /* Favorite button active: primary accent */
  .main-player-section .controls #favorite-btn.active {
    color: var(--primary);
  }
}

/* =====================================================================
   TOUCH DEVICES — Remove hover transforms that cause sticky tap effects
   Already handled in resonate.css; play button override ensures color
   consistency even without hover.
   ===================================================================== */
@media (hover: none) and (pointer: coarse) {
  /* On touch, ensure accent color is preserved (no transform side-effects) */
  .play-btn:hover,
  .play-btn-favorite:hover {
    background: var(--primary);
    box-shadow:
      0 4px 20px rgba(var(--primary-rgb), 0.45),
      0 2px 6px rgba(var(--primary-rgb), 0.3);
  }
}
/**
 * player-bottom-sheet.css — App Menu and Track Menu Sheets
 *
 * Defines the two menu entry points introduced in the UI split:
 *   - Header app menu trigger
 *   - Contextual track menu trigger
 * Both triggers reuse the same bottom sheet visual language.
 */

.app-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  min-height: 44px;
  width: 44px;
  min-width: 44px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 999px;
  box-shadow: none;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: color 150ms ease, opacity 150ms ease, transform 100ms ease;
}

.menu-trigger-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.menu-trigger-svg {
  width: 20px;
  height: 20px;
  display: block;
  stroke: currentColor;
  fill: none;
}

.app-menu-btn:hover,
.app-menu-btn[aria-expanded="true"] {
  background: transparent;
  color: var(--primary);
  opacity: 1;
}

.app-menu-btn:active {
  transform: scale(0.94);
}

.app-menu-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.player-menu-btn {
  color: var(--fg);
  background: var(--surface-subtle, rgba(var(--primary-rgb), 0.08));
  border-color: var(--surface-border, rgba(var(--primary-rgb), 0.18));
  box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb), 0.06);
}

.player-menu-btn:hover,
.player-menu-btn:focus-visible,
.player-menu-btn[aria-expanded="true"] {
  color: var(--primary);
  background: var(--surface-hover, rgba(var(--primary-rgb), 0.12));
  border-color: rgba(var(--primary-rgb), 0.28);
}

.player-menu-btn:active {
  transform: scale(0.94);
  background: rgba(var(--primary-rgb), 0.16);
}

.player-menu-btn .btn-svg {
  width: 18px;
  height: 18px;
}

/* =====================================================================
   BOTTOM SHEET OVERLAY — Semi-transparent backdrop
   ===================================================================== */

.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease;
}

.bottom-sheet-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* =====================================================================
   BOTTOM SHEET — Slide-up panel from the bottom
   ===================================================================== */

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 900;
  background: var(--sheet-bg, var(--card, #1a1a2e));
  border: 1px solid var(--sheet-border, var(--surface-border, rgba(255, 255, 255, 0.08)));
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  box-shadow: var(--sheet-shadow, 0 -12px 36px rgba(0, 0, 0, 0.32), 0 0 0 1px rgba(var(--primary-rgb), 0.06));
  max-height: 70vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateY(100%);
  transition: transform 250ms cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
  /* Safe area padding for iOS home bar */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-sheet.open {
  transform: translateY(0);
}

/* =====================================================================
   SHEET DRAG HANDLE — Visual affordance for swipe-to-dismiss
   ===================================================================== */

.sheet-drag-handle {
  width: 40px;
  height: 4px;
  background: var(--sheet-handle-bg, var(--surface-border, rgba(255, 255, 255, 0.25)));
  border-radius: 2px;
  margin: 12px auto 0;
  flex-shrink: 0;
}

/* =====================================================================
   SHEET HEADER
   ===================================================================== */

.sheet-header {
  padding: 16px 20px 8px;
  border-bottom: 1px solid var(--sheet-border-subtle, var(--surface-border-subtle, rgba(255, 255, 255, 0.08)));
  flex-shrink: 0;
}

.sheet-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted, rgba(255, 255, 255, 0.5));
}

.sheet-subtitle {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted, rgba(255, 255, 255, 0.4));
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =====================================================================
   SHEET CONTENT — List of action items
   ===================================================================== */

.sheet-content {
  padding: 8px 0;
  display: flex;
  flex-direction: column;
}

/* =====================================================================
   SHEET ACTION ITEM — Each row in the bottom sheet
   ===================================================================== */

.sheet-action-item {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 56px;
  padding: 0 20px;
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--fg, #e8eaf6);
  font-size: 16px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 120ms ease;
  /* Reset theme-selector styles that bleed through */
  height: auto;
  max-height: none;
  box-shadow: none;
  letter-spacing: normal;
}

.sheet-action-item:hover {
  background: var(--sheet-item-hover-bg, rgba(var(--primary-rgb), 0.10));
}

.sheet-action-item:active {
  background: var(--sheet-item-active-bg, rgba(var(--primary-rgb), 0.18));
}

.sheet-action-item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  background: var(--sheet-item-hover-bg, rgba(var(--primary-rgb), 0.10));
}

/* Icon wrapper inside each sheet action item */
.sheet-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--sheet-icon-bg, rgba(var(--primary-rgb), 0.12));
  color: var(--primary);
  flex-shrink: 0;
  /* Override header-icon defaults */
  border: none;
}

.sheet-item-svg {
  width: 20px;
  height: 20px;
  display: block;
  /* Allow SVGs with stroke to render correctly */
  stroke: currentColor;
  fill: none;
}

/* For SVGs that use <use> and fill (like resonate-icon / info-icon) */
.sheet-item-svg.resonate-icon,
.sheet-item-svg use {
  stroke: none;
  fill: currentColor;
}

.sheet-item-label {
  flex: 1;
  /* Override theme-label's visually-hidden styles */
  position: static;
  width: auto;
  height: auto;
  padding: 0;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  border: 0;
  font-size: 16px;
  font-weight: 500;
  color: var(--fg, #e8eaf6);
}

/* Resonates count badge in sheet */
.sheet-action-item .resontes-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--bg, #1a1a2e);
  font-size: 12px;
  font-weight: 700;
}

.sheet-action-item .resontes-label {
  /* Override the display:none set by .header-controls #resontes-toggle .resontes-label */
  display: block !important;
  font-size: 16px;
  font-weight: 500;
  color: var(--fg, #e8eaf6);
}

/* Theme label in sheet */
.sheet-action-item .theme-label {
  /* Override the visually-hidden .theme-label */
  position: static;
  width: auto;
  height: auto;
  padding: 0;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  border: 0;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted, rgba(255, 255, 255, 0.5));
  flex-shrink: 0;
}

/* Cast badge in sheet (show when cast available) */
.sheet-action-item .cast-badge {
  display: none;
}

.sheet-action-item.cast-available .cast-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--bg, #1a1a2e);
  font-size: 11px;
  font-weight: 700;
}

/* =====================================================================
   SHEET FOOTER — Cancel button
   ===================================================================== */

.sheet-footer {
  padding: 8px 20px 16px;
  border-top: 1px solid var(--sheet-border-subtle, var(--surface-border-subtle, rgba(255, 255, 255, 0.08)));
}

.sheet-cancel-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 50px;
  padding: 0 20px;
  background: var(--sheet-item-hover-bg, rgba(var(--primary-rgb), 0.10));
  border: 1px solid rgba(var(--primary-rgb), 0.20);
  border-radius: 12px;
  color: var(--primary);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 120ms ease;
}

.sheet-cancel-btn:hover {
  background: var(--sheet-item-active-bg, rgba(var(--primary-rgb), 0.18));
}

.sheet-cancel-btn:active {
  background: rgba(var(--primary-rgb), 0.25);
}

.sheet-cancel-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* =====================================================================
   BODY SCROLL LOCK — Prevent background scroll while sheet is open
   ===================================================================== */

body.sheet-open {
  overflow: hidden;
}

/* =====================================================================
   DYNAMICALLY-GENERATED ICON MARKUP inside sheet action items
   (e.g. the share button's icon is replaced by setShareButtonIcon in ui.js
   which outputs class="header-icon" instead of class="sheet-item-icon")
   ===================================================================== */

.sheet-action-item .header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--sheet-icon-bg, rgba(var(--primary-rgb), 0.12));
  color: var(--primary);
  flex-shrink: 0;
  border: none;
}

.sheet-action-item .header-svg {
  width: 20px;
  height: 20px;
  display: block;
  stroke: currentColor;
  fill: none;
}

/* =====================================================================
   HEADER RESONATES SHORTCUT — Direct access button in the app header
   ===================================================================== */

.header-resontes-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  min-height: 44px;
  width: 44px;
  min-width: 44px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 999px;
  box-shadow: none;
  color: var(--muted);
  cursor: pointer;
  overflow: visible;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: color 150ms ease, opacity 150ms ease, transform 100ms ease;
}

.header-resontes-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.header-resontes-svg {
  width: 20px;
  height: 20px;
  display: block;
  stroke: currentColor;
  fill: none;
}

.header-resontes-count {
  position: absolute;
  top: 4px;
  right: 4px;
  transform: translate(30%, -30%) scale(0.7);
  background: rgba(var(--primary-rgb), 0.15);
  color: var(--primary);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 999px;
  min-width: 15px;
  white-space: nowrap;
  text-align: center;
  border: 1px solid rgba(var(--primary-rgb), 0.3);
  opacity: 0;
  transition: opacity 200ms ease, transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

[data-theme="day"] .header-resontes-count {
  color: #065f46;
}

.header-resontes-btn.has-resontes .header-resontes-count {
  opacity: 1;
  transform: translate(30%, -30%) scale(1);
}

.header-resontes-btn:hover,
.header-resontes-btn.active {
  color: var(--primary);
}

.header-resontes-btn.active .header-resontes-icon {
  filter: drop-shadow(0 1px 4px rgba(var(--primary-rgb), 0.35));
}

.header-resontes-btn:active {
  transform: scale(0.94);
}

.header-resontes-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@keyframes resontesBtnPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18); }
  70%  { transform: scale(0.95); }
  100% { transform: scale(1); }
}

.header-resontes-btn.pop .header-resontes-icon {
  animation: resontesBtnPop 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* ============================================================
   Playlists panel & picker popup
   ============================================================ */

/* ── Playlists panel (mirrors .resontes-list layout) ─────── */
.playlists-list {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg, #0d0d0d);
  z-index: 300;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  flex-direction: column;
}

.playlists-list.active {
  display: flex;
}

.playlists-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  gap: 10px;
  border-bottom: 1px solid var(--surface-border, rgba(255,255,255,0.08));
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg, #0d0d0d);
}

.playlists-panel-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--fg, #f0f0f0);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlists-panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.playlists-panel-close-btn,
.playlists-new-btn,
.playlists-import-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--fg, #f0f0f0);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  font-size: 13px;
  gap: 5px;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

.playlists-panel-close-btn {
  padding: 4px 8px;
  font-size: 18px;
  color: var(--muted, #888);
}

.playlists-new-btn {
  background: var(--primary);
  color: #000;
  font-weight: 600;
  border-color: transparent;
}

.playlists-import-btn {
  border-color: var(--surface-border, rgba(255,255,255,0.15));
  color: var(--muted, #aaa);
}

.playlists-new-btn:hover,
.playlists-new-btn:focus-visible {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.playlists-new-btn:active {
  transform: translateY(0);
}

.playlists-import-btn:hover,
.playlists-import-btn:focus-visible {
  background: var(--surface-2, rgba(255,255,255,0.06));
}

/* ── Playlist list body ─────────────────────────────────── */
.playlists-panel-body {
  flex: 1;
  padding: 12px 16px 80px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Empty state ────────────────────────────────────────── */
.playlists-empty-msg {
  text-align: center;
  color: var(--muted, #888);
  font-size: 14px;
  margin: 40px auto;
  line-height: 1.6;
}

.playlists-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  margin: auto;
}

.playlists-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.playlists-empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--fg, #f0f0f0);
  margin: 0 0 8px;
}

.playlists-empty-text {
  font-size: 14px;
  color: var(--muted, #888);
  margin: 0 0 24px;
  max-width: 280px;
  line-height: 1.5;
}

.playlists-empty-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 220px;
}

.playlists-empty-cta {
  background: var(--primary);
  color: #000;
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}

.playlists-empty-cta:hover,
.playlists-empty-cta:focus-visible {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.playlists-empty-secondary {
  background: transparent;
  color: var(--muted, #aaa);
  border: 1px solid var(--surface-border, rgba(255,255,255,0.15));
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.playlists-empty-secondary:hover,
.playlists-empty-secondary:focus-visible {
  background: var(--surface-2, rgba(255,255,255,0.06));
  color: var(--fg, #f0f0f0);
}

/* ── Single playlist card ───────────────────────────────── */
.pl-card {
  background: var(--surface-2, rgba(255,255,255,0.04));
  border: 1px solid var(--surface-border, rgba(255,255,255,0.08));
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.18s, border-color 0.18s;
}

.pl-card:hover {
  box-shadow: 0 4px 18px rgba(0,0,0,0.2);
}

.pl-card--expanded {
  border-color: var(--primary);
  box-shadow: 0 4px 20px rgba(110, 231, 183, 0.1);
}

.pl-card-header {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

/* Expand/collapse indicator */
.pl-card-expand-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted, #888);
  transition: transform 0.2s ease, color 0.15s;
  flex-shrink: 0;
}

.pl-card--expanded .pl-card-expand-indicator {
  transform: rotate(180deg);
  color: var(--primary);
}

.pl-card-info {
  flex: 1;
  min-width: 0;
}

/* Name container for inline editing */
.pl-card-name-container {
  position: relative;
}

.pl-card-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--fg, #f0f0f0);
  /* Allow 2 lines with ellipsis */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

.pl-card-name-input {
  position: absolute;
  top: -4px;
  left: -6px;
  right: -6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--fg, #f0f0f0);
  background: var(--surface-1, #1a1a1a);
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: 4px 6px;
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  outline: none;
}

.pl-card--editing .pl-card-name {
  opacity: 0;
}

.pl-card--editing .pl-card-name-input {
  opacity: 1;
  pointer-events: auto;
}

.pl-card-meta {
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted, #888);
  margin-top: 3px;
}

.pl-card-btns {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.pl-card-btn {
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--muted, #aaa);
  cursor: pointer;
  font-size: 14px;
  padding: 6px 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background 0.12s, color 0.12s, transform 0.1s;
}

.pl-card-btn:hover,
.pl-card-btn:focus-visible {
  background: var(--surface-3, rgba(255,255,255,0.08));
  color: var(--fg, #f0f0f0);
  transform: scale(1.05);
}

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

.pl-card-btn svg {
  width: 16px;
  height: 16px;
}

.pl-card-btn--play {
  color: var(--primary);
}

.pl-card-btn--shuffle {
  color: var(--muted, #aaa);
}

.pl-card-btn--shuffle:hover,
.pl-card-btn--shuffle:focus-visible {
  color: var(--primary);
}

.pl-card-btn--danger:hover,
.pl-card-btn--danger:focus-visible {
  color: #f88;
  background: rgba(255,80,80,0.1);
}

/* ── Playlist tracks (expandable) ──────────────────────── */
.pl-tracks-list {
  border-top: 1px solid var(--surface-border, rgba(255,255,255,0.06));
  padding: 4px 0 8px;
  display: none;
  animation: pl-tracks-in 0.2s ease;
}

@keyframes pl-tracks-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.pl-tracks-list.open {
  display: block;
}

.pl-tracks-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px 6px;
  flex-wrap: wrap;
}

.pl-tracks-summary-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg, #f0f0f0);
}

.pl-tracks-summary-duration {
  color: var(--muted, #888);
  font-variant-numeric: tabular-nums;
}

.pl-tracks-summary-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted, #888);
}

/* Empty tracks state */
.pl-tracks-empty {
  padding: 20px 14px;
  text-align: center;
}

.pl-tracks-empty-msg {
  font-size: 14px;
  color: var(--fg, #f0f0f0);
  margin: 0 0 4px;
}

.pl-tracks-empty-hint {
  font-size: 12px;
  color: var(--muted, #888);
  margin: 0;
}

.pl-track-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  padding: 10px 14px;
  gap: 10px;
  cursor: pointer;
  transition: background 0.1s, opacity 0.2s, transform 0.2s;
  border-radius: 10px;
  margin: 0 8px 4px;
  min-height: 52px;
}

.pl-track-row:hover {
  background: var(--surface-3, rgba(255,255,255,0.05));
}

.pl-track-row:focus-visible {
  outline: none;
  background: var(--surface-3, rgba(255,255,255,0.08));
}

.pl-track-row--playing {
  background: rgba(var(--primary-rgb), 0.08);
  box-shadow: inset 3px 0 0 var(--primary);
}

.pl-track-row--playing .pl-track-number {
  color: var(--primary);
}

/* Remove animation */
.pl-track-row--removing {
  opacity: 0;
  transform: translateX(-20px);
}

.pl-track-number {
  font-size: 12px;
  color: var(--muted, #888);
  text-align: center;
  font-variant-numeric: tabular-nums;
  position: relative;
  transition: color 0.15s ease;
}

.pl-track-row:hover:not(.pl-track-row--playing) .pl-track-number {
  color: transparent;
}

.pl-track-row:hover:not(.pl-track-row--playing) .pl-track-number::before {
  content: '▶';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg, #f0f0f0);
  font-size: 10px;
}

.pl-track-row--playing .pl-track-number {
  color: transparent;
}

.pl-track-row--playing .pl-track-number::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-8px, -50%);
  width: 16px;
  height: 14px;
  background-image:
    linear-gradient(var(--primary), var(--primary)),
    linear-gradient(var(--primary), var(--primary)),
    linear-gradient(var(--primary), var(--primary));
  background-size: 3px 8px, 3px 4px, 3px 10px;
  background-position: 0 bottom, 6px bottom, 12px bottom;
  background-repeat: no-repeat;
  animation: eq-bars 0.9s ease-in-out infinite;
}

.pl-track-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 10px;
}

.pl-track-info {
  min-width: 0;
  flex: 1;
}

.pl-track-title {
  font-size: 13px;
  line-height: 1.35;
  color: var(--fg, #f0f0f0);
  /* Allow 2 lines with ellipsis for better readability */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

.pl-track-meta {
  font-size: 11px;
  line-height: 1.3;
  color: var(--muted, #888);
  margin-top: 2px;
  /* Single line with ellipsis for artist/album info */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-track-duration {
  min-width: 40px;
  text-align: right;
  font-size: 12px;
  color: var(--muted, #aaa);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pl-track-remove-btn {
  background: transparent;
  border: none;
  color: var(--muted, #888);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color 0.12s, background 0.12s;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.78;
}

.pl-track-row:hover .pl-track-remove-btn {
  opacity: 1;
}

.pl-track-remove-btn:hover,
.pl-track-remove-btn:focus-visible {
  color: #f88;
  background: rgba(255,80,80,0.1);
  opacity: 1;
}

.pl-track-remove-btn svg {
  width: 14px;
  height: 14px;
}

@media (max-width: 480px) {
  .pl-tracks-summary {
    padding: 8px 12px 4px;
  }

  .pl-track-row {
    padding: 9px 12px;
    gap: 8px;
    margin: 0 6px 4px;
  }

  .pl-track-duration {
    min-width: 34px;
    font-size: 11px;
  }
}

/* ── Add-to-playlist picker popup ─────────────────────── */
.pl-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.4);
  animation: pl-backdrop-in 0.15s ease;
}

@keyframes pl-backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.pl-picker {
  position: fixed;
  z-index: 501;
  background: var(--surface-1, #1a1a1a);
  border: 1px solid var(--surface-border, rgba(255,255,255,0.12));
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  min-width: 260px;
  max-width: 320px;
  overflow: hidden;
  animation: pl-picker-in 0.15s ease;
}

@keyframes pl-picker-in {
  from { opacity: 0; transform: translateY(6px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

.pl-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg, #f0f0f0);
  border-bottom: 1px solid var(--surface-border, rgba(255,255,255,0.08));
}

.pl-picker-close {
  background: transparent;
  border: none;
  color: var(--muted, #888);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.12s, background 0.12s;
}

.pl-picker-close:hover,
.pl-picker-close:focus-visible {
  color: var(--fg, #f0f0f0);
  background: var(--surface-3, rgba(255,255,255,0.08));
}

.pl-picker-search-container {
  padding: 8px 12px;
  border-bottom: 1px solid var(--surface-border, rgba(255,255,255,0.06));
}

.pl-picker-search {
  width: 100%;
  background: var(--surface-2, rgba(255,255,255,0.06));
  border: 1px solid var(--surface-border, rgba(255,255,255,0.1));
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--fg, #f0f0f0);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.pl-picker-search::placeholder {
  color: var(--muted, #888);
}

.pl-picker-search:focus {
  border-color: var(--primary);
  background: var(--surface-3, rgba(255,255,255,0.08));
}

.pl-picker-list {
  max-height: 260px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.pl-picker-no-results {
  padding: 20px 14px;
  text-align: center;
  font-size: 13px;
  color: var(--muted, #888);
}

.pl-picker-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 14px;
  gap: 2px;
  cursor: pointer;
  font-size: 14px;
  color: var(--fg, #f0f0f0);
  transition: background 0.1s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.pl-picker-item:hover,
.pl-picker-item:focus-visible {
  background: var(--surface-3, rgba(255,255,255,0.08));
  outline: none;
}

.pl-picker-item-name {
  font-weight: 500;
}

.pl-picker-item-meta {
  font-size: 11px;
  color: var(--muted, #888);
}

.pl-picker-item--new {
  flex-direction: row;
  border-top: 1px solid var(--surface-border, rgba(255,255,255,0.08));
  color: var(--primary);
  font-weight: 600;
  padding: 12px 14px;
}

/* ── Modal styles ─────────────────────────────────────── */
.pl-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0, 0, 0, 0.6);
  animation: pl-backdrop-in 0.15s ease;
}

.pl-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 601;
  background: var(--surface-1, #1a1a1a);
  border: 1px solid var(--surface-border, rgba(255,255,255,0.12));
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.6);
  min-width: 0;
  max-width: 400px;
  width: calc(100% - 40px);
  overflow: hidden;
  animation: pl-modal-in 0.2s ease;
}

@keyframes pl-modal-in {
  from { 
    opacity: 0; 
    transform: translate(-50%, -50%) scale(0.95); 
  }
  to { 
    opacity: 1; 
    transform: translate(-50%, -50%) scale(1); 
  }
}

.pl-modal-header {
  padding: 20px 20px 0;
}

.pl-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--fg, #f0f0f0);
  margin: 0;
}

.pl-modal-body {
  padding: 16px 20px 20px;
}

.pl-modal-message {
  font-size: 14px;
  color: var(--fg, #f0f0f0);
  margin: 0 0 8px;
  line-height: 1.5;
}

.pl-modal-submessage {
  font-size: 13px;
  color: var(--muted, #888);
  margin: 0;
  line-height: 1.4;
}

.pl-modal-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted, #aaa);
  margin-bottom: 8px;
}

.pl-modal-input {
  width: 100%;
  background: var(--surface-2, rgba(255,255,255,0.06));
  border: 1px solid var(--surface-border, rgba(255,255,255,0.15));
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--fg, #f0f0f0);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  box-sizing: border-box;
}

.pl-modal-input::placeholder {
  color: var(--muted, #888);
}

.pl-modal-input:focus {
  border-color: var(--primary);
  background: var(--surface-3, rgba(255,255,255,0.08));
}

.pl-modal-actions {
  display: flex;
  gap: 10px;
  padding: 0 20px 20px;
  justify-content: flex-end;
}

.pl-modal-btn {
  background: transparent;
  border: 1px solid var(--surface-border, rgba(255,255,255,0.15));
  border-radius: 10px;
  color: var(--fg, #f0f0f0);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 18px;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.pl-modal-btn:hover,
.pl-modal-btn:focus-visible {
  background: var(--surface-2, rgba(255,255,255,0.06));
}

.pl-modal-btn:active {
  transform: scale(0.98);
}

.pl-modal-btn--primary {
  background: var(--primary);
  border-color: transparent;
  color: #000;
  font-weight: 600;
}

.pl-modal-btn--primary:hover,
.pl-modal-btn--primary:focus-visible {
  filter: brightness(1.1);
  background: var(--primary);
}

.pl-modal-btn--danger {
  background: #f44;
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}

.pl-modal-btn--danger:hover,
.pl-modal-btn--danger:focus-visible {
  filter: brightness(1.1);
  background: #f44;
}

.pl-modal-btn--cancel {
  background: transparent;
}

/* ── "Add to playlist" button in track rows ────────────── */
.tlv2-playlist-add {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: transparent;
  border: none;
  color: var(--muted, #888);
  cursor: pointer;
  padding: 0 6px;
  font-size: 18px;
  line-height: 1;
  border-radius: 6px;
  transition: color 0.12s, background 0.12s;
}

.tlv2-playlist-add:hover,
.tlv2-playlist-add:focus-visible {
  color: var(--primary);
  background: var(--surface-3, rgba(255,255,255,0.06));
}

.tlv2-playlist-add svg {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

/* ── Responsive adjustments ─────────────────────────────── */
@media (max-width: 420px) {
  .pl-card-btns {
    gap: 0;
  }
  
  .pl-card-btn {
    padding: 5px 6px;
  }
  
  .pl-card-btn svg {
    width: 14px;
    height: 14px;
  }
  
  .pl-modal {
    min-width: min(280px, calc(100vw - 40px));
  }
  
  .pl-modal-actions {
    flex-direction: column-reverse;
  }
  
  .pl-modal-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ── Tablet — constrain panel width and add side padding ── */
@media (min-width: 600px) {
  .playlists-panel-body {
    padding: 16px 24px 80px;
  }

  .pl-card {
    border-radius: 14px;
  }
}

/* ── Desktop — centre the panel as a floating drawer ──── */
@media (min-width: 1024px) {
  .playlists-list {
    /* On desktop show as a centred panel rather than full-screen */
    left: 50%;
    right: auto;
    width: min(680px, calc(100vw - 48px));
    transform: translateX(-50%);
    border-radius: 16px;
    border: 1px solid var(--surface-border);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
    top: 48px;
    bottom: auto;
    max-height: calc(100vh - 80px);
  }

  .playlists-panel-header {
    border-radius: 16px 16px 0 0;
  }

  .playlists-panel-body {
    padding: 16px 32px 32px;
  }

  .pl-modal {
    max-width: 480px;
  }
}
