/* Sound G web — "Letra en pantalla": escenario casi negro, una sola luz de horizonte y la tinta
   encendida del color del usuario. Mona Sans en dos anchos: pantalla (82) y texto (100). */

@font-face {
  font-family: 'SG';
  src: url('../fonts/sg_sans.ttf') format('truetype');
  font-weight: 200 900;
  font-stretch: 75% 125%;
  font-display: swap;
}

:root {
  --c1: #8b5cf6;
  --c2: #22d3ee;
  --lit: #8b5cf6;
  --on-fill: #fff;
  --c1-rgb: 139, 92, 246;
  --c2-rgb: 34, 211, 238;
  --stage: #0a0a0f;
  --ink: #f2f2f5;
  --ink-muted: #a3a3b2;
  --unlit: #6e6e7c;
  --surface-low: #101016;
  --surface: #14141b;
  --surface-high: #1a1a22;
  --surface-highest: #22222b;
  --hairline: #24242d;
  --outline: #3b3b47;
  --error: #ff6b6b;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --horizon: 0.55;
  --r-thumb: 10px;
  --r-control: 14px;
  --r-panel: 20px;
  --r-sheet: 28px;
  --gutter: 20px;
  --rail-w: clamp(210px, 22vw, 300px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

:root[data-bg='amoled'] {
  --surface-low: #0b0b0f;
  --surface: #111116;
  --surface-high: #18181e;
  --surface-highest: #202027;
  --hairline: #1f1f26;
}

:root[data-bg='light'] {
  --ink: #121216;
  --ink-muted: #55555f;
  --unlit: #8c8c98;
  --surface-low: #f9f9fb;
  --surface: #efeff3;
  --surface-high: #e9e9ef;
  --surface-highest: #e2e2e9;
  --hairline: #dadae2;
  --outline: #b4b4bf;
  --error: #c62828;
  --shadow: 0 10px 30px rgba(20, 20, 40, 0.16);
  --horizon: 0.28;
  color-scheme: light;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--stage);
  color: var(--ink);
  font-family: 'SG', system-ui, sans-serif;
  font-stretch: 100%;
  font-size: 14px;
  line-height: 1.4;
  overscroll-behavior: none;
}

body {
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

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

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

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--lit);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.ic {
  font-family: 'Material Symbols Rounded';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  direction: ltr;
  font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  user-select: none;
  flex: none;
  width: 1em;
  overflow: hidden;
}

.display {
  font-stretch: 82%;
}

.tnum {
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--ink-muted);
}

/* ---------- Estructura ---------- */

#app {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr auto auto;
  grid-template-areas: 'main' 'mini' 'tabs';
}

.horizon {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(var(--c2-rgb), calc(0.1 * var(--horizon))) 9%,
    rgba(var(--c1-rgb), calc(0.22 * var(--horizon))) 15%,
    rgba(var(--c2-rgb), calc(0.08 * var(--horizon))) 21%,
    transparent 34%
  );
  transform: translateY(-17%);
  transition: background 600ms ease;
}

main {
  grid-area: main;
  position: relative;
  min-height: 0;
  z-index: 1;
}

.screen {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: calc(var(--safe-t) + 18px) calc(var(--gutter) + var(--safe-r)) 24px calc(var(--gutter) + var(--safe-l));
  scrollbar-width: thin;
  scrollbar-color: var(--outline) transparent;
}

.screen::-webkit-scrollbar {
  width: 8px;
}
.screen::-webkit-scrollbar-thumb {
  background: var(--outline);
  border-radius: 8px;
}

/* Barra de pestañas (vertical) */
.tabbar {
  grid-area: tabs;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--hairline);
  background: var(--stage);
  padding: 6px 4px calc(6px + var(--safe-b));
  z-index: 3;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 500;
}

.tab .pill {
  width: 60px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  transition: background 260ms cubic-bezier(0.3, 1.4, 0.5, 1), width 260ms cubic-bezier(0.3, 1.4, 0.5, 1);
  width: 44px;
}

