/* Estilos de Reminiscencia (DESIGN §3 a §12): la distribución del reproductor web de Spotify de 2025.
   Escritorio ≥ 1024 px (con el panel «Reproduciendo»), tableta 768–1023 px y teléfono < 768 px. */

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

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-m);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  overflow: hidden;
}

h1,
h2,
h3,
p,
ul,
fieldset {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

fieldset {
  min-width: 0;
  padding: 0;
  border: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

button:disabled {
  cursor: default;
  opacity: 0.4;
}

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

[tabindex='-1']:focus {
  outline: none;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  left: 8px;
  top: -100px;
  z-index: 3000;
  padding: 12px 16px;
  border-radius: var(--radius-small);
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
}

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

.icon {
  display: block;
  flex: none;
}

/* ------------------------------------------------------------------------- */
/* Marco: barra superior, tres paneles y reproductor                          */
/* ------------------------------------------------------------------------- */

.app {
  display: grid;
  grid-template-columns: var(--lib-w) minmax(0, 1fr);
  grid-template-rows: var(--topbar-h) minmax(0, 1fr) auto;
  grid-template-areas:
    'top top'
    'lib main'
    'player player';
  column-gap: var(--gap);
  height: 100vh;
  height: 100dvh;
  padding: 0 var(--gap);
  background: var(--bg);
}

.now-open .app {
  grid-template-columns: var(--lib-w) minmax(0, 1fr) var(--now-w);
  grid-template-areas:
    'top top top'
    'lib main now'
    'player player player';
}

.panel {
  background: var(--surface);
  border-radius: var(--radius);
}

/* ---- Barra superior ---- */

.topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: var(--gap);
  min-width: 0;
  height: var(--topbar-h);
  padding: 8px 0;
}

.topbar-left,
.topbar-right {
  display: flex;
  flex: 1 0 0;
  align-items: center;
}

.topbar-left {
  min-width: max-content;
}

.topbar-center {
  display: flex;
  flex: 0 1 536px;
  align-items: center;
  gap: var(--gap);
  min-width: 0;
}

.brand {
  padding: 4px 12px 4px 16px;
  border-radius: var(--radius-small);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  white-space: nowrap;
}

.home-button {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--elevated);
  color: var(--text-2);
  transition: background-color 0.2s, color 0.2s, transform 0.15s;
}

.home-button:hover {
  background: var(--highlight);
  color: var(--text);
  transform: scale(1.04);
}

.home-button.is-active {
  color: var(--text);
}

.top-search {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  max-width: 480px;
  height: 48px;
  min-width: 0;
  padding: 0 4px 0 12px;
  border: 1px solid transparent;
  border-radius: 500px;
  background: var(--elevated);
  color: var(--text-2);
  transition: background-color 0.2s, border-color 0.2s;
}

.top-search:hover {
  background: var(--highlight);
}

.top-search:focus-within {
  border-color: var(--text);
  background: var(--highlight);
}

.top-search-icon {
  display: flex;
  flex: none;
  padding-right: 8px;
  pointer-events: none;
}

.top-search-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: var(--text-m);
  -webkit-appearance: none;
  appearance: none;
}

.top-search-input:focus,
.top-search-input:focus-visible {
  outline: none;
}

.top-search-input::placeholder {
  color: var(--text-2);
}

.top-search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-cancel-button,
.library-filter-input::-webkit-search-cancel-button {
  display: none;
}

.top-search-clear {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-2);
}

.top-search-clear:hover {
  color: var(--text);
}

.top-search-divider {
  flex: none;
  width: 1px;
  height: 24px;
  margin: 0 4px;
  background: var(--outline);
}

.explore-button {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--text-2);
  transition: color 0.2s, transform 0.15s;
}

.explore-button:hover,
.explore-button.is-active {
  color: var(--text);
}

.explore-button:hover {
  transform: scale(1.04);
}

.nav-icon {
  display: flex;
}

/* ---- Paneles ---- */

.sidebar {
  grid-area: lib;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.library-resize {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  width: 8px;
  cursor: col-resize;
  touch-action: none;
}

.library-resize::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 2px;
  background: transparent;
  transition: background-color 0.2s;
}

.library-resize:hover::after {
  background: var(--separator);
}

.library-resize:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: -2px;
}

.main {
  grid-area: main;
  position: relative;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  container-type: inline-size;
  container-name: main;
  scrollbar-color: #5a5a5a transparent;
}

.main:focus {
  outline: none;
}

.now-panel {
  grid-area: now;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 0 16px 16px;
  scrollbar-color: #5a5a5a transparent;
}

/* ------------------------------------------------------------------------- */
/* «Tu biblioteca»                                                            */
/* ------------------------------------------------------------------------- */

.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 64px;
  padding: 8px 16px;
}

.library-heading {
  min-width: 0;
  font-size: var(--text-m);
  font-weight: 700;
  line-height: 1.3;
}

.library-heading-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 4px;
  border-radius: var(--radius-small);
  transition: color 0.2s;
}

.library-heading-link:hover {
  color: var(--text-2);
}

.create-button {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 16px 0 12px;
  border-radius: 500px;
  background: var(--elevated);
  color: var(--text);
  font-size: var(--text-s);
  font-weight: 700;
  transition: background-color 0.2s, transform 0.15s;
}

.create-button:hover {
  background: var(--highlight);
  transform: scale(1.04);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.library-chips {
  padding: 0 16px 8px;
}

.chip {
  height: 32px;
  padding: 0 12px;
  border-radius: 500px;
  background: var(--highlight);
  color: var(--text);
  font-size: var(--text-s);
  white-space: nowrap;
  transition: background-color 0.2s;
}

.chip:hover {
  background: #333333;
}

.chip.is-active {
  background: var(--text);
  color: var(--bg);
}

.chip.is-active:hover {
  background: #f0f0f0;
}

.library-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 16px 4px 8px;
}

.library-search {
  display: flex;
  min-width: 0;
  align-items: center;
  border-radius: var(--radius-small);
}

.library-tools.is-searching .library-search {
  background: var(--highlight);
}

.library-search-toggle {
  width: 32px;
  height: 32px;
}

.library-filter-input {
  width: 160px;
  min-width: 0;
  height: 32px;
  padding: 0 8px 0 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: var(--text-s);
  -webkit-appearance: none;
  appearance: none;
}

.library-filter-input:focus-visible {
  outline: none;
}

.library-search:focus-within {
  outline: 2px solid var(--text);
  outline-offset: 0;
}

.library-filter-input::placeholder {
  color: var(--text-2);
}

.sort-button {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 4px 0 8px;
  border-radius: var(--radius-small);
  color: var(--text-2);
  font-size: var(--text-s);
  transition: color 0.2s, transform 0.15s;
}

.sort-button:hover {
  color: var(--text);
  transform: scale(1.04);
}

.library-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 8px 8px;
  scrollbar-color: #5a5a5a transparent;
}