.tab .ic {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.tab[aria-selected='true'] {
  color: var(--ink);
}

.tab[aria-selected='true'] .pill {
  background: var(--c1);
  color: var(--on-fill);
  width: 62px;
}

.tab[aria-selected='true'] .ic {
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

/* Menú lateral (acostado y PC) */
.rail {
  display: none;
}

html.wide #app {
  grid-template-columns: var(--rail-w) 1fr;
  grid-template-rows: 1fr;
  grid-template-areas: 'rail main';
}

html.wide .tabbar,
html.wide .mini {
  display: none !important;
}

html.wide .rail {
  grid-area: rail;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: calc(var(--safe-t) + 18px) 12px calc(14px + var(--safe-b)) calc(12px + var(--safe-l));
  border-right: 1px solid var(--hairline);
  z-index: 3;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}

.rail .brand {
  font-stretch: 82%;
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -0.025em;
  padding: 0 12px 12px;
  line-height: 1;
}

.brand b {
  color: var(--lit);
  font-weight: 900;
}

.rail .tab {
  flex-direction: row;
  justify-content: flex-start;
  gap: 14px;
  padding: 0 16px;
  height: 48px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  transition: background 200ms ease;
}

.rail .tab .pill {
  width: auto;
  height: auto;
  background: none !important;
  color: inherit !important;
}

.rail .tab:hover {
  background: var(--surface-high);
}

.rail .tab[aria-selected='true'] {
  background: var(--c1);
  color: var(--on-fill);
}

.rail-spacer {
  flex: 1;
  min-height: 10px;
}

.rail-player {
  border-radius: var(--r-panel);
  background: var(--surface);
  border: 1px solid var(--hairline);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rail-player .now {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
  text-align: left;
}

.rail-player .now .thumb {
  width: 52px;
  height: 52px;
}

.rail-player .controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}

/* En PC con ventana muy angosta, el menú lateral queda solo con íconos. */
@media (max-width: 760px) {
  html.wide.desktop {
    --rail-w: 76px;
  }
  html.wide.desktop .rail .tab span:not(.pill):not(.ic) {
    display: none;
  }
  html.wide.desktop .rail .tab {
    padding: 0;
    justify-content: center;
  }
  html.wide.desktop .rail .brand {
    font-size: 0;
    padding: 0 0 12px;
    text-align: center;
  }
  html.wide.desktop .rail .brand b {
    font-size: 30px;
  }
  html.wide.desktop .rail-player .now .meta,
  html.wide.desktop .rail-player .controls .side {
    display: none;
  }
  html.wide.desktop .rail-player .controls {
    justify-content: center;
  }
  html.wide.desktop .rail-player .now {
    justify-content: center;
  }
}

/* ---------- Encabezados ---------- */

.head {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 14px;
}

.head .titles {
  flex: 1;
  min-width: 0;
}

h1.title {
  font-stretch: 82%;
  font-weight: 800;
  font-size: 40px;
  line-height: 42px;
  letter-spacing: -0.025em;
  margin: 0;
}

h1.title b {
  color: var(--lit);
  font-weight: 900;
}

.sub {
  color: var(--ink-muted);
  margin-top: 4px;
  font-size: 14px;
}

h2.section {
  font-stretch: 82%;
  font-weight: 700;
  font-size: 22px;
  line-height: 26px;
  letter-spacing: -0.01em;
  margin: 26px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

h2.section .link {
  margin-left: auto;
  font-stretch: 100%;
  font-size: 14px;
  font-weight: 600;
  color: var(--lit);
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  color: var(--ink);
  flex: none;
  transition: background 160ms ease, transform 120ms ease;
}

.icon-btn:hover {
  background: var(--surface-high);
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn.on {
  color: var(--lit);
}

.icon-btn.small {
  width: 36px;
  height: 36px;
}

.icon-btn.small .ic {
  font-size: 20px;
}

.btn {
  height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  transition: transform 120ms ease, background 160ms ease;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.96);
}

.btn.primary {
  background: var(--c1);
  color: var(--on-fill);
}

.btn.secondary {
  border: 1px solid color-mix(in srgb, var(--ink) 22%, transparent);
}

.btn.secondary .ic {
  color: var(--lit);
}

.btn.secondary:hover {
  background: var(--surface-high);
}

.btn.danger {
  color: var(--error);
  border: 1px solid color-mix(in srgb, var(--error) 40%, transparent);
}

.btn .ic {
  font-size: 22px;
}

.btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Buscador y chips */
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 50px;
  border-radius: var(--r-control);
  background: var(--surface-high);
  padding: 0 8px 0 14px;
  color: var(--ink-muted);
}

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--ink);
  font-size: 15px;
  height: 100%;
}

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

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-control);
  border: 1px solid var(--outline);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  transition: background 160ms ease, border-color 160ms ease;
}

.chip[aria-pressed='true'] {
  background: var(--c1);
  border-color: var(--c1);
  color: var(--on-fill);
}

.chip .ic {
  font-size: 18px;
}

/* ---------- Filas de canciones ---------- */

.thumb {
  width: 50px;
  height: 50px;
  border-radius: var(--r-thumb);
  background: linear-gradient(135deg, rgba(var(--c1-rgb), 0.55), rgba(var(--c2-rgb), 0.35));
  flex: none;
  overflow: hidden;
  display: grid;
  place-items: center;
  position: relative;
  color: rgba(255, 255, 255, 0.92);
  font-stretch: 82%;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
}

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

.thumb img:not([src]) {
  visibility: hidden;
}

.list {
  display: flex;
  flex-direction: column;
}

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 0 7px 0;
  border-radius: var(--r-control);
  cursor: pointer;
  min-width: 0;
  position: relative;
}

.row:hover::before {
  content: '';
  position: absolute;
  inset: 0 -10px;
  border-radius: var(--r-control);
  background: var(--surface);
  z-index: -1;
}

.row .meta {
  flex: 1;
  min-width: 0;
}

.row .t,
.lit-1 {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row .a {
  font-size: 12.5px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.row .dur {
  font-size: 12.5px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.row .more {
  margin-right: -10px;
  color: var(--ink-muted);
}

.row.playing .t {
  color: var(--unlit);
}

.group {
  content-visibility: auto;
  contain-intrinsic-size: auto 500px;
}

.letter {
  position: sticky;
  top: -18px;
  z-index: 2;
  font-stretch: 82%;
  font-weight: 900;
  font-size: 34px;
  line-height: 1;
  color: var(--lit);
  padding: 14px 0 6px;
  background: linear-gradient(var(--stage) 70%, transparent);
  margin: 0 -2px;
}

/* Índice de letras al costado */
.index {
  position: absolute;
  right: calc(2px + var(--safe-r));
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 4;
  padding: 6px 2px;
  border-radius: 999px;
  user-select: none;
  touch-action: none;
}

.index span {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-muted);
  line-height: 1.55;
  width: 18px;
  text-align: center;
  cursor: pointer;
}

.index span.on {
  color: var(--lit);
}

.index-bubble {
  position: absolute;
  right: 44px;
  width: 64px;
  height: 64px;
  border-radius: 999px 999px 4px 999px;
  background: var(--c1);
  color: var(--on-fill);
  display: grid;
  place-items: center;
  font-stretch: 82%;
  font-weight: 900;
  font-size: 34px;
  z-index: 5;
  pointer-events: none;
  box-shadow: var(--shadow);
}

/* ---------- Texto encendido ---------- */

.lit {
  position: relative;
  display: block;
  min-width: 0;
}

.lit > .base {
  color: var(--unlit);
}

.lit > .top {
  position: absolute;
  inset: 0;
  color: var(--lit);
  pointer-events: none;
}

.lit-1 {
  position: relative;
}

.lit-1 > .top {
  position: absolute;
  inset: 0;
  color: var(--lit);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  clip-path: inset(0 100% 0 0);
}

.lit-1 > .base {
  color: var(--unlit);
}

/* ---------- Mini reproductor ---------- */

.mini {
  grid-area: mini;
  margin: 0 10px 8px;
  border-radius: 18px;
  background: var(--surface-high);
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
  z-index: 3;
  cursor: pointer;
  touch-action: pan-x;
}

.mini .thumb {
  width: 48px;
  height: 48px;
}

.mini .meta {
  flex: 1;
  min-width: 0;
}

.mini .a {
  font-size: 12.5px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.play-fab {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  color: #fff;
  box-shadow: 0 6px 18px rgba(var(--c1-rgb), 0.35);
  flex: none;
  transition: transform 120ms ease;
}

.play-fab:active {
  transform: scale(0.94);
}

.play-fab .ic {
  font-size: 30px;
}

/* ---------- Tarjetas ---------- */

.card {
  border-radius: var(--r-panel);
  background: var(--surface);
  border: 1px solid var(--hairline);
  padding: 18px;
  margin-bottom: 14px;
}

.card h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card p {
  margin: 6px 0 0;
  color: var(--ink-muted);
  font-size: 13.5px;
}

.setting {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--hairline);
}

.setting:first-of-type {
  border-top: 0;
}

.setting .txt {
  flex: 1;
  min-width: 0;
}

.setting .txt b {
  display: block;
  font-size: 15.5px;
  font-weight: 600;
}

.setting .txt span {
  display: block;
  color: var(--ink-muted);
  font-size: 13px;
  margin-top: 2px;
}

/* Interruptor */
.switch {
  width: 52px;
  height: 32px;
  border-radius: 999px;
  border: 2px solid var(--outline);
  position: relative;
  flex: none;
  transition: background 180ms ease, border-color 180ms ease;
}

.switch::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 6px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--outline);
  transition: transform 220ms cubic-bezier(0.3, 1.4, 0.5, 1), width 180ms ease, height 180ms ease, top 180ms ease, background 180ms ease;
}