.library-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 64px;
  padding: 8px;
  border-radius: 6px;
  transition: background-color 0.2s;
}

.library-item:hover {
  background: var(--elevated);
}

.library-item.is-active {
  background: var(--highlight);
}

.library-item.is-active:hover {
  background: #333333;
}

.library-cover {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-small);
}

.library-text {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
}

.library-title,
.library-subtitle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-title {
  font-size: var(--text-m);
  line-height: 1.4;
}

.library-item.is-current .library-title {
  color: var(--accent);
}

.library-subtitle {
  font-size: var(--text-s);
  color: var(--text-2);
  line-height: 1.4;
}

.library-playing {
  display: none;
  color: var(--accent);
}

.library-item.is-playing .library-playing {
  display: flex;
}

.library-empty {
  padding: 16px 8px;
  font-size: var(--text-s);
  color: var(--text-2);
}

/* ------------------------------------------------------------------------- */
/* Portadas                                                                   */
/* ------------------------------------------------------------------------- */

.cover {
  position: relative;
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(135deg, var(--cover-color, #333) 0%, color-mix(in srgb, var(--cover-color, #333) 55%, #000) 100%);
  color: rgba(255, 255, 255, 0.85);
}

.cover.has-image {
  background: var(--highlight);
}

.cover-empty {
  background: var(--highlight);
  color: var(--text-2);
}

.cover-icon {
  width: 40%;
  height: 40%;
  max-width: 64px;
  max-height: 64px;
}

.cover.has-image .cover-icon {
  visibility: hidden;
}

.cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-mosaic {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.cover-mosaic .cover-img {
  position: static;
}

.cover-mosaic .cover-icon {
  display: none;
}

/* ------------------------------------------------------------------------- */
/* Páginas                                                                    */
/* ------------------------------------------------------------------------- */

.page {
  padding: 16px var(--page-x) 32px;
}

.page-home {
  min-height: 100%;
  padding-top: 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--home-color, #535353) 45%, var(--surface)) 0, var(--surface) 332px);
  transition: background 0.6s;
}

.page-title {
  margin: 8px 0 24px;
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.offline-banner {
  position: sticky;
  top: 0;
  z-index: 6;
  padding: 8px var(--page-x);
  background: var(--highlight);
  color: var(--text);
  font-size: var(--text-s);
  font-weight: 600;
}

.empty-title {
  font-size: var(--text-m);
  font-weight: 700;
}

.empty-text {
  color: var(--text-2);
  font-size: var(--text-s);
}

.icon-button.page-back {
  display: none;
}

/* ---- Inicio: chips y accesos rápidos ---- */

.home-chips {
  margin-bottom: 24px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 40px;
}

@container main (min-width: 600px) {
  .quick-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  overflow: hidden;
  border-radius: var(--radius-small);
  background: var(--tile);
  transition: background-color 0.3s;
}

.tile:hover,
.tile:focus-within {
  background: var(--tile-hover);
}

.tile-cover {
  width: 48px;
  height: 48px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.tile-cover .cover-icon {
  width: 50%;
  height: 50%;
}

.tile-title {
  flex: 1;
  min-width: 0;
  padding-right: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-s);
  font-weight: 700;
  line-height: 1.3;
}

.tile.is-current .tile-title {
  color: var(--accent);
}

.tile-eq {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
  margin-right: 12px;
}

.tile-eq i,
.num-playing i {
  display: block;
  width: 3px;
  height: 100%;
  background: var(--accent);
  transform-origin: bottom;
}

.tile.is-playing .tile-eq {
  display: inline-flex;
}

.tile.is-playing:hover .tile-eq,
.tile.is-playing:focus-within .tile-eq {
  display: none;
}

.tile-eq i:nth-child(1),
.num-playing i:nth-child(1) {
  height: 60%;
}

.tile-eq i:nth-child(3),
.num-playing i:nth-child(3) {
  height: 80%;
}

.tile.is-playing .tile-eq i,
.track-row.is-playing .num-playing i {
  animation: eq 0.9s ease-in-out infinite alternate;
}

.tile.is-playing .tile-eq i:nth-child(2),
.track-row.is-playing .num-playing i:nth-child(2) {
  animation-delay: -0.3s;
}

.tile.is-playing .tile-eq i:nth-child(3),
.track-row.is-playing .num-playing i:nth-child(3) {
  animation-delay: -0.6s;
}

@keyframes eq {
  from {
    transform: scaleY(0.3);
  }
  to {
    transform: scaleY(1);
  }
}

.card-link::after {
  content: '';
  position: absolute;
  inset: 0;
}

.card-link:focus-visible {
  outline: none;
}

.tile:has(.card-link:focus-visible),
.card:has(.card-link:focus-visible),
.top-card:has(.card-link:focus-visible) {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.tile .play-button {
  position: absolute;
  top: 50%;
  right: 8px;
  z-index: 1;
  transform: translateY(-50%);
}

.tile .play-button:hover {
  transform: translateY(-50%) scale(1.04);
}

/* ---- Botón verde de reproducir ---- */

.play-button {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  transition: transform 0.3s, background-color 0.15s, opacity 0.3s;
}

.play-button:hover {
  background: var(--accent-hover);
  transform: scale(1.04);
}

.play-button-card {
  width: 48px;
  height: 48px;
  box-shadow: 0 8px 8px rgba(0, 0, 0, 0.3);
}

.play-button-big {
  width: 56px;
  height: 56px;
}

.play-button-tile {
  width: 32px;
  height: 32px;
  box-shadow: 0 8px 8px rgba(0, 0, 0, 0.3);
}

.tile .play-button,
.card .play-button,
.top-card .play-button {
  opacity: 0;
}

.tile:hover .play-button,
.tile:focus-within .play-button,
.card:hover .play-button,
.card:focus-within .play-button,
.card:focus-visible .play-button,
.top-card:hover .play-button,
.top-card:focus-within .play-button,
.play-button.is-playing,
.card-song.is-playing .play-button {
  opacity: 1;
}

/* ---- Estantes y tarjetas ---- */

.shelf {
  margin-bottom: 40px;
}

.shelf-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.shelf-title {
  font-size: var(--text-l);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.shelf-title-link:hover,
.shelf-more:hover {
  text-decoration: underline;
}

.shelf-more {
  flex: none;
  font-size: var(--text-s);
  font-weight: 700;
  color: var(--text-2);
}

.shelf-row {
  display: flex;
  gap: 0;
  margin: 0 -12px;
  padding: 0 0 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: #5a5a5a transparent;
}

.card {
  position: relative;
  display: flex;
  flex: 0 0 var(--card-w);
  flex-direction: column;
  width: var(--card-w);
  padding: 12px;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  scroll-snap-align: start;
  transition: background-color 0.3s;
}

.card:hover,
.card:focus-within,
.card-song:focus-visible {
  background: var(--elevated);
}

.card-cover-wrap {
  position: relative;
  display: block;
  margin-bottom: 8px;
}

.card-cover {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.card .play-button {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 1;
  transform: translateY(8px);
}

.card:hover .play-button,
.card:focus-within .play-button,
.card:focus-visible .play-button,
.card .play-button.is-playing,
.card-song.is-playing .play-button {
  transform: translateY(0);
}

.card .play-button:hover {
  transform: translateY(0) scale(1.04);
}

.card-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-m);
  font-weight: 700;
  line-height: 1.4;
}

.card-song.is-current .card-title {
  color: var(--accent);
}

.card-subtitle {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  margin-top: 2px;
  font-size: var(--text-s);
  color: var(--text-2);
  line-height: 1.4;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-w), 1fr));
  gap: 0;
  margin: 0 -12px;
}

.card-grid .card {
  width: auto;
}

.empty-card {
  display: flex;
  max-width: 420px;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--elevated);
}

/* ------------------------------------------------------------------------- */
/* Página de álbum o lista                                                    */
/* ------------------------------------------------------------------------- */

.page-collection {
  padding: 0;
}

.collection-header {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 24px;
  min-height: 340px;
  padding: 64px var(--page-x) 24px;
  background: linear-gradient(180deg, var(--cover-color, #535353) 0%, color-mix(in srgb, var(--cover-color, #535353) 30%, var(--surface)) 100%);
}

.collection-cover-wrap {
  flex: none;
}

.collection-cover {
  width: 232px;
  height: 232px;
  border-radius: var(--radius-small);
  box-shadow: 0 4px 60px rgba(0, 0, 0, 0.5);
}

.collection-cover-button {
  position: relative;
  display: block;
  border-radius: var(--radius-small);
}

.cover-edit-hint {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: inherit;
  background: rgba(0, 0, 0, 0.7);
  color: var(--text);
  font-size: var(--text-m);
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.2s;
}

.collection-cover-button:hover .cover-edit-hint,
.collection-cover-button:focus-visible .cover-edit-hint,
.edit-cover-button:hover .cover-edit-hint,
.edit-cover-button:focus-visible .cover-edit-hint {
  opacity: 1;
}

.collection-info {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
}

.collection-type {
  font-size: var(--text-s);
  font-weight: 600;
}

.collection-title {
  margin: 4px 0 8px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;
}

.collection-title[data-size='xl'] {
  font-size: 96px;
}

.collection-title[data-size='l'] {
  font-size: 72px;
}

.collection-title[data-size='m'] {
  font-size: 48px;
}

.collection-title[data-size='s'] {
  font-size: 32px;
}

@container main (max-width: 760px) {
  .collection-title[data-size='xl'] {
    font-size: 72px;
  }
  .collection-title[data-size='l'] {
    font-size: 48px;
  }
  .collection-title[data-size='m'] {
    font-size: 36px;
  }
}

@container main (max-width: 600px) {
  .collection-cover {
    width: 192px;
    height: 192px;
  }
  .collection-title[data-size='xl'],
  .collection-title[data-size='l'] {
    font-size: 40px;
  }
  .collection-title[data-size='m'],
  .collection-title[data-size='s'] {
    font-size: 28px;
  }
}

.collection-description {
  color: rgba(255, 255, 255, 0.85);
  font-size: var(--text-s);
}

.collection-meta {
  font-size: var(--text-s);
}

.meta-owner {
  font-weight: 700;
}

.collection-body {
  min-height: 300px;
  padding: 0 var(--page-x) 32px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--cover-color, #535353) 30%, var(--surface)) 0, var(--surface) 232px);
}

.action-bar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 24px 0;
}

.action-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--text-2);
  transition: color 0.2s, transform 0.15s;
}