.switch[aria-checked='true'] {
  background: var(--c1);
  border-color: var(--c1);
}

.switch[aria-checked='true']::after {
  background: var(--on-fill);
  transform: translateX(20px);
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
}

/* Deslizadores */
.slider {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0 4px;
}

.slider label {
  flex: none;
  width: 150px;
  font-weight: 600;
}

.slider output {
  width: 54px;
  text-align: right;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 0;
  height: 28px;
  background: none;
  cursor: pointer;
  --p: 50%;
}

input[type='range']::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--c1) var(--p), var(--surface-highest) var(--p));
}

input[type='range']::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--c1) var(--p), var(--surface-highest) var(--p));
}

input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--ink);
  margin-top: -7px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

input[type='range']::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
}

input[type='range']:disabled {
  opacity: 0.4;
}

/* Paletas */
.palettes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 4px 8px;
  border-radius: var(--r-control);
  border: 1px solid transparent;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-muted);
}

.swatch .dot {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: conic-gradient(from 225deg, var(--a) 0 50%, var(--b) 50% 100%);
  display: grid;
  place-items: center;
  color: #fff;
}

.swatch .dot .ic {
  font-size: 22px;
  opacity: 0;
}

.swatch[aria-pressed='true'] {
  border-color: var(--outline);
  background: var(--surface-high);
  color: var(--ink);
}

.swatch[aria-pressed='true'] .dot .ic {
  opacity: 1;
}

/* ---------- Ecualizador ---------- */

.eq {
  margin-top: 14px;
  user-select: none;
  touch-action: none;
}

.eq svg {
  width: 100%;
  height: 210px;
  display: block;
  overflow: visible;
}

.eq.off {
  opacity: 0.45;
}

.eq .freqs {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  text-align: center;
  font-size: 11px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- Playlists ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px 14px;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  min-width: 0;
}

.cover {
  aspect-ratio: 1;
  width: 100%;
  border-radius: var(--r-panel);
  overflow: hidden;
  background: var(--surface-high);
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  position: relative;
}

.cover.one {
  display: block;
}

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

.cover .initials {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(var(--c1-rgb), 0.75), rgba(var(--c2-rgb), 0.45));
  font-stretch: 82%;
  font-weight: 900;
  font-size: 44px;
  color: #fff;
  letter-spacing: -0.03em;
}

.tile .name {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile .info {
  font-size: 12.5px;
  color: var(--ink-muted);
  margin-top: -6px;
}

.strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(130px, 150px);
  gap: 14px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.strip::-webkit-scrollbar {
  display: none;
}

.new-tile .cover {
  border: 1.5px dashed var(--outline);
  background: transparent;
  display: grid;
  place-items: center;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  color: var(--lit);
}

.new-tile .cover .ic {
  font-size: 40px;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px 0 8px;
  border-radius: 999px;
  margin: -6px 0 12px -8px;
  font-weight: 600;
}

.back:hover {
  background: var(--surface-high);
}

.collection-head {
  display: flex;
  gap: 18px;
  align-items: flex-end;
  margin-bottom: 18px;
}

.collection-head .cover {
  width: 132px;
  flex: none;
}

.collection-head h1 {
  font-size: 34px;
  line-height: 36px;
  word-break: break-word;
}

html.wide .collection {
  display: grid;
  grid-template-columns: minmax(220px, 30%) 1fr;
  gap: 28px;
  align-items: start;
}

html.wide .collection .collection-head {
  flex-direction: column;
  align-items: stretch;
  position: sticky;
  top: 0;
}

html.wide .collection .collection-head .cover {
  width: 100%;
  max-width: 320px;
}

/* Biblioteca en dos columnas al estar acostado */
html.wide .lib-list,
html.wide .two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: 28px;
}