.action-icon:hover {
  color: var(--text);
  transform: scale(1.04);
}

.action-icon.is-active {
  color: var(--accent);
}

.shuffle-toggle.is-active::after,
.control-button.is-active::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  transform: translateX(-50%);
}

.control-button.is-active::after {
  bottom: 0;
}

.action-icon[aria-disabled='true'] {
  opacity: 0.5;
  cursor: progress;
}

/* Descarga sin conexión en marcha (ADR-0033): anillo con lo descargado y una cruz para cancelar. */
.action-bar {
  position: relative;
}

.download-toggle.is-busy {
  color: var(--text);
}

.download-toggle.is-busy::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--download-ratio, 0) * 1turn), var(--highlight) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  transition: background 0.2s;
}

/* «Descargando 3 de 8 · 2,4 MB»: va en el hueco inferior de la barra, así no mueve la tabla al aparecer. */
.download-status {
  position: absolute;
  bottom: 0;
  left: 0;
  max-width: 100%;
  overflow: hidden;
  color: var(--text-2);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  line-height: 16px;
  white-space: nowrap;
  text-overflow: ellipsis;
  pointer-events: none;
}

.download-status[hidden] {
  display: none;
}

.collection-empty {
  padding: 24px 0;
}

/* ---- Tabla de canciones ---- */

.track-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: var(--text-s);
}

.track-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 36px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-2);
  font-weight: 400;
  text-align: left;
  transition: background-color 0.2s;
}

.track-table thead.is-stuck th {
  background: var(--elevated);
  border-bottom-color: var(--separator);
}

.track-table .col-num {
  width: 48px;
  padding-right: 0;
  text-align: right;
}

.track-table .col-album {
  width: 32%;
}

.track-table .col-dur {
  width: 152px;
}

.col-dur-icon {
  display: flex;
  justify-content: flex-end;
  padding-right: 40px;
}

.track-row td {
  height: var(--row-h);
  padding: 0 16px;
  color: var(--text-2);
  vertical-align: middle;
}

.track-row td:first-child {
  border-radius: var(--radius-small) 0 0 var(--radius-small);
}

.track-row td:last-child {
  border-radius: 0 var(--radius-small) var(--radius-small) 0;
}

.track-row:hover td,
.track-row:focus-within td {
  background: var(--row-hover);
}

.track-row {
  cursor: pointer;
}

.num-text {
  font-variant-numeric: tabular-nums;
  font-size: var(--text-m);
}

.num-play {
  display: none;
  justify-content: flex-end;
  color: var(--text);
}

.num-playing {
  display: none;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 2px;
  height: 14px;
}

.track-row:hover .num-text,
.track-row.is-current .num-text {
  display: none;
}

.track-row:hover .num-play {
  display: flex;
}

.track-row.is-current .num-playing {
  display: inline-flex;
}

.track-row.is-current:hover .num-playing {
  display: none;
}

.track-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.track-cover {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-small);
}

.track-text {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
}

.track-play {
  align-items: flex-start;
  justify-content: center;
  min-height: 44px;
  text-align: left;
}

.track-title {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: var(--text-m);
}

.track-play:hover .track-title {
  text-decoration: underline;
}

.track-row.is-current .track-title {
  color: var(--accent);
}

.track-artist {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
  font-size: var(--text-s);
}

.track-row:hover .track-artist {
  color: var(--text);
}

.badge {
  display: inline-block;
  margin-right: 6px;
  padding: 0 6px;
  border-radius: 2px;
  background: var(--text-2);
  color: var(--bg);
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  vertical-align: 1px;
}

.track-row.is-unavailable .track-title,
.track-row.is-unavailable .track-artist {
  color: var(--text-2);
}

.track-album {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.track-album:hover,
.track-row:hover .track-album {
  color: var(--text);
}

.track-album:hover {
  text-decoration: underline;
}

.track-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.track-duration {
  min-width: 44px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.icon-button {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-2);
  transition: color 0.2s, transform 0.15s;
}

.icon-button:hover:not(:disabled) {
  color: var(--text);
}

.row-more,
.track-row .like-button {
  opacity: 0;
}

.track-row:hover .row-more,
.track-row:focus-within .row-more,
.track-row:hover .like-button,
.track-row:focus-within .like-button,
.like-button.is-active,
.row-more[aria-expanded='true'] {
  opacity: 1;
}

.like-button.is-active {
  color: var(--accent);
}

.like-button.is-active:hover {
  color: var(--accent-hover);
}

@media (hover: none) {
  .row-more {
    opacity: 1;
  }
}

/* ---- «Busquemos algo para tu lista» ---- */

.add-songs {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--separator);
}

.add-songs .shelf-title {
  margin-bottom: 16px;
}

.add-results {
  margin-top: 16px;
}

.add-row,
.upload-local-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--row-h);
  padding: 8px;
  border-radius: var(--radius-small);
}

.add-row:hover {
  background: var(--row-hover);
}

.add-row .track-text,
.upload-local-text {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
}

.add-album {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--text-2);
  font-size: var(--text-s);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.add-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.add-title.is-playing {
  color: var(--accent);
}

/* «Añadir canciones» de un álbum: botón bajo la tabla y hoja con buscador y casillas. */
.album-add {
  margin-top: 24px;
}

.pick-search {
  max-width: none;
}

.pick-count {
  margin-top: 8px;
  color: var(--text-2);
  font-size: var(--text-s);
}

.pick-list {
  max-height: min(360px, 45vh);
  max-height: min(360px, 45dvh);
  margin-top: 8px;
  overflow-y: auto;
}

.pick-row {
  cursor: pointer;
}

.pick-row input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

/* Modo «Seleccionar» de un álbum (ADR-0026): barra con el contador y las acciones, y una casilla por canción. */
.album-select-button {
  margin-left: auto;
}

.select-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 8px 0;
}

.select-bar .select-count {
  margin-top: 0;
}

.select-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.select-list {
  margin-top: 8px;
}

/* «Ordenar canciones»: lista numerada con Subir y Bajar en cada fila. */
.order-list {
  max-height: min(420px, 50vh);
  max-height: min(420px, 50dvh);
  margin-top: 8px;
  overflow-y: auto;
}

.order-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--row-h);
  padding: 4px 8px;
  border-radius: var(--radius-small);
}

.order-row:hover {
  background: var(--row-hover);
}

.order-row .track-text {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
}

.order-num {
  flex: none;
  min-width: 2ch;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.order-actions {
  display: flex;
  flex: none;
  gap: 4px;
}

.order-move {
  width: 44px;
  height: 44px;
}

.order-move[aria-disabled='true'] {
  opacity: 0.35;
  cursor: default;
}

/* ------------------------------------------------------------------------- */
/* Buscar                                                                     */
/* ------------------------------------------------------------------------- */

.search-form {
  position: relative;
  max-width: 480px;
  margin-bottom: 24px;
}

.search-form-small {
  max-width: 400px;
  margin-bottom: 0;
}

.search-input {
  width: 100%;
  height: 48px;
  padding: 0 48px;
  border: 1px solid transparent;
  border-radius: 500px;
  background: var(--elevated);
  color: var(--text);
  font-size: var(--text-m);
  transition: background-color 0.2s, border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.search-input:hover {
  background: var(--highlight);
}

.search-input:focus-visible {
  outline: none;
  border-color: var(--text);
}

.search-input::placeholder {
  color: var(--text-2);
}

.search-input-small {
  height: 40px;
  padding: 0 16px 0 40px;
  border-radius: var(--radius-small);
  background: var(--highlight);
  font-size: var(--text-s);
}

.search-input-small:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 0;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  color: var(--text-2);
  pointer-events: none;
  transform: translateY(-50%);
}

.search-clear {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
}

/* En escritorio y tableta se busca desde la barra superior: el campo y el H1 de la página no se ven. */
@media (min-width: 768px) {
  .search-form-page {
    display: none;
  }

  .search-title {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

.search-chips {
  margin-bottom: 24px;
}

.search-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  margin-bottom: 40px;
}

@container main (min-width: 800px) {
  .search-top {
    grid-template-columns: minmax(280px, 2fr) minmax(0, 3fr);
  }
}

.search-top-result .shelf-title,
.search-songs .shelf-title,
.search-more-songs .shelf-title {
  margin-bottom: 8px;
}

.search-more-songs {
  margin-bottom: 40px;
}

.top-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 232px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--card);
  transition: background-color 0.3s;
}

.top-card:hover,
.top-card:focus-within {
  background: var(--card-hover);
}

.top-cover {
  width: 92px;
  height: 92px;
  margin-bottom: 16px;
  border-radius: var(--radius-small);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.top-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.25;
}

.top-meta {
  display: flex;
  align-items: center;
  gap: 0;
  white-space: pre;
  color: var(--text-2);
  font-size: var(--text-s);
}

.top-type {
  color: var(--text-2);
}

.top-card .play-button {
  position: absolute;
  right: 20px;
  bottom: 20px;
  z-index: 1;
  transform: translateY(8px);
}

.top-card:hover .play-button,
.top-card:focus-within .play-button {
  transform: translateY(0);
}

.search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 0;
  text-align: center;
}

.browse .shelf-title {
  margin-bottom: 16px;
}

.browse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 24px;
}

.browse-tile {
  position: relative;
  display: block;
  aspect-ratio: 1;
  max-height: 220px;
  min-height: 120px;
  padding: 16px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--cover-color);
}

.browse-title {
  position: relative;
  z-index: 1;
  display: block;
  max-width: 100%;
  font-size: var(--text-l);
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.browse-cover {
  position: absolute;
  right: -6%;
  bottom: -4%;
  width: 45%;
  aspect-ratio: 1;
  border-radius: var(--radius-small);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transform: rotate(25deg);
}

/* ------------------------------------------------------------------------- */
/* Panel «Reproduciendo» y cola                                               */
/* ------------------------------------------------------------------------- */

.now-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 64px;
  background: var(--surface);
}

.now-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-m);
  font-weight: 700;
}

.now-cover {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.now-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 24px;
}

.now-text {
  min-width: 0;
}