html.wide .lib-list .group,
html.wide .lib-list .group-rows {
  display: contents;
}

html.wide .lib-list > .empty {
  grid-column: 1 / -1;
}

html.wide .lib-list .letter {
  display: none;
}

.rail-player .a {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink-muted);
}

html.wide .lib-head {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: end;
  gap: 10px 24px;
}

html.wide .lib-head .search-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.lib-head .search-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------- Estados vacíos ---------- */

.empty {
  max-width: 520px;
  margin: 8vh auto 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.empty .big {
  font-stretch: 82%;
  font-weight: 900;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -0.03em;
}

.empty p {
  color: var(--ink-muted);
  margin: 0;
  font-size: 15px;
}

.empty .btns {
  justify-content: center;
  margin-top: 6px;
}

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

.progress-bar {
  width: min(320px, 80%);
  height: 4px;
  border-radius: 999px;
  background: var(--surface-highest);
  overflow: hidden;
}

.progress-bar i {
  display: block;
  height: 100%;
  background: var(--c1);
  width: 0;
  transition: width 200ms ease;
}

/* ---------- Reproductor ---------- */

.player {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--stage);
  display: grid;
  grid-template-rows: auto 1fr auto;
  transform: translateY(0);
  transition: transform 320ms cubic-bezier(0.2, 0.9, 0.25, 1), opacity 200ms ease;
  overflow: hidden;
  touch-action: none;
}

.player.closed {
  transform: translateY(102%);
  pointer-events: none;
}

.player .p-horizon {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    transparent 40%,
    rgba(var(--c2-rgb), calc(0.1 * var(--horizon))) 62%,
    rgba(var(--c1-rgb), calc(0.2 * var(--horizon))) 72%,
    rgba(var(--c2-rgb), calc(0.07 * var(--horizon))) 82%,
    transparent 100%
  );
}

.p-top {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: calc(var(--safe-t) + 8px) calc(10px + var(--safe-r)) 4px calc(10px + var(--safe-l));
  position: relative;
  z-index: 3;
}

.p-top .grow {
  flex: 1;
}

.p-stage {
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.art-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  cursor: grab;
}

.art {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  will-change: transform;
}

.art .img {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  transition: filter 600ms ease, opacity 300ms ease;
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
}

.art .img.empty {
  background: radial-gradient(120% 90% at 30% 20%, rgba(var(--c1-rgb), 0.55), transparent 60%),
    radial-gradient(100% 80% at 80% 60%, rgba(var(--c2-rgb), 0.4), transparent 65%), var(--surface);
  display: grid;
  place-items: center;
}

.art .img.empty .ic {
  font-size: 96px;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 15%;
}

.player.paused .art .img {
  filter: brightness(0.62) saturate(0.45);
}

.p-info {
  position: relative;
  z-index: 2;
  padding: 0 calc(var(--gutter) + var(--safe-r)) 0 calc(var(--gutter) + var(--safe-l));
  margin-top: -84px;
}