.now-track {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-l);
  font-weight: 700;
  line-height: 1.3;
}

.now-artist {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
  font-size: var(--text-m);
}

.now-next {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--elevated);
}

.now-next-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.now-next-title {
  font-size: var(--text-m);
  font-weight: 700;
}

.now-open-queue {
  flex: none;
  color: var(--text-2);
  font-size: var(--text-s);
  font-weight: 700;
}

.now-open-queue:hover {
  color: var(--text);
  text-decoration: underline;
}

.queue-heading {
  margin: 16px 0 8px;
  font-size: var(--text-m);
  font-weight: 700;
}

.queue-row {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  min-height: var(--row-h);
  padding: 8px;
  border-radius: var(--radius-small);
  text-align: left;
}

.queue-button:hover {
  background: var(--row-hover);
}

/* ------------------------------------------------------------------------- */
/* Reproductor (escritorio y tableta)                                         */
/* ------------------------------------------------------------------------- */

.player-bar {
  grid-area: player;
  display: grid;
  grid-template-columns: minmax(180px, 3fr) minmax(0, 4fr) minmax(180px, 3fr);
  align-items: center;
  gap: 8px;
  height: var(--player-h);
  margin: var(--gap) calc(-1 * var(--gap)) 0;
  padding: 0 16px 0 8px;
  background: var(--bg);
}

.player-left {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  padding-left: 8px;
}

.player-cover {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-small);
}

.player-text {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.player-title,
.player-artist {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-title {
  font-size: var(--text-s);
}

.player-title-link:hover {
  text-decoration: underline;
}

.player-artist {
  color: var(--text-2);
  font-size: var(--text-xs);
}

.player-center {
  display: flex;
  max-width: 722px;
  width: 100%;
  flex-direction: column;
  align-items: center;
  justify-self: center;
  gap: 8px;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.control-button {
  position: relative;
}

.control-button.is-active {
  color: var(--accent);
}

.control-button.is-active:hover {
  color: var(--accent-hover);
}

.player-play {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
}

.player-play:hover:not(:disabled) {
  color: var(--bg);
  transform: scale(1.06);
}

.player-progress {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
}

.player-time {
  min-width: 40px;
  color: var(--text-2);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.player-time-total {
  text-align: left;
}

.player-right {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.volume-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.volume {
  width: 93px;
  flex: none;
}

@media (max-width: 1023px) {
  .player-bar {
    grid-template-columns: minmax(0, 3fr) minmax(0, 4fr) minmax(0, 3fr);
  }

  [data-testid='player-lyrics'] {
    display: none;
  }

  .volume {
    width: 64px;
  }
}

/* ---- Barras deslizantes (progreso y volumen) ---- */

.slider {
  position: relative;
  flex: 1;
  height: 16px;
  --ratio: 0;
}

.slider-track {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--slider-track);
  transform: translateY(-50%);
}

.slider-fill {
  display: block;
  width: calc(var(--ratio) * 100%);
  height: 100%;
  border-radius: 2px;
  background: var(--text);
}

.slider:hover .slider-fill,
.slider:focus-within .slider-fill {
  background: var(--accent);
}

.slider-thumb {
  position: absolute;
  top: 50%;
  left: calc(var(--ratio) * 100%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.slider:hover .slider-thumb,
.slider:focus-within .slider-thumb {
  opacity: 1;
}

.slider-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.slider-input:disabled {
  cursor: default;
}

.slider:has(.slider-input:focus-visible) .slider-track {
  outline: 2px solid var(--text);
  outline-offset: 4px;
  overflow: visible;
}

/* ------------------------------------------------------------------------- */
/* Botones, campos, diálogos, menús y avisos                                  */
/* ------------------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 32px;
  border-radius: 500px;
  font-size: var(--text-m);
  font-weight: 700;
  transition: transform 0.15s, background-color 0.15s, border-color 0.15s;
}

.button-small {
  min-height: 32px;
  padding: 0 16px;
  font-size: var(--text-s);
}

.button-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.button-primary:hover {
  background: var(--accent-hover);
  transform: scale(1.04);
}

.button-light {
  background: var(--text);
  color: var(--bg);
}

.button-light:hover:not([aria-disabled='true']) {
  transform: scale(1.04);
}

.button-secondary,
.button-outline {
  border: 1px solid var(--outline);
  color: var(--text);
}

.button-secondary:hover,
.button-outline:hover {
  border-color: var(--text);
  transform: scale(1.04);
}

.button-outline {
  min-height: 32px;
  padding: 0 16px;
  font-size: var(--text-s);
}

.button-danger {
  background: var(--danger);
  color: var(--text);
}

.button-text {
  min-height: 40px;
  padding: 0 8px;
  color: var(--text-2);
}

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

.button[aria-disabled='true'] {
  opacity: 0.5;
  cursor: not-allowed;
}

.text-field {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  background: #3e3e3e;
  color: var(--text);
  font-size: var(--text-s);
}

.text-area {
  height: auto;
  min-height: 96px;
  padding: 8px 12px;
  resize: vertical;
}

.text-field:hover {
  border-color: var(--outline);
}

.text-field:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 0;
  border-color: transparent;
  background: #333333;
}

.text-field[aria-invalid='true'] {
  border-color: #ff7a8a;
}

.text-field::placeholder {
  color: var(--text-2);
}

.code-field {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field-label {
  font-size: var(--text-s);
  font-weight: 700;
}

.field-help {
  color: var(--text-2);
  font-size: var(--text-s);
}

.field-error {
  color: #ff8b98;
  font-size: var(--text-s);
}

.dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: 85vh;
  max-height: 85dvh;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  background: var(--card-hover);
  color: var(--text);
  box-shadow: 0 16px 24px rgba(0, 0, 0, 0.5);
}

.dialog[open] {
  display: flex;
  flex-direction: column;
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 16px 8px 24px;
}

.dialog-title {
  font-size: var(--text-l);
  font-weight: 700;
  line-height: 1.3;
}

.dialog-body {
  overflow-y: auto;
  padding: 8px 24px 24px;
}

.dialog-text {
  margin-bottom: 16px;
  color: var(--text);
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

.dialog-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---- Hojas de edición («Editar detalles») ---- */

.dialog-edit {
  width: min(560px, calc(100vw - 32px));
}

.edit-grid {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.edit-grid.no-cover {
  grid-template-columns: minmax(0, 1fr);
}

.edit-cover {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.edit-cover-image {
  width: 180px;
  height: 180px;
  border-radius: var(--radius-small);
  box-shadow: 0 4px 60px rgba(0, 0, 0, 0.5);
}

.edit-cover-button {
  position: relative;
  display: block;
  border-radius: var(--radius-small);
}

.edit-cover-action {
  min-height: 32px;
  font-size: var(--text-s);
}

.edit-note {
  margin-top: 16px;
  color: var(--text-2);
  font-size: var(--text-s);
}

.edit-status {
  flex: 1;
  min-width: 160px;
  color: var(--text-2);
  font-size: var(--text-s);
}

.copy-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 280px;
  overflow-y: auto;
}

.radio-group legend {
  margin-bottom: 8px;
}

.radio-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 4px 8px;
  border-radius: var(--radius-small);
  cursor: pointer;
}

.radio-row:hover {
  background: var(--row-hover);
}

.radio-row input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.radio-text {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.radio-label {
  font-size: var(--text-s);
}

.radio-detail {
  color: var(--text-2);
  font-size: var(--text-xs);
}

/* ---- Menús ---- */

.menu {
  position: fixed;
  z-index: 1000;
  min-width: 196px;
  max-width: min(340px, calc(100vw - 16px));
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px;
  border-radius: var(--radius-small);
  background: var(--card-hover);
  box-shadow: 0 16px 24px rgba(0, 0, 0, 0.3), 0 6px 8px rgba(0, 0, 0, 0.2);
}

.menu-heading {
  padding: 8px 12px 4px;
  color: var(--text-2);
  font-size: var(--text-xs);
  font-weight: 700;
}

.menu-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 2px;
  color: var(--text);
  font-size: var(--text-s);
  text-align: left;
}

.menu-item.has-description {
  padding: 8px 12px;
}

.menu-item.is-checked {
  color: var(--accent);
}

.menu-text {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
}

.menu-description {
  color: var(--text-2);
  font-size: var(--text-xs);
}

.menu-item:hover,
.menu-item:focus {
  background: #3e3e3e;
}

.menu-item:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: -2px;
}

/* ---- Avisos ---- */

.toast {
  position: fixed;
  bottom: calc(var(--player-h) + 24px);
  left: 50%;
  z-index: 2500;
  max-width: calc(100vw - 32px);
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  font-size: var(--text-s);
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s, transform 0.2s;
}

.toast:empty {
  padding: 0;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---- Hoja «Subir canciones» ---- */

.upload-back {
  margin: 0 0 8px -8px;
}

.upload-panel-title {
  margin-bottom: 12px;
  font-size: 20px;
  font-weight: 700;
}

.upload-subtitle {
  margin: 24px 0 8px;
  font-size: var(--text-m);
  font-weight: 700;
}

.upload-note {
  margin-bottom: 12px;
  color: var(--text-2);
  font-size: var(--text-s);
}

.upload-note.is-warning {
  color: var(--text);
  font-weight: 600;
}

.upload-row {
  margin: 16px 0 8px;
}

/* Hoja Homeostasia: una entrada clara y cómoda para importar desde YouTube. */
.homeostasia-card {
  position: relative;
  display: grid;
  gap: 22px;
  margin-top: 4px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--separator);
  border-radius: 24px;
  background:
    radial-gradient(ellipse at 100% 0, rgba(29, 185, 84, 0.18), transparent 55%),
    var(--card);
}

.homeostasia-card-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.homeostasia-card-icon {
  display: grid;
  flex: none;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 18px;
  background: var(--accent);
  color: #071b0e;
  box-shadow: 0 8px 24px rgba(29, 185, 84, 0.24);
}

.homeostasia-card-title {
  margin: 1px 0 6px;
  font-size: var(--text-l);
  font-weight: 750;
  line-height: 1.25;
}

.homeostasia-card-description {
  max-width: 42ch;
  color: var(--text-2);
  font-size: var(--text-s);
  line-height: 1.5;
}

.homeostasia-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.homeostasia-form .input {
  min-width: 0;
  min-height: 52px;
  padding-inline: 16px;
  border-radius: 14px;
  background: var(--elevated);
}

.homeostasia-submit {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 20px;
  border-radius: 14px;
  background: var(--accent);
  color: #071b0e;
  font-size: var(--text-s);
  font-weight: 750;
  white-space: nowrap;
  transition: transform 160ms ease, filter 160ms ease;
}

.homeostasia-submit:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.homeostasia-submit:disabled {
  cursor: wait;
  opacity: 0.65;
}

@media (max-width: 600px) {
  .homeostasia-card {
    gap: 18px;
    padding: 20px;
    border-radius: 20px;
  }

  .homeostasia-card-head {
    gap: 12px;
  }

  .homeostasia-card-icon {
    width: 46px;
    height: 46px;
    border-radius: 15px;
  }

  .homeostasia-form {
    grid-template-columns: 1fr;
  }

  .homeostasia-submit {
    width: 100%;
  }
}

/* Subidas: una fila por archivo con icono, nombre, paso y barra (DESIGN §8.4). El paso va siempre en texto. */
.upload-summary {
  margin: 16px 0 8px;
  font-size: var(--text-s);
  font-weight: 700;
}

.upload-summary[hidden],
.upload-indicator[hidden] {
  display: none;
}

/* Sin nada que medir (en cola, error), la barra no se ve pero guarda su hueco: la fila no cambia de alto (ADR-0033). */
.upload-item-progress.is-idle {
  visibility: hidden;
}

.upload-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

/* Grupo de un ZIP: cabecera «Álbum.zip: 12 canciones», lo ignorado y sus filas, un poco sangradas (DESIGN §12). */
.upload-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 8px 0 4px;
}

.upload-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: var(--text-m);
  font-weight: 700;
}

.upload-group-icon {
  display: grid;
  flex: none;
  place-items: center;
  color: var(--text-2);
}

.upload-group-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.upload-group-note {
  margin: 0 0 4px 28px;
}

.upload-group-items {
  margin: 0 0 0 12px;
}

.upload-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: var(--row-h);
  padding: 8px;
  border-radius: var(--radius-small);
  background: var(--tile);
}

.upload-item:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.upload-item-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--highlight);
  color: var(--text-2);
}

.upload-item[data-state="publicada"] .upload-item-icon {
  background: transparent;
  color: var(--accent);
}

.upload-item[data-state="error"] .upload-item-icon {
  color: #ff8b98;
}

.upload-item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.upload-item-name {
  overflow: hidden;
  font-size: var(--text-m);
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.upload-item-status {
  color: var(--text-2);
  font-size: var(--text-s);
  overflow-wrap: anywhere;
}

.upload-item[data-state="publicada"] .upload-item-status {
  color: var(--accent);
  font-weight: 700;
}

.upload-item[data-state="error"] .upload-item-status {
  color: #ff8b98;
}

.upload-item-progress {
  width: 100%;
  height: 4px;
  margin-top: 4px;
  accent-color: var(--accent);
}

/* Publicándose: no se puede medir, así que la barra se mueve sin porcentaje. */
.upload-item-progress:indeterminate {
  appearance: none;
  border: 0;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--highlight) 0%, var(--accent) 50%, var(--highlight) 100%);
  background-size: 200% 100%;
  animation: upload-indeterminate 1.6s linear infinite;
}

.upload-item-progress:indeterminate::-webkit-progress-bar {
  background: transparent;
}