.p-title {
  font-stretch: 82%;
  font-weight: 900;
  line-height: 1.04;
  letter-spacing: -0.03em;
  font-size: 46px;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.p-title .top {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.p-artist {
  color: var(--ink-muted);
  font-size: 16px;
  font-weight: 500;
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p-artist button {
  color: inherit;
}

.p-artist button:hover {
  color: var(--ink);
  text-decoration: underline;
}

.p-line {
  font-stretch: 82%;
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  min-height: 25px;
  margin-top: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.92;
  transition: opacity 200ms ease;
}

.p-line:empty {
  opacity: 0;
}

.p-controls {
  position: relative;
  z-index: 2;
  padding: 10px calc(var(--gutter) + var(--safe-r)) calc(14px + var(--safe-b)) calc(var(--gutter) + var(--safe-l));
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Línea de progreso */
.litline {
  position: relative;
  height: 28px;
  cursor: pointer;
  touch-action: none;
}

.litline .track {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 4px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--unlit) 45%, transparent);
  transition: height 160ms ease;
}

.litline .fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: var(--lit);
}

.litline .knob {
  position: absolute;
  top: 50%;
  width: 4px;
  height: 18px;
  border-radius: 999px;
  background: var(--ink);
  transform: translate(-50%, -50%);
  transition: height 160ms ease, width 160ms ease;
}

.litline:hover .track,
.litline.drag .track {
  height: 8px;
}

.litline.drag .knob {
  width: 6px;
  height: 24px;
}

.times {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  margin-top: -4px;
}

.transport {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 0 4px;
}

.transport .icon-btn {
  width: 52px;
  height: 52px;
}

.transport .icon-btn .ic {
  font-size: 34px;
}

.transport .icon-btn.side .ic {
  font-size: 26px;
  color: var(--unlit);
}

.transport .icon-btn.side.on .ic {
  color: var(--lit);
}

.transport .play-fab {
  width: 76px;
  height: 76px;
}

.transport .play-fab .ic {
  font-size: 44px;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.tile-opt {
  border-radius: var(--r-control);
  border: 1px solid var(--hairline);
  padding: 10px 4px 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-muted);
  transition: background 160ms ease, color 160ms ease;
}

.tile-opt .ic {
  font-size: 22px;
  color: var(--ink);
}

.tile-opt[aria-pressed='true'] {
  background: rgba(var(--c1-rgb), 0.18);
  border-color: rgba(var(--c1-rgb), 0.55);
  color: var(--ink);
}

.tile-opt[aria-pressed='true'] .ic {
  color: var(--lit);
}

.tile-opt:hover {
  background: var(--surface);
}

.vol {
  display: none;
  align-items: center;
  gap: 10px;
  color: var(--ink-muted);
}

html.desktop .vol {
  display: flex;
}

/* Letra */
.ly-box {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.lyrics {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 28% calc(var(--gutter) + var(--safe-r)) 45% calc(var(--gutter) + var(--safe-l));
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14%, #000 78%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 14%, #000 78%, transparent 100%);
  touch-action: pan-y;
  overscroll-behavior: contain;
}

.lyrics::-webkit-scrollbar {
  display: none;
}

.lyrics .ly {
  font-stretch: 82%;
  font-weight: 800;
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
  cursor: pointer;
  transition: transform 300ms ease;
  transform-origin: left center;
}

.lyrics .ly > .base {
  color: var(--unlit);
}

.lyrics .ly.past > .base {
  color: color-mix(in srgb, var(--lit) 50%, var(--unlit));
}

.lyrics .ly.now {
  transform: scale(1.02);
}

.lyrics .ly.gap {
  height: 14px;
  margin: 0;
}

.lyrics .plain {
  font-stretch: 82%;
  font-weight: 700;
  font-size: 24px;
  line-height: 1.3;
  white-space: pre-wrap;
  color: var(--ink);
}

.lyrics.plain-mode {
  padding-top: 24px;
}

.lyrics-msg {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: var(--ink-muted);
}

.lyrics-msg b {
  display: block;
  font-stretch: 82%;
  font-weight: 800;
  font-size: 26px;
  color: var(--ink);
  margin-bottom: 6px;
}

.ly-tools {
  position: absolute;
  right: calc(12px + var(--safe-r));
  bottom: 6px;
  z-index: 3;
  display: flex;
  gap: 2px;
  align-items: center;
  background: var(--surface-high);
  border-radius: 999px;
  padding: 2px 4px;
  font-size: 12.5px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow);
}

.ly-tools span {
  min-width: 46px;
  text-align: center;
}

.player.lyrics-mode .art {
  opacity: 0.2;
  filter: blur(22px);
}

.player.lyrics-mode .p-info {
  margin-top: 0;
}

.player.lyrics-mode .p-title {
  font-size: 26px !important;
  -webkit-line-clamp: 1;
}

.player.lyrics-mode .p-line {
  display: none;
}

/* Reproductor acostado: carátula a la izquierda, controles (o la letra) a la derecha */
html.wide .player {
  grid-template-columns: minmax(0, 46%) minmax(0, 1fr);
  grid-template-rows: 1fr;
}

html.wide .player .p-top {
  position: absolute;
  top: 0;
  left: 0;
  width: 46%;
  background: linear-gradient(rgba(0, 0, 0, 0.45), transparent);
}

html.wide .player .p-top .icon-btn {
  color: #fff;
}

html.wide .player .p-stage {
  grid-column: 1;
  grid-row: 1;
}

html.wide .art .img {
  -webkit-mask-image: linear-gradient(to right, #000 60%, transparent 100%);
  mask-image: linear-gradient(to right, #000 60%, transparent 100%);
}

html.wide .player .p-side {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  padding: calc(var(--safe-t) + 14px) 0 calc(var(--safe-b) + 6px);
  max-width: 780px;
  position: relative;
  z-index: 2;
}

html.wide .p-info {
  margin-top: 0;
  padding-left: 8px;
}

html.wide .p-controls {
  padding-left: 8px;
  padding-bottom: 6px;
}

html.wide .player.lyrics-mode .art {
  opacity: 1;
  filter: none;
}

html.wide .player.lyrics-mode .p-side {
  justify-content: flex-start;
}

html.wide .player.lyrics-mode .p-side .ly-box {
  position: relative;
  inset: auto;
  flex: 1;
  min-height: 0;
}

html.wide .lyrics {
  padding-left: 8px;
  padding-top: 18%;
}

html.wide .lyrics-msg {
  padding-left: 8px;
}

/* Teléfono acostado (poca altura): todo más compacto */
@media (max-height: 520px) {
  html.wide .p-title {
    font-size: 30px;
  }
  html.wide .p-line {
    font-size: 15px;
    margin-top: 4px;
    min-height: 20px;
  }
  html.wide .p-artist {
    font-size: 14px;
    margin-top: 2px;
  }
  html.wide .transport .play-fab {
    width: 58px;
    height: 58px;
  }
  html.wide .transport .icon-btn {
    width: 44px;
    height: 44px;
  }
  html.wide .tile-opt {
    flex-direction: row;
    justify-content: center;
    padding: 7px 4px;
    gap: 6px;
  }
  html.wide .tile-opt .ic {
    font-size: 19px;
  }
  html.wide .p-controls {
    gap: 4px;
  }
  html.wide .lyrics .ly {
    font-size: 24px;
  }
  .rail .brand {
    font-size: 24px;
    padding-bottom: 6px;
  }
  .rail .tab {
    height: 40px;
  }
  .rail-player .now .thumb {
    width: 40px;
    height: 40px;
  }
}

/* ---------- Hojas y diálogos ---------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade 180ms ease;
}

.sheet {
  width: 100%;
  max-width: 640px;
  max-height: 86vh;
  background: var(--surface-low);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  padding: 10px 0 calc(16px + var(--safe-b));
  display: flex;
  flex-direction: column;
  animation: rise 240ms cubic-bezier(0.2, 0.9, 0.25, 1);
  box-shadow: var(--shadow);
}

html.wide .scrim {
  align-items: center;
}

html.wide .sheet {
  border-radius: var(--r-sheet);
  max-width: 520px;
  max-height: 88vh;
  padding-bottom: 16px;
  margin: 0 16px;
}

.sheet .handle {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--outline);
  margin: 0 auto 8px;
}

html.wide .sheet .handle {
  display: none;
}

.sheet .sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 22px 12px;
}

.sheet h3 {
  margin: 0;
  font-stretch: 82%;
  font-weight: 700;
  font-size: 22px;
  line-height: 26px;
  flex: 1;
  min-width: 0;
}

.sheet .sheet-body {
  overflow-y: auto;
  padding: 0 22px;
  min-height: 0;
}

.sheet .sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px 0;
  flex-wrap: wrap;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  height: 52px;
  padding: 0 22px;
  font-size: 15.5px;
  font-weight: 500;
  text-align: left;
}

.menu-item:hover {
  background: var(--surface-high);
}

.menu-item .ic {
  color: var(--ink-muted);
}

.menu-item.danger {
  color: var(--error);
}

.menu-item.danger .ic {
  color: var(--error);
}

.menu-item .check {
  margin-left: auto;
  color: var(--lit);
}

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

.field label {
  font-size: 13px;
  color: var(--ink-muted);
  font-weight: 600;
}

.field input {
  height: 50px;
  border-radius: var(--r-control);
  border: 1px solid var(--outline);
  background: var(--surface);
  padding: 0 14px;
  font-size: 16px;
  outline: none;
}

.field input:focus {
  border-color: var(--lit);
}

.sheet .row {
  padding-left: 22px;
  padding-right: 22px;
}

.sheet .row:hover::before {
  inset: 0;
}

.queue-row {
  touch-action: pan-y;
}

.queue-row.current .t {
  color: var(--lit);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 60;
  background: var(--ink);
  color: var(--stage);
  padding: 12px 18px;
  border-radius: var(--r-control);
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow);
  max-width: calc(100% - 32px);
  animation: rise 220ms ease;
  display: flex;
  gap: 14px;
  align-items: center;
}

.toast button {
  color: var(--c1);
  font-weight: 700;
}

html.wide .toast {
  bottom: calc(24px + var(--safe-b));
}

.dropzone {
  position: fixed;
  inset: 12px;
  z-index: 70;
  border: 2px dashed var(--lit);
  border-radius: var(--r-sheet);
  background: rgba(var(--c1-rgb), 0.12);
  display: grid;
  place-items: center;
  font-stretch: 82%;
  font-weight: 900;
  font-size: 36px;
  pointer-events: none;
}

.color-row {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.color-row label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border: 1px solid var(--outline);
  border-radius: 999px;
  cursor: pointer;
}

.color-row input[type='color'] {
  width: 34px;
  height: 34px;
  border: 0;
  padding: 0;
  border-radius: 999px;
  background: none;
  cursor: pointer;
}

.color-row input[type='color']::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-row input[type='color']::-webkit-color-swatch {
  border: 0;
  border-radius: 999px;
}

.keys {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  margin-top: 10px;
  font-size: 13.5px;
  color: var(--ink-muted);
}

kbd {
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  border: 1px solid var(--outline);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 1px 7px;
  white-space: nowrap;
}

@keyframes rise {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

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

/* Pantallas anchas: un poco más de aire */
@media (min-width: 1100px) {
  html.wide {
    --gutter: 36px;
  }
}

@media (max-width: 380px) {
  :root {
    --gutter: 16px;
  }
  h1.title {
    font-size: 36px;
  }
}

main:not([data-tab='library']) .index {
  display: none !important;
}

/* Biblioteca parada: botones debajo del buscador y lugar para el índice de letras */
html.tall .lib-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

html.tall .lib-head .head {
  order: 0;
}

html.tall .lib-head .search-row {
  order: 1;
}

html.tall .lib-head > .btns {
  order: 2;
  justify-content: flex-start !important;
  align-self: stretch !important;
}

html.tall .lib-head > .btns .btn {
  flex: 1;
}

html.tall .lib-list {
  margin-right: 16px;
}

.player.lyrics-mode .p-side .p-info {
  padding-top: 8px;
}

html.wide .lib-head > .btns {
  flex-wrap: nowrap;
}

@media (max-height: 520px) {
  html.wide h1.title {
    font-size: 32px;
    line-height: 34px;
  }
  html.wide .lib-head .btn {
    height: 42px;
    padding: 0 16px;
  }
  html.wide .screen {
    padding-top: calc(var(--safe-t) + 12px);
  }
}

/* Ayuda para USB y celular */
.device-help {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  padding-bottom: 4px;
}

html.wide .device-help {
  grid-template-columns: 1fr 1fr;
}

.device-help section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.device-help h4 {
  margin: 0 0 2px;
  font-stretch: 82%;
  font-weight: 800;
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.device-help h4 .ic {
  color: var(--lit);
}

.device-help p {
  margin: 0;
  font-size: 14px;
}

.device-help .btns {
  margin-top: 4px;
}

.step {
  display: flex;
  gap: 10px;
  font-size: 14px;
  line-height: 1.45;
}

.step .num {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(var(--c1-rgb), 0.2);
  color: var(--lit);
  display: grid;
  place-items: center;
  font-size: 12.5px;
}

.qr-row {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border-radius: var(--r-panel);
  background: var(--surface);
  border: 1px solid var(--hairline);
}

.qr-row .qr {
  width: 132px;
  height: 132px;
  border-radius: 12px;
  flex: none;
  background: #fff;
}

.qr-row b {
  display: block;
  font-size: 15.5px;
  margin-bottom: 4px;
}

.device-help .or {
  font-size: 15.5px;
  margin-top: 4px;
}

.card.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 0;
  padding: 10px 10px 10px 16px;
}

.card.banner .ic {
  color: var(--lit);
}

.card.banner span:not(.ic) {
  flex: 1;
  min-width: 0;
}

.card.banner .btn {
  height: 40px;
  padding: 0 18px;
}

.setting > .ic {
  color: var(--ink-muted);
}