@keyframes upload-indeterminate {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

.upload-item-actions {
  display: flex;
  gap: 8px;
}

.upload-item-actions:empty {
  display: none;
}

/* Indicador discreto al pie de «Tu biblioteca»: «Publicándose 1 canción». Abre la hoja. */
.upload-indicator {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--highlight);
  color: var(--text);
  font-size: var(--text-s);
  font-weight: 600;
  text-align: left;
}

/* En la página «Tu biblioteca» del teléfono (no hay barra lateral): debajo de la cabecera. */
.upload-indicator-page {
  margin: 0 var(--page-x) 8px;
}

.upload-indicator:hover {
  background: var(--card-hover);
}

.upload-indicator:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.upload-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: upload-pulse 1.4s ease-in-out infinite;
}

@keyframes upload-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.badge-pending {
  background: var(--accent);
  color: var(--on-accent);
}

.upload-local[hidden] {
  display: none;
}

.upload-rules {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  padding-left: 20px;
  list-style: disc;
}

.upload-archive-link {
  margin: 24px 0 0 -8px;
}

.dialog-upload .text-field {
  height: 48px;
}

/* ------------------------------------------------------------------------- */
/* Tableta: 768–1023 px (sin panel «Reproduciendo»)                           */
/* ------------------------------------------------------------------------- */

@media (max-width: 1023px) {
  .now-open .app {
    grid-template-columns: var(--lib-w) minmax(0, 1fr);
    grid-template-areas:
      'top top'
      'lib main'
      'player player';
  }

  .now-panel {
    display: none !important;
  }

  .app {
    --lib-w: 280px;
  }

  .brand {
    font-size: 18px;
  }
}

/* ------------------------------------------------------------------------- */
/* Teléfono: < 768 px, como la app de Spotify                                 */
/* ------------------------------------------------------------------------- */

.tabbar,
.mini-player {
  display: none;
}

@media (max-width: 767px) {
  .app {
    display: block;
    padding: 0;
  }

  .topbar,
  .sidebar,
  .player-bar,
  .now-panel {
    display: none !important;
  }

  .main {
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    padding-bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  }

  .has-track .main {
    padding-bottom: calc(var(--tabbar-h) + var(--mini-h) + 24px + env(safe-area-inset-bottom));
  }

  .tabbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: linear-gradient(0deg, #000 0%, rgba(0, 0, 0, 0.92) 55%, rgba(0, 0, 0, 0.7) 100%);
  }

  .tab-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: var(--tabbar-h);
    color: var(--text-2);
    font-size: var(--text-xs);
  }

  .tab-link.is-active {
    color: var(--text);
  }

  .tab-link:focus-visible {
    outline-offset: -4px;
  }

  .mini-player {
    position: fixed;
    right: 8px;
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    left: 8px;
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 4px;
    height: var(--mini-h);
    padding: 0 4px 0 8px;
    overflow: hidden;
    border-radius: 6px;
    background: var(--cover-color, #282828);
    transition: background-color 0.6s;
  }

  .mini-open {
    display: flex;
    flex: 1;
    min-width: 0;
    align-items: center;
    gap: 8px;
    height: 100%;
    text-align: left;
  }

  .mini-cover {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-small);
  }

  .mini-text {
    display: flex;
    min-width: 0;
    flex-direction: column;
  }

  .mini-title,
  .mini-artist {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--text-s);
    line-height: 1.3;
  }

  .mini-title {
    font-weight: 700;
  }

  .mini-artist {
    color: #e6e6e6;
  }

  .mini-play,
  .mini-player .like-button {
    width: 44px;
    height: 44px;
    color: var(--text);
  }

  .mini-player .like-button.is-active {
    color: var(--accent);
  }

  .mini-progress {
    position: absolute;
    right: 8px;
    bottom: 0;
    left: 8px;
    height: 2px;
    overflow: hidden;
    border-radius: 1px;
    background: rgba(255, 255, 255, 0.3);
  }

  .mini-progress-fill {
    display: block;
    width: calc(var(--ratio, 0) * 100%);
    height: 100%;
    background: var(--text);
  }

  .toast {
    bottom: calc(var(--tabbar-h) + var(--mini-h) + 16px);
  }

  /* Objetivos táctiles de 44 px (DESIGN §12). */
  .icon-button,
  .button-text,
  .chip,
  .create-button,
  .sort-button,
  .button-outline,
  .button-small,
  .menu-item,
  .shelf-more,
  .shelf-title-link,
  .now-open-queue,
  .library-search-toggle,
  .library-filter-input,
  .action-icon {
    min-width: 44px;
    min-height: 44px;
  }

  .shelf-more,
  .shelf-title-link {
    display: inline-flex;
    align-items: center;
  }

  .icon-button.page-back {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    display: inline-flex;
    width: 44px;
    height: 44px;
    color: var(--text);
  }

  .page-home {
    padding-top: 16px;
  }

  /* En el teléfono no hay hover: el acceso rápido se abre al tocarlo. */
  .tile .play-button {
    display: none;
  }

  .tile {
    height: 56px;
  }

  .tile-cover {
    width: 56px;
    height: 56px;
  }

  .tile-title {
    font-size: 13px;
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .page-library {
    padding: 0;
  }

  .page-library .library-header {
    padding: 16px var(--page-x) 8px;
  }

  .page-library .library-heading {
    font-size: var(--text-l);
  }

  .page-library .library-chips {
    padding: 0 var(--page-x) 8px;
  }

  .page-library .library-tools {
    padding: 0 var(--page-x) 8px calc(var(--page-x) - 8px);
  }

  .page-library .library-list {
    padding: 0 8px;
  }

  .page-title {
    font-size: var(--text-l);
    margin-bottom: 16px;
  }

  .shelf-title {
    font-size: 20px;
  }

  .card {
    flex-basis: 152px;
    width: 152px;
  }

  .collection-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    min-height: 0;
    padding-top: 56px;
  }

  .collection-cover-wrap {
    align-self: center;
  }

  .collection-cover {
    width: 232px;
    height: 232px;
  }

  .collection-type {
    display: none;
  }

  .collection-title[data-size] {
    margin: 0;
    font-size: var(--text-l);
    letter-spacing: -0.02em;
  }

  .action-bar {
    gap: 16px;
    padding: 16px 0;
  }

  /* Como en la app: «Me gusta», descargar y «···» a la izquierda; aleatorio y reproducir a la derecha. */
  .action-bar .play-button {
    order: 10;
  }

  .action-bar .shuffle-toggle {
    order: 9;
    margin-left: auto;
  }

  /* «Seleccionar» se queda en su icono (el nombre va en aria-label y en «···»): con el texto no cabía a 360 px. */
  .action-bar .album-select-button {
    width: 44px;
    margin-left: 0;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }

  .album-select-label {
    display: none;
  }

  .track-table thead,
  .track-table .col-num,
  .track-table .col-album,
  .track-duration,
  .track-row .like-button {
    display: none;
  }

  .track-table {
    table-layout: auto;
  }

  .track-table .col-title {
    width: 100%;
    max-width: 0;
  }

  .track-table .col-dur {
    width: 56px;
  }

  .track-row td {
    padding: 0 4px;
  }

  .track-row td.col-title {
    padding-left: 0;
  }

  .row-more {
    opacity: 1;
  }

  .search-form {
    margin-bottom: 24px;
  }

  .browse-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .browse-tile {
    aspect-ratio: auto;
    min-height: 100px;
  }

  .browse-title {
    font-size: var(--text-m);
  }

  .top-title {
    font-size: var(--text-l);
  }

  .dialog {
    width: 100%;
    max-width: none;
    margin: auto 0 0;
    border-radius: 12px 12px 0 0;
  }

  .dialog-title {
    font-size: 20px;
  }

  /* La hoja llega al borde inferior: con viewport-fit=cover, lo último no queda bajo la barra de gestos (ADR-0033). */
  .dialog:not(.dialog-full) .dialog-body {
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }

  .edit-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .edit-cover {
    align-items: center;
  }

  .edit-cover-image {
    width: 160px;
    height: 160px;
  }

  .text-field {
    height: 48px;
  }

  .text-area {
    height: auto;
  }
}

/* ---- Reproducción a pantalla completa (teléfono, tableta y «Pantalla completa») ---- */

.dialog-full {
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  border-radius: 0;
  background: linear-gradient(180deg, var(--cover-color, #3a3a3a) 0%, var(--surface) 75%);
}

.dialog-full .dialog-head {
  flex-direction: row-reverse;
  padding: 12px 16px 0;
}

.dialog-full .dialog-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-l);
}

.dialog-full .dialog-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 24px 24px;
}

.full-context {
  order: -2;
  color: var(--text);
  font-size: var(--text-s);
  font-weight: 700;
  text-align: center;
}

.full-cover-slot {
  order: -1;
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

.full-cover {
  width: min(100%, 420px, 48vh);
  aspect-ratio: 1;
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.full-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.full-artist {
  color: #e6e6e6;
}

.full-like-slot .like-button {
  width: 44px;
  height: 44px;
  color: var(--text);
}

.full-like-slot .like-button.is-active {
  color: var(--accent);
}

.full-times {
  display: flex;
  justify-content: space-between;
}

.full-times .player-time {
  min-width: 0;
  color: #e6e6e6;
}

.full-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.full-controls .control-button {
  width: 48px;
  height: 48px;
  color: var(--text);
}

.full-controls .control-button.is-active {
  color: var(--accent);
}

.full-play {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
}

.full-play:hover {
  color: var(--bg);
}

.full-queue {
  align-self: flex-end;
  color: var(--text);
}

/* ------------------------------------------------------------------------- */
/* Movimiento reducido                                                        */
/* ------------------------------------------------------------------------- */

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

  .play-button:hover,
  .action-icon:hover,
  .home-button:hover,
  .explore-button:hover,
  .create-button:hover,
  .sort-button:hover,
  .button:hover,
  .player-play:hover:not(:disabled) {
    transform: none !important;
  }

  .card .play-button,
  .top-card .play-button {
    transform: none;
  }
}

/* Resultados de YouTube en el buscador (ADR-0021) */
.yt-section { margin-top: 24px; }
.yt-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.yt-row { background: var(--card); border-radius: 8px; padding: 12px; }
.yt-main { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.yt-info { min-width: 0; flex: 1 1 200px; }
.yt-title { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.yt-meta, .yt-status { margin: 2px 0 0; color: var(--text-2); font-size: 0.875rem; }
.yt-actions { display: flex; gap: 8px; }
.yt-actions .button { display: inline-flex; align-items: center; gap: 6px; }
.yt-dock { position: fixed; right: 16px; bottom: 96px; width: min(360px, calc(100vw - 32px)); z-index: 40; background: var(--card); border-radius: 8px; padding: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); }
.yt-dock-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.yt-dock-title { margin: 0; font-size: 0.875rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yt-dock iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 6px; display: block; }
.yt-error { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }

/* Filtro dentro de una colección */
.collection-filter-form { position: relative; display: flex; align-items: center; max-width: 320px; margin: 0 0 12px; }
.collection-filter-form .search-icon { position: absolute; left: 10px; display: flex; color: var(--text-2); pointer-events: none; }
.collection-filter-input { width: 100%; height: 44px; padding: 0 12px 0 36px; border: 0; border-radius: 4px; background: rgba(255, 255, 255, 0.1); color: var(--text); font: inherit; }
.collection-filter-input:focus-visible { outline: 2px solid var(--text); outline-offset: 0; }

/* Ediciones pendientes (ADR-0027): marca «Pendiente» (texto, no solo color), botón de Tu biblioteca y lista. */
.badge-edit {
  background: var(--text-2);
  color: var(--bg);
}

.badge-error {
  background: var(--danger);
  color: #ffffff;
}

.collection-pending {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 4px 0 0;
  color: var(--text-2);
  font-size: var(--text-s);
}

.edits-indicator {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: 0 8px 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--highlight);
  color: var(--text);
  font-size: var(--text-s);
  font-weight: 600;
  text-align: left;
}

.edits-indicator:hover {
  background: var(--card-hover);
}

.edits-indicator:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.edits-indicator.has-error {
  box-shadow: inset 3px 0 0 var(--danger);
}

.edits-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
  padding: 0;
  list-style: none;
}

.edits-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--highlight);
}

.edits-row.is-error {
  box-shadow: inset 3px 0 0 var(--danger);
}

.edits-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.edits-label {
  overflow-wrap: anywhere;
  font-weight: 700;
}

.edits-detail {
  color: var(--text-2);
  font-size: var(--text-s);
}

.edits-text .badge {
  align-self: flex-start;
  margin-top: 2px;
}

.edits-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.edits-actions .button {
  min-height: 44px;
}

/* Teléfonos estrechos: la barra de acciones de una colección cabe sin salirse por la derecha (ADR-0033). */
@media (max-width: 400px) {
  .action-bar {
    gap: 8px;
  }
}

@media (max-width: 359px) {
  /* A 320 px no caben seis botones de 44 px: «Seleccionar» sigue en «···». */
  .action-bar .album-select-button {
    display: none;
  }
}

/* Hoja «Subir canciones» en el teléfono: «Reintentar» y «Reproducir» van debajo del texto, así el nombre y el error
   usan todo el ancho de la fila en lugar de una columna estrecha (ADR-0033). */
@media (max-width: 600px) {
  .upload-item {
    grid-template-columns: 32px minmax(0, 1fr);
    row-gap: 4px;
  }

  .upload-item-actions {
    grid-column: 2;
  }
}

/* «8 canciones, 19 min 16 s» no se parte por dentro (antes, la «s» quedaba sola en otra línea a 360 px). */
.meta-nowrap {
  white-space: nowrap;
}
